@uipath/solution-tool 1.202.1 → 1.203.0-preview.180

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 (46) hide show
  1. package/dist/THIRD-PARTY-NOTICES.md +23 -1
  2. package/dist/deploy.js +7 -6
  3. package/dist/{packager-tool-txs8perg.js → embedded-file-reader-xxqe8vs8.js} +98 -16584
  4. package/dist/first-party-service-sd8yaf73.js +27 -0
  5. package/dist/index-dqa169gp.js +25 -0
  6. package/dist/index.js +19 -13
  7. package/dist/init.js +8 -5
  8. package/dist/{list-ngr4950s.js → list-hmzx9798.js} +5 -4
  9. package/dist/models/pack-command-types.d.ts +33 -5
  10. package/dist/pack.js +12 -6
  11. package/dist/{packager-tool-rqvyf18m.js → packager-tool-0f0wt9vh.js} +353 -1519
  12. package/dist/{packager-tool-jmb2c7m1.js → packager-tool-1haahq17.js} +5 -3
  13. package/dist/{packager-tool-7s77bznz.js → packager-tool-2syrt51a.js} +7 -4
  14. package/dist/{packager-tool-dmr7g2d3.js → packager-tool-2t7gyz7x.js} +45 -21
  15. package/dist/packager-tool-3jrq7smt.js +1459 -0
  16. package/dist/{packager-tool-arkenm6k.js → packager-tool-40yp3re0.js} +9 -6
  17. package/dist/packager-tool-53w8skv5.js +262 -0
  18. package/dist/{packager-tool-svcjmtbs.js → packager-tool-6byq9bhj.js} +4 -4
  19. package/dist/packager-tool-7znqtw3f.js +244 -0
  20. package/dist/packager-tool-bkwnetqn.js +16678 -0
  21. package/dist/{packager-tool-f46c7htx.js → packager-tool-dqb4x0h9.js} +15382 -2422
  22. package/dist/{packager-tool-d83m85g9.js → packager-tool-f9vfa06w.js} +11 -12
  23. package/dist/packager-tool-gdtpsdn7.js +342 -0
  24. package/dist/{packager-tool-p6mgvgdk.js → packager-tool-jz2wbfjz.js} +15 -2
  25. package/dist/packager-tool-k4mskzww.js +125 -0
  26. package/dist/packager-tool-resolver-fmjr60x8.js +19 -0
  27. package/dist/{packager-tool-324gr08j.js → packager-tool-vas0xg5h.js} +1 -1
  28. package/dist/{packager-tool-7ze6x4r5.js → packager-tool-yf3jx470.js} +360 -96
  29. package/dist/packager-tool-znakt6yw.js +188 -0
  30. package/dist/packager-tool.d.ts +1 -1
  31. package/dist/packager-tool.js +1 -1
  32. package/dist/prepare-solution-resources-wds3r8bq.js +22 -0
  33. package/dist/project-contributions-cvttys34.js +27 -0
  34. package/dist/publish.js +7 -6
  35. package/dist/resource.js +7 -4
  36. package/dist/services/deployment-validation.d.ts +33 -0
  37. package/dist/services/governance-options.d.ts +61 -1
  38. package/dist/services/pack-command-service.d.ts +33 -2
  39. package/dist/services/packager-tool-resolver.d.ts +3 -0
  40. package/dist/services/prepare-solution-resources.d.ts +40 -0
  41. package/dist/services/project-contributions.d.ts +58 -0
  42. package/dist/services/project-type-tools.d.ts +6 -0
  43. package/dist/templates/AGENTS.md +78 -8
  44. package/dist/tool.js +19 -13
  45. package/package.json +3 -2
  46. package/dist/services/validate-appv2-action-schemas.d.ts +0 -10
