@uipath/solution-tool 1.200.0-preview.109 → 1.201.0-preview.115

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 (29) hide show
  1. package/dist/{browser-strategy-brs3w53e.js → browser-strategy-yccf8mtd.js} +1 -1
  2. package/dist/deploy.js +5 -5
  3. package/dist/index-2fj08e7n.js +2058 -0
  4. package/dist/index-w03qc9m8.js +634 -0
  5. package/dist/index.js +11 -11
  6. package/dist/init.js +5 -5
  7. package/dist/js-yaml-4ypbq2tt.js +3145 -0
  8. package/dist/node-strategy-12qfy0nv.js +348 -0
  9. package/dist/pack.js +8 -20
  10. package/dist/{packager-tool-1ps2qeqg.js → packager-tool-5arsyj36.js} +3 -2
  11. package/dist/packager-tool-7eva0peq.js +265 -0
  12. package/dist/{packager-tool-kfzzznjr.js → packager-tool-85x8cje1.js} +2 -2
  13. package/dist/{packager-tool-sdhdmkt8.js → packager-tool-9vehmnke.js} +2 -1
  14. package/dist/{packager-tool-gnmkvkz3.js → packager-tool-9x8dbxbn.js} +675 -29
  15. package/dist/{packager-tool-gkwmyc48.js → packager-tool-arbagkf2.js} +28 -13
  16. package/dist/{packager-tool-rdxaysxe.js → packager-tool-c84z58bt.js} +65 -8
  17. package/dist/{packager-tool-br2aa2fh.js → packager-tool-n49qbf8m.js} +10 -18
  18. package/dist/{packager-tool-37g19zk3.js → packager-tool-ngh4qwjv.js} +4 -4
  19. package/dist/{packager-tool-y4wacqkp.js → packager-tool-r9n45rjm.js} +1059 -6017
  20. package/dist/{packager-tool-7efxm815.js → packager-tool-y35nbbkm.js} +6243 -5846
  21. package/dist/packager-tool.js +1 -1
  22. package/dist/publish.js +5 -5
  23. package/dist/resource.js +4 -4
  24. package/dist/services/feed-resolver.d.ts +4 -5
  25. package/dist/templates/AGENTS.md +2 -1
  26. package/dist/tool.js +11 -11
  27. package/package.json +2 -2
  28. package/dist/node-strategy-a4n0d6dx.js +0 -63
  29. package/dist/packager-tool-q90kqh83.js +0 -1161
@@ -6,11 +6,11 @@ import {
6
6
  listDeploymentsAsync,
7
7
  listPackagesAsync,
8
8
  uninstallDeploymentAsync
9
- } from "./packager-tool-br2aa2fh.js";
9
+ } from "./packager-tool-n49qbf8m.js";
10
10
  import {
11
11
  SolutionInitError,
12
12
  solutionInitAsync
13
- } from "./packager-tool-kfzzznjr.js";
13
+ } from "./packager-tool-85x8cje1.js";
14
14
  import {
15
15
  GOVERNANCE_OPTION_INSTRUCTIONS,
16
16
  PackCommandService,
@@ -18,28 +18,35 @@ import {
18
18
  applyAuthConnection,
19
19
  createSolutionPackager,
20
20
  ensurePackagerTools,
21
+ packSolutionAsync,
21
22
  readSolutionFileAsUint8Array,
22
23
  resolveSdkLogLevel,
23
24
  validateGovernanceOptions
24
- } from "./packager-tool-7efxm815.js";
25
+ } from "./packager-tool-y35nbbkm.js";
25
26
  import {
26
27
  publishSolutionAsync
27
- } from "./packager-tool-rdxaysxe.js";
28
+ } from "./packager-tool-c84z58bt.js";
28
29
  import {
29
30
  Configuration,
30
31
  Configuration1 as Configuration2,
31
32
  DeploymentActivationStatus,
32
33
  DeploymentOperationStatus,
33
34
  DeploymentsApi,
35
+ PackagesApi,
34
36
  PipelinesApi,
35
37
  SearchApi,
36
38
  bundleSolution,
39
+ feedResolutionFailureInstructions,
40
+ feedScopeInitOverride,
41
+ folderKeyInitOverride,
37
42
  importSolution,
38
43
  listSelectablePublishLocations,
44
+ resolveFeedScope,
39
45
  resolvePersonalWorkspace,
46
+ searchPackageVersions,
40
47
  solutionExistsOnStudioWeb,
41
48
  uploadOrOverwriteSolution
42
- } from "./packager-tool-gkwmyc48.js";
49
+ } from "./packager-tool-arbagkf2.js";
43
50
  import {
44
51
  Tokens,
45
52
  applyEntryPointEnhancementAsync,
@@ -60,7 +67,7 @@ import {
60
67
  syncAndLog,
61
68
  syncResourcesFromBindings,
62
69
  writeSolutionFile
63
- } from "./packager-tool-37g19zk3.js";
70
+ } from "./packager-tool-ngh4qwjv.js";
64
71
  import {
65
72
  ToolResult
66
73
  } from "./packager-tool-vpr77gre.js";
@@ -93,12 +100,13 @@ import {
93
100
  resolveSolutionDir,
94
101
  toPortableRelativePath,
95
102
  trackShipSucceeded,
103
+ unsupportedSolutionProjectType,
96
104
  updateUipxSolutionId,
97
105
  withCompleter
98
- } from "./packager-tool-y4wacqkp.js";
106
+ } from "./packager-tool-r9n45rjm.js";
99
107
  import {
100
108
  getFileSystem
101
- } from "./packager-tool-q90kqh83.js";
109
+ } from "./packager-tool-7eva0peq.js";
102
110
  import {
103
111
  unzipSync
104
112
  } from "./packager-tool-129wn232.js";
