@uipath/solution-tool 1.206.0-preview.306 → 1.207.0-preview.307

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 (124) hide show
  1. package/dist/THIRD-PARTY-NOTICES.md +4 -4
  2. package/dist/{archive-extract-ma0gy822.js → archive-extract-afgwacbg.js} +3 -3
  3. package/dist/{cleanup-command-service-abtxpefz.js → cleanup-command-service-0j6qxj96.js} +20 -15
  4. package/dist/deploy-delete-service-ghyetrvj.js +23 -0
  5. package/dist/deploy-run-service-sz77fpsz.js +24 -0
  6. package/dist/{deploy-status-service-k1gycn13.js → deploy-status-service-aj4m61hg.js} +49 -25
  7. package/dist/deploy.js +21 -20
  8. package/dist/{deployment-search-bjdwqh5w.js → deployment-search-mkvzgeq4.js} +9 -9
  9. package/dist/{embedded-file-reader-pxpwcq3n.js → embedded-file-reader-k94wt612.js} +16 -16
  10. package/dist/feed-resolver-yj94m9j1.js +31 -0
  11. package/dist/feed-scope-failure-7abh61sj.js +20 -0
  12. package/dist/{feed-session-ytew8k2j.js → feed-session-z8t87r5w.js} +6 -6
  13. package/dist/{first-party-service-6gf3n6d8.js → first-party-service-bmtxd7wx.js} +1 -1
  14. package/dist/folder-runtime-check-8nf63er2.js +25 -0
  15. package/dist/{governance-options-40m81z8h.js → governance-options-ft8bqz4p.js} +7 -7
  16. package/dist/{packager-tool-v3ze7wmr.js → index-6ma58k47.js} +33 -708
  17. package/dist/{index-yjvmjpdn.js → index-j3tpb2cr.js} +12 -11
  18. package/dist/{index-p3x7ztdr.js → index-jy1760qy.js} +1 -1
  19. package/dist/{index-2bn3jzn9.js → index-nbs04tqr.js} +9 -7
  20. package/dist/index.js +26 -26
  21. package/dist/init.js +10 -10
  22. package/dist/{list-0k8c4rt6.js → list-3a1tdrgm.js} +11 -11
  23. package/dist/models/pack-command-types.d.ts +12 -0
  24. package/dist/{node-6ay6nbnq.js → node-83xy0gm0.js} +6 -6
  25. package/dist/pack-command-service-42p3t8xa.js +32 -0
  26. package/dist/{pack-project-2g2ncn2k.js → pack-project-w514zr5v.js} +21 -18
  27. package/dist/pack.js +25 -22
  28. package/dist/{package-id-56k44s7y.js → package-id-2dgfbh5h.js} +3 -3
  29. package/dist/{packager-tool-2zn98p5r.js → packager-tool-0gyqtxvs.js} +4 -4
  30. package/dist/{packager-tool-vgrswa8p.js → packager-tool-1db1wqdy.js} +30 -8
  31. package/dist/{packager-tool-vx2c68sb.js → packager-tool-1dsxhz1r.js} +2 -2
  32. package/dist/{packager-tool-xxf8f4v2.js → packager-tool-2syv199e.js} +9 -5
  33. package/dist/packager-tool-3ft8hywr.js +449 -0
  34. package/dist/{packager-tool-829w06ns.js → packager-tool-3qach0s4.js} +14 -8
  35. package/dist/{packager-tool-bkmwknfn.js → packager-tool-4f1k64fh.js} +8 -74
  36. package/dist/{packager-tool-7v03ncmv.js → packager-tool-70ag56bf.js} +49 -24
  37. package/dist/{packager-tool-5e4gps62.js → packager-tool-71sz9598.js} +20 -8
  38. package/dist/{packager-tool-23g7kn35.js → packager-tool-7j920ac5.js} +18 -11
  39. package/dist/packager-tool-7s842xrq.js +140 -0
  40. package/dist/{packager-tool-s8q14fth.js → packager-tool-849ch2tq.js} +4 -6
  41. package/dist/{packager-tool-aws5w512.js → packager-tool-887bkh9y.js} +1 -1
  42. package/dist/{packager-tool-f5pzh184.js → packager-tool-a566400t.js} +26 -10
  43. package/dist/packager-tool-a813na66.js +75 -0
  44. package/dist/{packager-tool-c8x0tpe4.js → packager-tool-af8n6rqz.js} +85 -30
  45. package/dist/{packager-tool-y1304xzm.js → packager-tool-bpdyy6vs.js} +530 -204
  46. package/dist/{packager-tool-fx4ws49n.js → packager-tool-cenfraf4.js} +2 -2
  47. package/dist/{packager-tool-0z4aq300.js → packager-tool-cwqy5rb5.js} +119 -52
  48. package/dist/{packager-tool-a7s0gbxs.js → packager-tool-devc4w73.js} +7 -2
  49. package/dist/{packager-tool-pqk9v4h7.js → packager-tool-fbajevvm.js} +52 -15
  50. package/dist/{packager-tool-r0ha8c95.js → packager-tool-fz96p75n.js} +3 -3
  51. package/dist/{packager-tool-m07vyk89.js → packager-tool-gb3dq79g.js} +36 -9
  52. package/dist/{packager-tool-h8tksb5s.js → packager-tool-gns0nxbt.js} +28 -9
  53. package/dist/{packager-tool-wjvks6st.js → packager-tool-h8wam8pt.js} +15 -6
  54. package/dist/{packager-tool-z4cbca95.js → packager-tool-hczpvrc1.js} +6 -6
  55. package/dist/{packager-tool-t39pjz7n.js → packager-tool-jtvhkavz.js} +48 -6
  56. package/dist/{packager-tool-p5322gew.js → packager-tool-kmwjscby.js} +88 -10
  57. package/dist/{packager-tool-ppj5f4y7.js → packager-tool-n1zrk6zv.js} +4 -2
  58. package/dist/{packager-tool-2qsbh4kd.js → packager-tool-ncgpx1ce.js} +50 -12
  59. package/dist/{packager-tool-f15an17m.js → packager-tool-p1xfsv6c.js} +92 -4
  60. package/dist/{packager-tool-egc54x78.js → packager-tool-qhht1tc9.js} +2408 -771
  61. package/dist/packager-tool-r7fmsz2t.js +741 -0
  62. package/dist/{packager-tool-resolver-30hxk8vm.js → packager-tool-resolver-mynfj0rt.js} +6 -6
  63. package/dist/{packager-tool-ay4j9x92.js → packager-tool-s9tyw75r.js} +19 -8
  64. package/dist/{packager-tool-ckrt4gyr.js → packager-tool-t9zked1m.js} +3 -3
  65. package/dist/{packager-tool-1ctvbx0h.js → packager-tool-tr3ttz5c.js} +1 -1
  66. package/dist/{packager-tool-chff74yz.js → packager-tool-tt9v40x6.js} +3010 -846
  67. package/dist/{packager-tool-k9dk39tg.js → packager-tool-txygqgb2.js} +3 -3
  68. package/dist/packager-tool-v6jcys3s.js +46 -0
  69. package/dist/packager-tool-w0tmr9xe.js +279 -0
  70. package/dist/packager-tool-w35s60sx.js +179 -0
  71. package/dist/{packager-tool-axqk17xw.js → packager-tool-xbfr6y2x.js} +142 -34
  72. package/dist/{packager-tool-m5mwc6by.js → packager-tool-zsv8208n.js} +22 -18
  73. package/dist/{packager-tool-vrw36pdb.js → packager-tool-ztxsccjk.js} +140 -10
  74. package/dist/packager-tool.js +2 -2
  75. package/dist/prepare-solution-resources-g9y01pgd.js +26 -0
  76. package/dist/{project-command-utils-82tja3k0.js → project-command-utils-yxrgwzf9.js} +20 -13
  77. package/dist/project-contributions-c8v3bwjr.js +31 -0
  78. package/dist/project-identity-telemetry-yxdhswyq.js +18 -0
  79. package/dist/publish.js +14 -14
  80. package/dist/{resource-mutations-h6wfdqr4.js → resource-mutations-dn4f8xr1.js} +9 -9
  81. package/dist/{resource-version-lookup-xzgnvr48.js → resource-version-lookup-mksxc1dc.js} +9 -9
  82. package/dist/resource.js +9 -9
  83. package/dist/{restore-command-service-bqs7r9y3.js → restore-command-service-ztbt2ejp.js} +20 -15
  84. package/dist/run-service-r52wgf69.js +1056 -0
  85. package/dist/services/deploy-activate-service.d.ts +5 -2
  86. package/dist/services/deploy-config-file.d.ts +24 -0
  87. package/dist/services/deploy-delete-service.d.ts +1 -1
  88. package/dist/services/deploy-run-service.d.ts +8 -1
  89. package/dist/services/deploy-uninstall-service.d.ts +4 -2
  90. package/dist/services/deploy-upgrade-service.d.ts +23 -2
  91. package/dist/services/deployment-feed-locator.d.ts +19 -6
  92. package/dist/services/deployment-links.d.ts +16 -0
  93. package/dist/services/deployment-progress.d.ts +10 -0
  94. package/dist/services/deployment-search.d.ts +15 -2
  95. package/dist/services/deployment-state.d.ts +9 -0
  96. package/dist/services/feed-resolver.d.ts +17 -0
  97. package/dist/services/feed-selection.d.ts +59 -0
  98. package/dist/services/folder-runtime-check.d.ts +107 -0
  99. package/dist/services/incomplete-feed-sweep.d.ts +6 -0
  100. package/dist/services/pack-command-service.d.ts +6 -0
  101. package/dist/services/pack-project.d.ts +1 -1
  102. package/dist/services/package-metadata-rewrite.d.ts +13 -0
  103. package/dist/services/personal-workspace-resolver.d.ts +4 -1
  104. package/dist/services/prepare-solution-resources.d.ts +11 -6
  105. package/dist/services/project-contributions.d.ts +26 -2
  106. package/dist/services/project-identity-telemetry.d.ts +31 -0
  107. package/dist/services/solution-members.d.ts +31 -0
  108. package/dist/{ship-telemetry-19gx83af.js → ship-telemetry-9djqndmy.js} +4 -4
  109. package/dist/{solution-auth-jxcgd2m0.js → solution-auth-0e3qm74f.js} +3 -3
  110. package/dist/{solution-definition-helper-tqwd6cxn.js → solution-definition-helper-dreejga4.js} +1 -1
  111. package/dist/{solution-identity-c23d9bfv.js → solution-identity-j63p6n81.js} +4 -4
  112. package/dist/templates/AGENTS.md +131 -24
  113. package/dist/tool.js +26 -26
  114. package/package.json +2 -2
  115. package/dist/deploy-delete-service-as1jfycj.js +0 -23
  116. package/dist/deploy-run-service-gs1xv1y1.js +0 -23
  117. package/dist/feed-resolver-x0kt3yrw.js +0 -27
  118. package/dist/feed-scope-failure-9p8w0j1v.js +0 -20
  119. package/dist/pack-command-service-jzbch4eb.js +0 -29
  120. package/dist/packager-tool-qpryf1x2.js +0 -74
  121. package/dist/packager-tool-vrqbbh01.js +0 -182
  122. package/dist/prepare-solution-resources-h7zvnncd.js +0 -26
  123. package/dist/project-contributions-xx560n8y.js +0 -27
  124. package/dist/run-service-ekbx2jdg.js +0 -506