@@ -0,0 +1,188 @@
1
+ import {
2
+ toolVerbForProjectType
3
+ } from "./packager-tool-k4mskzww.js";
4
+ import {
5
+ computeEntryPointSpec,
6
+ createResourceBuilderServices,
7
+ hasAnyTemplateRow,
8
+ hasBareTemplateRow,
9
+ readUipxProjects
10
+ } from "./packager-tool-bkwnetqn.js";
11
+ import {
12
+ toolsFactoryRepository
13
+ } from "./packager-tool-nzghfa48.js";
14
+ import {
15
+ catchError,
16
+ getFileSystem,
17
+ logger
18
+ } from "./packager-tool-0f0wt9vh.js";
19
+
20
+ // src/services/project-contributions.ts
21
+ var ENTRY_POINT_RESOURCE_KIND = "process";
22
+
23
+ class ProjectContributionsError extends Error {
24
+ contributionErrors;
25
+ instructions;
26
+ errorCode = "invalid_argument";
27
+ contributionCode;
28
+ constructor(errors) {
29
+ super(errors.map((e) => e.message).join(`
30
+ `));
31
+ this.name = "ProjectContributionsError";
32
+ this.contributionErrors = errors;
33
+ const instructions = errors.map((e) => e.instructions).filter((i) => typeof i === "string" && i.length > 0);
34
+ this.instructions = instructions.length > 0 ? [...new Set(instructions)].join(" ") : undefined;
35
+ const codes = errors.map((e) => e.code);
36
+ const everyCoded = codes.every((c) => typeof c === "string" && c.length > 0);
37
+ this.contributionCode = everyCoded && new Set(codes).size === 1 ? codes[0] : undefined;
38
+ }
39
+ }
40
+ async function collectProjectContributions(solutionDir, fs = getFileSystem()) {
41
+ const byProject = new Map;
42
+ const skipped = [];
43
+ const projects = await readUipxProjects(solutionDir);
44
+ for (const project of projects) {
45
+ if (!toolsFactoryRepository.canHandleProject(project.type))
46
+ continue;
47
+ const factory = toolsFactoryRepository.getProjectToolFactory(project.type);
48
+ if (typeof factory.describeResourcesAsync !== "function") {
49
+ const verb = toolVerbForProjectType(project.type);
50
+ const update = verb ? `update the tool that provides it ('uip tools install ${verb}')` : "update the tool that provides it";
51
+ if (!hasBareTemplateRow(project.type) && hasAnyTemplateRow(project.type)) {
52
+ byProject.set(project.id, {
53
+ errors: [
54
+ {
55
+ code: "contribution_unavailable",
56
+ message: `Project '${project.name}' (${project.type}) has no resource contribution: the installed tool for its type predates the contract, and ${project.type} artefact resources are generated only from that contribution.`,
57
+ instructions: `To generate them, ${update}, then re-run the command.`
58
+ }
59
+ ]
60
+ });
61
+ continue;
62
+ }
63
+ const notice = `Project '${project.name}' (${project.type}) was not checked for resource contributions; ${update}.`;
64
+ skipped.push(notice);
65
+ logger.warn(notice);
66
+ continue;
67
+ }
68
+ const [describeError, contribution] = await catchError(factory.describeResourcesAsync(project.path, fs));
69
+ if (describeError) {
70
+ byProject.set(project.id, {
71
+ errors: [
72
+ {
73
+ code: "contribution_failed",
74
+ message: `Project '${project.name}' (${project.type}) failed to describe its resource contribution: ${describeError.message}`,
75
+ instructions: `Fix the reported problem in ${project.path}, then re-run the command.`
76
+ }
77
+ ]
78
+ });
79
+ continue;
80
+ }
81
+ if (contribution)
82
+ byProject.set(project.id, contribution);
83
+ }
84
+ return { byProject, skipped };
85
+ }
86
+ function assertNoContributionErrors(contributions) {
87
+ const errors = [...contributions.byProject.values()].flatMap((c) => c.errors ?? []);
88
+ if (errors.length === 0)
89
+ return;
90
+ throw new ProjectContributionsError(errors);
91
+ }
92
+ function contributionErrorMessages(contributions) {
93
+ return [...contributions.byProject.values()].flatMap((c) => c.errors ?? []).map((e) => e.instructions ? `${e.message} ${e.instructions}` : e.message);
94
+ }
95
+ async function applyProjectContributions(solutionDir, contributions, options, fs = getFileSystem()) {
96
+ const result = {
97
+ updated: 0,
98
+ warnings: [...contributions.skipped]
99
+ };
100
+ const services = await createResourceBuilderServices();
101
+ const builder = await services.getSolutionBuilder(solutionDir);
102
+ try {
103
+ const solution = await builder.context.loadAsync();
104
+ const resources = solution?.resources ?? [];
105
+ const touched = new Set;
106
+ for (const [projectKey, contribution] of contributions.byProject) {
107
+ for (const patch of contribution.specPatch ?? []) {
108
+ const matches = resources.filter((r) => r.projectKey === projectKey && r.kind?.toLowerCase() === patch.kind.toLowerCase());
109
+ if (matches.length === 0) {
110
+ const message = `No '${patch.kind}' resource found for project '${projectKey}' — nothing to apply the contributed spec to.`;
111
+ if (options?.failOnUnmatchedPatch) {
112
+ throw new Error(message);
113
+ }
114
+ result.warnings.push(message);
115
+ continue;
116
+ }
117
+ for (const resource of matches) {
118
+ if (applySpecValues(resource, patch.values)) {
119
+ touched.add(resource);
120
+ }
121
+ }
122
+ }
123
+ }
124
+ for (const resource of resources) {
125
+ if (!resource.projectKey)
126
+ continue;
127
+ if (resource.kind?.toLowerCase() !== ENTRY_POINT_RESOURCE_KIND) {
128
+ continue;
129
+ }
130
+ const [computeError, computed] = await catchError(computeEntryPointSpec(fs, solutionDir, resource.projectKey));
131
+ if (computeError) {
132
+ result.warnings.push(`Failed to read entry points for project '${resource.projectKey}': ${computeError.message}`);
133
+ continue;
134
+ }
135
+ if (!computed)
136
+ continue;
137
+ if (applySpecValues(resource, computed))
138
+ touched.add(resource);
139
+ }
140
+ result.updated = touched.size;
141
+ if (touched.size > 0 && solution) {
142
+ await builder.context.saveAsync(solution);
143
+ }
144
+ return result;
145
+ } finally {
146
+ const dispose = builder.disposeAsync;
147
+ if (typeof dispose === "function") {
148
+ const [disposeError] = await catchError(dispose.call(builder));
149
+ if (disposeError) {
150
+ logger.warn(`Failed to dispose solution builder after applying project contributions: ${disposeError.message}`);
151
+ }
152
+ }
153
+ }
154
+ }
155
+ function applySpecValues(resource, values) {
156
+ const spec = { ...resource.spec ?? {} };
157
+ let changed = false;
158
+ for (const [key, value] of Object.entries(values)) {
159
+ const existingKey = Object.keys(spec).find((k) => k.toLowerCase() === key.toLowerCase()) ?? key;
160
+ if (value === null) {
161
+ if (existingKey in spec) {
162
+ delete spec[existingKey];
163
+ changed = true;
164
+ }
165
+ continue;
166
+ }
167
+ if (isSameSpecValue(spec[existingKey], value))
168
+ continue;
169
+ spec[existingKey] = value;
170
+ changed = true;
171
+ }
172
+ if (changed) {
173
+ resource.spec = spec;
174
+ }
175
+ return changed;
176
+ }
177
+ function isSameSpecValue(a, b) {
178
+ if (a === b)
179
+ return true;
180
+ if (typeof a !== "object" || typeof b !== "object" || !a || !b) {
181
+ return false;
182
+ }
183
+ return JSON.stringify(a) === JSON.stringify(b);
184
+ }
185
+
186
+ export { ProjectContributionsError, collectProjectContributions, assertNoContributionErrors, contributionErrorMessages, applyProjectContributions };
187
+
188
+ //# debugId=F82FA56EE24E69EE64756E2164756E21
@@ -4,7 +4,7 @@
4
4
  * factory for Connector, the one project type no CLI tool owns — there is no