@@ -106,7 +114,7 @@ import {
106
114
  var package_default = {
107
115
  name: "@uipath/solution-tool",
108
116
  license: "MIT",
109
- version: "1.200.0-preview.109",
117
+ version: "1.201.0-preview.115",
110
118
  description: "Create, pack, publish, and deploy UiPath Automation Solutions.",
111
119
  repository: {
112
120
  type: "git",
@@ -169,6 +177,7 @@ var package_default = {
169
177
  "@uipath/packager-tool-connector": "workspace:*",
170
178
  "@uipath/packager-tool-webapp": "workspace:*",
171
179
  "@uipath/pipelines-sdk": "workspace:*",
180
+ "@uipath/project-executor": "workspace:*",
172
181
  "@uipath/resource-builder-sdk": "^2025.11.0-alpha4202-3459",
173
182
  "@uipath/resource-builder-tool": "2025.11.0-alpha4535-3530",
174
183
  "@uipath/solution-packager": "workspace:*",
@@ -1458,11 +1467,6 @@ var fail = (reason, message, instructions, exitCode = 1) => ({
1458
1467
  exitCode
1459
1468
  });
1460
1469
  var AUTH_INSTRUCTIONS = "Run 'uip login' to refresh credentials, then retry. If the deployment is in a different tenant, switch with 'uip login tenant set <tenant>'.";
1461
- function folderScope(folderKey) {
1462
- return async ({ init }) => ({
1463
- headers: { ...init.headers, "X-UIPATH-FolderKey": folderKey }
1464
- });
1465
- }
1466
1470
  async function upgradeDeploymentAsync(deploymentKey, options = {}) {
1467
1471
  const [authError, auth] = await catchError(getSolutionAuthContext({
1468
1472
  tenant: options.tenant,
@@ -1487,7 +1491,7 @@ async function upgradeDeploymentAsync(deploymentKey, options = {}) {
1487
1491
  if (pwError || !pw) {
1488
1492
  return fail("personal_workspace_failed", pwError?.message ?? "Personal Workspace could not be resolved.", "Ensure your user has a Personal Workspace, then retry.");
1489
1493
  }
1490
- feedScope = folderScope(pw.key);
1494
+ feedScope = folderKeyInitOverride(pw.key);
1491
1495
  }
1492
1496
  const [getError, deployment] = await catchError(deploymentsApi.deploymentsGetByKey({ deploymentKey }, feedScope));
1493
1497
  if (getError || !deployment) {
@@ -2057,8 +2061,100 @@ var SOLUTION_PACKAGES_DELETE_EXAMPLES = [
2057
2061
  }
2058
2062
  }
2059
2063
  ];
2064
+ var SEARCH_PAGE_SIZE = 50;
2065
+ function scopeName(scope) {
2066
+ if (scope.kind === "tenant") {
2067
+ return "the tenant feed";
2068
+ }
2069
+ if (scope.name) {
2070
+ return `'${scope.name}'`;
2071
+ }
2072
+ return scope.kind === "personal" ? "the Personal Workspace feed" : "the selected feed";
2073
+ }
2074
+ function packageDeleteFailureInstructions(scope, packageName) {
2075
+ const base = "Check that the package name and version are correct and that you have permission to delete it.";
2076
+ if (scope.kind === "personal") {
2077
+ return `List workspace packages with: uip solution packages list --personal-workspace --name ${packageName}.`;
2078
+ }
2079
+ if (scope.kind === "folder") {
2080
+ return `List packages in that feed with: uip solution packages list --feed <name-or-key> --name ${packageName}.`;
2081
+ }
2082
+ if (isPreviewBuild()) {
2083
+ return `${base} If the package was published to a Personal Workspace or folder feed, add --personal-workspace or --feed.`;
2084
+ }
2085
+ return `${base} If the package was published to a Personal Workspace, add --personal-workspace.`;
2086
+ }
2087
+ async function resolvePackageVersionKey(auth, scope, packageName, packageVersion) {
2088
+ const config = new Configuration2({
2089
+ basePath: auth.basePath,
2090
+ accessToken: auth.accessToken
2091
+ });
2092
+ const searchApi = new SearchApi(config);
2093
+ const pkg = await findPackage(searchApi, scope, packageName);
2094
+ if (pkg.latestVersion === packageVersion) {
2095
+ return pkg.packageVersionKey;
2096
+ }
2097
+ for (let skip = 0;; ) {
2098
+ const page = await searchPackageVersions({ basePath: auth.basePath, accessToken: auth.accessToken }, pkg.key, {
2099
+ searchTerm: packageVersion,
2100
+ take: SEARCH_PAGE_SIZE,
2101
+ skip,
2102
+ excludeInvalidPackages: true
2103
+ }, scope.folderKey);
2104
+ const match = page.values.find((version) => version.version === packageVersion);
2105
+ if (match) {
2106
+ return match.key;
2107
+ }
2108
+ if (page.values.length < SEARCH_PAGE_SIZE) {
2109
+ throw new Error(`Package version '${packageName}@${packageVersion}' was not found in ${scopeName(scope)}.`);
2110
+ }
2111
+ skip += page.values.length;
2112
+ }
2113
+ }
2114
+ async function findPackage(searchApi, scope, packageName) {
2115
+ for (let skip = 0;; ) {
2116
+ const packages = await searchApi.searchSearchPackages({
2117
+ searchFilter: {
2118
+ searchTerm: packageName,
2119
+ take: SEARCH_PAGE_SIZE,
2120
+ skip
2121
+ }
2122
+ }, feedScopeInitOverride(scope));
2123
+ const values = packages.values ?? [];
2124
+ const match = values.find((pkg) => pkg.name === packageName);
2125
+ if (match) {
2126
+ return match;
2127
+ }
2128
+ if (values.length < SEARCH_PAGE_SIZE) {
2129
+ throw new Error(`Package '${packageName}' was not found in ${scopeName(scope)}.`);
2130
+ }
2131
+ skip += values.length;
2132
+ }
2133
+ }
2134
+ async function deleteTenantPackageVersion(auth, packageName, packageVersion) {
2135
+ const api = new PipelinesApi(new Configuration({
2136
+ basePath: auth.basePath,
2137
+ accessToken: auth.accessToken
2138
+ }));
2139
+ await api.pipelinesPackageDelete({
2140
+ packageName,
2141
+ packageVersion
2142
+ });
2143
+ }
2144
+ async function deleteScopedPackageVersion(auth, scope, packageName, packageVersion) {
2145
+ const packageVersionKey = await resolvePackageVersionKey(auth, scope, packageName, packageVersion);
2146
+ const packagesApi = new PackagesApi(new Configuration2({
2147
+ basePath: auth.basePath,
2148
+ accessToken: auth.accessToken
2149
+ }));
2150
+ await packagesApi.packagesDeleteVersion({ packageVersionKey }, feedScopeInitOverride(scope));
2151
+ }
2060
2152
  var registerPackagesDeleteCommand = (program) => {
2061
- program.command("delete").description("Delete a specific version of a solution package. " + "Use 'solution packages list' to find available package names and versions.").argument("<package-name>", "The name of the package").argument("<package-version>", "The version to delete (e.g. 1.0.0)").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--login-validity <minutes>", "Minimum minutes before token expiration to trigger a refresh (default: 10)", parseInt, 10).option("-y, --yes", "Confirm this irreversible operation (required; the CLI never prompts)").examples(SOLUTION_PACKAGES_DELETE_EXAMPLES).trackedAction(processContext, async (packageName, packageVersion, options) => {
2153
+ const command = program.command("delete").description("Delete a specific version of a solution package. " + "Use 'solution packages list' to find available package names and versions.").argument("<package-name>", "The name of the package").argument("<package-version>", "The version to delete (e.g. 1.0.0)").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--login-validity <minutes>", "Minimum minutes before token expiration to trigger a refresh (default: 10)", parseInt, 10).option("-y, --yes", "Confirm this irreversible operation (required; the CLI never prompts)").option("--personal-workspace", "Delete the package version from the current user's Personal Workspace feed.");
2154
+ if (isPreviewBuild()) {
2155
+ command.addOption(new Option("--feed <name-or-key>", "Delete the package version from this feed (name or folder key, from 'solution feeds list'). Mutually exclusive with --personal-workspace.").conflicts("personalWorkspace"));
2156
+ }
2157
+ command.examples(SOLUTION_PACKAGES_DELETE_EXAMPLES).trackedAction(processContext, async (packageName, packageVersion, options) => {
2062
2158
  if (!requireConfirmation(options, `delete package '${packageName}@${packageVersion}'`)) {
2063
2159
  return;
2064
2160
  }
@@ -2075,20 +2171,28 @@ var registerPackagesDeleteCommand = (program) => {
2075
2171
  processContext.exit(1);
2076
2172
  return;
2077
2173
  }
2078
- const api = new PipelinesApi(new Configuration({
2079
- basePath: auth.basePath,
2080
- accessToken: auth.accessToken
2081
- }));
2082
- const [deleteError] = await catchError(api.pipelinesPackageDelete({
2083
- packageName,
2084
- packageVersion
2174
+ const [scopeError, scope] = await catchError(resolveFeedScope({
2175
+ personalWorkspace: options.personalWorkspace,
2176
+ feed: options.feed,
2177
+ tenant: options.tenant,
2178
+ loginValidity: options.loginValidity
2085
2179
  }));
2180
+ if (scopeError) {
2181
+ OutputFormatter.error({
2182
+ Result: RESULTS.Failure,
2183
+ Message: scopeError.message,
2184
+ Instructions: feedResolutionFailureInstructions(options)
2185
+ });
2186
+ processContext.exit(1);
2187
+ return;
2188
+ }
2189
+ const [deleteError] = await catchError(scope.kind === "tenant" ? deleteTenantPackageVersion(auth, packageName, packageVersion) : deleteScopedPackageVersion(auth, scope, packageName, packageVersion));
2086
2190
  if (deleteError) {
2087
2191
  const { message } = await extractErrorDetails(deleteError);
2088
2192
  OutputFormatter.error({
2089
2193
  Result: RESULTS.Failure,
2090
2194
  Message: message,
2091
- Instructions: "Check that the package name and version are correct and that you have permission to delete it."
2195
+ Instructions: packageDeleteFailureInstructions(scope, packageName)
2092
2196
  });
2093
2197
  processContext.exit(1);
2094
2198
  return;
@@ -2310,9 +2414,9 @@ var SOLUTION_PACKAGES_LIST_EXAMPLES = [
2310
2414
  }
2311
2415
  ];
2312
2416
  var registerPackagesListCommand = (program) => {
2313
- const command = program.command("list").description("List solution packages published to UiPath. Returns package name, version, and publish date. Use the package name and version from this output when running 'solution deploy run'.").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("-l, --limit <number>", "Number of packages to return", parseLimit, DEFAULT_PAGE_SIZE).option("--offset <number>", "Number of packages to skip", parseOffset, 0).option("--sort-by <column>", "Column to sort by (default: publishDate)", "publishDate").option("--sort-order <direction>", "Sort direction: Ascending or Descending (default: Descending)", "Descending").option("--name <pattern>", "Filter packages by name (server-side substring match)").option("--login-validity <minutes>", "Minimum minutes before token expiration to trigger a refresh (default: 10)", parseInt, 10);
2417
+ const command = program.command("list").description("List solution packages published to UiPath. Returns package name, version, and publish date. Use the package name and version from this output when running 'solution deploy run'.").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("-l, --limit <number>", "Number of packages to return", parseLimit, DEFAULT_PAGE_SIZE).option("--offset <number>", "Number of packages to skip", parseOffset, 0).option("--sort-by <column>", "Column to sort by (default: publishDate)", "publishDate").option("--sort-order <direction>", "Sort direction: Ascending or Descending (default: Descending)", "Descending").option("--name <pattern>", "Filter packages by name (server-side substring match)").option("--login-validity <minutes>", "Minimum minutes before token expiration to trigger a refresh (default: 10)", parseInt, 10).option("--personal-workspace", "Only list packages in the current user's Personal Workspace feed.");
2314
2418
  if (isPreviewBuild()) {
2315
- command.addOption(new Option("--feed <name-or-key>", "Only list packages in this feed (name or folder key, from 'solution feeds list'). Mutually exclusive with --personal-workspace.").conflicts("personalWorkspace")).option("--personal-workspace", "Only list packages in the current user's Personal Workspace feed.");
2419
+ command.addOption(new Option("--feed <name-or-key>", "Only list packages in this feed (name or folder key, from 'solution feeds list'). Mutually exclusive with --personal-workspace.").conflicts("personalWorkspace"));
2316
2420
  }
2317
2421
  command.examples(SOLUTION_PACKAGES_LIST_EXAMPLES).trackedAction(processContext, async (options) => {
2318
2422
  const result = await listPackagesAsync({
@@ -2376,6 +2480,21 @@ async function resolveAppV2SubType(projectDir) {
2376
2480
  return manifest?.config?.isActionApp === true ? "CodedAction" : "Coded";
2377
2481
  }
2378
2482
 
2483
+ // src/commands/project-command-utils.ts
2484
+ function rejectUnsupportedProjectType(projectType, failureMessage) {
2485
+ const reason = unsupportedSolutionProjectType(projectType);
2486
+ if (!reason) {
2487
+ return false;
2488
+ }
2489
+ OutputFormatter.error({
2490
+ Result: RESULTS.Failure,
2491
+ Message: failureMessage,
2492
+ Instructions: reason
2493
+ });
2494
+ processContext.exit(1);
2495
+ return true;
2496
+ }
2497
+
2379
2498
  // src/commands/project-add.ts
2380
2499
  var PROJECT_ADD_EXAMPLES = [
2381
2500
  {
@@ -2464,6 +2583,9 @@ var registerProjectAddCommand = (project) => {
2464
2583
  processContext.exit(1);
2465
2584
  return;
2466
2585
  }
2586
+ if (rejectUnsupportedProjectType(parsedProject.projectType, "Failed to add project to solution")) {
2587
+ return;
2588
+ }
2467
2589
  const [readSolutionError, parsedSolution] = await readSolutionFile(resolvedSolutionFile);
2468
2590
  if (readSolutionError) {
2469
2591
  OutputFormatter.error({
@@ -2607,6 +2729,9 @@ var registerProjectImportCommand = (project) => {
2607
2729
  processContext.exit(1);
2608
2730
  return;
2609
2731
  }
2732
+ if (rejectUnsupportedProjectType(parsedProject.projectType, "Failed to import project into solution")) {
2733
+ return;
2734
+ }
2610
2735
  const [solutionFileError, resolvedSolutionFile] = await resolveSolutionFilePath(solutionFile, cwd);
2611
2736
  if (solutionFileError) {
2612
2737
  OutputFormatter.error({
@@ -3017,7 +3142,8 @@ var registerProjectRemoveCommand = (project) => {
3017
3142
  return;
3018
3143
  }
3019
3144
  const projects = solution.Projects ?? [];
3020
- if (projects.length <= 1) {
3145
+ const removingUnsupportedType = unsupportedSolutionProjectType(projects[projectIndex].Type) !== null;
3146
+ if (projects.length <= 1 && !removingUnsupportedType) {
3021
3147
  OutputFormatter.error({
3022
3148
  Result: RESULTS.Failure,
3023
3149
  Message: "Failed to remove project from solution",
@@ -3245,7 +3371,7 @@ function formatSyncErrors(errors) {
3245
3371
  }
3246
3372
 
3247
3373
  // src/commands/project.ts
3248
- var PROJECTS_DESCRIPTION = "Manage projects within a UiPath solution (.uipx). Add, import, or remove automation projects (workflows, test cases, libraries) from the solution manifest.";
3374
+ var PROJECTS_DESCRIPTION = "Manage projects within a UiPath solution (.uipx). Add, import, list, or remove the automation projects registered in the solution manifest — RPA processes, tests, agents, Maestro flows, case and BPMN projects, coded apps, functions, API workflows, and other buildable project types. A library is not a project: publish it on its own, then attach it with 'uip solution resources add --source remote --kind Library --name <library-name>'.";
3249
3375
  var PROJECT_ALIAS_DESCRIPTION = "Deprecated alias of 'uip solution projects'. Use 'uip solution projects' instead.";
3250
3376
  var wireProjectSubcommands = (group) => {
3251
3377
  registerProjectAddCommand(group);
@@ -4802,6 +4928,525 @@ var registerRestoreCommand = (program) => {
4802
4928
  }, processContext);
4803
4929
  });
4804
4930
  };
4931
+ // ../executor/project-executor/src/models/run-status.ts
4932
+ var TERMINAL_RUN_STATUSES = [
4933
+ "Succeeded" /* Succeeded */,
4934
+ "Faulted" /* Faulted */,
4935
+ "Cancelled" /* Cancelled */
4936
+ ];
4937
+ function isTerminalRunStatus(status) {
4938
+ return TERMINAL_RUN_STATUSES.includes(status);
4939
+ }
4940
+
4941
+ // ../executor/project-executor/src/models/run-result.ts
4942
+ class RunResult {
4943
+ status;
4944
+ errorCode;
4945
+ rawStatus;
4946
+ message;
4947
+ jobKey;
4948
+ instanceId;
4949
+ runId;
4950
+ traceId;
4951
+ steps;
4952
+ output;
4953
+ url;
4954
+ details;
4955
+ constructor(status, errorCode = "None" /* None */, message) {
4956
+ this.status = status;
4957
+ this.errorCode = errorCode;
4958
+ this.message = message;
4959
+ }
4960
+ get isSuccess() {
4961
+ return this.status === "Succeeded" /* Succeeded */ && this.errorCode === "None" /* None */;
4962
+ }
4963
+ get isTerminal() {
4964
+ return isTerminalRunStatus(this.status);
4965
+ }
4966
+ static succeeded(init = {}) {
4967
+ return Object.assign(new RunResult("Succeeded" /* Succeeded */, "None" /* None */), init);
4968
+ }
4969
+ static failed(errorCode, message, init = {}) {
4970
+ return Object.assign(new RunResult("Faulted" /* Faulted */, errorCode, message), init);
4971
+ }
4972
+ }
4973
+ // ../executor/project-executor/src/services/executor-tool-import.ts
4974
+ async function importExecutorToolModule(specifier) {
4975
+ try {
4976
+ return { module: await import(specifier) };
4977
+ } catch (error) {
4978
+ return {
4979
+ error: error instanceof Error ? error : new Error(String(error))
4980
+ };
4981
+ }
4982
+ }
4983
+
4984
+ // ../executor/project-executor/src/services/executor-tool-module.ts
4985
+ var EXECUTOR_FACTORY_EXPORT = "createExecutorFactory";
4986
+ function isExecutorFactoryModule(module) {
4987
+ return typeof module === "object" && module !== null && typeof module[EXECUTOR_FACTORY_EXPORT] === "function";
4988
+ }
4989
+
4990
+ // ../executor/project-executor/src/services/executors-factory-repository.ts
4991
+ class ExecutorsFactoryRepository {
4992
+ factoryMap = new Map;
4993
+ onConflict;
4994
+ constructor(onConflict) {
4995
+ this.onConflict = onConflict ?? ((message) => console.warn(message));
4996
+ }
4997
+ registerProjectExecutorFactory(factory) {
4998
+ for (const projectType of factory.supportedTypes) {
4999
+ const existing = this.factoryMap.get(projectType);
5000
+ if (existing) {
5001
+ if (existing.constructor?.name !== factory.constructor?.name) {
5002
+ this.onConflict(`Executor factory conflict for project type '${projectType}': ` + `'${existing.constructor?.name}' already registered, ` + `ignoring '${factory.constructor?.name}'.`);
5003
+ }
5004
+ continue;
5005
+ }
5006
+ this.factoryMap.set(projectType, factory);
5007
+ }
5008
+ }
5009
+ canHandleProject(projectType) {
5010
+ return this.factoryMap.has(projectType);
5011
+ }
5012
+ getProjectExecutorFactory(projectType) {
5013
+ const factory = this.factoryMap.get(projectType);
5014
+ if (!factory) {
5015
+ throw new Error(`No executor is registered for project type '${projectType}'. ` + `Registered types: ${this.registeredTypes.join(", ") || "none"}.`);
5016
+ }
5017
+ return factory;
5018
+ }
5019
+ get registeredTypes() {
5020
+ return [...this.factoryMap.keys()];
5021
+ }
5022
+ reset() {
5023
+ this.factoryMap.clear();
5024
+ }
5025
+ }
5026
+ var REGISTRY_KEY = Symbol.for("@uipath/project-executor/executorsFactoryRepository");
5027
+ var _global = globalThis;
5028
+ if (!_global[REGISTRY_KEY]) {
5029
+ _global[REGISTRY_KEY] = new ExecutorsFactoryRepository;
5030
+ }
5031
+ var executorsFactoryRepository = _global[REGISTRY_KEY];
5032
+
5033
+ // ../executor/project-executor/src/services/executor-factory-provider.ts
5034
+ var PROVIDER_KEY = Symbol.for("@uipath/project-executor/executorFactoryProvider");
5035
+ var _global2 = globalThis;
5036
+ function registerExecutorFactoryFromModule(module, source) {
5037
+ if (!isExecutorFactoryModule(module)) {
5038
+ throw new Error(`${source} does not export ${EXECUTOR_FACTORY_EXPORT}().`);
5039
+ }
5040
+ const factory = module.createExecutorFactory();
5041
+ executorsFactoryRepository.registerProjectExecutorFactory(factory);
5042
+ return factory;
5043
+ }
5044
+ async function ensureExecutorFactory(verb, packageName) {
5045
+ const provider = _global2[PROVIDER_KEY];
5046
+ if (provider) {
5047
+ await provider(verb);
5048
+ return;
5049
+ }
5050
+ if (!packageName) {
5051
+ throw new Error(`Running this project type needs the executor factory for '${verb}', and no package provides it.`);
5052
+ }
5053
+ const specifier = `${packageName}/executor-tool`;
5054
+ const { module, error } = await importExecutorToolModule(specifier);
5055
+ if (error) {
5056
+ throw new Error(`Running this project type needs '${packageName}'. Install it.`, { cause: error });
5057
+ }
5058
+ registerExecutorFactoryFromModule(module, specifier);
5059
+ }
5060
+ // ../executor/project-executor/src/services/executor-logger.ts
5061
+ var noopExecutorLogger = {
5062
+ info: () => {},
5063
+ warn: () => {},
5064
+ error: () => {}
5065
+ };
5066
+ // ../executor/project-executor/src/services/project-runner.ts
5067
+ class ProjectRunner {
5068
+ fileSystem;
5069
+ logger;
5070
+ registry;
5071
+ constructor(deps) {
5072
+ this.fileSystem = deps.fileSystem;
5073
+ this.logger = deps.logger ?? noopExecutorLogger;
5074
+ this.registry = deps.registry ?? executorsFactoryRepository;
5075
+ }
5076
+ canRun(projectType) {
5077
+ return this.registry.canHandleProject(projectType);
5078
+ }
5079
+ get runnableTypes() {
5080
+ return this.registry.registeredTypes;
5081
+ }
5082
+ async runAsync(options, cancellationToken) {
5083
+ const { projectType, name } = options.project;
5084
+ if (!this.canRun(projectType)) {
5085
+ const known = this.runnableTypes.join(", ") || "none";
5086
+ return RunResult.failed("UnsupportedProjectType" /* UnsupportedProjectType */, `No executor is registered for project type '${projectType}' ` + `(project '${name}'). Runnable types: ${known}.`);
5087
+ }
5088
+ let executor;
5089
+ try {
5090
+ const factory = this.registry.getProjectExecutorFactory(projectType);
5091
+ executor = await factory.createAsync(this.logger, this.fileSystem);
5092
+ this.logger.info(`Running ${name} (${projectType}) on ${options.target}.`);
5093
+ return await executor.runAsync(options, cancellationToken);
5094
+ } catch (error) {
5095
+ return RunResult.failed("Unknown" /* Unknown */, messageOf(error));
5096
+ } finally {
5097
+ try {
5098
+ await executor?.dispose();
5099
+ } catch (error) {
5100
+ this.logger.warn(`Failed to dispose the ${projectType} executor: ${messageOf(error)}`);
5101
+ }
5102
+ }
5103
+ }
5104
+ }
5105
+ function messageOf(error) {
5106
+ return error instanceof Error ? error.message : String(error);
5107
+ }
5108
+ // src/services/executor-tool-resolver.ts
5109
+ var PROJECT_TYPE_TO_TOOL = new Map([
5110
+ ["Process", "rpa"],
5111
+ ["Tests", "rpa"],
5112
+ ["WebApp", "rpa"],
5113
+ ["Agent", "agent"]
5114
+ ]);
5115
+ var TOOL_TO_PACKAGE = new Map([
5116
+ ["rpa", "@uipath/rpa-tool"],
5117
+ ["agent", "@uipath/agent-tool"]
5118
+ ]);
5119
+ function hasExecutorToolFor(projectType) {
5120
+ return PROJECT_TYPE_TO_TOOL.has(projectType);
5121
+ }
5122
+ async function ensureExecutorTools(projectTypes) {
5123
+ const neededTools = new Set;
5124
+ for (const type of projectTypes) {
5125
+ if (executorsFactoryRepository.canHandleProject(type))
5126
+ continue;
5127
+ const toolVerb = PROJECT_TYPE_TO_TOOL.get(type);
5128
+ if (toolVerb) {
5129
+ neededTools.add(toolVerb);
5130
+ } else {
5131
+ logger.warn(`No CLI tool provides an executor for project type '${type}'. Run may fail.`);
5132
+ }
5133
+ }
5134
+ for (const toolVerb of neededTools) {
5135
+ logger.info(`Loading executor factory for '${toolVerb}' to run project types...`);
5136
+ await ensureExecutorFactory(toolVerb, TOOL_TO_PACKAGE.get(toolVerb));
5137
+ }
5138
+ }
5139
+ function projectDirOf(fs, declaredPath) {
5140
+ const dir = fs.path.dirname(declaredPath);
5141
+ return dir && dir !== "." ? dir : "";
5142
+ }
5143
+ async function readSolutionProjects(solutionDir, fs) {
5144
+ const entries = await fs.readdir(solutionDir);
5145
+ const uipxFile = entries.find((f) => f.endsWith(".uipx"));
5146
+ if (!uipxFile) {
5147
+ throw new Error(`No .uipx solution file found in '${solutionDir}'. ` + `Pass a solution directory or run 'uip solution init' first.`);
5148
+ }
5149
+ const content = await fs.readFile(fs.path.join(solutionDir, uipxFile));
5150
+ if (!content) {
5151
+ throw new Error(`Solution file '${uipxFile}' is empty.`);
5152
+ }
5153
+ const json = typeof content === "string" ? content : new TextDecoder().decode(content);
5154
+ const [parseError, solution] = catchError(() => JSON.parse(json));
5155
+ if (parseError) {
5156
+ throw new Error(`Failed to parse ${uipxFile}: ${parseError.message}`);
5157
+ }
5158
+ return (solution.Projects ?? []).map((p) => {
5159
+ const relativePath = projectDirOf(fs, p.ProjectRelativePath ?? "");
5160
+ return {
5161
+ name: p.Name || fs.path.basename(relativePath || solutionDir) || "",
5162
+ projectType: p.Type ?? "",
5163
+ relativePath
5164
+ };
5165
+ });
5166
+ }
5167
+
5168
+ // src/services/provision-debug-service.ts
5169
+ function nextDebugVersion() {
5170
+ return `1.0.${Math.floor(Date.now() / 1000)}`;
5171
+ }
5172
+ async function defaultGetSolutionBuilder(solutionDir) {
5173
+ const services = await createResourceBuilderServices();
5174
+ return services.getSolutionBuilder(solutionDir, true);
5175
+ }
5176
+ async function provisionSolutionForDebugAsync(options, deps = {}) {
5177
+ const listLocations = deps.listLocations ?? listSelectablePublishLocations;
5178
+ const pack = deps.pack ?? packSolutionAsync;
5179
+ const publish = deps.publish ?? publishSolutionAsync;
5180
+ const getBuilder = deps.getSolutionBuilder ?? defaultGetSolutionBuilder;
5181
+ const newSessionId = deps.newSessionId ?? (() => crypto.randomUUID());
5182
+ const authOptions = {
5183
+ tenant: options.tenant,
5184
+ loginValidity: options.loginValidity
5185
+ };
5186
+ logger.info("Resolving the personal workspace to deploy into...");
5187
+ const [locationsError, locations] = await catchError(listLocations(authOptions));
5188
+ if (locationsError) {
5189
+ return fail2(`Could not resolve a personal workspace to deploy into: ${locationsError.message}`);
5190
+ }
5191
+ const personal = locations.find((l) => l.isMyPersonalWorkspace);
5192
+ if (!personal) {
5193
+ return fail2("This account has no personal workspace, so there is nowhere to deploy the solution for a debug run. " + "Ask an administrator to enable a personal workspace, or run with --no-provision-resources — " + "the run then starts without a deployment, and cross-project calls will not resolve.");
5194
+ }
5195
+ const version = options.version ?? nextDebugVersion();
5196
+ const fs = getFileSystem();
5197
+ const outputPath = fs.path.join(fs.env.tmpdir(), "uip-solution-run", newSessionId());
5198
+ logger.info("Packing the solution...");
5199
+ const [packError, packed] = await catchError(pack(options.solutionDir, {
5200
+ output: outputPath,
5201
+ name: options.solutionName,
5202
+ version,
5203
+ loginValidity: options.loginValidity
5204
+ }));
5205
+ if (packError) {
5206
+ return fail2(`Packing the solution failed: ${packError.message}`);
5207
+ }
5208
+ if (!packed.ok) {
5209
+ return fail2(`Packing the solution failed: ${packed.message}`);
5210
+ }
5211
+ const packagePath = packed.packages?.[0];
5212
+ if (!packagePath) {
5213
+ return fail2("Packing the solution produced no package.");
5214
+ }
5215
+ logger.info("Uploading the solution to the personal workspace...");
5216
+ const [publishError, published] = await catchError(publish(packagePath, {
5217
+ ...authOptions,
5218
+ personalWorkspace: true,
5219
+ packageVersion: version
5220
+ }));
5221
+ if (publishError) {
5222
+ return fail2(`Uploading the solution failed: ${publishError.message}`);
5223
+ }
5224
+ if (!published.ok) {
5225
+ return fail2(`Uploading the solution failed: ${published.message}`);
5226
+ }
5227
+ if (!published.packageVersionKey) {
5228
+ return fail2("The solution was uploaded but the feed did not report a package version, so it cannot be provisioned. Retry the run.");
5229
+ }
5230
+ logger.info("Provisioning the solution's resources for the run...");
5231
+ const [builderError, builder] = await catchError(getBuilder(options.solutionDir));
5232
+ if (builderError) {
5233
+ return fail2(`Could not read the solution: ${builderError.message}`);
5234
+ }
5235
+ const [debugError, debug] = await catchError(builder.debugProjectAsync(personal.key, options.solutionName, newSessionId(), published.packageVersionKey, true));
5236
+ await builder.disposeAsync().catch(() => {});
5237
+ if (debugError) {
5238
+ return fail2(`Provisioning the solution failed: ${debugError.message}`);
5239
+ }
5240
+ if (debug.complete === false) {
5241
+ return fail2("The solution is still being provisioned in the cloud, and this command cannot yet wait for it to finish. " + "Give it a moment and run again — the second run reuses the completed provisioning.");
5242
+ }
5243
+ const folderPath = debug.folderFullyQualifiedName;
5244
+ logger.info(folderPath ? `Solution provisioned into ${folderPath}.` : "Solution provisioned.");
5245
+ return {
5246
+ ok: true,
5247
+ folderPath,
5248
+ packageVersionKey: published.packageVersionKey
5249
+ };
5250
+ }
5251
+ function fail2(message) {
5252
+ return { ok: false, message };
5253
+ }
5254
+
5255
+ // src/services/run-service.ts
5256
+ async function runSolutionAsync(options, deps, cancellationToken) {
5257
+ const { fileSystem } = deps;
5258
+ const solutionDir = fileSystem.path.resolve(options.solutionPath);
5259
+ const [readError, projects] = await catchError(readSolutionProjects(solutionDir, fileSystem));
5260
+ if (readError) {
5261
+ return RunResult.failed("InvalidInput" /* InvalidInput */, readError.message);
5262
+ }
5263
+ const runnable = projects.filter((p) => hasExecutorToolFor(p.projectType));
5264
+ if (runnable.length === 0) {
5265
+ const seen = projects.map((p) => `${p.name} (${p.projectType})`).join(", ") || "none";
5266
+ return RunResult.failed("UnsupportedProjectType" /* UnsupportedProjectType */, `No project in this solution can be run. Projects: ${seen}.`);
5267
+ }
5268
+ const [selectionError, selected] = selectProject(runnable, options.projectName);
5269
+ if (selectionError) {
5270
+ return RunResult.failed("InvalidInput" /* InvalidInput */, selectionError);
5271
+ }
5272
+ const provision = deps.provisionForDebug ?? provisionSolutionForDebugAsync;
5273
+ const shouldProvision = options.provisionResources ?? projects.length > 1;
5274
+ const [executorOutcome, provisionOutcome] = await Promise.allSettled([
5275
+ ensureExecutorTools([selected.projectType]),
5276
+ shouldProvision ? provision({
5277
+ solutionDir,
5278
+ solutionName: fileSystem.path.basename(solutionDir),
5279
+ tenant: options.tenant,
5280
+ loginValidity: options.loginValidity
5281
+ }) : Promise.resolve(undefined)
5282
+ ]);
5283
+ if (executorOutcome.status === "rejected") {
5284
+ return RunResult.failed("PrepareFailed" /* PrepareFailed */, `Could not load the executor for project type '${selected.projectType}': ${describeError(executorOutcome.reason)}`);
5285
+ }
5286
+ if (provisionOutcome.status === "rejected") {
5287
+ return RunResult.failed("PrepareFailed" /* PrepareFailed */, `Could not deploy the solution before the run: ${describeError(provisionOutcome.reason)}`);
5288
+ }
5289
+ let folderPath = options.folderPath;
5290
+ const provisioned = provisionOutcome.value;
5291
+ if (provisioned) {
5292
+ if (!provisioned.ok) {
5293
+ return RunResult.failed("PrepareFailed" /* PrepareFailed */, provisioned.message ?? "Could not deploy the solution before the run.");
5294
+ }
5295
+ folderPath = provisioned.folderPath;
5296
+ }
5297
+ const projectPath = fileSystem.path.resolve(solutionDir, selected.relativePath);
5298
+ logger.debug(`Running '${selected.name}' (${selected.projectType}) from ${projectPath}` + `${options.entryPoint ? ` with entry point ${options.entryPoint}` : " with its default entry point"}`);
5299
+ const connection = await resolveConnection(folderPath, options, deps);
5300
+ const runner = new ProjectRunner({
5301
+ fileSystem,
5302
+ logger: deps.logger
5303
+ });
5304
+ return runner.runAsync({
5305
+ project: {
5306
+ name: selected.name,
5307
+ projectType: selected.projectType,
5308
+ projectPath
5309
+ },
5310
+ entryPoint: options.entryPoint,
5311
+ inputArguments: options.inputArguments,
5312
+ target: "Local" /* Local */,
5313
+ connection,
5314
+ siblingProjects: projects.filter((p) => p !== selected).map((p) => ({
5315
+ name: p.name,
5316
+ projectType: p.projectType,
5317
+ projectPath: fileSystem.path.resolve(solutionDir, p.relativePath)
5318
+ })),
5319
+ timeoutMs: options.timeoutMs
5320
+ }, cancellationToken);
5321
+ }
5322
+ async function resolveConnection(folderPath, options, deps) {
5323
+ const getLoginStatus = deps.getLoginStatus ?? getLoginStatusAsync;
5324
+ const [loginError, status] = await catchError(getLoginStatus({
5325
+ ensureTokenValidityMinutes: options.loginValidity
5326
+ }));
5327
+ if (loginError || status.loginStatus !== "Logged in") {
5328
+ logger.debug(`No signed-in session for the run: ${loginError?.message ?? status.loginStatus}. ` + "A project type that needs one will say so.");
5329
+ return {
5330
+ folderPath,
5331
+ baseUrl: "",
5332
+ accessToken: "",
5333
+ organizationId: "",
5334
+ organizationName: ""
5335
+ };
5336
+ }
5337
+ return {
5338
+ folderPath,
5339
+ baseUrl: status.baseUrl ?? "",
5340
+ accessToken: status.accessToken ?? "",
5341
+ organizationId: status.organizationId ?? "",
5342
+ organizationName: status.organizationName ?? "",
5343
+ tenantId: status.tenantId,
5344
+ tenantName: status.tenantName
5345
+ };
5346
+ }
5347
+ function describeError(reason) {
5348
+ return reason instanceof Error ? reason.message : String(reason);
5349
+ }
5350
+ function selectProject(runnable, requested) {
5351
+ if (requested) {
5352
+ const match = runnable.find((p) => p.name === requested);
5353
+ if (!match) {
5354
+ const names = runnable.map((p) => p.name).join(", ");
5355
+ return [
5356
+ `Project '${requested}' is not a runnable project in this solution. Runnable projects: ${names}.`,
5357
+ runnable[0]
5358
+ ];
5359
+ }
5360
+ return [undefined, match];
5361
+ }
5362
+ if (runnable.length > 1) {
5363
+ const names = runnable.map((p) => p.name).join(", ");
5364
+ return [
5365
+ `This solution has more than one runnable project, so one has to be named with --project-name. Runnable projects: ${names}.`,
5366
+ runnable[0]
5367
+ ];
5368
+ }
5369
+ return [undefined, runnable[0]];
5370
+ }
5371
+
5372
+ // src/commands/run.ts
5373
+ var ERROR_CODE_BY_RUN_ERROR = {
5374
+ ["InvalidInput" /* InvalidInput */]: "invalid_argument",
5375
+ ["UnsupportedProjectType" /* UnsupportedProjectType */]: "invalid_argument",
5376
+ ["Unauthorized" /* Unauthorized */]: "authentication_required",
5377
+ ["Timeout" /* Timeout */]: "timeout"
5378
+ };
5379
+ var NEVER_STARTED = new Set([
5380
+ "InvalidInput" /* InvalidInput */,
5381
+ "UnsupportedProjectType" /* UnsupportedProjectType */,
5382
+ "Unauthorized" /* Unauthorized */
5383
+ ]);
5384
+ var registerRunCommand = (program) => {
5385
+ program.command("run", { hidden: true }).description("Run a project from a UiPath solution. Currently supports RPA projects and agents.").argument("<solutionPath>", "Path to a solution directory (containing .uipx)").option("--project-name <name>", "Name of the project to run. Required only when the solution has more than one runnable project.").option("--entry-point <path>", "Entry point to execute (for RPA, a workflow such as Main.xaml). Defaults to the project's own entry point.").option("--input-arguments <json>", `Input arguments for the entry point, as a JSON object string (e.g. '{"name": "World"}').`).option("--folder-path <path>", "Orchestrator folder the run reports itself under, when the runtime needs one. Ignored when the solution is deployed, which uses the folder it deploys into.").option("--provision-resources", "Pack and deploy the solution into your personal workspace before running, even when the solution holds a single project. Done automatically for a solution with more than one project.").option("--no-provision-resources", "Run without deploying the solution first. Cross-project calls will not resolve.").option("--login-validity <minutes>", "Minimum minutes before token expiration to trigger a refresh (default: 10).", Number.parseInt, 10).trackedAction(processContext, async (solutionPath, options) => {
5386
+ const [inputError, inputArguments] = parseInputArguments(options.inputArguments);
5387
+ if (inputError) {
5388
+ OutputFormatter.error({
5389
+ Result: RESULTS.Failure,
5390
+ Message: "Failed to run solution",
5391
+ Instructions: inputError,
5392
+ ErrorCode: "invalid_argument"
5393
+ });
5394
+ processContext.exit(1);
5395
+ return;
5396
+ }
5397
+ const result = await runSolutionAsync({
5398
+ solutionPath,
5399
+ projectName: options.projectName,
5400
+ entryPoint: options.entryPoint,
5401
+ inputArguments,
5402
+ folderPath: options.folderPath,
5403
+ provisionResources: options.provisionResources,
5404
+ loginValidity: options.loginValidity
5405
+ }, { fileSystem: getFileSystem(), logger });
5406
+ if (!result.isSuccess) {
5407
+ OutputFormatter.error({
5408
+ Result: RESULTS.Failure,
5409
+ Message: result.message ?? "The run did not succeed.",
5410
+ Instructions: NEVER_STARTED.has(result.errorCode) ? `The run did not start (${result.errorCode}).` : `Run ended with status '${result.status}' (${result.errorCode}).`,
5411
+ ErrorCode: ERROR_CODE_BY_RUN_ERROR[result.errorCode]
5412
+ });
5413
+ processContext.exit(1);
5414
+ return;
5415
+ }
5416
+ OutputFormatter.success({
5417
+ Result: RESULTS.Success,
5418
+ Code: "SolutionRun",
5419
+ Data: {
5420
+ Status: result.status,
5421
+ EntryPoint: result.details?.entryPoint,
5422
+ Output: result.output
5423
+ }
5424
+ }, { preserveDataKeys: true });
5425
+ });
5426
+ };
5427
+ function parseInputArguments(raw) {
5428
+ if (raw === undefined)
5429
+ return [undefined, undefined];
5430
+ const [parseError, parsed] = catchError(() => JSON.parse(raw));
5431
+ if (parseError) {
5432
+ return [
5433
+ `--input-arguments is not valid JSON: ${parseError.message}. Provide a JSON object (e.g. '{"name": "World"}').`,
5434
+ undefined
5435
+ ];
5436
+ }
5437
+ if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
5438
+ return [
5439
+ `--input-arguments must be a JSON object keyed by argument name (e.g. '{"name": "World"}'), not ${describeJson(parsed)}.`,
5440
+ undefined
5441
+ ];
5442
+ }
5443
+ return [undefined, parsed];
5444
+ }
5445
+ function describeJson(value) {
5446
+ if (value === null)
5447
+ return "null";
5448
+ return Array.isArray(value) ? "an array" : `a ${typeof value}`;
5449
+ }
4805
5450
 
4806
5451
  // src/commands/upload.ts
4807
5452
  var SOLUTION_UPLOAD_EXAMPLES = [
@@ -5004,6 +5649,7 @@ var registerCommands = async (program) => {
5004
5649
  registerPackCommand(program);
5005
5650
  registerCleanupCommand(program);
5006
5651
  registerRestoreCommand(program);
5652
+ registerRunCommand(program);
5007
5653
  registerDownloadCommand(program);
5008
5654
  registerNewCommand(program);
5009
5655
  registerProjectCommand(program);
@@ -5017,4 +5663,4 @@ var registerCommands = async (program) => {
5017
5663
 
5018
5664
  export { metadata, registerCommands };
5019
5665
 
5020
- //# debugId=7B39B2BFA5F3331B64756E2164756E21
5666
+ //# debugId=88BBF99B737F82D864756E2164756E21