@@ -1,11 +1,19 @@
1
1
  import {
2
2
  catchError
3
- } from "./packager-tool-m07vyk89.js";
3
+ } from "./packager-tool-gb3dq79g.js";
4
4
  import {
5
5
  logger
6
- } from "./packager-tool-axqk17xw.js";
6
+ } from "./packager-tool-xbfr6y2x.js";
7
7
 
8
8
  // ../solution-sdk/src/solution-file.ts
9
+ class SolutionFileError extends Error {
10
+ errorCode;
11
+ constructor(message, errorCode) {
12
+ super(message);
13
+ this.name = "SolutionFileError";
14
+ this.errorCode = errorCode;
15
+ }
16
+ }
9
17
  var STUDIO_WEB_PROJECT_TYPE_OVERRIDES = {
10
18
  ProcessOrchestration: "processOrchestration"
11
19
  };
@@ -63,6 +71,29 @@ function resolveSolutionDir2(fs, inputPath) {
63
71
  }
64
72
  return resolved;
65
73
  }
74
+ var DEFAULT_UIPX_INDENT = " ";
75
+ function escapeRegExp(text) {
76
+ return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
77
+ }
78
+ function withSolutionId(content, parsed, newSolutionId) {
79
+ const previous = parsed.SolutionId;
80
+ if (typeof previous === "string") {
81
+ const pattern = new RegExp(`("SolutionId"\\s*:\\s*")${escapeRegExp(previous)}(")`, "g");
82
+ const matches = content.match(pattern) ?? [];
83
+ if (matches.length === 1) {
84
+ return content.replace(pattern, (_match, open, close) => `${open}${newSolutionId}${close}`);
85
+ }
86
+ }
87
+ const indent = content.match(/^([ \t]+)"/m)?.[1] ?? DEFAULT_UIPX_INDENT;
88
+ const text = JSON.stringify({ ...parsed, SolutionId: newSolutionId }, null, indent);
89
+ const eol = content.includes(`\r
90
+ `) ? `\r
91
+ ` : `
92
+ `;
93
+ const body = text.replace(/\n/g, eol);
94
+ return content.endsWith(`
95
+ `) ? `${body}${eol}` : body;
96
+ }
66
97
  async function updateUipxSolutionId2(fs, uipxPath, newSolutionId) {
67
98
  const [readError, content] = await catchError(fs.readFile(uipxPath, "utf-8"));
68
99
  if (readError || !content) {
@@ -74,13 +105,21 @@ async function updateUipxSolutionId2(fs, uipxPath, newSolutionId) {
74
105
  logger.error(`Could not parse .uipx file for update: ${parseError.message}`);
75
106
  return;
76
107
  }
77
- parsed.SolutionId = newSolutionId;
78
- const [writeError] = await catchError(fs.writeFile(uipxPath, JSON.stringify(parsed, null, 4)));
108
+ if (parsed.SolutionId === newSolutionId) {
109
+ return;
110
+ }
111
+ const [writeError] = await catchError(fs.writeFile(uipxPath, withSolutionId(content, parsed, newSolutionId)));
79
112
  if (writeError) {
80
113
  logger.error(`Could not update .uipx with new SolutionId: ${writeError.message}`);
81
- } else {
82
- logger.info(`Updated .uipx with Studio Web SolutionId: ${newSolutionId}`);
114
+ return;
83
115
  }
116
+ const from = typeof parsed.SolutionId === "string" ? parsed.SolutionId : undefined;
117
+ logger.warn(from ? `Rewrote SolutionId in ${uipxPath}: ${from} -> ${newSolutionId} (Studio Web's id for this solution).` : `Wrote SolutionId ${newSolutionId} into ${uipxPath} (Studio Web's id for this solution).`);
118
+ return {
119
+ Path: uipxPath,
120
+ ...from ? { From: from } : {},
121
+ To: newSolutionId
122
+ };
84
123
  }
85
124
  async function findSolutionFileUpward(fs, startDir) {
86
125
  let dir = startDir;
@@ -91,16 +130,55 @@ async function findSolutionFileUpward(fs, startDir) {
91
130
  return fs.path.join(dir, files[0]);
92
131
  }
93
132
  if (files.length > 1) {
94
- throw new Error(`Multiple .uipx files found in ${dir}. Please specify which solution file to use.`);
133
+ throw new SolutionFileError(`Multiple .uipx files found in ${dir}. Please specify which solution file to use.`, "invalid_argument");
95
134
  }
96
135
  const parent = fs.path.dirname(dir);
97
136
  if (parent === dir) {
98
- throw new Error(`No .uipx solution file found (searched from ${startDir} to filesystem root)`);
137
+ throw new SolutionFileError(`No .uipx solution file found (searched from ${startDir} to filesystem root)`, "not_found");
99
138
  }
100
139
  dir = parent;
101
140
  }
102
141
  }
103
142
 
104
- export { normalizeProjectType, toPortableRelativePath2, readUipxFile, resolveSolutionDir2, updateUipxSolutionId2, findSolutionFileUpward };
143
+ // ../solution-sdk/src/resources/services/resource-name.ts
144
+ var MAX_RESOURCE_NAME_LENGTH = 256;
145
+ var UNSAFE_NAME_CHARS = /[\\/:*?"<>|]/;
146
+ function hasControlChar(value) {
147
+ for (let i = 0;i < value.length; i++) {
148
+ if (value.charCodeAt(i) < 32)
149
+ return true;
150
+ }
151
+ return false;
152
+ }
153
+ function hasUnsafeNameChars(name) {
154
+ return UNSAFE_NAME_CHARS.test(name) || hasControlChar(name);
155
+ }
156
+ function validateResourceName2(name, options = {}) {
157
+ const optionName = options.optionName ?? "--name";
158
+ if (name.trim() === "") {
159
+ return {
160
+ ok: false,
161
+ message: `${optionName} must not be blank`,
162
+ instructions: "Pass a non-empty resource name."
163
+ };
164
+ }
165
+ if (name.length > MAX_RESOURCE_NAME_LENGTH) {
166
+ return {
167
+ ok: false,
168
+ message: `${optionName} exceeds the ${MAX_RESOURCE_NAME_LENGTH}-character limit (got ${name.length})`,
169
+ instructions: "Shorten the resource name. Orchestrator name limits are kind-specific (queues cap at 50, assets at 256)."
170
+ };
171
+ }
172
+ if (hasUnsafeNameChars(name)) {
173
+ return {
174
+ ok: false,
175
+ message: `${optionName} contains unsafe characters`,
176
+ instructions: 'Resource names cannot contain path separators (/, \\), control characters, or any of: : * ? " < > |'
177
+ };
178
+ }
179
+ return { ok: true };
180
+ }
181
+
182
+ export { SolutionFileError, normalizeProjectType, toPortableRelativePath2, readUipxFile, resolveSolutionDir2, updateUipxSolutionId2, findSolutionFileUpward, hasUnsafeNameChars, validateResourceName2 };
105
183
 
106
- //# debugId=DCC60B330CDD064964756E2164756E21
184
+ //# debugId=8EDCA88CEAA6E29B64756E2164756E21
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getAuthContext
3
- } from "./packager-tool-t39pjz7n.js";
3
+ } from "./packager-tool-jtvhkavz.js";
4
4
 