5
5
  * `connector` verb. Every other project type is registered by the tool that
6
6
  * owns it, through that tool's own `packager-tool` entry point, loaded on
7
- * demand by `ensurePackagerTools` (AGENTS.md Hard Rule #18).
7
+ * demand by `ensurePackagerTools` (AGENTS.md Hard Rule #19).
8
8
  *
9
9
  * Explicit, not a module-load side effect: `ensurePackagerTools` calls this at
10
10
  * the start of every pack / restore / cleanup, which is the only code that
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  registerPackagerFactories
3
- } from "./packager-tool-p6mgvgdk.js";
3
+ } from "./packager-tool-jz2wbfjz.js";
4
4
  import"./packager-tool-nzghfa48.js";
5
5
  import"./packager-tool-dfrk01gn.js";
6
6
  import"./packager-tool-1de529jm.js";
@@ -0,0 +1,22 @@
1
+ import {
2
+ prepareSolutionResources,
3
+ projectSubTypesFrom
4
+ } from "./packager-tool-7znqtw3f.js";
5
+ import"./packager-tool-znakt6yw.js";
6
+ import"./packager-tool-k4mskzww.js";
7
+ import"./packager-tool-jz2wbfjz.js";
8
+ import"./packager-tool-bkwnetqn.js";
9
+ import"./packager-tool-gdtpsdn7.js";
10
+ import"./packager-tool-53w8skv5.js";
11
+ import"./packager-tool-nzghfa48.js";
12
+ import"./packager-tool-2syrt51a.js";
13
+ import"./packager-tool-3jrq7smt.js";
14
+ import"./packager-tool-0f0wt9vh.js";
15
+ import"./packager-tool-dfrk01gn.js";
16
+ import"./packager-tool-1de529jm.js";
17
+ export {
18
+ prepareSolutionResources,
19
+ projectSubTypesFrom
20
+ };
21
+
22
+ //# debugId=9F446E87789120A364756E2164756E21
@@ -0,0 +1,27 @@
1
+ import {
2
+ ProjectContributionsError,
3
+ applyProjectContributions,
4
+ assertNoContributionErrors,
5
+ collectProjectContributions,
6
+ contributionErrorMessages
7
+ } from "./packager-tool-znakt6yw.js";
8
+ import"./packager-tool-k4mskzww.js";
9
+ import"./packager-tool-jz2wbfjz.js";
10
+ import"./packager-tool-bkwnetqn.js";
11
+ import"./packager-tool-gdtpsdn7.js";
12
+ import"./packager-tool-53w8skv5.js";
13
+ import"./packager-tool-nzghfa48.js";
14
+ import"./packager-tool-2syrt51a.js";
15
+ import"./packager-tool-3jrq7smt.js";
16
+ import"./packager-tool-0f0wt9vh.js";
17
+ import"./packager-tool-dfrk01gn.js";
18
+ import"./packager-tool-1de529jm.js";
19
+ export {
20
+ ProjectContributionsError,
21
+ applyProjectContributions,
22
+ assertNoContributionErrors,
23
+ collectProjectContributions,
24
+ contributionErrorMessages
25
+ };
26
+
27
+ //# debugId=5BEB743E097B870464756E2164756E21
package/dist/publish.js CHANGED
@@ -1,14 +1,15 @@
1
1
  import {
2
2
  publishSolutionAsync
3
- } from "./packager-tool-svcjmtbs.js";
4
- import"./packager-tool-arkenm6k.js";
5
- import"./packager-tool-d83m85g9.js";
6
- import"./packager-tool-7s77bznz.js";
7
- import"./packager-tool-rqvyf18m.js";
3
+ } from "./packager-tool-6byq9bhj.js";
4
+ import"./packager-tool-40yp3re0.js";
5
+ import"./packager-tool-f9vfa06w.js";
6
+ import"./packager-tool-2syrt51a.js";
7
+ import"./packager-tool-3jrq7smt.js";
8
+ import"./packager-tool-0f0wt9vh.js";
8
9
  import"./packager-tool-dfrk01gn.js";
