@uipath/solution-tool 0.1.5 → 0.1.7

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.
Files changed (4) hide show
  1. package/README.md +29 -29
  2. package/dist/index.js +93 -46
  3. package/dist/tool.js +236 -126
  4. package/package.json +54 -55
package/dist/tool.js CHANGED
@@ -4,25 +4,43 @@ var __getProtoOf = Object.getPrototypeOf;
4
4
  var __defProp = Object.defineProperty;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ function __accessProp(key) {
8
+ return this[key];
9
+ }
10
+ var __toESMCache_node;
11
+ var __toESMCache_esm;
7
12
  var __toESM = (mod, isNodeMode, target) => {
13
+ var canCache = mod != null && typeof mod === "object";
14
+ if (canCache) {
15
+ var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
16
+ var cached = cache.get(mod);
17
+ if (cached)
18
+ return cached;
19
+ }
8
20
  target = mod != null ? __create(__getProtoOf(mod)) : {};
9
21
  const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
10
22
  for (let key of __getOwnPropNames(mod))
11
23
  if (!__hasOwnProp.call(to, key))
12
24
  __defProp(to, key, {
13
- get: () => mod[key],
25
+ get: __accessProp.bind(mod, key),
14
26
  enumerable: true
15
27
  });
28
+ if (canCache)
29
+ cache.set(mod, to);
16
30
  return to;
17
31
  };
18
32
  var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
33
+ var __returnValue = (v) => v;
34
+ function __exportSetter(name, newValue) {
35
+ this[name] = __returnValue.bind(null, newValue);
36
+ }
19
37
  var __export = (target, all) => {
20
38
  for (var name in all)
21
39
  __defProp(target, name, {
22
40
  get: all[name],
23
41
  enumerable: true,
24
42
  configurable: true,
25
- set: (newValue) => all[name] = () => newValue
43
+ set: __exportSetter.bind(all, name)
26
44
  });
27
45
  };
28
46
  var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
@@ -4662,7 +4680,7 @@ class SimpleLogger {
4662
4680
  return 0 /* DEBUG */;
4663
4681
  }
4664
4682
  } catch {}
4665
- return 3 /* ERROR */;
4683
+ return DEFAULT_LOG_LEVEL;
4666
4684
  }
