@uipath/solution-tool 1.204.0-preview.254 → 1.205.0-preview.256

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 (122) hide show
  1. package/README.md +3 -3
  2. package/dist/THIRD-PARTY-NOTICES.md +2 -2
  3. package/dist/archive-extract-x35t9ktj.js +120 -0
  4. package/dist/cleanup-command-service-n4e7vxnw.js +149 -0
  5. package/dist/deploy-delete-service-cag0q8yx.js +25 -0
  6. package/dist/deploy-run-service-f0h8wb9w.js +25 -0
  7. package/dist/{deploy-status-service-sa302ab9.js → deploy-status-service-yh6xn6e0.js} +41 -33
  8. package/dist/deploy.js +23 -17
  9. package/dist/{deployment-search-692d15j3.js → deployment-search-mnywd9nc.js} +16 -10
  10. package/dist/{embedded-file-reader-rf2g1kfj.js → embedded-file-reader-z4becc02.js} +2 -2
  11. package/dist/{feed-resolver-yybwzmh6.js → feed-resolver-fve33dxq.js} +10 -9
  12. package/dist/feed-scope-failure-jmg4t1r1.js +19 -0
  13. package/dist/{feed-session-sxga31vn.js → feed-session-7xqphdrg.js} +3 -3
  14. package/dist/governance-options-4vxz7ekn.js +32 -0
  15. package/dist/index-g8c8nf1c.js +667 -0
  16. package/dist/index-prm27bvm.js +138 -0
  17. package/dist/index.js +27 -29
  18. package/dist/init.js +11 -10
  19. package/dist/{list-0qrxqrfn.js → list-50mepbed.js} +10 -8
  20. package/dist/models/pack-command-types.d.ts +15 -0
  21. package/dist/node-7jm7ksqa.js +86 -0
  22. package/dist/pack-command-service-dewf5vsq.js +35 -0
  23. package/dist/pack-project-xwd1rbaa.js +97 -0
  24. package/dist/pack.js +24 -14
  25. package/dist/package-id-1wr3cy9c.js +13 -0
  26. package/dist/packager-tool-09swr9cp.js +171 -0
  27. package/dist/{packager-tool-dapys0dd.js → packager-tool-2vmsh5pt.js} +196 -1519
  28. package/dist/{packager-tool-px1j9kre.js → packager-tool-3bwnkjdq.js} +2 -2
  29. package/dist/{packager-tool-gb35b4qs.js → packager-tool-43ahv5mn.js} +192 -96
  30. package/dist/{packager-tool-5v92rtp2.js → packager-tool-47by487p.js} +6 -4
  31. package/dist/packager-tool-47wzvqw0.js +86 -0
  32. package/dist/{packager-tool-zns6n8zp.js → packager-tool-5ddtwzva.js} +1 -1
  33. package/dist/packager-tool-5edvzz80.js +543 -0
  34. package/dist/{packager-tool-13dsb9e6.js → packager-tool-5n6jsn41.js} +104 -14
  35. package/dist/packager-tool-60af1hw2.js +26 -0
  36. package/dist/{packager-tool-f5gq77m5.js → packager-tool-61pwb567.js} +2 -2
  37. package/dist/{packager-tool-yrz4mwfn.js → packager-tool-6kz1pv9f.js} +1373 -486
  38. package/dist/packager-tool-6ybywxxn.js +1809 -0
  39. package/dist/packager-tool-8ptbmmmp.js +2132 -0
  40. package/dist/{packager-tool-7gr2nphb.js → packager-tool-97rcgwvv.js} +224 -6
  41. package/dist/{packager-tool-9z1yxjme.js → packager-tool-9t26kde1.js} +3556 -1646
  42. package/dist/packager-tool-act5r386.js +239 -0
  43. package/dist/packager-tool-amhyxzz6.js +125 -0
  44. package/dist/packager-tool-b03rva43.js +188 -0
  45. package/dist/{packager-tool-e2rtr49j.js → packager-tool-b2nhscfk.js} +15 -31
  46. package/dist/{packager-tool-v8rseyfk.js → packager-tool-d6rrfd46.js} +149 -53
  47. package/dist/packager-tool-frr2xmkr.js +445 -0
  48. package/dist/{packager-tool-v8bkkqdb.js → packager-tool-gmwva4yv.js} +5 -5
  49. package/dist/packager-tool-gs3f3tf7.js +103 -0
  50. package/dist/packager-tool-jg692f13.js +517 -0
  51. package/dist/packager-tool-jmpb786m.js +109 -0
  52. package/dist/{packager-tool-4ytxbjez.js → packager-tool-kds8ytzw.js} +74 -23
  53. package/dist/packager-tool-kkfb5kgn.js +182 -0
  54. package/dist/packager-tool-kvcxg0zv.js +1510 -0
  55. package/dist/packager-tool-n3jfjn5r.js +42 -0
  56. package/dist/{packager-tool-8sx1w3h1.js → packager-tool-n5d5dx5j.js} +2196 -3455
  57. package/dist/{packager-tool-97w8aw8y.js → packager-tool-nsya65z1.js} +357 -1370
  58. package/dist/{packager-tool-fv7xyzg2.js → packager-tool-pbmqk39a.js} +126 -128
  59. package/dist/{packager-tool-bqre28m1.js → packager-tool-qw47eyw7.js} +1 -1
  60. package/dist/{packager-tool-erp9bv22.js → packager-tool-rc3hwn4b.js} +25 -4
  61. package/dist/packager-tool-resolver-994z3jkj.js +23 -0
  62. package/dist/{packager-tool-d9ethrmn.js → packager-tool-rvt68c1t.js} +17 -8
  63. package/dist/{packager-tool-gab9y5ct.js → packager-tool-t8gh825q.js} +37 -13
  64. package/dist/{packager-tool-kswwd3hp.js → packager-tool-tx834spe.js} +2376 -4077
  65. package/dist/{packager-tool-zf3929se.js → packager-tool-v1f5e8t9.js} +11 -1
  66. package/dist/{packager-tool-wjk91v0q.js → packager-tool-w77d72a7.js} +13 -11
  67. package/dist/{packager-tool-1rzssy0x.js → packager-tool-wy4fx250.js} +19 -18
  68. package/dist/packager-tool-wz34ma3s.js +1333 -0
  69. package/dist/packager-tool-zq16e1xv.js +68 -0
  70. package/dist/packager-tool.js +2 -2
  71. package/dist/prepare-solution-resources-m1djfj62.js +29 -0
  72. package/dist/project-command-utils-t6pmpvq3.js +90 -0
  73. package/dist/project-contributions-79ndycrx.js +32 -0
  74. package/dist/publish.js +13 -12
  75. package/dist/resource-mutations-c3krjqze.js +36 -0
  76. package/dist/resource-version-lookup-0e3e2j58.js +99 -0
  77. package/dist/resource.js +10 -9
  78. package/dist/restore-command-service-5v0b9363.js +155 -0
  79. package/dist/run-service-tg6b67wp.js +428 -0
  80. package/dist/services/deploy-activate-service.d.ts +10 -5
  81. package/dist/services/deploy-delete-service.d.ts +8 -4
  82. package/dist/services/deploy-run-service.d.ts +34 -1
  83. package/dist/services/deploy-uninstall-service.d.ts +21 -3
  84. package/dist/services/deploy-upgrade-service.d.ts +35 -1
  85. package/dist/services/deployment-feed-locator.d.ts +15 -4
  86. package/dist/services/deployment-search-client.d.ts +5 -53
  87. package/dist/services/deployment-search.d.ts +58 -3
  88. package/dist/services/deployment-state.d.ts +84 -24
  89. package/dist/services/deployment-validation.d.ts +5 -0
  90. package/dist/services/emit-runtime-dependencies.d.ts +2 -1
  91. package/dist/services/feed-resolver.d.ts +6 -4
  92. package/dist/services/feed-selection.d.ts +47 -0
  93. package/dist/services/http-status.d.ts +2 -7
  94. package/dist/services/pack-command-service.d.ts +9 -0
  95. package/dist/services/pack-project-selection.d.ts +51 -0
  96. package/dist/services/pack-project.d.ts +26 -0
  97. package/dist/services/pack-service.d.ts +7 -3
  98. package/dist/services/package-search-client.d.ts +7 -0
  99. package/dist/services/packager-tool-resolver.d.ts +7 -1
  100. package/dist/services/packages-list-service.d.ts +1 -1
  101. package/dist/services/permanent-deletion-consent.d.ts +110 -0
  102. package/dist/services/pipeline-deploy-poll.d.ts +7 -0
  103. package/dist/services/prepare-solution-resources.d.ts +12 -2
  104. package/dist/services/project-contributions.d.ts +5 -4
  105. package/dist/services/search-failure.d.ts +9 -13
  106. package/dist/services/solution-packager-helpers.d.ts +5 -2
  107. package/dist/services/solution-path.d.ts +1 -1
  108. package/dist/services/uninstall-consent.d.ts +82 -0
  109. package/dist/ship-telemetry-myes7ak5.js +21 -0
  110. package/dist/solution-auth-aead70sw.js +11 -0
  111. package/dist/templates/AGENTS.md +125 -12
  112. package/dist/tool.js +27 -29
  113. package/dist/utils/deployment-errors.d.ts +9 -1
  114. package/package.json +2 -2
  115. package/dist/deploy-delete-service-7fms6rrp.js +0 -22
  116. package/dist/feed-scope-failure-kf94beem.js +0 -18
  117. package/dist/packager-tool-f2e9rzxk.js +0 -104
  118. package/dist/packager-tool-resolver-6zwhec62.js +0 -20
  119. package/dist/packager-tool-zdfn32bc.js +0 -4465
  120. package/dist/prepare-solution-resources-jpb5as2s.js +0 -25
  121. package/dist/project-contributions-6wpff2hm.js +0 -30
  122. package/dist/services/legacy-deployment-search-v3.d.ts +0 -23