9
10
  import"./packager-tool-1de529jm.js";
10
11
  export {
11
12
  publishSolutionAsync
12
13
  };
13
14
 
14
- //# debugId=AD7DDE48BF35E04564756E2164756E21
15
+ //# debugId=C6A6B2A4D9E3236B64756E2164756E21
package/dist/resource.js CHANGED
@@ -1,13 +1,16 @@
1
1
  import {
2
2
  resourceRefreshAsync
3
- } from "./packager-tool-txs8perg.js";
3
+ } from "./packager-tool-bkwnetqn.js";
4
+ import"./packager-tool-gdtpsdn7.js";
5
+ import"./packager-tool-53w8skv5.js";
4
6
  import"./packager-tool-nzghfa48.js";
5
- import"./packager-tool-7s77bznz.js";
6
- import"./packager-tool-rqvyf18m.js";
7
+ import"./packager-tool-2syrt51a.js";
8
+ import"./packager-tool-3jrq7smt.js";
9
+ import"./packager-tool-0f0wt9vh.js";
7
10
  import"./packager-tool-dfrk01gn.js";
8
11
  import"./packager-tool-1de529jm.js";
9
12
  export {
10
13
  resourceRefreshAsync
11
14
  };
12
15
 
13
- //# debugId=54ED39ED9D918B1A64756E2164756E21
16
+ //# debugId=EF371AE5DDFD388A64756E2164756E21
@@ -0,0 +1,33 @@
1
+ import type { InitOverrideFunction } from "@uipath/solution-sdk";
2
+ import { DeploymentsApi, type SolutionDeploymentAction } from "@uipath/solution-sdk";
3
+ import type { SolutionAuthContext } from "@uipath/solution-sdk/auth";
4
+ export declare const NO_SERVER_REASON = "the server reported no reason.";
5
+ /**
6
+ * How long one validation lookup may take.
7
+ *
8
+ * This runs after the caller's wait has already ended, so it has no budget
9
+ * left to inherit, and the generated SDK hands the request to `fetch` without
10
+ * a deadline of its own. Unbounded, a stalled lookup outlives `--timeout` and
11
+ * the command sits there instead of returning the failure it already knows
12
+ * about.
13
+ */
14
+ export declare const LOOKUP_TIMEOUT_MS = 15000;
15
+ /**
16
+ * Ask the server why an install/upgrade failed. Deployment records carry a
17
+ * status and no error field, so the validation result is the only place an
18
+ * actionable cause lives (e.g. `SolutionFolderNotFound`).
19
+ *
20
+ * Best-effort: this runs on an already-failing path, so a second failure here
21
+ * must not replace the caller's message with a transport error.
22
+ */
23
+ export declare function describeValidationFailureAsync(deploymentsApi: DeploymentsApi, deploymentKey: string, deploymentAction: SolutionDeploymentAction, scope: InitOverrideFunction | undefined, signal?: AbortSignal): Promise<string>;
24
+ /**
25
+ * The same question for a deployment known only from its search record.
26
+ *
27
+ * A search row carries two keys and the API documents neither, so ask with
28
+ * `key` and fall back to `installDeploymentKey` when that answers nothing.
29
+ */
30
+ export declare function describeDeploymentFailureAsync(auth: SolutionAuthContext, deployment: {
31
+ key: string;
32
+ installDeploymentKey?: string;
33
+ }, deploymentAction: SolutionDeploymentAction, scope: InitOverrideFunction | undefined, signal?: AbortSignal): Promise<string>;
@@ -1,3 +1,5 @@
1
+ import type { IFileSystem } from "@uipath/filesystem";
2
+ import { RulesConfigFileType } from "@uipath/solution-packager/node";
1
3
  import type { PackCommandOptions } from "../models";