4667
4685
  static parseLevel(value) {
4668
4686
  switch (value.toLowerCase()) {
@@ -4795,7 +4813,7 @@ class SimpleLogger {
4795
4813
  function getLogFilePath() {
4796
4814
  return logger.getLogFilePath();
4797
4815
  }
4798
- var GLOBAL_KEY = "__uipcli_log_file_path__", logger;
4816
+ var GLOBAL_KEY = "__uipcli_log_file_path__", DEFAULT_LOG_LEVEL = 3 /* ERROR */, logger;
4799
4817
  var init_logger = __esm(() => {
4800
4818
  init_output_context();
4801
4819
  logger = SimpleLogger.getInstance();
@@ -5066,7 +5084,7 @@ var init_telemetry = __esm(() => {
5066
5084
  init_logger_telemetry_provider();
5067
5085
  init_node_appinsights_telemetry_provider();
5068
5086
  sessionId = getOrCreateSessionId();
5069
- DEFAULT_AI_CONNECTION_STRING = Buffer.from("SW5zdHJ1bWVudGF0aW9uS2V5PTYwNjQ5ZGY3LTk4ZmYtNDk2My1iMWQ0LWE3MGQwMzA2MTc0ZjtJbmdlc3Rpb25FbmRwb2ludD1odHRwczovL3dlc3RldXJvcGUtNS5pbi5hcHBsaWNhdGlvbmluc2lnaHRzLmF6dXJlLmNvbS87TGl2ZUVuZHBvaW50PWh0dHBzOi8vd2VzdGV1cm9wZS5saXZlZGlhZ25vc3RpY3MubW9uaXRvci5henVyZS5jb20vO0FwcGxpY2F0aW9uSWQ9ZjlmYWNiNTctM2QxMS00Njc4LWJiOGItMDI0YmJhYmM1Y2Fl", "base64").toString("utf-8");
5087
+ DEFAULT_AI_CONNECTION_STRING = Buffer.from("SW5zdHJ1bWVudGF0aW9uS2V5PTliZDM3NDgyLTgxMGUtNDQyYS1hYWE2LWQzOGVmNjVjNjY3NDtJbmdlc3Rpb25FbmRwb2ludD1odHRwczovL3dlc3RldXJvcGUtNS5pbi5hcHBsaWNhdGlvbmluc2lnaHRzLmF6dXJlLmNvbS87TGl2ZUVuZHBvaW50PWh0dHBzOi8vd2VzdGV1cm9wZS5saXZlZGlhZ25vc3RpY3MubW9uaXRvci5henVyZS5jb20vO0FwcGxpY2F0aW9uSWQ9MzU2OTdlZjEtOGJkMC00ZjE5LWEyN2MtZDg3Y2NhYzY2ZDJj", "base64").toString("utf-8");
5070
5088
  telemetry = new Proxy({}, {
5071
5089
  get(_, prop) {
5072
5090
  const instance = getTelemetryInstance();
@@ -5080,7 +5098,7 @@ var init_telemetry = __esm(() => {
5080
5098
  var CommonTelemetryEvents;
5081
5099
  var init_telemetry_events = __esm(() => {
5082
5100
  CommonTelemetryEvents = {
5083
- Error: "Error"
5101
+ Error: "uip.error"
5084
5102
  };
5085
5103
  });
5086
5104
 
@@ -5131,11 +5149,6 @@ function logOutput(data, format = "table") {
5131
5149
  printOutput(data, format, (msg) => sink.writeOut(`${msg}
5132
5150
  `));
5133
5151
  }
5134
- function errorOutput(data, format = "table") {
5135
- const sink = getOutputSink();
5136
- printOutput(data, format, (msg) => sink.writeErr(`${msg}
5137
- `));
5138
- }
5139
5152
  function printTable(data, logFn = console.log, externalLogValue) {
5140
5153
  if (data.length === 0)
5141
5154
  return;
@@ -5198,7 +5211,7 @@ var init_formatter = __esm(() => {
5198
5211
  result: data.Result,
5199
5212
  message: data.Message
5200
5213
  });
5201
- errorOutput(data, getOutputFormat());
5214
+ logOutput(data, getOutputFormat());
5202
5215
  }
5203
5216
  OutputFormatter.error = error;
5204
5217
  function log(data) {
@@ -5236,6 +5249,12 @@ var init_command_help = __esm(() => {
5236
5249
  init_output_format_context();
5237
5250
  });
5238
5251
 
5252
+ // ../common/src/constants.ts
5253
+ var UIPATH_HOME_DIR = ".uipath", AUTH_FILENAME = ".auth", CONFIG_FILENAME = "config.json", LOCAL_CONFIG_FILENAME = "uipath.config.json", DEFAULT_BASE_URL = "https://cloud.uipath.com", DEFAULT_AUTH_TIMEOUT_MS;
5254
+ var init_constants = __esm(() => {
5255
+ DEFAULT_AUTH_TIMEOUT_MS = 5 * 60 * 1000;
5256
+ });
5257
+
5239
5258
  // ../../node_modules/jsonpath-plus/dist/index-node-esm.js
5240
5259
  import vm from "vm";
5241
5260
 
@@ -6642,12 +6661,35 @@ var init_jsonpath = __esm(() => {
6642
6661
  });
6643
6662
  // ../common/src/trackedAction.ts
6644
6663
  import { Command } from "commander";
6664
+ function deriveCommandPath(cmd) {
6665
+ const parts = [];
6666
+ let current = cmd;
6667
+ while (current) {
6668
+ const name = current.name();
6669
+ if (name) {
6670
+ parts.unshift(name);
6671
+ }
6672
+ current = current.parent;
6673
+ }
6674
+ if (parts.length > 1) {
6675
+ parts.shift();
6676
+ }
6677
+ return ["uip", ...parts.filter((p) => p !== "uip")].join(".");
6678
+ }
6679
+ var processContext;
6645
6680
  var init_trackedAction = __esm(() => {
6646
6681
  init_formatter();
6647
6682
  init_logger();
6648
6683
  init_telemetry();
6649
- Command.prototype.trackedAction = function(context, telemetryName, fn, properties) {
6684
+ processContext = {
6685
+ exit: (code) => {
6686
+ process.exitCode = code;
6687
+ }
6688
+ };
6689
+ Command.prototype.trackedAction = function(context, fn, properties) {
6690
+ const command = this;
6650
6691
  return this.action(async (...args) => {
6692
+ const telemetryName = deriveCommandPath(command);
6651
6693
  const props = typeof properties === "function" ? properties(...args) : properties;
6652
6694
  const startTime = performance.now();
6653
6695
  let errorMessage;
@@ -6678,6 +6720,7 @@ var init_trackedAction = __esm(() => {
6678
6720
  var init_src = __esm(() => {
6679
6721
  init_node_appinsights_telemetry_provider();
6680
6722
  init_command_help();
6723
+ init_constants();
6681
6724
  init_formatter();
6682
6725
  init_jsonpath();
6683
6726
  init_logger();
@@ -6685,7 +6728,6 @@ var init_src = __esm(() => {
6685
6728
  init_output_format_context();
6686
6729
  init_registry();
6687
6730
  init_telemetry();
6688
- init_telemetry_events();
6689
6731
  init_trackedAction();
6690
6732
  });
6691
6733
 
@@ -9878,15 +9920,15 @@ var require_cjs = __commonJS((exports) => {
9878
9920
  // package.json
9879
9921
  var package_default = {
9880
9922
  name: "@uipath/solution-tool",
9881
- version: "0.1.5",
9882
- description: "uipcli plugin for managing UiPath Automation Solutions.",
9923
+ version: "0.1.7",
9924
+ description: "Create, pack, publish, and deploy UiPath Automation Solutions.",
9883
9925
  repository: {
9884
9926
  type: "git",
9885
9927
  url: "https://github.com/UiPath/uipcli.git",
9886
9928
  directory: "packages/solution-tool"
9887
9929
  },
9888
9930
  publishConfig: {
9889
- registry: "https://npm.pkg.github.com/@uipath"
9931
+ registry: "https://registry.npmjs.org/"
9890
9932
  },
9891
9933
  keywords: [
9892
9934
  "uipcli-tool"
@@ -9912,8 +9954,7 @@ var package_default = {
9912
9954
  build: "bun build ./src/tool.ts --outdir dist --format esm --target node --external commander && bun build ./src/index.ts --outdir dist --format esm --target node",
9913
9955
  package: "bun run build && bun pm pack",
9914
9956
  lint: "biome check .",
9915
- "lint:fix": "biome check --write .",
9916
- e2e: "vitest run --config ../../vitest.e2e.base.config.ts"
9957
+ "lint:fix": "biome check --write ."
9917
9958
  },
9918
9959
  dependencies: {
9919
9960
  commander: "^14.0.3",
@@ -10641,7 +10682,7 @@ async function createZipFromDir(dir) {
10641
10682
  return zipSync(zippable, { level: 6 });
10642
10683
  }
10643
10684
  var registerBundleCommand = (program) => {
10644
- program.command("bundle").description("Bundle a local solution directory into a .uis file for upload.").argument("<solutionPath>", "Path to the solution directory (containing a .uipx file)").option("-o, --output <path>", "Output directory for the .uis file (default: current directory)").option("-n, --name <name>", "Name for the .uis file (default: solution directory name)").action(async (solutionPath, options) => {
10685
+ program.command("bundle").description("Bundle a local solution directory into a .uis file for upload.").argument("<solutionPath>", "Path to the solution directory (containing a .uipx file)").option("-o, --output <path>", "Output directory for the .uis file (default: current directory)").option("-n, --name <name>", "Name for the .uis file (default: solution directory name)").trackedAction(processContext, async (solutionPath, options) => {
10645
10686
  const resolvedPath = resolve(solutionPath);
10646
10687
  const [statError, solStat] = await catchError(stat(resolvedPath));
10647
10688
  if (statError) {
@@ -10746,7 +10787,7 @@ function outputError(message) {
10746
10787
  Message: message,
10747
10788
  Instructions: message
10748
10789
  });
10749
- process.exitCode = 1;
10790
+ processContext.exit(1);
10750
10791
  }
10751
10792
 
10752
10793
  // src/commands/deploy-activate.ts
@@ -12069,6 +12110,12 @@ var OUTPUT_DIR = join2(PKG_ROOT, "generated");
12069
12110
  var TEMP_DIR = join2(PKG_ROOT, "temp");
12070
12111
  var GENERATE_DIR = join2(PKG_ROOT, "swagger");
12071
12112
  if (false) {}
12113
+ // ../auth/src/index.ts
12114
+ init_src();
12115
+
12116
+ // ../auth/src/config.ts
12117
+ init_src();
12118
+
12072
12119
  // ../auth/src/utils/loadConfig.ts
12073
12120
  init_src();
12074
12121
 
@@ -25655,11 +25702,11 @@ var loadConfigAsync = async () => {
25655
25702
  const fs7 = await getFs();
25656
25703
  let configPath = fs7.env.getenv("UIPATH_CONFIG_PATH");
25657
25704
  if (!configPath) {
25658
- const localPath = fs7.path.join(fs7.env.cwd(), "uipath.config.json");
25705
+ const localPath = fs7.path.join(fs7.env.cwd(), LOCAL_CONFIG_FILENAME);
25659
25706
  if (await fs7.exists(localPath)) {
25660
25707
  configPath = localPath;
25661
25708
  } else {
25662
- configPath = fs7.path.join(fs7.env.homedir(), ".uipcli", "config.json");
25709
+ configPath = fs7.path.join(fs7.env.homedir(), UIPATH_HOME_DIR, CONFIG_FILENAME);
25663
25710
  }
25664
25711
  }
25665
25712
  if (!await fs7.exists(configPath)) {
@@ -25692,7 +25739,6 @@ Please ensure your config file contains valid JSON.`;
25692
25739
  };
25693
25740
 
25694
25741
  // ../auth/src/config.ts
25695
- var DEFAULT_BASE_URL = "https://cloud.uipath.com";
25696
25742
  var DEFAULT_CLIENT_ID = "36dea5b8-e8bb-423d-8e7b-c808df8f1c00";
25697
25743
 
25698
25744
  class InvalidBaseUrlError extends Error {
@@ -25787,10 +25833,10 @@ init_src2();
25787
25833
 
25788
25834
  // ../auth/src/telemetry-events.ts
25789
25835
  var AuthTelemetryEvents = {
25790
- Login: "Auth.Login",
25791
- TenantSelected: "Auth.TenantSelected",
25792
- TokenRefresh: "Auth.TokenRefresh",
25793
- Logout: "Auth.Logout"
25836
+ Login: "uip.auth.login",
25837
+ TenantSelected: "uip.auth.tenant-selected",
25838
+ TokenRefresh: "uip.auth.token-refresh",
25839
+ Logout: "uip.auth.logout"
25794
25840
  };
25795
25841
 
25796
25842
  // ../auth/src/tenantSelection.ts
@@ -26311,9 +26357,7 @@ var Qe = `${t("gray", h)} `;
26311
26357
  // ../auth/src/utils/envFile.ts
26312
26358
  init_src();
26313
26359
  init_src2();
26314
- var DEFAULT_AUTH_FILENAME = ".auth";
26315
- var DEFAULT_AUTH_DIR = ".uipath";
26316
- var DEFAULT_ENV_FILENAME = `${DEFAULT_AUTH_DIR}/${DEFAULT_AUTH_FILENAME}`;
26360
+ var DEFAULT_ENV_FILENAME = `${UIPATH_HOME_DIR}/${AUTH_FILENAME}`;
26317
26361
  var resolveEnvFilePathAsync = async (envFilePath = DEFAULT_ENV_FILENAME) => {
26318
26362
  const fs7 = getFileSystem();
26319
26363
  if (fs7.path.isAbsolute(envFilePath)) {
@@ -26706,7 +26750,7 @@ var TERMINAL_STATUSES = new Set([
26706
26750
  "FailedActivate"
26707
26751
  ]);
26708
26752
  var registerDeployActivateCommand = (program) => {
26709
- program.command("activate").description("Activate a deployed solution.").argument("<deployment-name>", "Name of the deployment to activate").option("-t, --tenant <tenant-name>", "Tenant (optional, defaults to value selected during auth)").option("--timeout <seconds>", "Timeout in seconds for activation polling (default: 360)", (v) => parseInt(v, 10), 360).option("--poll-interval <ms>", "Milliseconds between activation status polls (default: 5000)", (v) => parseInt(v, 10), 5000).option("--login-validity <minutes>", "Minimum minutes before token expiration to trigger a refresh (default: 10)", parseInt, 10).action(async (deploymentName, options) => {
26753
+ program.command("activate").description("Activate a deployed solution.").argument("<deployment-name>", "Name of the deployment to activate").option("-t, --tenant <tenant-name>", "Tenant (optional, defaults to value selected during auth)").option("--timeout <seconds>", "Timeout in seconds for activation polling (default: 360)", (v) => parseInt(v, 10), 360).option("--poll-interval <ms>", "Milliseconds between activation status polls (default: 5000)", (v) => parseInt(v, 10), 5000).option("--login-validity <minutes>", "Minimum minutes before token expiration to trigger a refresh (default: 10)", parseInt, 10).trackedAction(processContext, async (deploymentName, options) => {
26710
26754
  const [authError, auth] = await catchError(getSolutionAuthContext({
26711
26755
  tenant: options.tenant,
26712
26756
  loginValidity: options.loginValidity
@@ -26717,7 +26761,7 @@ var registerDeployActivateCommand = (program) => {
26717
26761
  Message: authError.message,
26718
26762
  Instructions: authError.message
26719
26763
  });
26720
- process.exitCode = 1;
26764
+ processContext.exit(1);
26721
26765
  return;
26722
26766
  }
26723
26767
  const configuration = new Configuration({
@@ -26733,7 +26777,7 @@ var registerDeployActivateCommand = (program) => {
26733
26777
  Message: message,
26734
26778
  Instructions: `Check deployment name. Deploy first with: uip solution deploy run. Details: ${details}`
26735
26779
  });
26736
- process.exitCode = 1;
26780
+ processContext.exit(1);
26737
26781
  return;
26738
26782
  }
26739
26783
  if (steps.steps.length > 0) {
@@ -26750,7 +26794,7 @@ var registerDeployActivateCommand = (program) => {
26750
26794
  Message: message,
26751
26795
  Instructions: `Check deployment name matches an existing deployment. Details: ${details}`
26752
26796
  });
26753
- process.exitCode = 1;
26797
+ processContext.exit(1);
26754
26798
  return;
26755
26799
  }
26756
26800
  const instanceId = activateResult.instanceId;
@@ -26780,7 +26824,7 @@ var registerDeployActivateCommand = (program) => {
26780
26824
  Message: "Activation polling failed",
26781
26825
  Instructions: `Activation may still be in progress. ${pollError.message}`
26782
26826
  });
26783
- process.exitCode = 1;
26827
+ processContext.exit(1);
26784
26828
  return;
26785
26829
  }
26786
26830
  if (finalStatus.status !== "SuccessfulActivate") {
@@ -26790,7 +26834,7 @@ var registerDeployActivateCommand = (program) => {
26790
26834
  Message: `Activation failed with status: ${finalStatus.status}`,
26791
26835
  Instructions: errors3
26792
26836
  });
26793
- process.exitCode = 1;
26837
+ processContext.exit(1);
26794
26838
  return;
26795
26839
  }
26796
26840
  OutputFormatter.success({
@@ -26809,7 +26853,7 @@ var registerDeployActivateCommand = (program) => {
26809
26853
  init_src();
26810
26854
  init_src2();
26811
26855
  var registerDeployConfigCommand = (program) => {
26812
- program.command("config").description("Fetch the default configuration for a solution package.").argument("<package-name>", "Solution package name").option("--package-version <version>", "Package version (optional, latest if omitted)").option("-o, --output <path>", "Write configuration to a file instead of stdout").option("-t, --tenant <tenant-name>", "Tenant (optional, defaults to value selected during auth)").option("--login-validity <minutes>", "Minimum minutes before token expiration to trigger a refresh (default: 10)", parseInt, 10).action(async (packageName, options) => {
26856
+ program.command("config").description("Fetch the default configuration for a solution package.").argument("<package-name>", "Solution package name").option("--package-version <version>", "Package version (optional, latest if omitted)").option("-o, --output <path>", "Write configuration to a file instead of stdout").option("-t, --tenant <tenant-name>", "Tenant (optional, defaults to value selected during auth)").option("--login-validity <minutes>", "Minimum minutes before token expiration to trigger a refresh (default: 10)", parseInt, 10).trackedAction(processContext, async (packageName, options) => {
26813
26857
  const [authError, auth] = await catchError(getSolutionAuthContext({
26814
26858
  tenant: options.tenant,
26815
26859
  loginValidity: options.loginValidity
@@ -26820,7 +26864,7 @@ var registerDeployConfigCommand = (program) => {
26820
26864
  Message: authError.message,
26821
26865
  Instructions: authError.message
26822
26866
  });
26823
- process.exitCode = 1;
26867
+ processContext.exit(1);
26824
26868
  return;
26825
26869
  }
26826
26870
  const configuration = new Configuration({
@@ -26840,7 +26884,7 @@ var registerDeployConfigCommand = (program) => {
26840
26884
  Message: message,
26841
26885
  Instructions: `Check available packages with: uip solution packages list. Details: ${details}`
26842
26886
  });
26843
- process.exitCode = 1;
26887
+ processContext.exit(1);
26844
26888
  return;
26845
26889
  }
26846
26890
  if (options.output) {
@@ -26853,7 +26897,7 @@ var registerDeployConfigCommand = (program) => {
26853
26897
  Message: `Failed to write config to: ${outputPath}`,
26854
26898
  Instructions: writeError.message
26855
26899
  });
26856
- process.exitCode = 1;
26900
+ processContext.exit(1);
26857
26901
  return;
26858
26902
  }
26859
26903
  OutputFormatter.success({
@@ -29065,7 +29109,7 @@ async function resolveParentFolder(options) {
29065
29109
 
29066
29110
  // src/commands/deploy-list.ts
29067
29111
  var registerDeployListCommand = (program) => {
29068
- program.command("list").description("List solution deployments.").option("-t, --tenant <tenant-name>", "Tenant (optional, defaults to value selected during auth)").option("-f, --folder-path <path>", "Filter by parent folder path (e.g., 'Shared')").option("--folder-key <key>", "Filter by parent folder key (GUID). Alternative to --folder-path.").option("--take <number>", "Max deployments to fetch (default: 10). Applied before --folder-path filter.", (v) => parseInt(v, 10), 10).option("--order-by <column>", "Column to order by (default: startTime)", "startTime").option("--order-direction <direction>", "Order direction: Ascending or Descending (default: Descending)", "Descending").option("--login-validity <minutes>", "Minimum minutes before token expiration to trigger a refresh (default: 10)", parseInt, 10).action(async (options) => {
29112
+ program.command("list").description("List solution deployments.").option("-t, --tenant <tenant-name>", "Tenant (optional, defaults to value selected during auth)").option("-f, --folder-path <path>", "Filter by parent folder path (e.g., 'Shared')").option("--folder-key <key>", "Filter by parent folder key (GUID). Alternative to --folder-path.").option("--take <number>", "Max deployments to fetch (default: 10). Applied before --folder-path filter.", (v) => parseInt(v, 10), 10).option("--order-by <column>", "Column to order by (default: startTime)", "startTime").option("--order-direction <direction>", "Order direction: Ascending or Descending (default: Descending)", "Descending").option("--login-validity <minutes>", "Minimum minutes before token expiration to trigger a refresh (default: 10)", parseInt, 10).trackedAction(processContext, async (options) => {
29069
29113
  const [authError, auth] = await catchError(getSolutionAuthContext({
29070
29114
  tenant: options.tenant,
29071
29115
  loginValidity: options.loginValidity
@@ -29076,7 +29120,7 @@ var registerDeployListCommand = (program) => {
29076
29120
  Message: authError.message,
29077
29121
  Instructions: authError.message
29078
29122
  });
29079
- process.exitCode = 1;
29123
+ processContext.exit(1);
29080
29124
  return;
29081
29125
  }
29082
29126
  const [folderError, folderPathFilter] = await catchError(resolveParentFolder({
@@ -29091,7 +29135,7 @@ var registerDeployListCommand = (program) => {
29091
29135
  Message: folderError.message,
29092
29136
  Instructions: "Provide a valid --folder-path or --folder-key to filter by folder."
29093
29137
  });
29094
- process.exitCode = 1;
29138
+ processContext.exit(1);
29095
29139
  return;
29096
29140
  }
29097
29141
  const configuration = new Configuration2({
@@ -29115,7 +29159,7 @@ var registerDeployListCommand = (program) => {
29115
29159
  Message: message,
29116
29160
  Instructions: `Failed to list deployments. Details: ${details}`
29117
29161
  });
29118
- process.exitCode = 1;
29162
+ processContext.exit(1);
29119
29163
  return;
29120
29164
  }
29121
29165
  let values = result.values;
@@ -29150,7 +29194,7 @@ var TERMINAL_STATUSES2 = new Set([
29150
29194
  "DeploymentScheduleError"
29151
29195
  ]);
29152
29196
  var registerDeployRunCommand = (program) => {
29153
- program.command("run").description("Deploy a solution to UiPath via Pipelines API.").requiredOption("-n, --name <deployment-name>", "Name for the deployment").requiredOption("--package-name <name>", "Solution package name to deploy").requiredOption("--package-version <version>", "Solution package version to deploy").requiredOption("--folder-name <name>", "Name of the Orchestrator folder to create for this deployment").option("-f, --folder-path <path>", "Parent folder path (e.g., 'Shared'). Solution folder is created under this.").option("--folder-key <key>", "Parent folder key (GUID). Alternative to --folder-path.").option("--config-file <path>", "JSON configuration file. Generate with: uip solution deploy config <name> -o config.json").option("-t, --tenant <tenant-name>", "Tenant (optional, defaults to value selected during auth)").option("--timeout <seconds>", "Timeout in seconds for deployment polling (default: 360)", (v) => parseInt(v, 10), 360).option("--poll-interval <ms>", "Milliseconds between deployment status polls (default: 5000)", (v) => parseInt(v, 10), 5000).option("--login-validity <minutes>", "Minimum minutes before token expiration to trigger a refresh (default: 10)", parseInt, 10).action(async (options) => {
29197
+ program.command("run").description("Deploy a solution to UiPath via Pipelines API.").requiredOption("-n, --name <deployment-name>", "Name for the deployment").requiredOption("--package-name <name>", "Solution package name to deploy").requiredOption("--package-version <version>", "Solution package version to deploy").requiredOption("--folder-name <name>", "Name of the Orchestrator folder to create for this deployment").option("-f, --folder-path <path>", "Parent folder path (e.g., 'Shared'). Solution folder is created under this.").option("--folder-key <key>", "Parent folder key (GUID). Alternative to --folder-path.").option("--config-file <path>", "JSON configuration file. Generate with: uip solution deploy config <name> -o config.json").option("-t, --tenant <tenant-name>", "Tenant (optional, defaults to value selected during auth)").option("--timeout <seconds>", "Timeout in seconds for deployment polling (default: 360)", (v) => parseInt(v, 10), 360).option("--poll-interval <ms>", "Milliseconds between deployment status polls (default: 5000)", (v) => parseInt(v, 10), 5000).option("--login-validity <minutes>", "Minimum minutes before token expiration to trigger a refresh (default: 10)", parseInt, 10).trackedAction(processContext, async (options) => {
29154
29198
  const [authError, auth] = await catchError(getSolutionAuthContext({
29155
29199
  tenant: options.tenant,
29156
29200
  loginValidity: options.loginValidity
@@ -29161,7 +29205,7 @@ var registerDeployRunCommand = (program) => {
29161
29205
  Message: authError.message,
29162
29206
  Instructions: authError.message
29163
29207
  });
29164
- process.exitCode = 1;
29208
+ processContext.exit(1);
29165
29209
  return;
29166
29210
  }
29167
29211
  const [folderError, parentFolderPath] = await catchError(resolveParentFolder({
@@ -29176,7 +29220,7 @@ var registerDeployRunCommand = (program) => {
29176
29220
  Message: folderError.message,
29177
29221
  Instructions: "Provide a valid --folder-path or --folder-key for the parent folder."
29178
29222
  });
29179
- process.exitCode = 1;
29223
+ processContext.exit(1);
29180
29224
  return;
29181
29225
  }
29182
29226
  const configuration = new Configuration({
@@ -29195,7 +29239,7 @@ var registerDeployRunCommand = (program) => {
29195
29239
  Message: `Failed to read config file: ${configPath}`,
29196
29240
  Instructions: readError.message
29197
29241
  });
29198
- process.exitCode = 1;
29242
+ processContext.exit(1);
29199
29243
  return;
29200
29244
  }
29201
29245
  const [parseError, parsed] = catchError(() => JSON.parse(configContent));
@@ -29205,7 +29249,7 @@ var registerDeployRunCommand = (program) => {
29205
29249
  Message: `Invalid JSON in config file: ${configPath}`,
29206
29250
  Instructions: parseError.message
29207
29251
  });
29208
- process.exitCode = 1;
29252
+ processContext.exit(1);
29209
29253
  return;
29210
29254
  }
29211
29255
  configBody = parsed;
@@ -29225,7 +29269,7 @@ var registerDeployRunCommand = (program) => {
29225
29269
  Message: message,
29226
29270
  Instructions: `Check package name/version with: uip solution packages list. Details: ${details}`
29227
29271
  });
29228
- process.exitCode = 1;
29272
+ processContext.exit(1);
29229
29273
  return;
29230
29274
  }
29231
29275
  const pipelineDeploymentId = installResult.pipelineDeploymentId;
@@ -29244,7 +29288,7 @@ var registerDeployRunCommand = (program) => {
29244
29288
  Message: "Deployment polling failed",
29245
29289
  Instructions: `Deployment may still be in progress. Check status with: uip solution deploy status ${pipelineDeploymentId}. ${pollError.message}`
29246
29290
  });
29247
- process.exitCode = 1;
29291
+ processContext.exit(1);
29248
29292
  return;
29249
29293
  }
29250
29294
  if (finalStatus.status !== "DeploymentSucceeded") {
@@ -29254,7 +29298,7 @@ var registerDeployRunCommand = (program) => {
29254
29298
  Message: `Deployment failed with status: ${finalStatus.status}`,
29255
29299
  Instructions: errors3
29256
29300
  });
29257
- process.exitCode = 1;
29301
+ processContext.exit(1);
29258
29302
  return;
29259
29303
  }
29260
29304
  OutputFormatter.success({
@@ -29273,7 +29317,7 @@ var registerDeployRunCommand = (program) => {
29273
29317
  // src/commands/deploy-status.ts
29274
29318
  init_src();
29275
29319
  var registerDeployStatusCommand = (program) => {
29276
- program.command("status").description("Check the status of a pipeline deployment.").argument("<pipeline-deployment-id>", "Pipeline deployment ID (GUID) to check status for.").option("-t, --tenant <tenant-name>", "Tenant (optional, defaults to value selected during auth)").option("--login-validity <minutes>", "Minimum minutes before token expiration to trigger a refresh (default: 10)", parseInt, 10).action(async (pipelineDeploymentId, options) => {
29320
+ program.command("status").description("Check the status of a pipeline deployment.").argument("<pipeline-deployment-id>", "Pipeline deployment ID (GUID) to check status for.").option("-t, --tenant <tenant-name>", "Tenant (optional, defaults to value selected during auth)").option("--login-validity <minutes>", "Minimum minutes before token expiration to trigger a refresh (default: 10)", parseInt, 10).trackedAction(processContext, async (pipelineDeploymentId, options) => {
29277
29321
  const [authError, auth] = await catchError(getSolutionAuthContext({
29278
29322
  tenant: options.tenant,
29279
29323
  loginValidity: options.loginValidity
@@ -29284,7 +29328,7 @@ var registerDeployStatusCommand = (program) => {
29284
29328
  Message: authError.message,
29285
29329
  Instructions: authError.message
29286
29330
  });
29287
- process.exitCode = 1;
29331
+ processContext.exit(1);
29288
29332
  return;
29289
29333
  }
29290
29334
  const configuration = new Configuration({
@@ -29302,7 +29346,7 @@ var registerDeployStatusCommand = (program) => {
29302
29346
  Message: message,
29303
29347
  Instructions: `Check the pipeline deployment ID. Get it from deploy run output. Details: ${details}`
29304
29348
  });
29305
- process.exitCode = 1;
29349
+ processContext.exit(1);
29306
29350
  return;
29307
29351
  }
29308
29352
  OutputFormatter.success({
@@ -29334,7 +29378,7 @@ var TERMINAL_STATUSES3 = new Set([
29334
29378
  "FailedUninstall"
29335
29379
  ]);
29336
29380
  var registerDeployUninstallCommand = (program) => {
29337
- program.command("uninstall").description("Uninstall a deployed solution.").argument("<deployment-name>", "Name of the deployment to uninstall").option("-t, --tenant <tenant-name>", "Tenant (optional, defaults to value selected during auth)").option("--timeout <seconds>", "Timeout in seconds for uninstall polling (default: 360)", (v) => parseInt(v, 10), 360).option("--poll-interval <ms>", "Milliseconds between uninstall status polls (default: 5000)", (v) => parseInt(v, 10), 5000).option("--login-validity <minutes>", "Minimum minutes before token expiration to trigger a refresh (default: 10)", parseInt, 10).action(async (deploymentName, options) => {
29381
+ program.command("uninstall").description("Uninstall a deployed solution.").argument("<deployment-name>", "Name of the deployment to uninstall").option("-t, --tenant <tenant-name>", "Tenant (optional, defaults to value selected during auth)").option("--timeout <seconds>", "Timeout in seconds for uninstall polling (default: 360)", (v) => parseInt(v, 10), 360).option("--poll-interval <ms>", "Milliseconds between uninstall status polls (default: 5000)", (v) => parseInt(v, 10), 5000).option("--login-validity <minutes>", "Minimum minutes before token expiration to trigger a refresh (default: 10)", parseInt, 10).trackedAction(processContext, async (deploymentName, options) => {
29338
29382
  const [authError, auth] = await catchError(getSolutionAuthContext({
29339
29383
  tenant: options.tenant,
29340
29384
  loginValidity: options.loginValidity
@@ -29345,7 +29389,7 @@ var registerDeployUninstallCommand = (program) => {
29345
29389
  Message: authError.message,
29346
29390
  Instructions: authError.message
29347
29391
  });
29348
- process.exitCode = 1;
29392
+ processContext.exit(1);
29349
29393
  return;
29350
29394
  }
29351
29395
  const configuration = new Configuration({
@@ -29361,7 +29405,7 @@ var registerDeployUninstallCommand = (program) => {
29361
29405
  Message: message,
29362
29406
  Instructions: `Check deployment name matches an existing deployment. Details: ${details}`
29363
29407
  });
29364
- process.exitCode = 1;
29408
+ processContext.exit(1);
29365
29409
  return;
29366
29410
  }
29367
29411
  if (uninstallResult.complete) {
@@ -29403,7 +29447,7 @@ var registerDeployUninstallCommand = (program) => {
29403
29447
  Message: "Uninstall polling failed",
29404
29448
  Instructions: `Uninstall may still be in progress. ${pollError.message}`
29405
29449
  });
29406
- process.exitCode = 1;
29450
+ processContext.exit(1);
29407
29451
  return;
29408
29452
  }
29409
29453
  if (finalStatus.status !== "SuccessfulUninstall") {
@@ -29413,7 +29457,7 @@ var registerDeployUninstallCommand = (program) => {
29413
29457
  Message: `Uninstall failed with status: ${finalStatus.status}`,
29414
29458
  Instructions: errors3
29415
29459
  });
29416
- process.exitCode = 1;
29460
+ processContext.exit(1);
29417
29461
  return;
29418
29462
  }
29419
29463
  OutputFormatter.success({
@@ -29443,13 +29487,24 @@ var registerDeployCommand = (program) => {
29443
29487
  init_src();
29444
29488
  init_src2();
29445
29489
  var registerNewCommand = (program) => {
29446
- program.command("new").description("Create a new empty UiPath solution file").argument("<solutionName>", "Solution file name or path (relative or absolute). Appends .uipx if no extension is specified").action(async (solutionName) => {
29490
+ program.command("new").description("Create a new empty UiPath solution file").argument("<solutionName>", "Solution file name or path (relative or absolute). Appends .uipx if no extension is specified").trackedAction(processContext, async (solutionName) => {
29447
29491
  const fs7 = getFileSystem();
29448
29492
  const base = fs7.path.basename(solutionName);
29449
- let filePath = fs7.path.resolve(solutionName);
29450
- if (base.lastIndexOf(".") <= 0) {
29451
- filePath += ".uipx";
29493
+ const hasExtension = base.lastIndexOf(".") > 0;
29494
+ const nameWithoutExt = hasExtension ? base.slice(0, base.lastIndexOf(".")) : base;
29495
+ const fileName = hasExtension ? base : `${base}.uipx`;
29496
+ const parentDir = fs7.path.resolve(fs7.path.dirname(solutionName), nameWithoutExt);
29497
+ const [mkdirError] = await catchError(fs7.mkdir(parentDir));
29498
+ if (mkdirError) {
29499
+ OutputFormatter.error({
29500
+ Result: "Failure",
29501
+ Message: "Failed to create solution directory",
29502
+ Instructions: mkdirError.message
29503
+ });
29504
+ processContext.exit(1);
29505
+ return;
29452
29506
  }
29507
+ const filePath = fs7.path.join(parentDir, fileName);
29453
29508
  const solution = {
29454
29509
  DocVersion: "1.0.0",
29455
29510
  StudioMinVersion: "2025.10.0",
@@ -29464,7 +29519,7 @@ var registerNewCommand = (program) => {
29464
29519
  Message: "Failed to create solution",
29465
29520
  Instructions: writeFileError.message
29466
29521
  });
29467
- process.exitCode = 1;
29522
+ processContext.exit(1);
29468
29523
  return;
29469
29524
  }
29470
29525
  OutputFormatter.success({
@@ -29475,10 +29530,13 @@ var registerNewCommand = (program) => {
29475
29530
  Path: filePath
29476
29531
  }
29477
29532
  });
29478
- process.exitCode = 0;
29533
+ processContext.exit(0);
29479
29534
  });
29480
29535
  };
29481
29536
 
29537
+ // src/commands/pack.ts
29538
+ init_src();
29539
+
29482
29540
  // src/services/pack-command-service.ts
29483
29541
  init_src();
29484
29542
  init_src2();
@@ -29489,7 +29547,7 @@ import { homedir as homedir2, platform as platform2 } from "os";
29489
29547
  import { dirname as dirname6, join as join6 } from "path";
29490
29548
  import node_child_process, { execFile as execFile7, execSync as external_node_child_process_execSync, spawn as external_node_child_process_spawn } from "node:child_process";
29491
29549
  import node_fs, { existsSync as existsSync3 } from "node:fs";
29492
- import promises, { constants, mkdir as mkdir3, mkdtemp as mkdtemp2, readFile as readFile3, readdir as readdir3, rename as rename2, rm as rm3, stat as promises_stat, writeFile as writeFile3 } from "node:fs/promises";
29550
+ import promises, { constants as constants2, mkdir as mkdir3, mkdtemp as mkdtemp2, readFile as readFile3, readdir as readdir3, rename as rename2, rm as rm3, stat as promises_stat, writeFile as writeFile3 } from "node:fs/promises";
29493
29551
  import node_os, { homedir as external_node_os_homedir, tmpdir as tmpdir2 } from "node:os";
29494
29552
  import node_path, { basename as basename3, dirname as external_node_path_dirname, isAbsolute as isAbsolute2, join as external_node_path_join, relative as relative3, resolve as external_node_path_resolve } from "node:path";
29495
29553
  import node_process from "node:process";
@@ -31926,7 +31984,7 @@ var __webpack_modules__ = {
31926
31984
  var require_semver2 = __commonJS2({
31927
31985
  "../agents-ub-storage-migration/node_modules/.pnpm/semver@7.7.2/node_modules/semver/index.js"(exports, module) {
31928
31986
  var internalRe = require_re();
31929
- var constants2 = require_constants();
31987
+ var constants3 = require_constants();
31930
31988
  var SemVer = require_semver();
31931
31989
  var identifiers = require_identifiers();
31932
31990
  var parse52 = require_parse();
@@ -32008,8 +32066,8 @@ var __webpack_modules__ = {
32008
32066
  re: internalRe.re,
32009
32067
  src: internalRe.src,
32010
32068
  tokens: internalRe.t,
32011
- SEMVER_SPEC_VERSION: constants2.SEMVER_SPEC_VERSION,
32012
- RELEASE_TYPES: constants2.RELEASE_TYPES,
32069
+ SEMVER_SPEC_VERSION: constants3.SEMVER_SPEC_VERSION,
32070
+ RELEASE_TYPES: constants3.RELEASE_TYPES,
32013
32071
  compareIdentifiers: identifiers.compareIdentifiers,
32014
32072
  rcompareIdentifiers: identifiers.rcompareIdentifiers
32015
32073
  };
@@ -33528,7 +33586,7 @@ var __webpack_modules__ = {
33528
33586
  var require_semver4 = __commonJS2({
33529
33587
  "node_modules/.pnpm/semver@7.7.4/node_modules/semver/index.js"(exports, module) {
33530
33588
  var internalRe = require_re2();
33531
- var constants2 = require_constants2();
33589
+ var constants3 = require_constants2();
33532
33590
  var SemVer = require_semver3();
33533
33591
  var identifiers = require_identifiers2();
33534
33592
  var parse52 = require_parse2();
@@ -33610,8 +33668,8 @@ var __webpack_modules__ = {
33610
33668
  re: internalRe.re,
33611
33669
  src: internalRe.src,
33612
33670
  tokens: internalRe.t,
33613
- SEMVER_SPEC_VERSION: constants2.SEMVER_SPEC_VERSION,
33614
- RELEASE_TYPES: constants2.RELEASE_TYPES,
33671
+ SEMVER_SPEC_VERSION: constants3.SEMVER_SPEC_VERSION,
33672
+ RELEASE_TYPES: constants3.RELEASE_TYPES,
33615
33673
  compareIdentifiers: identifiers.compareIdentifiers,
33616
33674
  rcompareIdentifiers: identifiers.rcompareIdentifiers
33617
33675
  };
@@ -71370,7 +71428,7 @@ var wslDrivesMountPoint2 = (() => {
71370
71428
  const configFilePath = "/etc/wsl.conf";
71371
71429
  let isConfigFileExists = false;
71372
71430
  try {
71373
- await promises.access(configFilePath, constants.F_OK);
71431
+ await promises.access(configFilePath, constants2.F_OK);
71374
71432
  isConfigFileExists = true;
71375
71433
  } catch {}
71376
71434
  if (!isConfigFileExists)
@@ -71396,7 +71454,7 @@ var canAccessPowerShell2 = async () => {
71396
71454
  canAccessPowerShellPromise2 ??= (async () => {
71397
71455
  try {
71398
71456
  const psPath = await powerShellPath22();
71399
- await promises.access(psPath, constants.X_OK);
71457
+ await promises.access(psPath, constants2.X_OK);
71400
71458
  return true;
71401
71459
  } catch {
71402
71460
  return false;
@@ -71741,7 +71799,7 @@ var baseOpen2 = async (options) => {
71741
71799
  const isBundled = !__dirname22 || __dirname22 === "/";
71742
71800
  let exeLocalXdgOpen = false;
71743
71801
  try {
71744
- await promises.access(localXdgOpenPath2, constants.X_OK);
71802
+ await promises.access(localXdgOpenPath2, constants2.X_OK);
71745
71803
  exeLocalXdgOpen = true;
71746
71804
  } catch {}
71747
71805
  const useSystemXdgOpen = node_process.versions.electron ?? (dist_platform === "android" || isBundled || !exeLocalXdgOpen);
@@ -74458,7 +74516,7 @@ Packing solution...
74458
74516
 
74459
74517
  // src/commands/pack.ts
74460
74518
  var registerPackCommand = (program) => {
74461
- program.command("pack").description("Pack a UiPath solution from a folder or .uis file").argument("<solutionPath>", "Solution path").argument("<outputPath>", "Output directory where the packed solution will be saved").option("-n, --name <name>", "Package name (default: solution folder name or .uis file name)").option("-v, --version <version>", "Package version (default: 1.0.0)", "1.0.0").option("--login-validity <minutes>", "Minimum minutes before token expiration to trigger a refresh (default: 10)", parseInt, 10).action(async (solutionPath, outputPath, options) => {
74519
+ program.command("pack").description("Pack a UiPath solution from a folder or .uis file").argument("<solutionPath>", "Solution path").argument("<outputPath>", "Output directory where the packed solution will be saved").option("-n, --name <name>", "Package name (default: solution folder name or .uis file name)").option("-v, --version <version>", "Package version (default: 1.0.0)", "1.0.0").option("--login-validity <minutes>", "Minimum minutes before token expiration to trigger a refresh (default: 10)", parseInt, 10).trackedAction(processContext, async (solutionPath, outputPath, options) => {
74462
74520
  const service = new PackCommandService;
74463
74521
  await service.execute(solutionPath, {
74464
74522
  output: outputPath,
@@ -74472,7 +74530,7 @@ var registerPackCommand = (program) => {
74472
74530
  // src/commands/packages-list.ts
74473
74531
  init_src();
74474
74532
  var registerPackagesListCommand = (program) => {
74475
- program.command("list").description("List all solution packages available in UiPath.").option("-t, --tenant <tenant-name>", "Tenant (optional, defaults to value selected during auth)").option("--take <count>", "Number of packages to return (default: 10)", (v) => parseInt(v, 10), 10).option("--order-by <column>", "Column to order by", "publishDate").option("--order-direction <direction>", "Order direction (Ascending or Descending)", "Descending").option("--login-validity <minutes>", "Minimum minutes before token expiration to trigger a refresh (default: 10)", parseInt, 10).action(async (options) => {
74533
+ program.command("list").description("List all solution packages available in UiPath.").option("-t, --tenant <tenant-name>", "Tenant (optional, defaults to value selected during auth)").option("--take <count>", "Number of packages to return (default: 10)", (v) => parseInt(v, 10), 10).option("--order-by <column>", "Column to order by", "publishDate").option("--order-direction <direction>", "Order direction (Ascending or Descending)", "Descending").option("--login-validity <minutes>", "Minimum minutes before token expiration to trigger a refresh (default: 10)", parseInt, 10).trackedAction(processContext, async (options) => {
74476
74534
  const [authError, auth] = await catchError(getSolutionAuthContext({
74477
74535
  tenant: options.tenant,
74478
74536
  loginValidity: options.loginValidity
@@ -74483,7 +74541,7 @@ var registerPackagesListCommand = (program) => {
74483
74541
  Message: authError.message,
74484
74542
  Instructions: authError.message
74485
74543
  });
74486
- process.exitCode = 1;
74544
+ processContext.exit(1);
74487
74545
  return;
74488
74546
  }
74489
74547
  const configuration = new Configuration2({
@@ -74505,7 +74563,7 @@ var registerPackagesListCommand = (program) => {
74505
74563
  Message: message,
74506
74564
  Instructions: `Failed to list packages. Details: ${details}`
74507
74565
  });
74508
- process.exitCode = 1;
74566
+ processContext.exit(1);
74509
74567
  return;
74510
74568
  }
74511
74569
  OutputFormatter.success({
@@ -77592,13 +77650,43 @@ class GetArtefactResourcesForProjectRequestHandler {
77592
77650
 
77593
77651
  class GetResourceKeyForProjectRequestHandler {
77594
77652
  async handleAsync(request, cancellationToken) {
77653
+ this.logger.info("Getting resource key for project {projectKey} from solution {solution}.", {
77654
+ projectKey: request.projectKey,
77655
+ solution: request.context.path
77656
+ });
77657
+ const cacheKey = `prk:${request.projectKey}`;
77658
+ const cached2 = await this.cacheProvider.getAsync(cacheKey, cancellationToken);
77659
+ if (cached2 && typeof cached2 == "object" && "resourceKey" in cached2) {
77660
+ this.logger.info("Cache hit for project {projectKey} resource key.", {
77661
+ projectKey: request.projectKey
77662
+ });
77663
+ const cachedResult3 = cached2;
77664
+ if (cachedResult3.resourceKey != null)
77665
+ return cachedResult3;
77666
+ }
77595
77667
  const solution = await request.context.loadAsync(cancellationToken);
77596
- const projectResource = solution.resources.find((r) => r.projectKey === request.projectKey && r.isArtefactResource);
77597
- if (!projectResource)
77668
+ let filteredResources = solution.resources.filter((r) => r.projectKey === request.projectKey && !isExcluded(r));
77669
+ filteredResources = await this.resourceService.filterVisibleAsync(filteredResources, cancellationToken);
77670
+ if (filteredResources.length === 0) {
77671
+ this.logger.error(`No resource meets the criteria for project ${request.projectKey} from solution ${request.context.path}.`);
77598
77672
  return null;
77599
- return {
77600
- resourceKey: projectResource.key
77673
+ }
77674
+ if (filteredResources.length > 1) {
77675
+ const resourceInfo = filteredResources.map((r) => `${r.key} - ${r.kind}`).join(", ");
77676
+ this.logger.error(`More than one resource meets the criteria for project ${request.projectKey} from solution ${request.context.path}. Resources: ${resourceInfo}`);
77677
+ return null;
77678
+ }
77679
+ const firstResource = filteredResources[0];
77680
+ const result = {
77681
+ resourceKey: firstResource ? firstResource.key : undefined
77601
77682
  };
77683
+ await this.cacheProvider.setAsync(cacheKey, result, cancellationToken);
77684
+ return result;
77685
+ }
77686
+ constructor(resourceService, cacheProvider, loggerFactory) {
77687
+ this.resourceService = resourceService;
77688
+ this.cacheProvider = cacheProvider;
77689
+ this.logger = loggerFactory.create("GetResourceKeyForProjectRequestHandler");
77602
77690
  }
77603
77691
  }
77604
77692
 
@@ -82564,6 +82652,7 @@ class ReconcileProjectsCommandHandler {
82564
82652
  });
82565
82653
  for (const artefactResource of artefactResourcesMatchedByNameAndType)
82566
82654
  artefactResource.projectKey = projectKeyStr;
82655
+ await this.cacheProjectResourceKeyAsync(command.context, projectKeyStr, cancellationToken);
82567
82656
  artefactResourcesByProjectKey = this.groupByProjectKey(artefactResources);
82568
82657
  } else if (artefactResourcesMatchedByNameAndType.length > 0) {
82569
82658
  this.logger.info("Project {projectKey} ({projectType}/{projectSubType}) found artefact resources by name for a different project type and key for solution {solutionKey}, recreate project artefacts. Matched {matchedCount} of {expectedCount} expected template resources, existing project key: {existingProjectKey}", {
@@ -82612,6 +82701,18 @@ class ReconcileProjectsCommandHandler {
82612
82701
  });
82613
82702
  await this.mediator.sendVoidCommandAsync(updateCmd, cancellationToken);
82614
82703
  }
82704
+ await this.cacheProjectResourceKeyAsync(context, projectKey, cancellationToken);
82705
+ }
82706
+ async cacheProjectResourceKeyAsync(context, projectKey, cancellationToken) {
82707
+ const sol = await context.loadAsync(cancellationToken);
82708
+ const visibleResources = await this.resourceService.filterVisibleAsync(sol.resources.filter((r) => r.projectKey === projectKey && !isExcluded(r)), cancellationToken);
82709
+ const firstVisible = visibleResources[0];
82710
+ const result = visibleResources.length === 1 && firstVisible ? {
82711
+ resourceKey: firstVisible.key
82712
+ } : {
82713
+ resourceKey: undefined
82714
+ };
82715
+ await this.cacheProvider.setAsync(`prk:${projectKey}`, result, cancellationToken);
82615
82716
  }
82616
82717
  groupByProjectKey(artefactResources) {
82617
82718
  const map3 = new Map;
@@ -82642,9 +82743,11 @@ class ReconcileProjectsCommandHandler {
82642
82743
  }
82643
82744
  });
82644
82745
  }
82645
- constructor(projectConfigurationReader, mediator, loggerFactory) {
82746
+ constructor(projectConfigurationReader, mediator, resourceService, cacheProvider, loggerFactory) {
82646
82747
  this.projectConfigurationReader = projectConfigurationReader;
82647
82748
  this.mediator = mediator;
82749
+ this.resourceService = resourceService;
82750
+ this.cacheProvider = cacheProvider;
82648
82751
  this.logger = loggerFactory.create("ReconcileProjectsCommandHandler");
82649
82752
  }
82650
82753
  }
@@ -85175,7 +85278,12 @@ function registerHandlers(diContainer) {
85175
85278
  }
85176
85279
  });
85177
85280
  diContainer.register(createRequestHandlerToken(GetResourceKeyForProjectRequest.name), {
85178
- useFactory: () => new GetResourceKeyForProjectRequestHandler
85281
+ useFactory: (c) => {
85282
+ const resourceService = c.resolve(Tokens.IResourceService);
85283
+ const cacheProvider = c.resolve(Tokens.ICacheProvider);
85284
+ const loggerFactory = c.resolve(ServiceTokens.LoggerFactory);
85285
+ return new GetResourceKeyForProjectRequestHandler(resourceService, cacheProvider, loggerFactory);
85286
+ }
85179
85287
  });
85180
85288
  diContainer.register(createCommandHandlerToken(CreateVirtualResourceCommand.name), {
85181
85289
  useFactory: (c) => {
@@ -85371,8 +85479,10 @@ function registerHandlers(diContainer) {
85371
85479
  useFactory: (c) => {
85372
85480
  const projectConfigurationReader = c.resolve(ServiceTokens.ProjectConfigurationReader);
85373
85481
  const mediator = c.resolve(ServiceTokens.Mediator);
85482
+ const resourceService = c.resolve(Tokens.IResourceService);
85483
+ const cacheProvider = c.resolve(Tokens.ICacheProvider);
85374
85484
  const loggerFactory = c.resolve(ServiceTokens.LoggerFactory);
85375
- return new ReconcileProjectsCommandHandler(projectConfigurationReader, mediator, loggerFactory);
85485
+ return new ReconcileProjectsCommandHandler(projectConfigurationReader, mediator, resourceService, cacheProvider, loggerFactory);
85376
85486
  }
85377
85487
  });
85378
85488
  diContainer.register(createRequestHandlerToken(DeploymentEntitiesSearchRequest.name), {
@@ -85897,7 +86007,7 @@ async function createResourceBuilderServices() {
85897
86007
 
85898
86008
  // src/commands/project-add.ts
85899
86009
  var registerProjectAddCommand = (project) => {
85900
- project.command("add").description("Add an existing project to a UiPath solution").argument("<projectPath>", "Path to the project folder (must contain project.uiproj or project.json)").argument("[solutionFile]", "Path to the .uipx solution file (defaults to the nearest .uipx file found by searching up from the project path)").action(async (projectPath, solutionFile) => {
86010
+ project.command("add").description("Add an existing project to a UiPath solution").argument("<projectPath>", "Path to the project folder (must contain project.uiproj or project.json)").argument("[solutionFile]", "Path to the .uipx solution file (defaults to the nearest .uipx file found by searching up from the project path)").trackedAction(processContext, async (projectPath, solutionFile) => {
85901
86011
  const fs7 = getFileSystem();
85902
86012
  const resolvedProjectPath = fs7.path.resolve(fs7.env.cwd(), projectPath);
85903
86013
  const isResolvedProjectPathValid = await fs7.exists(resolvedProjectPath);
@@ -85907,7 +86017,7 @@ var registerProjectAddCommand = (project) => {
85907
86017
  Message: "Failed to add project to solution",
85908
86018
  Instructions: `Project folder not found: ${resolvedProjectPath}`
85909
86019
  });
85910
- process.exitCode = 1;
86020
+ processContext.exit(1);
85911
86021
  return;
85912
86022
  }
85913
86023
  const uiprojPath = fs7.path.join(resolvedProjectPath, "project.uiproj");
@@ -85925,7 +86035,7 @@ var registerProjectAddCommand = (project) => {
85925
86035
  Message: "Failed to add project to solution",
85926
86036
  Instructions: `No project file found in ${resolvedProjectPath}. Expected project.uiproj or project.json`
85927
86037
  });
85928
- process.exitCode = 1;
86038
+ processContext.exit(1);
85929
86039
  return;
85930
86040
  }
85931
86041
  let resolvedSolutionFile;
@@ -85939,7 +86049,7 @@ var registerProjectAddCommand = (project) => {
85939
86049
  Message: "Failed to add project to solution",
85940
86050
  Instructions: findSolutionFileError.message
85941
86051
  });
85942
- process.exitCode = 1;
86052
+ processContext.exit(1);
85943
86053
  return;
85944
86054
  }
85945
86055
  resolvedSolutionFile = projectPathSolutionFile;
@@ -85951,7 +86061,7 @@ var registerProjectAddCommand = (project) => {
85951
86061
  Message: "Failed to add project to solution",
85952
86062
  Instructions: `Solution file not found: ${resolvedSolutionFile}`
85953
86063
  });
85954
- process.exitCode = 1;
86064
+ processContext.exit(1);
85955
86065
  return;
85956
86066
  }
85957
86067
  const solutionDir = fs7.path.dirname(resolvedSolutionFile);
@@ -85964,7 +86074,7 @@ var registerProjectAddCommand = (project) => {
85964
86074
  Solution: ${solutionDir}
85965
86075
  Project: ${resolvedProjectPath}`
85966
86076
  });
85967
- process.exitCode = 1;
86077
+ processContext.exit(1);
85968
86078
  return;
85969
86079
  }
85970
86080
  const [readProjectFileError, projectFileContent] = await catchError(fs7.readFile(projectFilePath, "utf-8"));
@@ -85974,7 +86084,7 @@ var registerProjectAddCommand = (project) => {
85974
86084
  Message: "Failed to add project to solution",
85975
86085
  Instructions: readProjectFileError?.message ?? "Unable to read project file"
85976
86086
  });
85977
- process.exitCode = 1;
86087
+ processContext.exit(1);
85978
86088
  return;
85979
86089
  }
85980
86090
  const projectContent = JSON.parse(projectFileContent);
@@ -85985,7 +86095,7 @@ var registerProjectAddCommand = (project) => {
85985
86095
  Message: "Failed to add project to solution",
85986
86096
  Instructions: `ProjectType not found in ${projectFilePath}`
85987
86097
  });
85988
- process.exitCode = 1;
86098
+ processContext.exit(1);
85989
86099
  return;
85990
86100
  }
85991
86101
  const [readSolutionFileError, solutionContent] = await catchError(fs7.readFile(resolvedSolutionFile, "utf-8"));
@@ -85995,7 +86105,7 @@ var registerProjectAddCommand = (project) => {
85995
86105
  Message: "Failed to add project to solution",
85996
86106
  Instructions: readSolutionFileError?.message ?? "Unable to read solution file"
85997
86107
  });
85998
- process.exitCode = 1;
86108
+ processContext.exit(1);
85999
86109
  return;
86000
86110
  }
86001
86111
  const solution = JSON.parse(solutionContent);
@@ -86007,7 +86117,7 @@ var registerProjectAddCommand = (project) => {
86007
86117
  Message: "Failed to add project to solution",
86008
86118
  Instructions: `Project already exists in solution: ${projectRelativePath}`
86009
86119
  });
86010
- process.exitCode = 1;
86120
+ processContext.exit(1);
86011
86121
  return;
86012
86122
  }
86013
86123
  const projectId = randomUUID();
@@ -86028,7 +86138,7 @@ var registerProjectAddCommand = (project) => {
86028
86138
  Message: "Failed to add project to solution",
86029
86139
  Instructions: writeSolutionFileError.message
86030
86140
  });
86031
- process.exitCode = 1;
86141
+ processContext.exit(1);
86032
86142
  return;
86033
86143
  }
86034
86144
  const services2 = await createResourceBuilderServices();
@@ -86045,7 +86155,7 @@ var registerProjectAddCommand = (project) => {
86045
86155
  Message: "Failed to add project to solution",
86046
86156
  Instructions: createProjectError.message
86047
86157
  });
86048
- process.exitCode = 1;
86158
+ processContext.exit(1);
86049
86159
  return;
86050
86160
  }
86051
86161
  OutputFormatter.success({
@@ -86057,7 +86167,7 @@ var registerProjectAddCommand = (project) => {
86057
86167
  Solution: resolvedSolutionFile
86058
86168
  }
86059
86169
  });
86060
- process.exitCode = 0;
86170
+ processContext.exit(0);
86061
86171
  });
86062
86172
  };
86063
86173
 
@@ -86065,7 +86175,7 @@ var registerProjectAddCommand = (project) => {
86065
86175
  init_src();
86066
86176
  init_src2();
86067
86177
  var registerProjectRemoveCommand = (project) => {
86068
- project.command("remove").description("Remove a project from a UiPath solution").argument("<projectPath>", "Path to the project folder to remove").argument("[solutionFile]", "Path to the .uipx solution file (defaults to the nearest .uipx file found by searching up from the project path)").action(async (projectPath, solutionFile) => {
86178
+ project.command("remove").description("Remove a project from a UiPath solution").argument("<projectPath>", "Path to the project folder to remove").argument("[solutionFile]", "Path to the .uipx solution file (defaults to the nearest .uipx file found by searching up from the project path)").trackedAction(processContext, async (projectPath, solutionFile) => {
86069
86179
  const fs7 = getFileSystem();
86070
86180
  const resolvedProjectPath = fs7.path.resolve(fs7.env.cwd(), projectPath);
86071
86181
  let resolvedSolutionFile;
@@ -86079,7 +86189,7 @@ var registerProjectRemoveCommand = (project) => {
86079
86189
  Message: "Failed to remove project from solution",
86080
86190
  Instructions: `Solution file not found: ${findSolutionFileError.message}`
86081
86191
  });
86082
- process.exitCode = 1;
86192
+ processContext.exit(1);
86083
86193
  return;
86084
86194
  }
86085
86195
  resolvedSolutionFile = projectPathSolutionFile;
@@ -86091,7 +86201,7 @@ var registerProjectRemoveCommand = (project) => {
86091
86201
  Message: "Failed to remove project from solution",
86092
86202
  Instructions: `Solution file not found: ${resolvedSolutionFile}`
86093
86203
  });
86094
- process.exitCode = 1;
86204
+ processContext.exit(1);
86095
86205
  return;
86096
86206
  }
86097
86207
  const solutionDir = fs7.path.dirname(resolvedSolutionFile);
@@ -86104,7 +86214,7 @@ var registerProjectRemoveCommand = (project) => {
86104
86214
  Solution: ${solutionDir}
86105
86215
  Project: ${resolvedProjectPath}`
86106
86216
  });
86107
- process.exitCode = 1;
86217
+ processContext.exit(1);
86108
86218
  return;
86109
86219
  }
86110
86220
  const [readSolutionFileError, solutionContent] = await catchError(fs7.readFile(resolvedSolutionFile, "utf-8"));
@@ -86114,7 +86224,7 @@ var registerProjectRemoveCommand = (project) => {
86114
86224
  Message: "Failed to remove project from solution",
86115
86225
  Instructions: readSolutionFileError?.message ?? "Unable to read solution file"
86116
86226
  });
86117
- process.exitCode = 1;
86227
+ processContext.exit(1);
86118
86228
  return;
86119
86229
  }
86120
86230
  const solution = JSON.parse(solutionContent);
@@ -86125,7 +86235,7 @@ var registerProjectRemoveCommand = (project) => {
86125
86235
  Message: "Failed to remove project from solution",
86126
86236
  Instructions: `Project not found in solution: ${relativePath}`
86127
86237
  });
86128
- process.exitCode = 1;
86238
+ processContext.exit(1);
86129
86239
  return;
86130
86240
  }
86131
86241
  const projectEntry = solution.Projects[projectIndex];
@@ -86139,7 +86249,7 @@ var registerProjectRemoveCommand = (project) => {
86139
86249
  Message: "Failed to remove project from solution",
86140
86250
  Instructions: writeSolutionFileError.message
86141
86251
  });
86142
- process.exitCode = 1;
86252
+ processContext.exit(1);
86143
86253
  return;
86144
86254
  }
86145
86255
  const services2 = await createResourceBuilderServices();
@@ -86152,7 +86262,7 @@ var registerProjectRemoveCommand = (project) => {
86152
86262
  Message: "Failed to remove project from solution",
86153
86263
  Instructions: deleteProjectError.message
86154
86264
  });
86155
- process.exitCode = 1;
86265
+ processContext.exit(1);
86156
86266
  return;
86157
86267
  }
86158
86268
  OutputFormatter.success({
@@ -86197,7 +86307,7 @@ var registerProjectCommand = (program) => {
86197
86307
  init_src();
86198
86308
  init_src2();
86199
86309
  var registerPublishCommand = (program) => {
86200
- program.command("publish").description("Publish a solution package (.zip) to UiPath.").option("-t, --tenant <tenant-name>", "Tenant (optional, defaults to value selected during auth)").argument("<packagePath>", "Path to a .zip package file to publish.").option("--login-validity <minutes>", "Minimum minutes before token expiration to trigger a refresh (default: 10)", parseInt, 10).action(async (packagePath, options) => {
86310
+ program.command("publish").description("Publish a solution package (.zip) to UiPath.").option("-t, --tenant <tenant-name>", "Tenant (optional, defaults to value selected during auth)").argument("<packagePath>", "Path to a .zip package file to publish.").option("--login-validity <minutes>", "Minimum minutes before token expiration to trigger a refresh (default: 10)", parseInt, 10).trackedAction(processContext, async (packagePath, options) => {
86201
86311
  const [authError, auth] = await catchError(getSolutionAuthContext({
86202
86312
  tenant: options.tenant,
86203
86313
  loginValidity: options.loginValidity
@@ -86208,7 +86318,7 @@ var registerPublishCommand = (program) => {
86208
86318
  Message: authError.message,
86209
86319
  Instructions: authError.message
86210
86320
  });
86211
- process.exitCode = 1;
86321
+ processContext.exit(1);
86212
86322
  return;
86213
86323
  }
86214
86324
  const fs7 = getFileSystem();
@@ -86220,7 +86330,7 @@ var registerPublishCommand = (program) => {
86220
86330
  Message: `File not found: ${resolvedPath}`,
86221
86331
  Instructions: `Ensure the file path is correct. Build a package first with: uip solution pack`
86222
86332
  });
86223
- process.exitCode = 1;
86333
+ processContext.exit(1);
86224
86334
  return;
86225
86335
  }
86226
86336
  if (!resolvedPath.endsWith(".zip")) {
@@ -86229,7 +86339,7 @@ var registerPublishCommand = (program) => {
86229
86339
  Message: `Invalid file type. Expected a .zip file, got: ${resolvedPath}`,
86230
86340
  Instructions: `Ensure file is a valid .zip solution package from: uip solution pack`
86231
86341
  });
86232
- process.exitCode = 1;
86342
+ processContext.exit(1);
86233
86343
  return;
86234
86344
  }
86235
86345
  const [fileBufferError, fileBuffer] = await catchError(fs7.readFile(resolvedPath));
@@ -86240,7 +86350,7 @@ var registerPublishCommand = (program) => {
86240
86350
  Message: message,
86241
86351
  Instructions: `Unable to read file: ${resolvedPath}`
86242
86352
  });
86243
- process.exitCode = 1;
86353
+ processContext.exit(1);
86244
86354
  return;
86245
86355
  }
86246
86356
  const configuration = new Configuration({
@@ -86258,7 +86368,7 @@ var registerPublishCommand = (program) => {
86258
86368
  Message: message,
86259
86369
  Instructions: `Ensure file is a valid .zip solution package from: uip solution pack. Details: ${details}`
86260
86370
  });
86261
- process.exitCode = 1;
86371
+ processContext.exit(1);
86262
86372
  return;
86263
86373
  }
86264
86374
  OutputFormatter.success({
@@ -86280,7 +86390,7 @@ import { readFile as readFile4 } from "node:fs/promises";
86280
86390
  import { basename as basename4, resolve as resolve3 } from "node:path";
86281
86391
  init_src();
86282
86392
  var registerUploadCommand = (program) => {
86283
- program.command("upload").description("Upload a solution (.uis) file to UiPath Studio Web for import.").argument("<solutionFile>", "Path to a .uis solution file to upload.").option("--login-validity <minutes>", "Minimum minutes before token expiration to trigger a refresh (default: 10)", parseInt, 10).action(async (solutionFile, options) => {
86393
+ program.command("upload").description("Upload a solution (.uis) file to UiPath Studio Web for import.").argument("<solutionFile>", "Path to a .uis solution file to upload.").option("--login-validity <minutes>", "Minimum minutes before token expiration to trigger a refresh (default: 10)", parseInt, 10).trackedAction(processContext, async (solutionFile, options) => {
86284
86394
  const [loginError, loginStatus2] = await catchError(getLoginStatusAsync({
86285
86395
  ensureTokenValidityMinutes: options.loginValidity
86286
86396
  }));
@@ -86291,7 +86401,7 @@ var registerUploadCommand = (program) => {
86291
86401
  Message: errorMessage,
86292
86402
  Instructions: loginError.message
86293
86403
  });
86294
- process.exitCode = 1;
86404
+ processContext.exit(1);
86295
86405
  return;
86296
86406
  }
86297
86407
  if (loginStatus2.loginStatus !== "Logged in" || !loginStatus2.accessToken || !loginStatus2.baseUrl) {
@@ -86300,7 +86410,7 @@ var registerUploadCommand = (program) => {
86300
86410
  Message: "Not logged in. Run 'uip login' first.",
86301
86411
  Instructions: "Not logged in. Run 'uip login' first."
86302
86412
  });
86303
- process.exitCode = 1;
86413
+ processContext.exit(1);
86304
86414
  return;
86305
86415
  }
86306
86416
  const organizationName = loginStatus2.organizationName;
@@ -86310,7 +86420,7 @@ var registerUploadCommand = (program) => {
86310
86420
  Message: "Organization name is not available. Re-authenticate with 'uip login'.",
86311
86421
  Instructions: "Organization name is not available. Re-authenticate with 'uip login'."
86312
86422
  });
86313
- process.exitCode = 1;
86423
+ processContext.exit(1);
86314
86424
  return;
86315
86425
  }
86316
86426
  const tenantId = loginStatus2.tenantId;
@@ -86320,7 +86430,7 @@ var registerUploadCommand = (program) => {
86320
86430
  Message: "Tenant ID is not available. Re-authenticate with 'uip login'.",
86321
86431
  Instructions: "Tenant ID is not available. Re-authenticate with 'uip login'."
86322
86432
  });
86323
- process.exitCode = 1;
86433
+ processContext.exit(1);
86324
86434
  return;
86325
86435
  }
86326
86436
  const resolvedPath = resolve3(solutionFile);
@@ -86330,7 +86440,7 @@ var registerUploadCommand = (program) => {
86330
86440
  Message: `File not found: ${resolvedPath}`,
86331
86441
  Instructions: `File not found: ${resolvedPath}`
86332
86442
  });
86333
- process.exitCode = 1;
86443
+ processContext.exit(1);
86334
86444
  return;
86335
86445
  }
86336
86446
  if (!resolvedPath.endsWith(".uis")) {
@@ -86339,7 +86449,7 @@ var registerUploadCommand = (program) => {
86339
86449
  Message: `Invalid file type. Expected a .uis file, got: ${resolvedPath}`,
86340
86450
  Instructions: `Invalid file type. Expected a .uis file, got: ${resolvedPath}`
86341
86451
  });
86342
- process.exitCode = 1;
86452
+ processContext.exit(1);
86343
86453
  return;
86344
86454
  }
86345
86455
  const [fileError, fileBuffer] = await catchError(readFile4(resolvedPath));
@@ -86350,7 +86460,7 @@ var registerUploadCommand = (program) => {
86350
86460
  Message: errorMessage,
86351
86461
  Instructions: fileError.message
86352
86462
  });
86353
- process.exitCode = 1;
86463
+ processContext.exit(1);
86354
86464
  return;
86355
86465
  }
86356
86466
  const fileName = basename4(resolvedPath);
@@ -86376,7 +86486,7 @@ var registerUploadCommand = (program) => {
86376
86486
  Message: errorMessage,
86377
86487
  Instructions: fetchError.message
86378
86488
  });
86379
- process.exitCode = 1;
86489
+ processContext.exit(1);
86380
86490
  return;
86381
86491
  }
86382
86492
  if (!response.ok) {
@@ -86386,7 +86496,7 @@ var registerUploadCommand = (program) => {
86386
86496
  Message: `Upload failed (${response.status}): ${text}`,
86387
86497
  Instructions: `Upload failed (${response.status}): ${text}`
86388
86498
  });
86389
- process.exitCode = 1;
86499
+ processContext.exit(1);
86390
86500
  return;
86391
86501
  }
86392
86502
  const result = await response.json();
@@ -86410,7 +86520,7 @@ var registerUploadCommand = (program) => {
86410
86520
  var metadata = {
86411
86521
  name: "solution-tool",
86412
86522
  version: package_default.version,
86413
- description: "UiPath Automation Solution Tool",
86523
+ description: "Create, pack, publish, and deploy UiPath Automation Solutions.",
86414
86524
  commandPrefix: "solution"
86415
86525
  };
86416
86526
  var registerCommands = async (program) => {