@@ -0,0 +1,1333 @@
1
+ import {
2
+ PackageIdReader
3
+ } from "./packager-tool-09swr9cp.js";
4
+ import {
5
+ BaseNodePackagerFactory,
6
+ DotnetDiscoveryService,
7
+ NodePackageSignService
8
+ } from "./packager-tool-b03rva43.js";
9
+ import {
10
+ GovernancePolicyService,
11
+ PackService,
12
+ PackagerParameters,
13
+ PackagerParametersValidator,
14
+ ProjectLoader,
15
+ ProjectToolExecutor,
16
+ ToolLogger,
17
+ ToolsFactory,
18
+ isPackageIdTooLongError,
19
+ resolveProducedNupkgsAsync,
20
+ signNupkgsAsync
21
+ } from "./packager-tool-n5d5dx5j.js";
22
+ import {
23
+ I18nManager,
24
+ Path,
25
+ TemporaryStorageService,
26
+ ToolResult,
27
+ ZipService,
28
+ toolsFactoryRepository,
29
+ translate
30
+ } from "./packager-tool-pbmqk39a.js";
31
+ import {
32
+ PackagerDimensions,
33
+ carriedInstructions
34
+ } from "./packager-tool-6ybywxxn.js";
35
+
36
+ // ../packager/solution-packager/src/models/solution-pack-options.ts
37
+ class SolutionPackOptions extends PackagerParameters {
38
+ destinationPath;
39
+ projectDesignIds;
40
+ validateOptions = {
41
+ skipAnalyze: false,
42
+ skipValidate: false,
43
+ governanceFileType: "Default" /* Default */
44
+ };
45
+ package;
46
+ solutionType;
47
+ configuration = "Release" /* Release */;
48
+ signingInfo;
49
+ packOptions;
50
+ publishInfo;
51
+ cleanupOptions = {
52
+ dryRun: false,
53
+ skipImports: false
54
+ };
55
+ lockKey;
56
+ localSourcePath;
57
+ }
58
+
59
+ // ../packager/solution-packager/src/services/member-package-ids.ts
60
+ var INVALID_PACKAGE_ID = "INVALID_PACKAGE_ID";
61
+ function memberFolder(project) {
62
+ return Path.dirname(project.ProjectRelativePath);
63
+ }
64
+ function findPackageIdConflicts(members) {
65
+ const byId = new Map;
66
+ for (const member of members) {
67
+ if (!member.id) {
68
+ continue;
69
+ }
70
+ const key = member.id.toLowerCase();
71
+ const existing = byId.get(key);
72
+ if (existing) {
73
+ existing.folders.push(member.folder);
74
+ continue;
75
+ }
76
+ byId.set(key, { id: member.id, folders: [member.folder] });
77
+ }
78
+ return [...byId.values()].filter((conflict) => conflict.folders.length > 1);
79
+ }
80
+ function packageIdConflictMessage(conflicts) {
81
+ const described = conflicts.map((conflict) => `'${conflict.id}' from ${conflict.folders.map((folder) => `'${folder}'`).join(" and ")}`).join("; ");
82
+ return `Solution members share a package id: ${described}. A NuGet feed stores one package per id and version, so one member's package would replace the other's.`;
83
+ }
84
+
85
+ // ../packager/solution-packager/src/services/tool-result-helpers.ts
86
+ function hasFailedResults(results) {
87
+ return results.some((result) => !result.isSuccess);
88
+ }
89
+ function getFailedResultsMessage(results) {
90
+ return results.filter((result) => !result.isSuccess).map((r) => r.message || "Unknown error").join(", ");
91
+ }
92
+ function getFailedResultsInstructions(results) {
93
+ const instructions = new Set;
94
+ for (const result of results) {
95
+ const next = result.isSuccess ? undefined : result.instructions?.trim();
96
+ if (next) {
97
+ instructions.add(next);
98
+ }
99
+ }
100
+ return instructions.size > 0 ? [...instructions].join(" ") : undefined;
101
+ }
102
+ function toProjectDiagnostics(projects, results) {
103
+ return projects.map((project, index) => {
104
+ const result = results[index];
105
+ const findings = result?.details?.findings;
106
+ return {
107
+ Path: Path.dirname(project.ProjectRelativePath),
108
+ Type: project.Type,
109
+ Result: result?.isSuccess ? "Success" : "Failure",
110
+ Message: result?.message,
111
+ Findings: Array.isArray(findings) ? findings.map(toFindingContract) : []
112
+ };
113
+ });
114
+ }
115
+ var FINDING_FIELDS = [
116
+ "Level",
117
+ "Source",
118
+ "ErrorCode",
119
+ "RuleName",
120
+ "Description",
121
+ "FilePath",
122
+ "ActivityIdRef",
123
+ "DocumentationLink"
124
+ ];
125
+ var CAMEL_TO_CONTRACT = new Map(FINDING_FIELDS.map((field) => [
126
+ field[0].toLowerCase() + field.slice(1),
127
+ field
128
+ ]));
129
+ function toFindingContract(finding) {
130
+ if (typeof finding !== "object" || finding === null) {
131
+ return {};
132
+ }
133
+ const source = finding;
134
+ const normalized = {};
135
+ for (const [key, value] of Object.entries(source)) {
136
+ const contractName = CAMEL_TO_CONTRACT.get(key);
137
+ if (contractName === undefined) {
138
+ normalized[key] = value;
139
+ } else if (source[contractName] === undefined) {
140
+ normalized[contractName] = value;
141
+ }
142
+ }
143
+ return normalized;
144
+ }
145
+ // ../packager/solution-packager/src/i18n/locales/de.json
146
+ var de_default = {
147
+ solutionpackager: {
148
+ solutionLoader: {
149
+ errors: {
150
+ pathRequired: "Solution directory path is required",
151
+ fileNotFound: "Solution file not found: {path}",
152
+ invalidSolution: "Invalid solution file: {path}",
153
+ projectMustBeObject: "Invalid solution file: {path}. Projects[{index}] must be an object.",
154
+ projectMissingProjectRelativePath: `Invalid solution file: {path}. Projects[{index}] is missing ProjectRelativePath.{pathHint} Use 'uip solution projects add' to add projects, or set ProjectRelativePath to the project file path, for example "Foo/project.uiproj".`,
155
+ projectRelativePathPathHint: " Found Path, but .uipx uses ProjectRelativePath.",
156
+ noSolutionFile: "No .uipx solution file found in directory: {path}",
157
+ invalidStorageFile: "Invalid {fileName} file"
158
+ }
159
+ },
160
+ optionsBuilder: {
161
+ errors: {
162
+ packageInfoRequired: "Package information is required for Pack command",
163
+ outputPathRequired: "Output path is required for Pack command",
164
+ invalidProjectIds: "The following project ids do not exist in the solution: {ids}"
165
+ }
166
+ }
167
+ }
168
+ };
169
+
170
+ // ../packager/solution-packager/src/i18n/locales/en.ts
171
+ var en = {
172
+ solutionpackager: {
173
+ solutionLoader: {
174
+ errors: {
175
+ pathRequired: "Solution directory path is required",
176
+ fileNotFound: "Solution file not found: {path}",
177
+ invalidSolution: "Invalid solution file: {path}",
178
+ projectMustBeObject: "Invalid solution file: {path}. Projects[{index}] must be an object.",
179
+ projectMissingProjectRelativePath: `Invalid solution file: {path}. Projects[{index}] is missing ProjectRelativePath.{pathHint} Use 'uip solution projects add' to add projects, or set ProjectRelativePath to the project file path, for example "Foo/project.uiproj".`,
180
+ projectRelativePathPathHint: " Found Path, but .uipx uses ProjectRelativePath.",
181
+ noSolutionFile: "No .uipx solution file found in directory: {path}",
182
+ invalidStorageFile: "Invalid {fileName} file"
183
+ }
184
+ },
185
+ optionsBuilder: {
186
+ errors: {
187
+ packageInfoRequired: "Package information is required for Pack command",
188
+ outputPathRequired: "Output path is required for Pack command",
189
+ invalidProjectIds: "The following project ids do not exist in the solution: {ids}"
190
+ }
191
+ }
192
+ }
193
+ };
194
+ // ../packager/solution-packager/src/i18n/locales/es.json
195
+ var es_default = {
196
+ solutionpackager: {
197
+ solutionLoader: {
198
+ errors: {
199
+ pathRequired: "Solution directory path is required",
200
+ fileNotFound: "Solution file not found: {path}",
201
+ invalidSolution: "Invalid solution file: {path}",
202
+ projectMustBeObject: "Invalid solution file: {path}. Projects[{index}] must be an object.",
203
+ projectMissingProjectRelativePath: `Invalid solution file: {path}. Projects[{index}] is missing ProjectRelativePath.{pathHint} Use 'uip solution projects add' to add projects, or set ProjectRelativePath to the project file path, for example "Foo/project.uiproj".`,
204
+ projectRelativePathPathHint: " Found Path, but .uipx uses ProjectRelativePath.",
205
+ noSolutionFile: "No .uipx solution file found in directory: {path}",
206
+ invalidStorageFile: "Invalid {fileName} file"
207
+ }
208
+ },
209
+ optionsBuilder: {
210
+ errors: {
211
+ packageInfoRequired: "Package information is required for Pack command",
212
+ outputPathRequired: "Output path is required for Pack command",
213
+ invalidProjectIds: "The following project ids do not exist in the solution: {ids}"
214
+ }
215
+ }
216
+ }
217
+ };
218
+ // ../packager/solution-packager/src/i18n/locales/es-MX.json
219
+ var es_MX_default = {
220
+ solutionpackager: {
221
+ solutionLoader: {
222
+ errors: {
223
+ pathRequired: "Solution directory path is required",
224
+ fileNotFound: "Solution file not found: {path}",
225
+ invalidSolution: "Invalid solution file: {path}",
226
+ projectMustBeObject: "Invalid solution file: {path}. Projects[{index}] must be an object.",
227
+ projectMissingProjectRelativePath: `Invalid solution file: {path}. Projects[{index}] is missing ProjectRelativePath.{pathHint} Use 'uip solution projects add' to add projects, or set ProjectRelativePath to the project file path, for example "Foo/project.uiproj".`,
228
+ projectRelativePathPathHint: " Found Path, but .uipx uses ProjectRelativePath.",
229
+ noSolutionFile: "No .uipx solution file found in directory: {path}",
230
+ invalidStorageFile: "Invalid {fileName} file"
231
+ }
232
+ },
233
+ optionsBuilder: {
234
+ errors: {
235
+ packageInfoRequired: "Package information is required for Pack command",
236
+ outputPathRequired: "Output path is required for Pack command",
237
+ invalidProjectIds: "The following project ids do not exist in the solution: {ids}"
238
+ }
239
+ }
240
+ }
241
+ };
242
+ // ../packager/solution-packager/src/i18n/locales/fr.json
243
+ var fr_default = {
244
+ solutionpackager: {
245
+ solutionLoader: {
246
+ errors: {
247
+ pathRequired: "Solution directory path is required",
248
+ fileNotFound: "Solution file not found: {path}",
249
+ invalidSolution: "Invalid solution file: {path}",
250
+ projectMustBeObject: "Invalid solution file: {path}. Projects[{index}] must be an object.",
251
+ projectMissingProjectRelativePath: `Invalid solution file: {path}. Projects[{index}] is missing ProjectRelativePath.{pathHint} Use 'uip solution projects add' to add projects, or set ProjectRelativePath to the project file path, for example "Foo/project.uiproj".`,
252
+ projectRelativePathPathHint: " Found Path, but .uipx uses ProjectRelativePath.",
253
+ noSolutionFile: "No .uipx solution file found in directory: {path}",
254
+ invalidStorageFile: "Invalid {fileName} file"
255
+ }
256
+ },
257
+ optionsBuilder: {
258
+ errors: {
259
+ packageInfoRequired: "Package information is required for Pack command",
260
+ outputPathRequired: "Output path is required for Pack command",
261
+ invalidProjectIds: "The following project ids do not exist in the solution: {ids}"
262
+ }
263
+ }
264
+ }
265
+ };
266
+ // ../packager/solution-packager/src/i18n/locales/ja.json
267
+ var ja_default = {
268
+ solutionpackager: {
269
+ solutionLoader: {
270
+ errors: {
271
+ pathRequired: "Solution directory path is required",
272
+ fileNotFound: "Solution file not found: {path}",
273
+ invalidSolution: "Invalid solution file: {path}",
274
+ projectMustBeObject: "Invalid solution file: {path}. Projects[{index}] must be an object.",
275
+ projectMissingProjectRelativePath: `Invalid solution file: {path}. Projects[{index}] is missing ProjectRelativePath.{pathHint} Use 'uip solution projects add' to add projects, or set ProjectRelativePath to the project file path, for example "Foo/project.uiproj".`,
276
+ projectRelativePathPathHint: " Found Path, but .uipx uses ProjectRelativePath.",
277
+ noSolutionFile: "No .uipx solution file found in directory: {path}",
278
+ invalidStorageFile: "Invalid {fileName} file"
279
+ }
280
+ },
281
+ optionsBuilder: {
282
+ errors: {
283
+ packageInfoRequired: "Package information is required for Pack command",
284
+ outputPathRequired: "Output path is required for Pack command",
285
+ invalidProjectIds: "The following project ids do not exist in the solution: {ids}"
286
+ }
287
+ }
288
+ }
289
+ };
290
+ // ../packager/solution-packager/src/i18n/locales/ko.json
291
+ var ko_default = {
292
+ solutionpackager: {
293
+ solutionLoader: {
294
+ errors: {
295
+ pathRequired: "Solution directory path is required",
296
+ fileNotFound: "Solution file not found: {path}",
297
+ invalidSolution: "Invalid solution file: {path}",
298
+ projectMustBeObject: "Invalid solution file: {path}. Projects[{index}] must be an object.",
299
+ projectMissingProjectRelativePath: `Invalid solution file: {path}. Projects[{index}] is missing ProjectRelativePath.{pathHint} Use 'uip solution projects add' to add projects, or set ProjectRelativePath to the project file path, for example "Foo/project.uiproj".`,
300
+ projectRelativePathPathHint: " Found Path, but .uipx uses ProjectRelativePath.",
301
+ noSolutionFile: "No .uipx solution file found in directory: {path}",
302
+ invalidStorageFile: "Invalid {fileName} file"
303
+ }
304
+ },
305
+ optionsBuilder: {
306
+ errors: {
307
+ packageInfoRequired: "Package information is required for Pack command",
308
+ outputPathRequired: "Output path is required for Pack command",
309
+ invalidProjectIds: "The following project ids do not exist in the solution: {ids}"
310
+ }
311
+ }
312
+ }
313
+ };
314
+ // ../packager/solution-packager/src/i18n/locales/pt.json
315
+ var pt_default = {
316
+ solutionpackager: {
317
+ solutionLoader: {
318
+ errors: {
319
+ pathRequired: "Solution directory path is required",
320
+ fileNotFound: "Solution file not found: {path}",
321
+ invalidSolution: "Invalid solution file: {path}",
322
+ projectMustBeObject: "Invalid solution file: {path}. Projects[{index}] must be an object.",
323
+ projectMissingProjectRelativePath: `Invalid solution file: {path}. Projects[{index}] is missing ProjectRelativePath.{pathHint} Use 'uip solution projects add' to add projects, or set ProjectRelativePath to the project file path, for example "Foo/project.uiproj".`,
324
+ projectRelativePathPathHint: " Found Path, but .uipx uses ProjectRelativePath.",
325
+ noSolutionFile: "No .uipx solution file found in directory: {path}",
326
+ invalidStorageFile: "Invalid {fileName} file"
327
+ }
328
+ },
329
+ optionsBuilder: {
330
+ errors: {
331
+ packageInfoRequired: "Package information is required for Pack command",
332
+ outputPathRequired: "Output path is required for Pack command",
333
+ invalidProjectIds: "The following project ids do not exist in the solution: {ids}"
334
+ }
335
+ }
336
+ }
337
+ };
338
+ // ../packager/solution-packager/src/i18n/locales/pt-BR.json
339
+ var pt_BR_default = {
340
+ solutionpackager: {
341
+ solutionLoader: {
342
+ errors: {
343
+ pathRequired: "Solution directory path is required",
344
+ fileNotFound: "Solution file not found: {path}",
345
+ invalidSolution: "Invalid solution file: {path}",
346
+ projectMustBeObject: "Invalid solution file: {path}. Projects[{index}] must be an object.",
347
+ projectMissingProjectRelativePath: `Invalid solution file: {path}. Projects[{index}] is missing ProjectRelativePath.{pathHint} Use 'uip solution projects add' to add projects, or set ProjectRelativePath to the project file path, for example "Foo/project.uiproj".`,
348
+ projectRelativePathPathHint: " Found Path, but .uipx uses ProjectRelativePath.",
349
+ noSolutionFile: "No .uipx solution file found in directory: {path}",
350
+ invalidStorageFile: "Invalid {fileName} file"
351
+ }
352
+ },
353
+ optionsBuilder: {
354
+ errors: {
355
+ packageInfoRequired: "Package information is required for Pack command",
356
+ outputPathRequired: "Output path is required for Pack command",
357
+ invalidProjectIds: "The following project ids do not exist in the solution: {ids}"
358
+ }
359
+ }
360
+ }
361
+ };
362
+ // ../packager/solution-packager/src/i18n/locales/ro.json
363
+ var ro_default = {
364
+ solutionpackager: {
365
+ solutionLoader: {
366
+ errors: {
367
+ pathRequired: "Solution directory path is required",
368
+ fileNotFound: "Solution file not found: {path}",
369
+ invalidSolution: "Invalid solution file: {path}",
370
+ projectMustBeObject: "Invalid solution file: {path}. Projects[{index}] must be an object.",
371
+ projectMissingProjectRelativePath: `Invalid solution file: {path}. Projects[{index}] is missing ProjectRelativePath.{pathHint} Use 'uip solution projects add' to add projects, or set ProjectRelativePath to the project file path, for example "Foo/project.uiproj".`,
372
+ projectRelativePathPathHint: " Found Path, but .uipx uses ProjectRelativePath.",
373
+ noSolutionFile: "No .uipx solution file found in directory: {path}",
374
+ invalidStorageFile: "Invalid {fileName} file"
375
+ }
376
+ },
377
+ optionsBuilder: {
378
+ errors: {
379
+ packageInfoRequired: "Package information is required for Pack command",
380
+ outputPathRequired: "Output path is required for Pack command",
381
+ invalidProjectIds: "The following project ids do not exist in the solution: {ids}"
382
+ }
383
+ }
384
+ }
385
+ };
386
+ // ../packager/solution-packager/src/i18n/locales/ru.json
387
+ var ru_default = {
388
+ solutionpackager: {
389
+ solutionLoader: {
390
+ errors: {
391
+ pathRequired: "Solution directory path is required",
392
+ fileNotFound: "Solution file not found: {path}",
393
+ invalidSolution: "Invalid solution file: {path}",
394
+ projectMustBeObject: "Invalid solution file: {path}. Projects[{index}] must be an object.",
395
+ projectMissingProjectRelativePath: `Invalid solution file: {path}. Projects[{index}] is missing ProjectRelativePath.{pathHint} Use 'uip solution projects add' to add projects, or set ProjectRelativePath to the project file path, for example "Foo/project.uiproj".`,
396
+ projectRelativePathPathHint: " Found Path, but .uipx uses ProjectRelativePath.",
397
+ noSolutionFile: "No .uipx solution file found in directory: {path}",
398
+ invalidStorageFile: "Invalid {fileName} file"
399
+ }
400
+ },
401
+ optionsBuilder: {
402
+ errors: {
403
+ packageInfoRequired: "Package information is required for Pack command",
404
+ outputPathRequired: "Output path is required for Pack command",
405
+ invalidProjectIds: "The following project ids do not exist in the solution: {ids}"
406
+ }
407
+ }
408
+ }
409
+ };
410
+ // ../packager/solution-packager/src/i18n/locales/tr.json
411
+ var tr_default = {
412
+ solutionpackager: {
413
+ solutionLoader: {
414
+ errors: {
415
+ pathRequired: "Solution directory path is required",
416
+ fileNotFound: "Solution file not found: {path}",
417
+ invalidSolution: "Invalid solution file: {path}",
418
+ projectMustBeObject: "Invalid solution file: {path}. Projects[{index}] must be an object.",
419
+ projectMissingProjectRelativePath: `Invalid solution file: {path}. Projects[{index}] is missing ProjectRelativePath.{pathHint} Use 'uip solution projects add' to add projects, or set ProjectRelativePath to the project file path, for example "Foo/project.uiproj".`,
420
+ projectRelativePathPathHint: " Found Path, but .uipx uses ProjectRelativePath.",
421
+ noSolutionFile: "No .uipx solution file found in directory: {path}",
422
+ invalidStorageFile: "Invalid {fileName} file"
423
+ }
424
+ },
425
+ optionsBuilder: {
426
+ errors: {
427
+ packageInfoRequired: "Package information is required for Pack command",
428
+ outputPathRequired: "Output path is required for Pack command",
429
+ invalidProjectIds: "The following project ids do not exist in the solution: {ids}"
430
+ }
431
+ }
432
+ }
433
+ };
434
+ // ../packager/solution-packager/src/i18n/locales/zh-CN.json
435
+ var zh_CN_default = {
436
+ solutionpackager: {
437
+ solutionLoader: {
438
+ errors: {
439
+ pathRequired: "Solution directory path is required",
440
+ fileNotFound: "Solution file not found: {path}",
441
+ invalidSolution: "Invalid solution file: {path}",
442
+ projectMustBeObject: "Invalid solution file: {path}. Projects[{index}] must be an object.",
443
+ projectMissingProjectRelativePath: `Invalid solution file: {path}. Projects[{index}] is missing ProjectRelativePath.{pathHint} Use 'uip solution projects add' to add projects, or set ProjectRelativePath to the project file path, for example "Foo/project.uiproj".`,
444
+ projectRelativePathPathHint: " Found Path, but .uipx uses ProjectRelativePath.",
445
+ noSolutionFile: "No .uipx solution file found in directory: {path}",
446
+ invalidStorageFile: "Invalid {fileName} file"
447
+ }
448
+ },
449
+ optionsBuilder: {
450
+ errors: {
451
+ packageInfoRequired: "Package information is required for Pack command",
452
+ outputPathRequired: "Output path is required for Pack command",
453
+ invalidProjectIds: "The following project ids do not exist in the solution: {ids}"
454
+ }
455
+ }
456
+ }
457
+ };
458
+ // ../packager/solution-packager/src/i18n/locales/zh-TW.json
459
+ var zh_TW_default = {
460
+ solutionpackager: {
461
+ solutionLoader: {
462
+ errors: {
463
+ pathRequired: "Solution directory path is required",
464
+ fileNotFound: "Solution file not found: {path}",
465
+ invalidSolution: "Invalid solution file: {path}",
466
+ projectMustBeObject: "Invalid solution file: {path}. Projects[{index}] must be an object.",
467
+ projectMissingProjectRelativePath: `Invalid solution file: {path}. Projects[{index}] is missing ProjectRelativePath.{pathHint} Use 'uip solution projects add' to add projects, or set ProjectRelativePath to the project file path, for example "Foo/project.uiproj".`,
468
+ projectRelativePathPathHint: " Found Path, but .uipx uses ProjectRelativePath.",
469
+ noSolutionFile: "No .uipx solution file found in directory: {path}",
470
+ invalidStorageFile: "Invalid {fileName} file"
471
+ }
472
+ },
473
+ optionsBuilder: {
474
+ errors: {
475
+ packageInfoRequired: "Package information is required for Pack command",
476
+ outputPathRequired: "Output path is required for Pack command",
477
+ invalidProjectIds: "The following project ids do not exist in the solution: {ids}"
478
+ }
479
+ }
480
+ }
481
+ };
482
+ // ../packager/solution-packager/src/i18n/locales/zu.json
483
+ var zu_default = {
484
+ solutionpackager: {
485
+ solutionLoader: {
486
+ errors: {
487
+ pathRequired: "Solution directory path is required",
488
+ fileNotFound: "Solution file not found: {path}",
489
+ invalidSolution: "Invalid solution file: {path}",
490
+ projectMustBeObject: "Invalid solution file: {path}. Projects[{index}] must be an object.",
491
+ projectMissingProjectRelativePath: `Invalid solution file: {path}. Projects[{index}] is missing ProjectRelativePath.{pathHint} Use 'uip solution projects add' to add projects, or set ProjectRelativePath to the project file path, for example "Foo/project.uiproj".`,
492
+ projectRelativePathPathHint: " Found Path, but .uipx uses ProjectRelativePath.",
493
+ noSolutionFile: "No .uipx solution file found in directory: {path}",
494
+ invalidStorageFile: "Invalid {fileName} file"
495
+ }
496
+ },
497
+ optionsBuilder: {
498
+ errors: {
499
+ packageInfoRequired: "Package information is required for Pack command",
500
+ outputPathRequired: "Output path is required for Pack command",
501
+ invalidProjectIds: "The following project ids do not exist in the solution: {ids}"
502
+ }
503
+ }
504
+ }
505
+ };
506
+
507
+ // ../packager/solution-packager/src/i18n/index.ts
508
+ I18nManager.registerTranslations("en", en);
509
+ I18nManager.registerTranslations("de", de_default);
510
+ I18nManager.registerTranslations("es", es_default);
511
+ I18nManager.registerTranslations("es-MX", es_MX_default);
512
+ I18nManager.registerTranslations("fr", fr_default);
513
+ I18nManager.registerTranslations("ja", ja_default);
514
+ I18nManager.registerTranslations("ko", ko_default);
515
+ I18nManager.registerTranslations("pt", pt_default);
516
+ I18nManager.registerTranslations("pt-BR", pt_BR_default);
517
+ I18nManager.registerTranslations("ro", ro_default);
518
+ I18nManager.registerTranslations("ru", ru_default);
519
+ I18nManager.registerTranslations("tr", tr_default);
520
+ I18nManager.registerTranslations("zh-CN", zh_CN_default);
521
+ I18nManager.registerTranslations("zh-TW", zh_TW_default);
522
+ I18nManager.registerTranslations("zu", zu_default);
523
+ // ../packager/solution-packager/src/services/options-builder.ts
524
+ class OptionsBuilder {
525
+ packageIdReader;
526
+ packService;
527
+ fileSystem;
528
+ constructor(packageIdReader, packService, fileSystem) {
529
+ this.packageIdReader = packageIdReader;
530
+ this.packService = packService;
531
+ this.fileSystem = fileSystem;
532
+ }
533
+ static FILES_DIRECTORY_NAME = "files";
534
+ static DEFAULT_AUTHOR = "UiPath";
535
+ static DEFAULT_DESCRIPTION = "Created by UiPath";
536
+ async buildSolutionPackOptions(parameters, solution) {
537
+ if (!parameters.outputPath) {
538
+ throw new Error(translate.t("solutionpackager.optionsBuilder.errors.outputPathRequired"));
539
+ }
540
+ await this.createOutputFilesDirectoryAsync(parameters.outputPath);
541
+ if (!parameters.package.id || parameters.package.id.trim() === "") {
542
+ parameters.package.id = solution.Name;
543
+ }
544
+ return {
545
+ solutionFilePath: solution.filePath,
546
+ outputPath: parameters.outputPath,
547
+ connection: parameters.connection,
548
+ configuration: parameters.configuration,
549
+ package: parameters.package,
550
+ solutionType: parameters.solutionType,
551
+ publishId: parameters.publishInfo?.id,
552
+ projectsToBuild: solution.Projects.map((p) => p.Id)
553
+ };
554
+ }
555
+ async resolveMemberMetadataAsync(solutionOptions, projectPath) {
556
+ const declared = await this.loadDeclaredMetadataAsync(projectPath);
557
+ return {
558
+ author: solutionOptions.package.author?.trim() || declared?.author || OptionsBuilder.DEFAULT_AUTHOR,
559
+ description: solutionOptions.package.description?.trim() || declared?.description || OptionsBuilder.DEFAULT_DESCRIPTION
560
+ };
561
+ }
562
+ async loadDeclaredMetadataAsync(projectPath) {
563
+ try {
564
+ const loaded = await new ProjectLoader(this.fileSystem).loadProject(projectPath);
565
+ return {
566
+ author: loaded.author,
567
+ description: loaded.description
568
+ };
569
+ } catch {
570
+ return;
571
+ }
572
+ }
573
+ async createOutputFilesDirectoryAsync(outputPath) {
574
+ const filesDir = Path.join(outputPath, OptionsBuilder.FILES_DIRECTORY_NAME);
575
+ await this.fileSystem.mkdir(filesDir);
576
+ }
577
+ async buildProjectPackOptions(solutionOptions, project, solutionName) {
578
+ const projectPath = this.resolveProjectPath(solutionOptions, project);
579
+ const packageInfo = {
580
+ ...solutionOptions.package,
581
+ id: await this.packageIdReader.read(project, solutionOptions.inputPath, solutionName) || "",
582
+ ...await this.resolveMemberMetadataAsync(solutionOptions, projectPath)
583
+ };
584
+ if (!solutionOptions.outputPath) {
585
+ throw new Error(translate.t("solutionpackager.optionsBuilder.errors.outputPathRequired"));
586
+ }
587
+ const packageId = !packageInfo.id || packageInfo.id.trim() === "" ? Path.basename(projectPath) : packageInfo.id;
588
+ packageInfo.id = this.packService.sanitizePackageId(packageId);
589
+ return {
590
+ projectPath,
591
+ excludeConfiguredSources: solutionOptions.excludeConfiguredSources ?? false,
592
+ nuGetSourcesConfigPath: solutionOptions.nuGetSourcesConfigPath,
593
+ feedFolder: solutionOptions.feedFolder,
594
+ logLevel: solutionOptions.logLevel,
595
+ skipAnalyze: solutionOptions.validateOptions.skipAnalyze,
596
+ skipValidate: solutionOptions.validateOptions.skipValidate,
597
+ ignoredRules: solutionOptions.validateOptions.ignoredRules,
598
+ projectStorageId: project.StorageId,
599
+ detailedLogPath: solutionOptions.detailedLogPath,
600
+ policyFilePath: solutionOptions.validateOptions.governanceFilePath,
601
+ policyFileType: solutionOptions.validateOptions.governanceFileType,
602
+ outputPath: await this.buildProjectOutputPath(solutionOptions.outputPath, project),
603
+ outputType: undefined,
604
+ projectType: project.Type,
605
+ package: packageInfo,
606
+ skipDependencyOptimization: solutionOptions.packOptions?.skipDependencyOptimization ?? false,
607
+ includeSources: solutionOptions.packOptions?.includeSources ?? false,
608
+ splitPackages: solutionOptions.packOptions?.splitPackages ?? false
609
+ };
610
+ }
611
+ buildProjectValidateOptions(solutionOptions, project) {
612
+ return {
613
+ projectPath: this.resolveProjectPath(solutionOptions, project),
614
+ excludeConfiguredSources: solutionOptions.excludeConfiguredSources ?? false,
615
+ nuGetSourcesConfigPath: solutionOptions.nuGetSourcesConfigPath,
616
+ feedFolder: solutionOptions.feedFolder,
617
+ logLevel: solutionOptions.logLevel,
618
+ skipAnalyze: solutionOptions.validateOptions.skipAnalyze,
619
+ skipValidate: solutionOptions.validateOptions.skipValidate,
620
+ ignoredRules: solutionOptions.validateOptions.ignoredRules,
621
+ defaultSeverity: solutionOptions.validateOptions.defaultSeverity,
622
+ detailedLogPath: solutionOptions.detailedLogPath,
623
+ policyFilePath: solutionOptions.validateOptions.governanceFilePath,
624
+ policyFileType: solutionOptions.validateOptions.governanceFileType
625
+ };
626
+ }
627
+ async buildProjectRestoreOptions(solutionOptions, project) {
628
+ if (!solutionOptions.outputPath) {
629
+ throw new Error(translate.t("solutionpackager.optionsBuilder.errors.outputPathRequired"));
630
+ }
631
+ return {
632
+ projectPath: this.resolveProjectPath(solutionOptions, project),
633
+ excludeConfiguredSources: solutionOptions.excludeConfiguredSources ?? false,
634
+ nuGetSourcesConfigPath: solutionOptions.nuGetSourcesConfigPath,
635
+ feedFolder: solutionOptions.feedFolder,
636
+ logLevel: solutionOptions.logLevel,
637
+ outputPath: await this.buildProjectOutputPath(solutionOptions.outputPath, project)
638
+ };
639
+ }
640
+ buildProjectCleanupOptions(solutionOptions, project) {
641
+ return {
642
+ projectPath: this.resolveProjectPath(solutionOptions, project),
643
+ excludeConfiguredSources: solutionOptions.excludeConfiguredSources ?? false,
644
+ nuGetSourcesConfigPath: solutionOptions.nuGetSourcesConfigPath,
645
+ feedFolder: solutionOptions.feedFolder,
646
+ logLevel: solutionOptions.logLevel,
647
+ dryRun: solutionOptions.cleanupOptions.dryRun,
648
+ skipImports: solutionOptions.cleanupOptions.skipImports
649
+ };
650
+ }
651
+ resolveProjectPath(solutionOptions, project) {
652
+ return Path.join(solutionOptions.inputPath, Path.dirname(project.ProjectRelativePath));
653
+ }
654
+ async buildProjectOutputPath(solutionOutputPath, project) {
655
+ const filesDir = Path.join(solutionOutputPath, OptionsBuilder.FILES_DIRECTORY_NAME);
656
+ const projectOutputPath = Path.join(filesDir, project.Id);
657
+ await this.fileSystem.mkdir(projectOutputPath);
658
+ return projectOutputPath;
659
+ }
660
+ }
661
+
662
+ // ../packager/solution-packager/src/services/solution-cleanup-service.ts
663
+ class SolutionCleanupService {
664
+ optionsBuilder;
665
+ projectExecutor;
666
+ telemetry;
667
+ constructor(optionsBuilder, projectExecutor, telemetry) {
668
+ this.optionsBuilder = optionsBuilder;
669
+ this.projectExecutor = projectExecutor;
670
+ this.telemetry = telemetry;
671
+ }
672
+ async cleanupAsync(parameters, solution, context, cancellationToken) {
673
+ return await this.telemetry.trackDependencyOperation("SolutionPackager.Solution.Cleanup" /* SolutionCleanup */, "cleanup", async () => {
674
+ const projectResults = await Promise.all(solution.Projects.map(async (project) => {
675
+ if (project.ProjectPath == null) {
676
+ return {
677
+ project,
678
+ result: ToolResult.error("INTERNAL_ERROR" /* InternalError */, `Project '${project.Id}' has no ProjectPath; the solution loader must populate it before cleanup.`)
679
+ };
680
+ }
681
+ const result2 = await this.projectExecutor.cleanupAsync(this.optionsBuilder.buildProjectCleanupOptions(parameters, project), project, context, cancellationToken);
682
+ return { project, result: result2 };
683
+ }));
684
+ const failed = projectResults.find((r) => !r.result.isSuccess);
685
+ if (failed) {
686
+ return failed.result;
687
+ }
688
+ const result = ToolResult.success();
689
+ const details = {};
690
+ const changedFilesByProject = this.mergeChangedFiles(projectResults.map((r) => r.result));
691
+ if (Object.keys(changedFilesByProject).length > 0) {
692
+ details.changedFilesByProject = changedFilesByProject;
693
+ }
694
+ const cleanupByProject = this.collectProjectCleanups(projectResults);
695
+ if (Object.keys(cleanupByProject).length > 0) {
696
+ details.cleanupByProject = cleanupByProject;
697
+ }
698
+ if (Object.keys(details).length > 0) {
699
+ result.details = details;
700
+ }
701
+ return result;
702
+ }, { [PackagerDimensions.SolutionId]: solution.SolutionId });
703
+ }
704
+ mergeChangedFiles(results) {
705
+ const merged = {};
706
+ for (const result of results) {
707
+ const changed = result.details?.changedFilesByProject;
708
+ if (!changed) {
709
+ continue;
710
+ }
711
+ for (const [projectId, files] of Object.entries(changed)) {
712
+ merged[projectId] = files;
713
+ }
714
+ }
715
+ return merged;
716
+ }
717
+ collectProjectCleanups(results) {
718
+ const byProject = {};
719
+ for (const { project, result } of results) {
720
+ const info = result.details?.projectCleanup;
721
+ if (info) {
722
+ byProject[project.Id] = info;
723
+ }
724
+ }
725
+ return byProject;
726
+ }
727
+ }
728
+
729
+ // ../packager/solution-packager/src/services/solution-loader.ts
730
+ class SolutionLoader {
731
+ fileSystem;
732
+ static SolutionStorageFileName = "SolutionStorage.json";
733
+ constructor(fileSystem) {
734
+ this.fileSystem = fileSystem;
735
+ }
736
+ async loadSolution(solutionPath) {
737
+ if (!solutionPath) {
738
+ throw new Error(translate.t("solutionpackager.solutionLoader.errors.pathRequired"));
739
+ }
740
+ const solutionFilePath = await this.getSolutionFilePathAsync(solutionPath);
741
+ const fileContent = await this.fileSystem.readFile(solutionFilePath);
742
+ if (!fileContent) {
743
+ throw new Error(translate.t("solutionpackager.solutionLoader.errors.fileNotFound", {
744
+ path: solutionFilePath
745
+ }));
746
+ }
747
+ const json = typeof fileContent === "string" ? fileContent : new TextDecoder("utf-8").decode(fileContent);
748
+ const parsed = JSON.parse(json);
749
+ const solution = validateSolutionFile(parsed, solutionFilePath);
750
+ const loadedSolution = {
751
+ ...solution,
752
+ Name: GetSolutionName(),
753
+ filePath: solutionFilePath
754
+ };
755
+ for (const project of loadedSolution.Projects) {
756
+ const projectRelativeDir = Path.dirname(project.ProjectRelativePath);
757
+ project.ProjectPath = Path.join(solutionPath, projectRelativeDir);
758
+ }
759
+ await this.populateStorageIds(loadedSolution, solutionPath);
760
+ return loadedSolution;
761
+ function GetSolutionName() {
762
+ const uipxFileName = Path.basename(solutionFilePath);
763
+ return uipxFileName.replace(/\.uipx$/i, "");
764
+ }
765
+ }
766
+ async getSolutionFilePathAsync(solutionPath) {
767
+ const files = await this.fileSystem.readdir(solutionPath);
768
+ const uipxFile = files.find((file) => file.endsWith(".uipx"));
769
+ if (!uipxFile) {
770
+ throw new Error(translate.t("solutionpackager.solutionLoader.errors.noSolutionFile", {
771
+ path: solutionPath
772
+ }));
773
+ }
774
+ return Path.join(solutionPath, uipxFile);
775
+ }
776
+ async populateStorageIds(solution, rootDirectory) {
777
+ const storageFile = Path.join(rootDirectory, SolutionLoader.SolutionStorageFileName);
778
+ const exists = await this.fileSystem.exists(storageFile);
779
+ if (!exists) {
780
+ return;
781
+ }
782
+ const fileContent = await this.fileSystem.readFile(storageFile);
783
+ if (!fileContent) {
784
+ return;
785
+ }
786
+ const json = typeof fileContent === "string" ? fileContent : new TextDecoder("utf-8").decode(fileContent);
787
+ const storage = JSON.parse(json);
788
+ if (!storage?.Projects) {
789
+ throw new Error(translate.t("solutionpackager.solutionLoader.errors.invalidStorageFile", {
790
+ fileName: SolutionLoader.SolutionStorageFileName
791
+ }));
792
+ }
793
+ for (const project of solution.Projects) {
794
+ const storageProject = storage.Projects.find((sp) => sp.ProjectRelativePath === project.ProjectRelativePath);
795
+ if (storageProject) {
796
+ project.StorageId = storageProject.ProjectId;
797
+ }
798
+ }
799
+ }
800
+ }
801
+ function validateSolutionFile(parsed, solutionFilePath) {
802
+ if (!isRecord(parsed)) {
803
+ throw new Error(translate.t("solutionpackager.solutionLoader.errors.invalidSolution", {
804
+ path: solutionFilePath
805
+ }));
806
+ }
807
+ if (!Array.isArray(parsed.Projects)) {
808
+ throw new Error(translate.t("solutionpackager.solutionLoader.errors.invalidSolution", {
809
+ path: solutionFilePath
810
+ }));
811
+ }
812
+ for (const [index, project] of parsed.Projects.entries()) {
813
+ if (!isRecord(project)) {
814
+ throw new Error(translate.t("solutionpackager.solutionLoader.errors.projectMustBeObject", {
815
+ path: solutionFilePath,
816
+ index
817
+ }));
818
+ }
819
+ if (typeof project.ProjectRelativePath !== "string" || !project.ProjectRelativePath.trim()) {
820
+ const pathHint = typeof project.Path === "string" ? translate.t("solutionpackager.solutionLoader.errors.projectRelativePathPathHint") : "";
821
+ throw new Error(translate.t("solutionpackager.solutionLoader.errors.projectMissingProjectRelativePath", {
822
+ path: solutionFilePath,
823
+ index,
824
+ pathHint
825
+ }));
826
+ }
827
+ }
828
+ return parsed;
829
+ }
830
+ function isRecord(value) {
831
+ return typeof value === "object" && value !== null && !Array.isArray(value);
832
+ }
833
+
834
+ // ../packager/solution-packager/src/services/solution-pack-options-validator.ts
835
+ class SolutionPackOptionsValidator extends PackagerParametersValidator {
836
+ async validateAsync(options, _cancellationToken) {
837
+ const destinationResult = this.validateDestinationPath(options.destinationPath);
838
+ if (!destinationResult.isSuccess) {
839
+ return destinationResult;
840
+ }
841
+ return await this.validateGovernanceOptions(options.validateOptions);
842
+ }
843
+ }
844
+
845
+ // ../packager/solution-packager/src/services/solution-pack-service.ts
846
+ class SolutionPackService {
847
+ optionsBuilder;
848
+ toolsFactory;
849
+ projectExecutor;
850
+ zipService;
851
+ fileSystem;
852
+ telemetry;
853
+ packageSignService;
854
+ constructor(optionsBuilder, toolsFactory, projectExecutor, zipService, fileSystem, telemetry, packageSignService) {
855
+ this.optionsBuilder = optionsBuilder;
856
+ this.toolsFactory = toolsFactory;
857
+ this.projectExecutor = projectExecutor;
858
+ this.zipService = zipService;
859
+ this.fileSystem = fileSystem;
860
+ this.telemetry = telemetry;
861
+ this.packageSignService = packageSignService;
862
+ }
863
+ async packAsync(parameters, solution, context, cancellationToken) {
864
+ const solutionOptions = await this.optionsBuilder.buildSolutionPackOptions(parameters, solution);
865
+ const prepared = await this.prepareProjectPackOptionsAsync(parameters, solution.Projects, solution.Name);
866
+ if (!prepared.ok) {
867
+ return ToolResult.error(prepared.errorCode, `Solution pack failed: ${prepared.message}`);
868
+ }
869
+ const solutionTool = await this.toolsFactory.createSolutionToolAsync(solution.SolutionId);
870
+ try {
871
+ return await this.telemetry.trackDependencyOperation("SolutionPackager.Solution.Pack" /* SolutionPack */, "pack", async () => {
872
+ const [restoreResult, ...projectResults] = await Promise.all([
873
+ solutionTool.restoreAsync(solutionOptions, cancellationToken),
874
+ ...this.packAllProjectsAsync(prepared.options, context, cancellationToken)
875
+ ]);
876
+ const restoreAndPackResults = [
877
+ restoreResult,
878
+ ...projectResults
879
+ ];
880
+ if (hasFailedResults(restoreAndPackResults)) {
881
+ const failure = ToolResult.error("INTERNAL_ERROR" /* InternalError */, `Solution pack failed: ${getFailedResultsMessage(restoreAndPackResults)}`, getFailedResultsInstructions(restoreAndPackResults));
882
+ failure.details = {
883
+ projects: toProjectDiagnostics(solution.Projects, projectResults)
884
+ };
885
+ return failure;
886
+ }
887
+ const buildResult = await solutionTool.buildAsync(solutionOptions, cancellationToken);
888
+ if (!buildResult.isSuccess) {
889
+ return ToolResult.error(buildResult.errorCode, `Solution build failed: ${buildResult.message || "Unknown error"}`);
890
+ }
891
+ if (!solutionOptions.outputPath) {
892
+ return ToolResult.error("INTERNAL_ERROR" /* InternalError */, "Solution output path is not defined");
893
+ }
894
+ const signResult = await this.signProjectPackagesAsync(projectResults, parameters.signingInfo);
895
+ if (!signResult.isSuccess) {
896
+ return signResult;
897
+ }
898
+ const archivePath = await this.compressSolutionAsync(parameters, solutionOptions.outputPath);
899
+ return new ToolResult("SUCCESS" /* Success */, undefined, [
900
+ archivePath
901
+ ]);
902
+ }, { [PackagerDimensions.SolutionId]: solution.SolutionId });
903
+ } finally {
904
+ const disposeResult = solutionTool.dispose();
905
+ if (disposeResult instanceof Promise) {
906
+ await disposeResult;
907
+ }
908
+ }
909
+ }
910
+ async prepareProjectPackOptionsAsync(parameters, projects, solutionName) {
911
+ const settled = await Promise.allSettled(projects.map((project) => this.optionsBuilder.buildProjectPackOptions(parameters, project, solutionName)));
912
+ const prepared = [];
913
+ const failures = [];
914
+ settled.forEach((result, index) => {
915
+ const project = projects[index];
916
+ if (result.status === "fulfilled") {
917
+ prepared.push({ project, options: result.value });
918
+ return;
919
+ }
920
+ const error = result.reason;
921
+ const message = error instanceof Error ? error.message : String(error);
922
+ failures.push(isPackageIdTooLongError(error) ? {
923
+ message: `${message} (member '${memberFolder(project)}')`,
924
+ isIdFailure: true
925
+ } : { message, isIdFailure: false });
926
+ });
927
+ if (failures.length > 0) {
928
+ return {
929
+ ok: false,
930
+ errorCode: failures.every((failure) => failure.isIdFailure) ? INVALID_PACKAGE_ID : "INTERNAL_ERROR" /* InternalError */,
931
+ message: failures.map((failure) => failure.message).join("; ")
932
+ };
933
+ }
934
+ const conflicts = findPackageIdConflicts(prepared.map((entry) => ({
935
+ folder: memberFolder(entry.project),
936
+ id: entry.options.package?.id ?? ""
937
+ })));
938
+ if (conflicts.length > 0) {
939
+ return {
940
+ ok: false,
941
+ errorCode: INVALID_PACKAGE_ID,
942
+ message: packageIdConflictMessage(conflicts)
943
+ };
944
+ }
945
+ return { ok: true, options: prepared };
946
+ }
947
+ packAllProjectsAsync(prepared, context, cancellationToken) {
948
+ return prepared.map((entry) => this.packSingleProjectAsync(entry, context, cancellationToken));
949
+ }
950
+ async packSingleProjectAsync(prepared, context, cancellationToken) {
951
+ try {
952
+ return await this.projectExecutor.packAsync(prepared.options, prepared.project, context, cancellationToken);
953
+ } catch (error) {
954
+ const errorMessage = error instanceof Error ? error.message : String(error);
955
+ return ToolResult.error("INTERNAL_ERROR" /* InternalError */, errorMessage);
956
+ }
957
+ }
958
+ async signProjectPackagesAsync(projectResults, signingInfo) {
959
+ if (!signingInfo?.certificatePath) {
960
+ return ToolResult.success();
961
+ }
962
+ const producedPaths = projectResults.flatMap((result) => result.packages);
963
+ const resolved = await Promise.all(producedPaths.map(async (producedPath) => ({
964
+ producedPath,
965
+ nupkgs: await resolveProducedNupkgsAsync(this.fileSystem, producedPath)
966
+ })));
967
+ const unresolved = resolved.filter((entry) => entry.nupkgs.length === 0).map((entry) => entry.producedPath);
968
+ if (unresolved.length > 0) {
969
+ return ToolResult.error("INTERNAL_ERROR" /* InternalError */, `Package signing was required but no .nupkg was found to sign for: ${unresolved.join(", ")}.`);
970
+ }
971
+ const nupkgsToSign = resolved.flatMap((entry) => entry.nupkgs);
972
+ return signNupkgsAsync(this.packageSignService, nupkgsToSign, signingInfo);
973
+ }
974
+ async compressSolutionAsync(parameters, outputPath) {
975
+ return await this.telemetry.trackDependencyOperation("SolutionPackager.Solution.Compress" /* SolutionCompress */, "compress", async () => {
976
+ const packageName = parameters.package.id || "solution";
977
+ const version = parameters.package.version || "1.0.0";
978
+ await this.writePackageMetadataAsync(parameters, outputPath);
979
+ const archiveFileName = `${packageName}_${version}.zip`;
980
+ const archivePath = `${parameters.destinationPath}/${archiveFileName}`;
981
+ const zipData = await this.zipService.compressAsync(outputPath);
982
+ await this.fileSystem.writeFile(archivePath, zipData);
983
+ return archivePath;
984
+ });
985
+ }
986
+ async writePackageMetadataAsync(parameters, outputPath) {
987
+ const pkg = parameters.package;
988
+ const metadata = {
989
+ name: pkg.id || "solution",
990
+ version: pkg.version || "1.0.0"
991
+ };
992
+ const optional = {
993
+ releaseNotes: pkg.releaseNotes,
994
+ projectUrl: pkg.projectUrl,
995
+ repositoryType: pkg.repositoryType,
996
+ repositoryUrl: pkg.repositoryUrl,
997
+ repositoryBranch: pkg.repositoryBranch,
998
+ repositoryCommit: pkg.repositoryCommit
999
+ };
1000
+ for (const [key, value] of Object.entries(optional)) {
1001
+ if (value !== undefined && value !== "") {
1002
+ metadata[key] = value;
1003
+ }
1004
+ }
1005
+ const metadataPath = `${outputPath}/package.metadata.json`;
1006
+ await this.fileSystem.writeFile(metadataPath, `${JSON.stringify(metadata, null, 2)}
1007
+ `);
1008
+ }
1009
+ }
1010
+
1011
+ // ../packager/solution-packager/src/services/solution-restore-service.ts
1012
+ class SolutionRestoreService {
1013
+ optionsBuilder;
1014
+ toolsFactory;
1015
+ projectExecutor;
1016
+ telemetry;
1017
+ constructor(optionsBuilder, toolsFactory, projectExecutor, telemetry) {
1018
+ this.optionsBuilder = optionsBuilder;
1019
+ this.toolsFactory = toolsFactory;
1020
+ this.projectExecutor = projectExecutor;
1021
+ this.telemetry = telemetry;
1022
+ }
1023
+ async restoreAsync(parameters, solution, context, cancellationToken) {
1024
+ const solutionOptions = await this.optionsBuilder.buildSolutionPackOptions(parameters, solution);
1025
+ const solutionTool = await this.toolsFactory.createSolutionToolAsync(solution.SolutionId);
1026
+ try {
1027
+ return await this.telemetry.trackDependencyOperation("SolutionPackager.Solution.Restore" /* SolutionRestore */, "restore", async () => {
1028
+ const restoreResults = await Promise.all([
1029
+ solutionTool.restoreAsync(solutionOptions, cancellationToken),
1030
+ ...solution.Projects.map(async (project) => {
1031
+ const projectRestoreOptions = await this.optionsBuilder.buildProjectRestoreOptions(parameters, project);
1032
+ return this.projectExecutor.restoreAsync(projectRestoreOptions, project, context, cancellationToken);
1033
+ })
1034
+ ]);
1035
+ if (hasFailedResults(restoreResults)) {
1036
+ return ToolResult.error("INTERNAL_ERROR" /* InternalError */, `Solution restore failed: ${getFailedResultsMessage(restoreResults)}`, getFailedResultsInstructions(restoreResults));
1037
+ }
1038
+ return ToolResult.success();
1039
+ }, { [PackagerDimensions.SolutionId]: solution.SolutionId });
1040
+ } finally {
1041
+ const disposeResult = solutionTool.dispose();
1042
+ if (disposeResult instanceof Promise) {
1043
+ await disposeResult;
1044
+ }
1045
+ }
1046
+ }
1047
+ }
1048
+
1049
+ // ../packager/solution-packager/src/services/solution-validate-options-validator.ts
1050
+ class SolutionValidateOptionsValidator extends PackagerParametersValidator {
1051
+ async validateAsync(options, _cancellationToken) {
1052
+ return await this.validateGovernanceOptions(options.validateOptions);
1053
+ }
1054
+ }
1055
+
1056
+ // ../packager/solution-packager/src/services/solution-validate-service.ts
1057
+ class SolutionValidateService {
1058
+ optionsBuilder;
1059
+ projectExecutor;
1060
+ telemetry;
1061
+ constructor(optionsBuilder, projectExecutor, telemetry) {
1062
+ this.optionsBuilder = optionsBuilder;
1063
+ this.projectExecutor = projectExecutor;
1064
+ this.telemetry = telemetry;
1065
+ }
1066
+ async validateAsync(parameters, solution, context, cancellationToken) {
1067
+ return await this.telemetry.trackDependencyOperation("SolutionPackager.Solution.Validate" /* SolutionValidate */, "validate", async () => {
1068
+ const projectResults = await Promise.all(solution.Projects.map((project) => {
1069
+ if (project.ProjectPath == null) {
1070
+ return Promise.resolve(ToolResult.error("INTERNAL_ERROR" /* InternalError */, `Project '${project.Id}' has no ProjectPath; the solution loader must populate it before validation.`));
1071
+ }
1072
+ return this.projectExecutor.validateAsync(this.optionsBuilder.buildProjectValidateOptions(parameters, project), project, context, cancellationToken);
1073
+ }));
1074
+ const failed = projectResults.find((r) => !r.isSuccess);
1075
+ return failed ?? ToolResult.success();
1076
+ }, { [PackagerDimensions.SolutionId]: solution.SolutionId });
1077
+ }
1078
+ }
1079
+
1080
+ // ../packager/solution-packager/src/services/solution-packager.ts
1081
+ class SolutionPackager {
1082
+ fileSystem;
1083
+ telemetryService;
1084
+ packageSignService;
1085
+ repository;
1086
+ temporaryStorage;
1087
+ zipService;
1088
+ logger;
1089
+ optionsBuilder;
1090
+ toolsFactory;
1091
+ projectExecutor;
1092
+ solutionLoader;
1093
+ solutionPackService;
1094
+ solutionRestoreService;
1095
+ solutionValidateService;
1096
+ solutionCleanupService;
1097
+ packOptionsValidator;
1098
+ validateOptionsValidator;
1099
+ governancePolicyService;
1100
+ constructor(fileSystem, telemetryService, packageSignService) {
1101
+ this.fileSystem = fileSystem;
1102
+ this.telemetryService = telemetryService;
1103
+ this.packageSignService = packageSignService;
1104
+ this.repository = toolsFactoryRepository;
1105
+ this.temporaryStorage = new TemporaryStorageService(this.fileSystem);
1106
+ this.zipService = new ZipService(this.fileSystem);
1107
+ this.logger = new ToolLogger("SolutionPackager", "PackSolution");
1108
+ this.packOptionsValidator = new SolutionPackOptionsValidator(this.logger, this.fileSystem);
1109
+ this.validateOptionsValidator = new SolutionValidateOptionsValidator(this.logger, this.fileSystem);
1110
+ const packService = new PackService;
1111
+ const packageIdReader = new PackageIdReader(this.fileSystem, packService);
1112
+ this.optionsBuilder = new OptionsBuilder(packageIdReader, packService, this.fileSystem);
1113
+ this.toolsFactory = new ToolsFactory(this.repository, this.fileSystem);
1114
+ this.projectExecutor = new ProjectToolExecutor(this.toolsFactory, this.telemetryService);
1115
+ this.solutionLoader = new SolutionLoader(this.fileSystem);
1116
+ this.governancePolicyService = new GovernancePolicyService(this.fileSystem, this.temporaryStorage);
1117
+ this.solutionPackService = new SolutionPackService(this.optionsBuilder, this.toolsFactory, this.projectExecutor, this.zipService, this.fileSystem, this.telemetryService, this.packageSignService);
1118
+ this.solutionRestoreService = new SolutionRestoreService(this.optionsBuilder, this.toolsFactory, this.projectExecutor, this.telemetryService);
1119
+ this.solutionValidateService = new SolutionValidateService(this.optionsBuilder, this.projectExecutor, this.telemetryService);
1120
+ this.solutionCleanupService = new SolutionCleanupService(this.optionsBuilder, this.projectExecutor, this.telemetryService);
1121
+ }
1122
+ async setupAsync(input, operationId) {
1123
+ this.telemetryService.setOperationId(operationId);
1124
+ await this.temporaryStorage.cleanup();
1125
+ if (typeof input === "string") {
1126
+ return input;
1127
+ }
1128
+ const inputPath = await this.temporaryStorage.getTempSubfolderPathAsync("input");
1129
+ await this.zipService.extractAsync(input, inputPath);
1130
+ const entries = await this.fileSystem.readdir(inputPath);
1131
+ if (entries.length === 1) {
1132
+ const innerPath = Path.join(inputPath, entries[0]);
1133
+ const stat = await this.fileSystem.stat(innerPath);
1134
+ if (stat?.isDirectory()) {
1135
+ return innerPath;
1136
+ }
1137
+ }
1138
+ return inputPath;
1139
+ }
1140
+ async setupWithUrlAsync(downloadUrl, accessToken, operationId) {
1141
+ const headers = {};
1142
+ if (accessToken) {
1143
+ headers.Authorization = `Bearer ${accessToken}`;
1144
+ }
1145
+ const response = await fetch(downloadUrl, { headers });
1146
+ if (!response.ok) {
1147
+ throw new Error(`Failed to download solution: ${response.status} ${response.statusText}`);
1148
+ }
1149
+ const arrayBuffer = await response.arrayBuffer();
1150
+ const zipData = new Uint8Array(arrayBuffer);
1151
+ return this.setupAsync(zipData, operationId);
1152
+ }
1153
+ async packSolutionAsync(options, cancellationToken) {
1154
+ return await this.telemetryService.trackDependencyOperation("SolutionPackager.PackSolution" /* SolutionPackagerPackSolution */, "pack", async () => {
1155
+ try {
1156
+ await this.governancePolicyService.resolveGovernancePolicyAsync(options.validateOptions, options.connection, cancellationToken);
1157
+ let result = await this.packOptionsValidator.validateAsync(options, cancellationToken);
1158
+ if (!result.isSuccess) {
1159
+ return result;
1160
+ }
1161
+ if (!options.outputPath) {
1162
+ options.outputPath = await this.temporaryStorage.getTempSubfolderPathAsync("output");
1163
+ }
1164
+ const loadedSolution = await this.solutionLoader.loadSolution(options.inputPath);
1165
+ const solution = this.filterSolutionProjects(loadedSolution, options.projectDesignIds);
1166
+ const context = this.createOperationContext(options, solution);
1167
+ result = await this.solutionPackService.packAsync(options, solution, context, cancellationToken);
1168
+ if (result.isSuccess) {
1169
+ this.logger.info(`Solution pack completed successfully. Packages: ${result.packages.join(", ")}`);
1170
+ } else {
1171
+ this.logger.error(`Solution pack failed with error code ${result.errorCode}: ${result.message}`);
1172
+ }
1173
+ return result;
1174
+ } catch (error) {
1175
+ const errorMessage = error instanceof Error ? error.message : String(error);
1176
+ this.logger.error(`Processing error: ${errorMessage}`);
1177
+ return ToolResult.error("INTERNAL_ERROR" /* InternalError */, `Solution pack failed: ${errorMessage}`, carriedInstructions(error));
1178
+ } finally {
1179
+ await this.temporaryStorage.cleanup();
1180
+ }
1181
+ });
1182
+ }
1183
+ async validateSolutionAsync(options, cancellationToken) {
1184
+ return await this.telemetryService.trackDependencyOperation("SolutionPackager.ValidateSolution" /* SolutionPackagerValidateSolution */, "validate", async () => {
1185
+ try {
1186
+ await this.governancePolicyService.resolveGovernancePolicyAsync(options.validateOptions, options.connection, cancellationToken, "analyze");
1187
+ const validationResult = await this.validateOptionsValidator.validateAsync(options, cancellationToken);
1188
+ if (!validationResult.isSuccess) {
1189
+ return validationResult;
1190
+ }
1191
+ const loadedSolution = await this.solutionLoader.loadSolution(options.inputPath);
1192
+ const solution = this.filterSolutionProjects(loadedSolution, options.projectDesignIds);
1193
+ const context = this.createOperationContext(options, solution);
1194
+ const result = await this.solutionValidateService.validateAsync(options, solution, context, cancellationToken);
1195
+ if (result.isSuccess) {
1196
+ this.logger.info("Solution validate completed successfully.");
1197
+ } else {
1198
+ this.logger.error(`Solution validate failed with error code ${result.errorCode}: ${result.message}`);
1199
+ }
1200
+ return result;
1201
+ } catch (error) {
1202
+ const errorMessage = error instanceof Error ? error.message : String(error);
1203
+ this.logger.error(`Processing error: ${errorMessage}`);
1204
+ return ToolResult.error("INTERNAL_ERROR" /* InternalError */, `Solution validate failed: ${errorMessage}`, carriedInstructions(error));
1205
+ } finally {
1206
+ await this.temporaryStorage.cleanup();
1207
+ }
1208
+ });
1209
+ }
1210
+ async restoreSolutionAsync(options, cancellationToken) {
1211
+ return await this.telemetryService.trackDependencyOperation("SolutionPackager.RestoreSolution" /* SolutionPackagerRestoreSolution */, "restore", async () => {
1212
+ try {
1213
+ if (!options.outputPath) {
1214
+ options.outputPath = await this.temporaryStorage.getTempSubfolderPathAsync("restore");
1215
+ }
1216
+ const loadedSolution = await this.solutionLoader.loadSolution(options.inputPath);
1217
+ const solution = this.filterSolutionProjects(loadedSolution, options.projectDesignIds);
1218
+ const context = this.createOperationContext(options, solution);
1219
+ const result = await this.solutionRestoreService.restoreAsync(options, solution, context, cancellationToken);
1220
+ if (result.isSuccess) {
1221
+ this.logger.info("Solution restore completed successfully.");
1222
+ } else {
1223
+ this.logger.error(`Solution restore failed with error code ${result.errorCode}: ${result.message}`);
1224
+ }
1225
+ return result;
1226
+ } catch (error) {
1227
+ const errorMessage = error instanceof Error ? error.message : String(error);
1228
+ this.logger.error(`Processing error: ${errorMessage}`);
1229
+ return ToolResult.error("INTERNAL_ERROR" /* InternalError */, `Solution restore failed: ${errorMessage}`);
1230
+ } finally {
1231
+ await this.temporaryStorage.cleanup();
1232
+ }
1233
+ });
1234
+ }
1235
+ async cleanupSolutionAsync(options, cancellationToken) {
1236
+ return await this.telemetryService.trackDependencyOperation("SolutionPackager.CleanupSolution" /* SolutionPackagerCleanupSolution */, "cleanup", async () => {
1237
+ try {
1238
+ const loadedSolution = await this.solutionLoader.loadSolution(options.inputPath);
1239
+ const solution = this.filterSolutionProjects(loadedSolution, options.projectDesignIds);
1240
+ const context = this.createOperationContext(options, solution);
1241
+ const result = await this.solutionCleanupService.cleanupAsync(options, solution, context, cancellationToken);
1242
+ if (result.isSuccess) {
1243
+ this.logger.info("Solution cleanup completed successfully.");
1244
+ } else {
1245
+ this.logger.error(`Solution cleanup failed with error code ${result.errorCode}: ${result.message}`);
1246
+ }
1247
+ return result;
1248
+ } catch (error) {
1249
+ const errorMessage = error instanceof Error ? error.message : String(error);
1250
+ this.logger.error(`Processing error: ${errorMessage}`);
1251
+ return ToolResult.error("INTERNAL_ERROR" /* InternalError */, `Solution cleanup failed: ${errorMessage}`);
1252
+ } finally {
1253
+ await this.temporaryStorage.cleanup();
1254
+ }
1255
+ });
1256
+ }
1257
+ filterSolutionProjects(solution, projectDesignIds) {
1258
+ if (!projectDesignIds?.length)
1259
+ return solution;
1260
+ const solutionProjectIds = new Set(solution.Projects.map((p) => p.Id));
1261
+ const unknownIds = projectDesignIds.filter((id) => !solutionProjectIds.has(id));
1262
+ if (unknownIds.length > 0) {
1263
+ this.logger.warn(translate.t("solutionpackager.optionsBuilder.errors.invalidProjectIds", { ids: unknownIds.join(",") }));
1264
+ }
1265
+ const requested = new Set(projectDesignIds);
1266
+ return {
1267
+ ...solution,
1268
+ Projects: solution.Projects.filter((p) => requested.has(p.Id))
1269
+ };
1270
+ }
1271
+ createOperationContext(options, solution) {
1272
+ return {
1273
+ id: crypto.randomUUID(),
1274
+ projects: solution.Projects,
1275
+ solutionRoot: this.fileSystem.path.dirname(solution.filePath),
1276
+ downloadUrl: options.downloadUrl,
1277
+ solutionId: solution.SolutionId,
1278
+ configuration: options.configuration,
1279
+ targetFramework: options.targetFramework ?? "Portable" /* Portable */,
1280
+ connection: options.connection,
1281
+ logger: this.logger,
1282
+ workflowCompilerVersion: options.workflowCompilerVersion,
1283
+ functionsPackagerVersion: options.functionsPackagerVersion,
1284
+ codedAppsPackagerVersion: options.codedAppsPackagerVersion,
1285
+ lockKey: options.lockKey,
1286
+ jobTarget: options.jobTarget,
1287
+ localSourcePath: options.localSourcePath
1288
+ };
1289
+ }
1290
+ async getPackageStreamsAsync(result) {
1291
+ if (!result.isSuccess) {
1292
+ throw new Error(`Cannot get package streams from failed result. Error code: ${result.errorCode}, message: ${result.message}`);
1293
+ }
1294
+ if (!result.packages || result.packages.length === 0) {
1295
+ return [];
1296
+ }
1297
+ const packageStreams = [];
1298
+ for (const packagePath of result.packages) {
1299
+ const data = await this.fileSystem.readFile(packagePath);
1300
+ if (!data) {
1301
+ throw new Error(`Failed to read package file: ${packagePath}`);
1302
+ }
1303
+ const name = packagePath.split(/[\\/]/).pop() || packagePath;
1304
+ packageStreams.push({ name, data });
1305
+ }
1306
+ return packageStreams;
1307
+ }
1308
+ }
1309
+
1310
+ // ../packager/solution-packager/src/node-solution-packager-factory.ts
1311
+ class NodeSolutionPackagerFactory extends BaseNodePackagerFactory {
1312
+ async createAsync(config) {
1313
+ const logger = new ToolLogger("SolutionPackagerFactory", "Create");
1314
+ this.configureLanguage(config);
1315
+ this.configureLogHandler(config);
1316
+ logger.info("Creating SolutionPackager instance...");
1317
+ const fileSystem = this.getOrCreateFileSystem(config);
1318
+ const telemetryService = this.getOrCreateTelemetryService(config);
1319
+ this.dotnetDiscovery = new DotnetDiscoveryService;
1320
+ const packageSignService = new NodePackageSignService(this.dotnetDiscovery, logger);
1321
+ const solutionPackager = new SolutionPackager(fileSystem, telemetryService, packageSignService);
1322
+ this.checkDotnetAvailability(logger);
1323
+ logger.info("SolutionPackager created successfully.");
1324
+ return solutionPackager;
1325
+ }
1326
+ }
1327
+ async function createNodeSolutionPackager(options) {
1328
+ const factory = new NodeSolutionPackagerFactory;
1329
+ return factory.createAsync(options);
1330
+ }
1331
+ export { SolutionPackOptions, INVALID_PACKAGE_ID, toProjectDiagnostics, createNodeSolutionPackager };
1332
+
1333
+ //# debugId=1B09B0F65CFCA09D64756E2164756E21