2
4
  /**
3
5
  * What to do about a rejected governance option. Pairs with the message
@@ -23,4 +25,62 @@ export declare const GOVERNANCE_OPTION_INSTRUCTIONS: string;
23
25
  * `Message` from `Instructions`. Owning the wording here keeps the two paths
24
26
  * from drifting apart.
25
27
  */
26
- export declare function validateGovernanceOptions(options: Pick<PackCommandOptions, "governanceFilePath" | "automationOpsProfile">): string | null;
28
+ export declare function validateGovernanceOptions(options: Pick<PackCommandOptions, "governanceFilePath" | "governanceProduct" | "automationOpsProfile">): string | null;
29
+ /** What {@link detectGovernanceFileType} concluded about a policy file. */
30
+ export type GovernanceFileDetection = {
31
+ kind: "detected";
32
+ fileType: RulesConfigFileType;
33
+ } | {
34
+ kind: "unparseable";
35
+ } | {
36
+ kind: "unwrapped-automation-ops";
37
+ };
38
+ /**
39
+ * Work out which rules-config source a local policy file belongs to.
40
+ *
41
+ * This exists because the compiler's `--policy-file-type` decides whether the
42
+ * policy is applied at all, and it does not fall back: handed an AutomationOps
43
+ * policy under `Studio`, the analyzer runs, reports nothing, and the pack
44
+ * succeeds — a policy escalating a rule to Error is silently discarded. The
45
+ * CLI has no flag for the type (`--governance-file-path` used to hardcode
46
+ * `Studio`), so a user's only realistic policy source — an AutomationOps
47
+ * export — never took effect.
48
+ *
49
+ * Anything that parses as JSON but carries no AutomationOps rule table is
50
+ * passed through as `Studio`. That is Studio's own rules-configuration format,
51
+ * whose schema lives inside the WorkflowCompiler, so the CLI cannot recognise
52
+ * it positively and must not reject it.
53
+ */
54
+ export declare function detectGovernanceFileType(source: string): GovernanceFileDetection;
55
+ /** Failure message for a policy file that could not be read. */
56
+ export declare function governanceFileUnreadableMessage(path: string): string;
57
+ /** Failure message for an AutomationOps policy stripped of its envelope. */
58
+ export declare function governanceFileUnwrappedMessage(path: string): string;
59
+ /** Failure message for a policy file that is not JSON. */
60
+ export declare function governanceFileUnparseableMessage(path: string): string;
61
+ /**
62
+ * Remedy for both read failures above. Deliberately does not say "drop the
63
+ * flag": the user asked for a policy, and packing without one would be the
64
+ * silent no-op this check exists to remove.
65
+ */
66
+ export declare const GOVERNANCE_FILE_UNUSABLE_INSTRUCTIONS: string;
67
+ /** Outcome of resolving `--governance-file-path` to a rules-config source. */
68
+ export type GovernanceFileTypeResult = {
69
+ ok: true;
70
+ fileType: RulesConfigFileType;
71
+ } | {
72
+ ok: false;
73
+ message: string;
74
+ instructions: string;
75
+ };
76
+ /**
77
+ * Read the policy file named by `--governance-file-path` and decide which
78
+ * rules-config source it belongs to.
79
+ *
80
+ * Reading it here, rather than leaving it to the packager's options validator,
81
+ * is what makes the choice possible at all: the type has to travel with the
82
+ * path, and the only way to tell the two formats apart is to look inside. A
83
+ * file that cannot be read or is not JSON fails the pack instead of falling
84
+ * back to a source that would discard it.
85
+ */
86
+ export declare function resolveGovernanceFileTypeAsync(fs: IFileSystem, governanceFilePath: string): Promise<GovernanceFileTypeResult>;
@@ -1,4 +1,4 @@
1
- import { type CommandContext } from "@uipath/common";
1
+ import { type CliErrorCode, type CommandContext, RESULTS, type RetryHint } from "@uipath/common";
2
2
  import { ToolResult } from "@uipath/solutionpackager-tool-core";