5
5
  // ../solution-sdk/src/solution-auth.ts
6
6
  async function getSolutionAuthContext2(options) {
@@ -16,6 +16,8 @@ async function getSolutionAuthContext2(options) {
16
16
  return {
17
17
  accessToken: ctx.accessToken,
18
18
  basePath,
19
+ baseUrl: ctx.baseUrl,
20
+ organizationName: ctx.organizationName,
19
21
  organizationId,
20
22
  tenantName,
21
23
  identity: ctx.identity
@@ -24,4 +26,4 @@ async function getSolutionAuthContext2(options) {
24
26
 
25
27
  export { getSolutionAuthContext2 };
26
28
 
27
- //# debugId=720557DFC760A35C64756E2164756E21
29
+ //# debugId=DC4278ED780D063764756E2164756E21
@@ -1,22 +1,22 @@
1
1
  import {
2
2
  getFileSystem
3
- } from "./packager-tool-vgrswa8p.js";
3
+ } from "./packager-tool-1db1wqdy.js";
4
4
  import {
5
5
  catchError
6
- } from "./packager-tool-m07vyk89.js";
6
+ } from "./packager-tool-gb3dq79g.js";
7
7
  import {
8
8
  logger
9
- } from "./packager-tool-axqk17xw.js";
9
+ } from "./packager-tool-xbfr6y2x.js";
10
10
  import {
11
11
  toolsFactoryRepository
12
- } from "./packager-tool-a7s0gbxs.js";
12
+ } from "./packager-tool-devc4w73.js";
13
13
  import {
14
14
  computeEntryPointSpec2,
15
15
  createResourceBuilderServices2,
16
16
  hasBareTemplateRow2,
17
17
  hasAnyTemplateRow2,
18
18
  readUipxProjects2
19
- } from "./packager-tool-chff74yz.js";
19
+ } from "./packager-tool-tt9v40x6.js";
20
20
  import {
21
21
  toolVerbForProjectType2
22
22
  } from "./packager-tool-qzcd5c9s.js";