3
3
  import type { PackCommandOptions } from "../models";
4
4
  /**
@@ -23,7 +23,8 @@ export declare class PackCommandService {
23
23
  execute(solutionPath: string, options: PackCommandOptions, context: CommandContext): Promise<void>;
24
24
  /**
25
25
  * The entry guards `executeAsync` runs before it touches a packager:
26
- * a missing output path, bad governance options, and a solution path that
26
+ * a missing output path, bad governance options, a governance policy file
27
+ * whose rules-config source cannot be derived, and a solution path that
27
28
  * is absent or unreadable. Split out so `executeAsync` stays inside the
28
29
  * cognitive-complexity budget; each one still returns the `ToolResult`
29
30
  * that caller expects rather than throwing.
@@ -74,3 +75,33 @@ export declare class PackCommandService {
74
75
  private resolvePackageName;
75
76
  private createPackOptions;
76
77
  }
78
+ /**
79
+ * The failure envelope for a pack the packager refused.
80
+ *
81
+ * Most failures keep the shape they have always had — `Error code: <tool code>
82
+ * : <message>` with the packager's own text as the next step — because the
83
+ * cause is whatever the compiler reported and there is nothing better to say.
84
+ * A member package id we know is unpublishable is different: the cause is a
85
+ * name on disk (a member folder, the `.uipx`), so it gets `invalid_argument`, a
86
+ * message without the tool-code prefix, and instructions naming what to
87
+ * rename. Agents branch on `ErrorCode`, and `unknown_error` there tells them
88
+ * this can never be fixed by the caller, which is the opposite of true.
89
+ *
90
+ * Instructions the packager carried up beat the generic next step, which for a
91
+ * non-dry-run pack is the message itself.
92
+ */
93
+ export declare function packFailureEnvelope(result: {
94
+ errorCode: string;
95
+ message?: string;
96
+ instructions?: string;
97
+ details?: ToolResult["details"];
98
+ }, dryRun: boolean): {
99
+ Result: typeof RESULTS.Failure;
100
+ Message: string;
101
+ Instructions: string;
102
+ ErrorCode?: CliErrorCode;
103
+ Retry?: RetryHint;
104
+ Data?: {
105
+ Projects: unknown[];
106
+ };
107
+ };
@@ -1,3 +1,4 @@
1
+ import { type CliErrorCode } from "@uipath/common";
1
2
  import type { IFileSystem } from "@uipath/filesystem";