@@ -24,7 +24,7 @@ import {
24
24
  // src/services/project-contributions.ts
25
25
  var ENTRY_POINT_RESOURCE_KIND = "process";
26
26
 
27
- class ProjectContributionsError extends Error {
27
+ class ProjectContributionsError2 extends Error {
28
28
  contributionErrors;
29
29
  instructions;
30
30
  errorCode = "invalid_argument";
@@ -41,7 +41,10 @@ class ProjectContributionsError extends Error {
41
41
  this.contributionCode = everyCoded && new Set(codes).size === 1 ? codes[0] : undefined;
42
42
  }
43
43
  }
44
- async function collectProjectContributions2(solutionDir, fs = getFileSystem(), onlyProjectId) {
44
+ async function collectProjectContributions2(solutionDir, fs = getFileSystem(), {
45
+ onlyProjectId,
46
+ forDebug
47
+ } = {}) {
45
48
  const byProject = new Map;
46
49
  const names = new Map;
47
50
  const projects = (await readUipxProjects2(solutionDir)).filter((project) => onlyProjectId === undefined || project.id === onlyProjectId);
@@ -69,7 +72,8 @@ async function collectProjectContributions2(solutionDir, fs = getFileSystem(), o
69
72
  continue;
70
73
  }
71
74
  const [describeError, contribution] = await catchError(factory.describeResourcesAsync(project.path, fs, {
72
- sharesSolutionDirectory: fs.path.resolve(project.path) === fs.path.resolve(solutionDir)
75
+ sharesSolutionDirectory: fs.path.resolve(project.path) === fs.path.resolve(solutionDir),
76
+ forDebug
73
77
  }));
74
78
  if (describeError) {
75
79
  byProject.set(project.id, {
@@ -88,11 +92,45 @@ async function collectProjectContributions2(solutionDir, fs = getFileSystem(), o
88
92
  }
89
93
  return { byProject, names };
90
94
  }
95
+ async function prepareProjectResources2(solutionDir, fs = getFileSystem()) {
96
+ const errors = [];
97
+ for (const project of await readUipxProjects2(solutionDir)) {
98
+ if (!toolsFactoryRepository.canHandleProject(project.type))
99
+ continue;
100
+ const factory = toolsFactoryRepository.getProjectToolFactory(project.type);
101
+ if (typeof factory.prepareProjectResourcesAsync !== "function") {
102
+ continue;
103
+ }
104
+ const [prepareError, preparation] = await catchError(factory.prepareProjectResourcesAsync(project.path, fs, {
105
+ solutionRoot: fs.path.resolve(solutionDir),
106
+ sharesSolutionDirectory: fs.path.resolve(project.path) === fs.path.resolve(solutionDir)
107
+ }));
108
+ if (prepareError) {
109
+ errors.push({
110
+ code: "preparation_failed",
111
+ message: `Project '${project.name}' (${project.type}) failed to prepare its resources: ${prepareError.message}`,
112
+ instructions: `Fix the reported problem in ${project.path}, then re-run the command.`
113
+ });
114
+ continue;
115
+ }
116
+ errors.push(...preparation?.errors ?? []);
117
+ }
118
+ const seen = new Set;
119
+ return {
120
+ errors: errors.filter((error) => {
121
+ const key = `${error.code ?? ""}|${error.message}`;
122
+ if (seen.has(key))
123
+ return false;
124
+ seen.add(key);
125
+ return true;
126
+ })
127
+ };
128
+ }
91
129
  function assertNoContributionErrors2(contributions) {
92
130
  const errors = [...contributions.byProject.values()].flatMap((c) => c.errors ?? []);
93
131
  if (errors.length === 0)
94
132
  return;
95
- throw new ProjectContributionsError(errors);
133
+ throw new ProjectContributionsError2(errors);
96
134
  }
97
135
  function contributionErrorMessages2(contributions) {
98
136
  return [...contributions.byProject.values()].flatMap((c) => c.errors ?? []).map((e) => e.instructions ? `${e.message} ${e.instructions}` : e.message);
@@ -110,7 +148,7 @@ async function applyProjectContributions2(solutionDir, contributions, options, f
110
148
  const touched = new Set;
111
149
  const conflicts = conflictingNamedPatches(contributions);
112
150
  if (conflicts.size > 0 && options?.failOnUnmatchedPatch) {
113
- throw new ProjectContributionsError([...conflicts.values()]);
151
+ throw new ProjectContributionsError2([...conflicts.values()]);
114
152
  }
115
153
  for (const conflict of conflicts.values()) {
116
154
  result.warnings.push(`${conflict.message} ${conflict.instructions}`);
@@ -245,6 +283,6 @@ function isSameSpecValue(a, b) {
245
283
  return JSON.stringify(a) === JSON.stringify(b);
246
284
  }
247
285
 
248
- export { collectProjectContributions2, assertNoContributionErrors2, contributionErrorMessages2, applyProjectContributions2 };
286
+ export { ProjectContributionsError2, collectProjectContributions2, prepareProjectResources2, assertNoContributionErrors2, contributionErrorMessages2, applyProjectContributions2 };
249
287
 
250
- //# debugId=D688C8E22C9ACFE464756E2164756E21
288
+ //# debugId=132D5A5F9A6B2E5F64756E2164756E21
@@ -9,7 +9,7 @@ import {
9
9
  ProjectTool,
10
10
  SolutionTool,
11
11
  toolsFactoryRepository
12
- } from "./packager-tool-a7s0gbxs.js";
12
+ } from "./packager-tool-devc4w73.js";
13
13
 
14
14
  // ../packager/packager-tool-connector/src/connector-tool.ts
15
15
  class ConnectorTool extends ProjectTool {
@@ -144,7 +144,7 @@ class ConnectorToolFactory {
144
144
  return new ConnectorTool(fileSystem, logger);
145
145
  }
146
146
  }
147
- // node_modules/@uipath/resource-builder-tool/dist/index.js
147
+ // ../../node_modules/@uipath/resource-builder-tool/dist/index.js
148
148
  function _define_property(obj, key, value) {
149
149
  if (key in obj)
150
150
  Object.defineProperty(obj, key, {
@@ -157,6 +157,24 @@ function _define_property(obj, key, value) {
157
157
  obj[key] = value;
158
158
  return obj;
159
159
  }
160
+ function attachedFileStoredPath(kind, name) {
161
+ return `resources/files/${kind}/${name}`;
162
+ }
163
+ function isPathInside(root, resolved) {
164
+ const windows = /^[A-Za-z]:[\\/]|^\\\\/.test(root);
165
+ if (windows) {
166
+ const base = root.replace(/\//g, "\\").replace(/\\+$/, "").toLowerCase();
167
+ return resolved.replace(/\//g, "\\").toLowerCase().startsWith(`${base}\\`);
168
+ }
169
+ const base = root.replace(/\/+$/, "");
170
+ return resolved.startsWith(`${base}/`);
171
+ }
172
+ function isValidFileName(name) {
173
+ return !!name && !/[/\\:*?"<>|]/.test(name);
174
+ }
175
+ function isPlainName(name) {
176
+ return isValidFileName(name) && name !== "." && name !== "..";
177
+ }
160
178
  var KNOWN_ARCHIVE_FILE_NAMES = {
161
179
  packageInfoJsonFileName: "packageInfo.json",
162
180
  metadataJsonFileName: "solutionMetadata.json"
@@ -448,13 +466,20 @@ class ResourceBuilderTool extends SolutionTool {
448
466
  projectsToBuild: options.projectsToBuild
449
467
  });
450
468
  const files = this.extractFilesFromResources(filteredResources);
469
+ const outputPath = options.outputPath ?? "";
470
+ const copyFailures = await this.copyAttachedFilesAsync(files, outputPath, cancellationToken);
471
+ if (copyFailures.length > 0) {
472
+ const message = copyFailures.join(`
473
+ `);
474
+ this.logger.error(message);
475
+ return ToolResult.error("INTERNAL_ERROR" /* InternalError */, message);
476
+ }
451
477
  const filesToDownload = files.filter((f) => f.url != null);
452
478
  if (filesToDownload.length === 0) {
453
479
  this.logger.info("No files to download.");
454
480
  this.logger.info("Restore finished.");
455
481
  return ToolResult.success();
456
482
  }
457
- const outputPath = options.outputPath ?? "";
458
483
  const downloadTasks = [];
459
484
  const semaphore = new Semaphore(MAX_DOWNLOAD_CONCURRENCY);
460
485
  for (const file of filesToDownload) {
@@ -807,6 +832,69 @@ class ResourceBuilderTool extends SolutionTool {
807
832
  return;
808
833
  }
809
834
  }
835
+ async copyAttachedFilesAsync(files, outputPath, cancellationToken) {
836
+ const failures = [];
837
+ const seen = new Set;
838
+ for (const file of files) {
839
+ throwIfCancelled(cancellationToken);
840
+ const id = `${file.key}/${file.name}`.toLowerCase();
841
+ if (file.url != null || !isPlainName(file.key) || !isPlainName(file.kind) || !isPlainName(file.name) || seen.has(id))
842
+ continue;
843
+ seen.add(id);
844
+ const stored = attachedFileStoredPath(file.kind, file.name);
845
+ const source = Path.join(this.inputPath, stored);
846
+ const target = Path.join(outputPath, KNOWN_ARCHIVE_FOLDERS.files, file.key, file.name);
847
+ if (!await this.fileSystem.exists(source)) {
848
+ this.logger.warn(`File ${file.name} has no download url and was not found at ${source}.`);
849
+ await this.removeStaleTargetAsync(target);
850
+ continue;
851
+ }
852
+ if (!await this.isPlainFileInsideInput(source, stored)) {
853
+ failures.push(`InvalidResourceFilePath: ${stored} must be a regular file inside the solution folder, not a symbolic link or junction.`);
854
+ continue;
855
+ }
856
+ const content = await this.fileSystem.readFile(source);
857
+ if (content == null) {
858
+ this.logger.warn(`File ${file.name} could not be read at ${source}.`);
859
+ await this.removeStaleTargetAsync(target);
860
+ continue;
861
+ }
862
+ if (content.byteLength === 0) {
863
+ failures.push(`InvalidResourceFilePath: ${stored} is empty or not a regular file.`);
864
+ continue;
865
+ }
866
+ await this.fileSystem.mkdir(Path.dirname(target));
867
+ try {
868
+ await this.fileSystem.writeFile(target, content);
869
+ } catch (error) {
870
+ try {
871
+ await this.fileSystem.rm(target);
872
+ } catch (cleanupError) {
873
+ this.logger.warn(`Could not remove the incomplete file ${target}: ${String(cleanupError)}`);
874
+ }
875
+ throw error;
876
+ }
877
+ this.logger.info(`Copied attached file ${file.name} to ${target}.`);
878
+ }
879
+ return failures;
880
+ }
881
+ async removeStaleTargetAsync(target) {
882
+ if (!await this.fileSystem.exists(target))
883
+ return;
884
+ try {
885
+ await this.fileSystem.rm(target);
886
+ } catch (error) {
887
+ this.logger.warn(`Could not remove the stale file ${target}: ${String(error)}`);
888
+ }
889
+ }
890
+ async isPlainFileInsideInput(source, stored) {
891
+ const stats = await this.fileSystem.stat(source);
892
+ if (!stats?.isFile())
893
+ return false;
894
+ const root = await this.fileSystem.realpath(this.inputPath);
895
+ const resolved = await this.fileSystem.realpath(source);
896
+ return isPathInside(root, resolved) && Path.normalize(resolved) === Path.normalize(Path.join(root, stored));
897
+ }
810
898
  extractFilesFromResources(resources) {
811
899
  const files = [];
812
900
  for (const resource of resources)
@@ -882,4 +970,4 @@ function registerPackagerFactories2() {
882
970
 
883
971
  export { registerPackagerFactories2 };
884
972
 
885
- //# debugId=1D227596F80BD51264756E2164756E21
973
+ //# debugId=2E8BD12F2BBFA44D64756E2164756E21