2
3
  /**
3
4
  * A `.uipx` names a project type nothing can pack, and no tool provides one.
@@ -12,10 +13,12 @@ import type { IFileSystem } from "@uipath/filesystem";
12
13
  export declare class UnpackableProjectTypeError extends Error {
13
14
  readonly __unpackableType = true;
14
15
  readonly instructions: string;
16
+ readonly errorCode: CliErrorCode;
15
17
  constructor(projectType: string, projectPath: string);
16
18
  }
17
19
  /** True when `error` is an {@link UnpackableProjectTypeError}, duck-typed. */
18
20
  export declare function isUnpackableProjectTypeError(error: unknown): boolean;
21
+ export { toolVerbForProjectType } from "./project-type-tools";
19
22
  /**
20
23
  * Puts every factory this pack needs in `toolsFactoryRepository`: registers
21
24
  * the ones solution-tool owns, then reads project types from the .uipx and
@@ -0,0 +1,40 @@
1
+ import type { IFileSystem } from "@uipath/filesystem";
2
+ import { type ProjectContributions } from "./project-contributions";
3
+ export interface PrepareResult {
4
+ /** Contributed problems (when not gating), skips, and unmatched patches. */
5
+ warnings: string[];
6
+ /** Artefact resources whose spec was rewritten. */
7
+ updated: number;
8
+ }
9
+ /**
10
+ * The projects that told us which template variant their artefact resources
11
+ * come from, keyed by `.uipx` project `Id`. Opaque strings: the value is
12
+ * produced by the tool that owns the project type and consumed by the SDK's
13
+ * reconciler, and nothing in between reads it (AGENTS.md Hard Rule #19).
14
+ */
15
+ export declare function projectSubTypesFrom(contributions: ProjectContributions): ReadonlyMap<string, string>;
16
+ /**
17
+ * Bring a solution directory's resource JSONs in line with its projects'
18
+ * authored files. Every path that reads those resources for real — `pack`,
19
+ * `upload`, `resources refresh` — runs this, so a coded app gets the same
20
+ * treatment whichever one the user reaches for.
21
+ *
22
+ * The order is load-bearing:
23
+ *
24
+ * 1. `ensurePackagerTools` — the collect dispatches to registered factories.
25
+ * 2. collect — reads project files only, which the sync never touches, so
26
+ * collecting before and applying after cannot see two different states.
27
+ * 3. gate (pack, upload) — a project reporting a problem with its own files
28
+ * must fail before any write, not leave half-synced resources behind.
29
+ * 4. sync — carries the contributed subTypes, which is what lets reconcile
30
+ * generate (or repair) artefact resources for a type whose template row is
31
+ * keyed `<type>_<subType>`.
32
+ * 5. apply — after the sync, because the sync can create the app resource a
33
+ * patch targets. An unmatched patch here is a contributor bug, not a race,
34
+ * which is why gating callers also fail on one.
35
+ * 6. runtime dependencies — mirrors Orchestrator BE's
36
+ * `ProcessesExportHandlerBase.GetRuntimeDependenciesAsync`.
37
+ */
38
+ export declare function prepareSolutionResources(solutionDir: string, fs: IFileSystem, options?: {
39
+ gate?: boolean;
40
+ }): Promise<PrepareResult>;
@@ -0,0 +1,58 @@
1
+ import { type CliErrorCode } from "@uipath/common";
2
+ import { type IFileSystem } from "@uipath/filesystem";
3
+ import { type ProjectContributionError, type ProjectResourceContribution } from "@uipath/solutionpackager-tool-core";
4
+ export interface ProjectContributions {
5
+ /** Per project key (the `.uipx` `Id`), what that project's factory returned. */
6
+ byProject: Map<string, ProjectResourceContribution>;
7
+ /** Supported types whose registered factory has no `describeResourcesAsync`. */
8
+ skipped: string[];
9
+ }
10
+ export interface ApplyContributionsResult {
11
+ /** Number of artefact resources whose spec was rewritten. */
12
+ updated: number;
13
+ /** Patches that matched no resource, plus the collect-time skip notices. */
14
+ warnings: string[];
15
+ }
16
+ /**
17
+ * Every contributed error from one collect, in one throw. Carries
18
+ * `instructions` so `carriedInstructions` can lift them into the failure
19
+ * envelope instead of losing the actionable half.
20
+ */
21
+ export declare class ProjectContributionsError extends Error {
22
+ readonly contributionErrors: readonly ProjectContributionError[];
23
+ readonly instructions?: string;
24
+ readonly errorCode: CliErrorCode;
25
+ /** The contributed `code`, when every error in the batch reports the same one. */
26
+ readonly contributionCode?: string;
27
+ constructor(errors: readonly ProjectContributionError[]);
28
+ }
29
+ /**
30
+ * Walk the `.uipx` and ask each project's registered tool factory what it
31
+ * contributes. One walk, one dispatch round — pack uses the same result for
32
+ * its gate and its write.
33
+ *
34
+ * Reads project files only, which `syncAndLog` never touches, so collecting
35
+ * before the sync and applying after it cannot see two different states.
36
+ */
37
+ export declare function collectProjectContributions(solutionDir: string, fs?: IFileSystem): Promise<ProjectContributions>;
38
+ /** Throws once with every collected error. Pack's gate. */
39
+ export declare function assertNoContributionErrors(contributions: ProjectContributions): void;
40
+ /**
41
+ * Contributed errors as flat strings. Refresh folds these into its
42
+ * `Warnings[]` — it is a sync command, not a gate, but it must not swallow
43
+ * them either. Pack remains the gate.
44
+ */
45
+ export declare function contributionErrorMessages(contributions: ProjectContributions): string[];
46
+ /**
47
+ * Merge every `specPatch` into the on-disk resources, and write the
48
+ * entry-point keys while we are here so they persist into the packed solution
49
+ * instead of existing only at GET.
50
+ *
51
+ * Writes go through the resource builder, so a save re-runs
52
+ * `ArtefactPairBindingProvider` — deliberate: it is what keeps the app+package
53
+ * linkage intact when this rewrites an app resource. Nothing is saved when
54
+ * nothing changed, which is what keeps a re-run byte-stable.
55
+ */
56
+ export declare function applyProjectContributions(solutionDir: string, contributions: ProjectContributions, options?: {
57
+ failOnUnmatchedPatch?: boolean;
58
+ }, fs?: IFileSystem): Promise<ApplyContributionsResult>;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * The CLI verb that owns a project type, or `undefined` for a type nothing
3
+ * maps. Used to name the tool to install or update in an error or warning.
4
+ */
5
+ export declare function toolVerbForProjectType(projectType: string): string | undefined;
6
+ export declare function toolOwnedProjectTypes(): string[];