@uipath/solution-packager 0.0.30 → 1.196.0

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 (28) hide show
  1. package/dist/index.js +231 -112
  2. package/dist/node.js +227 -54
  3. package/dist/src/browser-solution-packager-factory.d.ts +0 -1
  4. package/dist/src/i18n/locales/en.d.ts +3 -0
  5. package/dist/src/models/solution-pack-options.d.ts +4 -6
  6. package/dist/src/node-solution-packager-factory.d.ts +0 -1
  7. package/dist/src/services/options-builder.d.ts +7 -5
  8. package/dist/src/services/solution-loader.d.ts +1 -1
  9. package/dist/src/services/solution-pack-service.d.ts +7 -0
  10. package/dist/src/services/solution-packager.d.ts +25 -13
  11. package/dist/src/services/solution-restore-service.d.ts +23 -0
  12. package/dist/src/services/solution-validate-options-validator.d.ts +7 -0
  13. package/dist/src/services/solution-validate-service.d.ts +15 -0
  14. package/dist/src/services/tool-result-helpers.d.ts +10 -0
  15. package/dist/src/telemetry-names.d.ts +2 -0
  16. package/dist/tests/{solution-packager-e2e.test.d.ts → solution-packager.e2e.test.d.ts} +1 -0
  17. package/dist/tests/solution-packager.spec.d.ts +1 -0
  18. package/dist/tests/solution-validate-options-validator.spec.d.ts +1 -0
  19. package/dist/tests/solution-validate-service.spec.d.ts +1 -0
  20. package/dist/tests/zip-temp-storage.integration.test.d.ts +1 -0
  21. package/package.json +24 -39
  22. /package/dist/tests/{browser.test.d.ts → browser.spec.d.ts} +0 -0
  23. /package/dist/tests/{common.test.d.ts → common.spec.d.ts} +0 -0
  24. /package/dist/tests/{node.test.d.ts → node.spec.d.ts} +0 -0
  25. /package/dist/tests/{solution-pack-service.test.d.ts → options-builder.spec.d.ts} +0 -0
  26. /package/dist/tests/{solution-loader.test.d.ts → solution-loader.spec.d.ts} +0 -0
  27. /package/dist/tests/{solution-packager.test.d.ts → solution-pack-service.spec.d.ts} +0 -0
  28. /package/dist/tests/{zip-temp-storage-integration.test.d.ts → solution-restore-service.spec.d.ts} +0 -0
package/dist/index.js CHANGED
@@ -8,6 +8,9 @@ var de_default = {
8
8
  pathRequired: "Solution directory path is required",
9
9
  fileNotFound: "Solution file not found: {path}",
10
10
  invalidSolution: "Invalid solution file: {path}",
11
+ projectMustBeObject: "Invalid solution file: {path}. Projects[{index}] must be an object.",
12
+ projectMissingProjectRelativePath: `Invalid solution file: {path}. Projects[{index}] is missing ProjectRelativePath.{pathHint} Use 'uip solution project add' to add projects, or set ProjectRelativePath to the project file path, for example "Foo/project.uiproj".`,
13
+ projectRelativePathPathHint: " Found Path, but .uipx uses ProjectRelativePath.",
11
14
  noSolutionFile: "No .uipx solution file found in directory: {path}",
12
15
  invalidStorageFile: "Invalid {fileName} file"
13
16
  }
@@ -30,6 +33,9 @@ var en = {
30
33
  pathRequired: "Solution directory path is required",
31
34
  fileNotFound: "Solution file not found: {path}",
32
35
  invalidSolution: "Invalid solution file: {path}",
36
+ projectMustBeObject: "Invalid solution file: {path}. Projects[{index}] must be an object.",
37
+ projectMissingProjectRelativePath: `Invalid solution file: {path}. Projects[{index}] is missing ProjectRelativePath.{pathHint} Use 'uip solution project add' to add projects, or set ProjectRelativePath to the project file path, for example "Foo/project.uiproj".`,
38
+ projectRelativePathPathHint: " Found Path, but .uipx uses ProjectRelativePath.",
33
39
  noSolutionFile: "No .uipx solution file found in directory: {path}",
34
40
  invalidStorageFile: "Invalid {fileName} file"
35
41
  }
@@ -51,6 +57,9 @@ var es_default = {
51
57
  pathRequired: "Solution directory path is required",
52
58
  fileNotFound: "Solution file not found: {path}",
53
59
  invalidSolution: "Invalid solution file: {path}",
60
+ projectMustBeObject: "Invalid solution file: {path}. Projects[{index}] must be an object.",
61
+ projectMissingProjectRelativePath: `Invalid solution file: {path}. Projects[{index}] is missing ProjectRelativePath.{pathHint} Use 'uip solution project add' to add projects, or set ProjectRelativePath to the project file path, for example "Foo/project.uiproj".`,
62
+ projectRelativePathPathHint: " Found Path, but .uipx uses ProjectRelativePath.",
54
63
  noSolutionFile: "No .uipx solution file found in directory: {path}",
55
64
  invalidStorageFile: "Invalid {fileName} file"
56
65
  }
@@ -72,6 +81,9 @@ var es_MX_default = {
72
81
  pathRequired: "Solution directory path is required",
73
82
  fileNotFound: "Solution file not found: {path}",
74
83
  invalidSolution: "Invalid solution file: {path}",
84
+ projectMustBeObject: "Invalid solution file: {path}. Projects[{index}] must be an object.",
85
+ projectMissingProjectRelativePath: `Invalid solution file: {path}. Projects[{index}] is missing ProjectRelativePath.{pathHint} Use 'uip solution project add' to add projects, or set ProjectRelativePath to the project file path, for example "Foo/project.uiproj".`,
86
+ projectRelativePathPathHint: " Found Path, but .uipx uses ProjectRelativePath.",
75
87
  noSolutionFile: "No .uipx solution file found in directory: {path}",
76
88
  invalidStorageFile: "Invalid {fileName} file"
77
89
  }
@@ -93,6 +105,9 @@ var fr_default = {
93
105
  pathRequired: "Solution directory path is required",
94
106
  fileNotFound: "Solution file not found: {path}",
95
107
  invalidSolution: "Invalid solution file: {path}",
108
+ projectMustBeObject: "Invalid solution file: {path}. Projects[{index}] must be an object.",
109
+ projectMissingProjectRelativePath: `Invalid solution file: {path}. Projects[{index}] is missing ProjectRelativePath.{pathHint} Use 'uip solution project add' to add projects, or set ProjectRelativePath to the project file path, for example "Foo/project.uiproj".`,
110
+ projectRelativePathPathHint: " Found Path, but .uipx uses ProjectRelativePath.",
96
111
  noSolutionFile: "No .uipx solution file found in directory: {path}",
97
112
  invalidStorageFile: "Invalid {fileName} file"
98
113
  }
@@ -114,6 +129,9 @@ var ja_default = {
114
129
  pathRequired: "Solution directory path is required",
115
130
  fileNotFound: "Solution file not found: {path}",
116
131
  invalidSolution: "Invalid solution file: {path}",
132
+ projectMustBeObject: "Invalid solution file: {path}. Projects[{index}] must be an object.",
133
+ projectMissingProjectRelativePath: `Invalid solution file: {path}. Projects[{index}] is missing ProjectRelativePath.{pathHint} Use 'uip solution project add' to add projects, or set ProjectRelativePath to the project file path, for example "Foo/project.uiproj".`,
134
+ projectRelativePathPathHint: " Found Path, but .uipx uses ProjectRelativePath.",
117
135
  noSolutionFile: "No .uipx solution file found in directory: {path}",
118
136
  invalidStorageFile: "Invalid {fileName} file"
119
137
  }
@@ -135,6 +153,9 @@ var ko_default = {
135
153
  pathRequired: "Solution directory path is required",
136
154
  fileNotFound: "Solution file not found: {path}",
137
155
  invalidSolution: "Invalid solution file: {path}",
156
+ projectMustBeObject: "Invalid solution file: {path}. Projects[{index}] must be an object.",
157
+ projectMissingProjectRelativePath: `Invalid solution file: {path}. Projects[{index}] is missing ProjectRelativePath.{pathHint} Use 'uip solution project add' to add projects, or set ProjectRelativePath to the project file path, for example "Foo/project.uiproj".`,
158
+ projectRelativePathPathHint: " Found Path, but .uipx uses ProjectRelativePath.",
138
159
  noSolutionFile: "No .uipx solution file found in directory: {path}",
139
160
  invalidStorageFile: "Invalid {fileName} file"
140
161
  }
@@ -156,6 +177,9 @@ var pt_default = {
156
177
  pathRequired: "Solution directory path is required",
157
178
  fileNotFound: "Solution file not found: {path}",
158
179
  invalidSolution: "Invalid solution file: {path}",
180
+ projectMustBeObject: "Invalid solution file: {path}. Projects[{index}] must be an object.",
181
+ projectMissingProjectRelativePath: `Invalid solution file: {path}. Projects[{index}] is missing ProjectRelativePath.{pathHint} Use 'uip solution project add' to add projects, or set ProjectRelativePath to the project file path, for example "Foo/project.uiproj".`,
182
+ projectRelativePathPathHint: " Found Path, but .uipx uses ProjectRelativePath.",
159
183
  noSolutionFile: "No .uipx solution file found in directory: {path}",
160
184
  invalidStorageFile: "Invalid {fileName} file"
161
185
  }
@@ -177,6 +201,9 @@ var pt_BR_default = {
177
201
  pathRequired: "Solution directory path is required",
178
202
  fileNotFound: "Solution file not found: {path}",
179
203
  invalidSolution: "Invalid solution file: {path}",
204
+ projectMustBeObject: "Invalid solution file: {path}. Projects[{index}] must be an object.",
205
+ projectMissingProjectRelativePath: `Invalid solution file: {path}. Projects[{index}] is missing ProjectRelativePath.{pathHint} Use 'uip solution project add' to add projects, or set ProjectRelativePath to the project file path, for example "Foo/project.uiproj".`,
206
+ projectRelativePathPathHint: " Found Path, but .uipx uses ProjectRelativePath.",
180
207
  noSolutionFile: "No .uipx solution file found in directory: {path}",
181
208
  invalidStorageFile: "Invalid {fileName} file"
182
209
  }
@@ -198,6 +225,9 @@ var ro_default = {
198
225
  pathRequired: "Solution directory path is required",
199
226
  fileNotFound: "Solution file not found: {path}",
200
227
  invalidSolution: "Invalid solution file: {path}",
228
+ projectMustBeObject: "Invalid solution file: {path}. Projects[{index}] must be an object.",
229
+ projectMissingProjectRelativePath: `Invalid solution file: {path}. Projects[{index}] is missing ProjectRelativePath.{pathHint} Use 'uip solution project add' to add projects, or set ProjectRelativePath to the project file path, for example "Foo/project.uiproj".`,
230
+ projectRelativePathPathHint: " Found Path, but .uipx uses ProjectRelativePath.",
201
231
  noSolutionFile: "No .uipx solution file found in directory: {path}",
202
232
  invalidStorageFile: "Invalid {fileName} file"
203
233
  }
@@ -219,6 +249,9 @@ var ru_default = {
219
249
  pathRequired: "Solution directory path is required",
220
250
  fileNotFound: "Solution file not found: {path}",
221
251
  invalidSolution: "Invalid solution file: {path}",
252
+ projectMustBeObject: "Invalid solution file: {path}. Projects[{index}] must be an object.",
253
+ projectMissingProjectRelativePath: `Invalid solution file: {path}. Projects[{index}] is missing ProjectRelativePath.{pathHint} Use 'uip solution project add' to add projects, or set ProjectRelativePath to the project file path, for example "Foo/project.uiproj".`,
254
+ projectRelativePathPathHint: " Found Path, but .uipx uses ProjectRelativePath.",
222
255
  noSolutionFile: "No .uipx solution file found in directory: {path}",
223
256
  invalidStorageFile: "Invalid {fileName} file"
224
257
  }
@@ -240,6 +273,9 @@ var tr_default = {
240
273
  pathRequired: "Solution directory path is required",
241
274
  fileNotFound: "Solution file not found: {path}",
242
275
  invalidSolution: "Invalid solution file: {path}",
276
+ projectMustBeObject: "Invalid solution file: {path}. Projects[{index}] must be an object.",
277
+ projectMissingProjectRelativePath: `Invalid solution file: {path}. Projects[{index}] is missing ProjectRelativePath.{pathHint} Use 'uip solution project add' to add projects, or set ProjectRelativePath to the project file path, for example "Foo/project.uiproj".`,
278
+ projectRelativePathPathHint: " Found Path, but .uipx uses ProjectRelativePath.",
243
279
  noSolutionFile: "No .uipx solution file found in directory: {path}",
244
280
  invalidStorageFile: "Invalid {fileName} file"
245
281
  }
@@ -261,6 +297,9 @@ var zh_CN_default = {
261
297
  pathRequired: "Solution directory path is required",
262
298
  fileNotFound: "Solution file not found: {path}",
263
299
  invalidSolution: "Invalid solution file: {path}",
300
+ projectMustBeObject: "Invalid solution file: {path}. Projects[{index}] must be an object.",
301
+ projectMissingProjectRelativePath: `Invalid solution file: {path}. Projects[{index}] is missing ProjectRelativePath.{pathHint} Use 'uip solution project add' to add projects, or set ProjectRelativePath to the project file path, for example "Foo/project.uiproj".`,
302
+ projectRelativePathPathHint: " Found Path, but .uipx uses ProjectRelativePath.",
264
303
  noSolutionFile: "No .uipx solution file found in directory: {path}",
265
304
  invalidStorageFile: "Invalid {fileName} file"
266
305
  }
@@ -282,6 +321,9 @@ var zh_TW_default = {
282
321
  pathRequired: "Solution directory path is required",
283
322
  fileNotFound: "Solution file not found: {path}",
284
323
  invalidSolution: "Invalid solution file: {path}",
324
+ projectMustBeObject: "Invalid solution file: {path}. Projects[{index}] must be an object.",
325
+ projectMissingProjectRelativePath: `Invalid solution file: {path}. Projects[{index}] is missing ProjectRelativePath.{pathHint} Use 'uip solution project add' to add projects, or set ProjectRelativePath to the project file path, for example "Foo/project.uiproj".`,
326
+ projectRelativePathPathHint: " Found Path, but .uipx uses ProjectRelativePath.",
285
327
  noSolutionFile: "No .uipx solution file found in directory: {path}",
286
328
  invalidStorageFile: "Invalid {fileName} file"
287
329
  }
@@ -303,6 +345,9 @@ var zu_default = {
303
345
  pathRequired: "Solution directory path is required",
304
346
  fileNotFound: "Solution file not found: {path}",
305
347
  invalidSolution: "Invalid solution file: {path}",
348
+ projectMustBeObject: "Invalid solution file: {path}. Projects[{index}] must be an object.",
349
+ projectMissingProjectRelativePath: `Invalid solution file: {path}. Projects[{index}] is missing ProjectRelativePath.{pathHint} Use 'uip solution project add' to add projects, or set ProjectRelativePath to the project file path, for example "Foo/project.uiproj".`,
350
+ projectRelativePathPathHint: " Found Path, but .uipx uses ProjectRelativePath.",
306
351
  noSolutionFile: "No .uipx solution file found in directory: {path}",
307
352
  invalidStorageFile: "Invalid {fileName} file"
308
353
  }
@@ -337,22 +382,13 @@ I18nManager.registerTranslations("zu", zu_default);
337
382
  // src/index.ts
338
383
  import { RulesConfigFileType as RulesConfigFileType2 } from "@uipath/project-packager";
339
384
  import {
340
- BuildConfiguration as BuildConfiguration3,
385
+ BuildConfiguration as BuildConfiguration2,
341
386
  LogLevel
342
387
  } from "@uipath/solutionpackager-tool-core";
343
388
 
344
389
  // src/browser-solution-packager-factory.ts
345
- import { BrowserFileSystem } from "@uipath/filesystem/browser";
346
- import {
347
- setGlobalLogHandler,
348
- ToolLogger as ToolLogger2
349
- } from "@uipath/project-packager";
350
- import { translate as translate3 } from "@uipath/solutionpackager-tool-core";
351
- import {
352
- BrowserContextStorage,
353
- ConsoleTelemetryProvider,
354
- TelemetryService
355
- } from "@uipath/telemetry";
390
+ import { ToolLogger as ToolLogger2 } from "@uipath/project-packager";
391
+ import { BaseBrowserPackagerFactory } from "@uipath/project-packager/browser";
356
392
 
357
393
  // src/services/solution-packager.ts
358
394
  import {
@@ -366,15 +402,15 @@ import {
366
402
  Path as Path4,
367
403
  TargetFramework,
368
404
  TemporaryStorageService,
369
- ToolErrorCodes as ToolErrorCodes2,
370
- ToolResult as ToolResult2,
405
+ ToolErrorCodes as ToolErrorCodes3,
406
+ ToolResult as ToolResult3,
371
407
  toolsFactoryRepository,
408
+ translate as translate3,
372
409
  ZipService
373
410
  } from "@uipath/solutionpackager-tool-core";
374
411
 
375
412
  // src/services/options-builder.ts
376
413
  import {
377
- BuildConfiguration,
378
414
  Path,
379
415
  translate
380
416
  } from "@uipath/solutionpackager-tool-core";
@@ -394,7 +430,6 @@ class OptionsBuilder {
394
430
  throw new Error(translate.t("solutionpackager.optionsBuilder.errors.outputPathRequired"));
395
431
  }
396
432
  await this.createOutputFilesDirectoryAsync(parameters.outputPath);
397
- const projectsToBuild = this.getProjectIdsToBuild(parameters, solution);
398
433
  if (!parameters.package.id || parameters.package.id.trim() === "") {
399
434
  parameters.package.id = solution.Name;
400
435
  }
@@ -405,7 +440,7 @@ class OptionsBuilder {
405
440
  configuration: parameters.configuration,
406
441
  package: parameters.package,
407
442
  publishId: parameters.publishInfo?.id,
408
- projectsToBuild
443
+ projectsToBuild: solution.Projects.map((p) => p.Id)
409
444
  };
410
445
  }
411
446
  async createOutputFilesDirectoryAsync(outputPath) {
@@ -413,9 +448,7 @@ class OptionsBuilder {
413
448
  await this.fileSystem.mkdir(filesDir);
414
449
  }
415
450
  async buildProjectPackOptions(solutionOptions, project) {
416
- const solutionFolderPath = solutionOptions.inputPath;
417
- const projectRelativePath = Path.dirname(project.ProjectRelativePath);
418
- const projectPath = Path.join(solutionFolderPath, projectRelativePath);
451
+ const projectPath = this.resolveProjectPath(solutionOptions, project);
419
452
  const solutionName = solutionOptions.package.id || undefined;
420
453
  const packageInfo = {
421
454
  ...solutionOptions.package,
@@ -432,7 +465,7 @@ class OptionsBuilder {
432
465
  nuGetSourcesConfigPath: solutionOptions.nuGetSourcesConfigPath,
433
466
  logLevel: solutionOptions.logLevel,
434
467
  skipAnalyze: solutionOptions.validateOptions.skipAnalyze,
435
- skipValidate: false,
468
+ skipValidate: solutionOptions.validateOptions.skipValidate,
436
469
  projectStorageId: project.StorageId,
437
470
  detailedLogPath: solutionOptions.detailedLogPath,
438
471
  policyFilePath: solutionOptions.validateOptions.governanceFilePath,
@@ -446,26 +479,29 @@ class OptionsBuilder {
446
479
  splitPackages: solutionOptions.packOptions?.splitPackages ?? false
447
480
  };
448
481
  }
482
+ buildProjectValidateOptions(solutionOptions, project) {
483
+ return {
484
+ projectPath: this.resolveProjectPath(solutionOptions, project),
485
+ excludeConfiguredSources: solutionOptions.excludeConfiguredSources ?? false,
486
+ nuGetSourcesConfigPath: solutionOptions.nuGetSourcesConfigPath,
487
+ logLevel: solutionOptions.logLevel,
488
+ skipAnalyze: solutionOptions.validateOptions.skipAnalyze,
489
+ skipValidate: solutionOptions.validateOptions.skipValidate,
490
+ defaultSeverity: solutionOptions.validateOptions.defaultSeverity,
491
+ detailedLogPath: solutionOptions.detailedLogPath,
492
+ policyFilePath: solutionOptions.validateOptions.governanceFilePath,
493
+ policyFileType: solutionOptions.validateOptions.governanceFileType
494
+ };
495
+ }
496
+ resolveProjectPath(solutionOptions, project) {
497
+ return Path.join(solutionOptions.inputPath, Path.dirname(project.ProjectRelativePath));
498
+ }
449
499
  async buildProjectOutputPath(solutionOutputPath, project) {
450
500
  const filesDir = Path.join(solutionOutputPath, OptionsBuilder.FILES_DIRECTORY_NAME);
451
501
  const projectOutputPath = Path.join(filesDir, project.Id);
452
502
  await this.fileSystem.mkdir(projectOutputPath);
453
503
  return projectOutputPath;
454
504
  }
455
- getProjectIdsToBuild(parameters, solution) {
456
- const solutionProjectIds = solution.Projects.map((p) => p.Id);
457
- if (parameters.projectsToBuild === null || parameters.projectsToBuild === undefined || parameters.projectsToBuild.length === 0) {
458
- return parameters.configuration === BuildConfiguration.Release ? solutionProjectIds : [];
459
- }
460
- const invalidProjectIds = parameters.projectsToBuild.filter((id) => !solutionProjectIds.includes(id));
461
- if (invalidProjectIds.length > 0) {
462
- console.warn(translate.t("solutionpackager.optionsBuilder.errors.invalidProjectIds", {
463
- ids: invalidProjectIds.join(",")
464
- }));
465
- return solutionProjectIds.filter((id) => parameters.projectsToBuild?.includes(id));
466
- }
467
- return parameters.projectsToBuild;
468
- }
469
505
  }
470
506
 
471
507
  // src/services/package-id-reader.ts
@@ -481,7 +517,8 @@ class PackageIdReader {
481
517
  agent: "agent",
482
518
  api: "api",
483
519
  webapp: "webApp",
484
- process: "process"
520
+ process: "process",
521
+ flow: "flow"
485
522
  };
486
523
  static projectTypeMap = {
487
524
  process: "Rpa",
@@ -491,7 +528,8 @@ class PackageIdReader {
491
528
  processorchestration: "Agentic",
492
529
  casemanagement: "Case",
493
530
  api: "Api",
494
- agent: "Agent"
531
+ agent: "Agent",
532
+ flow: "Flow"
495
533
  };
496
534
  constructor(fileSystem, packService) {
497
535
  this.fileSystem = fileSystem;
@@ -629,7 +667,7 @@ import { Path as Path3, translate as translate2 } from "@uipath/solutionpackager
629
667
 
630
668
  class SolutionLoader {
631
669
  fileSystem;
632
- static SolutionStorageFileName = ".storage";
670
+ static SolutionStorageFileName = "SolutionStorage.json";
633
671
  constructor(fileSystem) {
634
672
  this.fileSystem = fileSystem;
635
673
  }
@@ -645,12 +683,8 @@ class SolutionLoader {
645
683
  }));
646
684
  }
647
685
  const json = typeof fileContent === "string" ? fileContent : new TextDecoder("utf-8").decode(fileContent);
648
- const solution = JSON.parse(json);
649
- if (!solution?.Projects) {
650
- throw new Error(translate2.t("solutionpackager.solutionLoader.errors.invalidSolution", {
651
- path: solutionFilePath
652
- }));
653
- }
686
+ const parsed = JSON.parse(json);
687
+ const solution = validateSolutionFile(parsed, solutionFilePath);
654
688
  const loadedSolution = {
655
689
  ...solution,
656
690
  Name: GetSolutionName(),
@@ -702,6 +736,38 @@ class SolutionLoader {
702
736
  }
703
737
  }
704
738
  }
739
+ function validateSolutionFile(parsed, solutionFilePath) {
740
+ if (!isRecord(parsed)) {
741
+ throw new Error(translate2.t("solutionpackager.solutionLoader.errors.invalidSolution", {
742
+ path: solutionFilePath
743
+ }));
744
+ }
745
+ if (!Array.isArray(parsed.Projects)) {
746
+ throw new Error(translate2.t("solutionpackager.solutionLoader.errors.invalidSolution", {
747
+ path: solutionFilePath
748
+ }));
749
+ }
750
+ for (const [index, project] of parsed.Projects.entries()) {
751
+ if (!isRecord(project)) {
752
+ throw new Error(translate2.t("solutionpackager.solutionLoader.errors.projectMustBeObject", {
753
+ path: solutionFilePath,
754
+ index
755
+ }));
756
+ }
757
+ if (typeof project.ProjectRelativePath !== "string" || !project.ProjectRelativePath.trim()) {
758
+ const pathHint = typeof project.Path === "string" ? translate2.t("solutionpackager.solutionLoader.errors.projectRelativePathPathHint") : "";
759
+ throw new Error(translate2.t("solutionpackager.solutionLoader.errors.projectMissingProjectRelativePath", {
760
+ path: solutionFilePath,
761
+ index,
762
+ pathHint
763
+ }));
764
+ }
765
+ }
766
+ return parsed;
767
+ }
768
+ function isRecord(value) {
769
+ return typeof value === "object" && value !== null && !Array.isArray(value);
770
+ }
705
771
 
706
772
  // src/services/solution-pack-options-validator.ts
707
773
  import {
@@ -796,6 +862,7 @@ class SolutionPackService {
796
862
  return await this.telemetry.trackDependencyOperation("SolutionPackager.Solution.Compress" /* SolutionCompress */, "compress", async () => {
797
863
  const packageName = parameters.package.id || "solution";
798
864
  const version = parameters.package.version || "1.0.0";
865
+ await this.writePackageMetadataAsync(parameters, outputPath);
799
866
  const archiveFileName = `${packageName}_${version}.zip`;
800
867
  const archivePath = `${parameters.destinationPath}/${archiveFileName}`;
801
868
  const zipData = await this.zipService.compressAsync(outputPath);
@@ -803,6 +870,68 @@ class SolutionPackService {
803
870
  return archivePath;
804
871
  });
805
872
  }
873
+ async writePackageMetadataAsync(parameters, outputPath) {
874
+ const pkg = parameters.package;
875
+ const metadata = {
876
+ name: pkg.id || "solution",
877
+ version: pkg.version || "1.0.0"
878
+ };
879
+ const optional = {
880
+ releaseNotes: pkg.releaseNotes,
881
+ projectUrl: pkg.projectUrl,
882
+ repositoryType: pkg.repositoryType,
883
+ repositoryUrl: pkg.repositoryUrl,
884
+ repositoryBranch: pkg.repositoryBranch,
885
+ repositoryCommit: pkg.repositoryCommit
886
+ };
887
+ for (const [key, value] of Object.entries(optional)) {
888
+ if (value !== undefined && value !== "") {
889
+ metadata[key] = value;
890
+ }
891
+ }
892
+ const metadataPath = `${outputPath}/package.metadata.json`;
893
+ await this.fileSystem.writeFile(metadataPath, `${JSON.stringify(metadata, null, 2)}
894
+ `);
895
+ }
896
+ }
897
+
898
+ // src/services/solution-validate-options-validator.ts
899
+ import {
900
+ PackagerParametersValidator as PackagerParametersValidator2
901
+ } from "@uipath/project-packager";
902
+
903
+ class SolutionValidateOptionsValidator extends PackagerParametersValidator2 {
904
+ async validateAsync(options, _cancellationToken) {
905
+ return await this.validateGovernanceOptions(options.validateOptions);
906
+ }
907
+ }
908
+
909
+ // src/services/solution-validate-service.ts
910
+ import {
911
+ ToolErrorCodes as ToolErrorCodes2,
912
+ ToolResult as ToolResult2
913
+ } from "@uipath/solutionpackager-tool-core";
914
+ class SolutionValidateService {
915
+ optionsBuilder;
916
+ projectExecutor;
917
+ telemetry;
918
+ constructor(optionsBuilder, projectExecutor, telemetry) {
919
+ this.optionsBuilder = optionsBuilder;
920
+ this.projectExecutor = projectExecutor;
921
+ this.telemetry = telemetry;
922
+ }
923
+ async validateAsync(parameters, solution, context, cancellationToken) {
924
+ return await this.telemetry.trackDependencyOperation("SolutionPackager.Solution.Validate" /* SolutionValidate */, "validate", async () => {
925
+ const projectResults = await Promise.all(solution.Projects.map((project) => {
926
+ if (project.ProjectPath == null) {
927
+ return Promise.resolve(ToolResult2.error(ToolErrorCodes2.InternalError, `Project '${project.Id}' has no ProjectPath; the solution loader must populate it before validation.`));
928
+ }
929
+ return this.projectExecutor.validateAsync(this.optionsBuilder.buildProjectValidateOptions(parameters, project), project, context, cancellationToken);
930
+ }));
931
+ const failed = projectResults.find((r) => !r.isSuccess);
932
+ return failed ?? ToolResult2.success();
933
+ }, { solutionId: solution.SolutionId });
934
+ }
806
935
  }
807
936
 
808
937
  // src/services/solution-packager.ts
@@ -819,7 +948,9 @@ class SolutionPackager {
819
948
  projectExecutor;
820
949
  solutionLoader;
821
950
  solutionPackService;
822
- optionsValidator;
951
+ solutionValidateService;
952
+ packOptionsValidator;
953
+ validateOptionsValidator;
823
954
  governancePolicyService;
824
955
  constructor(fileSystem, telemetryService, packageSignService) {
825
956
  this.fileSystem = fileSystem;
@@ -829,7 +960,8 @@ class SolutionPackager {
829
960
  this.temporaryStorage = new TemporaryStorageService(this.fileSystem);
830
961
  this.zipService = new ZipService(this.fileSystem);
831
962
  this.logger = new ToolLogger("SolutionPackager", "PackSolution");
832
- this.optionsValidator = new SolutionPackOptionsValidator(this.logger, this.fileSystem);
963
+ this.packOptionsValidator = new SolutionPackOptionsValidator(this.logger, this.fileSystem);
964
+ this.validateOptionsValidator = new SolutionValidateOptionsValidator(this.logger, this.fileSystem);
833
965
  const packService = new PackService;
834
966
  const packageIdReader = new PackageIdReader(this.fileSystem, packService);
835
967
  this.optionsBuilder = new OptionsBuilder(packageIdReader, packService, this.fileSystem);
@@ -838,19 +970,7 @@ class SolutionPackager {
838
970
  this.solutionLoader = new SolutionLoader(this.fileSystem);
839
971
  this.governancePolicyService = new GovernancePolicyService(this.fileSystem, this.temporaryStorage);
840
972
  this.solutionPackService = new SolutionPackService(this.optionsBuilder, this.toolsFactory, this.projectExecutor, this.zipService, this.fileSystem, this.telemetryService);
841
- }
842
- async canPackSolutionAsync(solutionPath) {
843
- const solution = await this.solutionLoader.loadSolution(solutionPath);
844
- for (const project of solution.Projects) {
845
- if (!project.ProjectPath) {
846
- return false;
847
- }
848
- const canHandle = this.repository.canHandleProject(project.Type);
849
- if (!canHandle) {
850
- return false;
851
- }
852
- }
853
- return true;
973
+ this.solutionValidateService = new SolutionValidateService(this.optionsBuilder, this.projectExecutor, this.telemetryService);
854
974
  }
855
975
  async setupAsync(input, operationId) {
856
976
  this.telemetryService.setOperationId(operationId);
@@ -887,14 +1007,15 @@ class SolutionPackager {
887
1007
  return await this.telemetryService.trackRequest("SolutionPackager.PackSolution" /* SolutionPackagerPackSolution */, async () => {
888
1008
  try {
889
1009
  await this.governancePolicyService.resolveGovernancePolicyAsync(options.validateOptions, options.connection, cancellationToken);
890
- let result = await this.optionsValidator.validateAsync(options, cancellationToken);
1010
+ let result = await this.packOptionsValidator.validateAsync(options, cancellationToken);
891
1011
  if (!result.isSuccess) {
892
1012
  return result;
893
1013
  }
894
1014
  if (!options.outputPath) {
895
1015
  options.outputPath = await this.temporaryStorage.getTempSubfolderPathAsync("output");
896
1016
  }
897
- const solution = await this.solutionLoader.loadSolution(options.inputPath);
1017
+ const loadedSolution = await this.solutionLoader.loadSolution(options.inputPath);
1018
+ const solution = this.filterSolutionProjects(loadedSolution, options.projectDesignIds);
898
1019
  const context = this.createOperationContext(options, solution);
899
1020
  result = await this.solutionPackService.packAsync(options, solution, context, cancellationToken);
900
1021
  if (result.isSuccess) {
@@ -906,16 +1027,57 @@ class SolutionPackager {
906
1027
  } catch (error) {
907
1028
  const errorMessage = error instanceof Error ? error.message : String(error);
908
1029
  this.logger.error(`Processing error: ${errorMessage}`);
909
- return ToolResult2.error(ToolErrorCodes2.InternalError, `Solution pack failed: ${errorMessage}`);
1030
+ return ToolResult3.error(ToolErrorCodes3.InternalError, `Solution pack failed: ${errorMessage}`);
910
1031
  } finally {
911
1032
  await this.temporaryStorage.cleanup();
912
1033
  }
913
1034
  });
914
1035
  }
1036
+ async validateSolutionAsync(options, cancellationToken) {
1037
+ return await this.telemetryService.trackRequest("SolutionPackager.ValidateSolution" /* SolutionPackagerValidateSolution */, async () => {
1038
+ try {
1039
+ await this.governancePolicyService.resolveGovernancePolicyAsync(options.validateOptions, options.connection, cancellationToken);
1040
+ const validationResult = await this.validateOptionsValidator.validateAsync(options, cancellationToken);
1041
+ if (!validationResult.isSuccess) {
1042
+ return validationResult;
1043
+ }
1044
+ const loadedSolution = await this.solutionLoader.loadSolution(options.inputPath);
1045
+ const solution = this.filterSolutionProjects(loadedSolution, options.projectDesignIds);
1046
+ const context = this.createOperationContext(options, solution);
1047
+ const result = await this.solutionValidateService.validateAsync(options, solution, context, cancellationToken);
1048
+ if (result.isSuccess) {
1049
+ this.logger.info("Solution validate completed successfully.");
1050
+ } else {
1051
+ this.logger.error(`Solution validate failed with error code ${result.errorCode}: ${result.message}`);
1052
+ }
1053
+ return result;
1054
+ } catch (error) {
1055
+ const errorMessage = error instanceof Error ? error.message : String(error);
1056
+ this.logger.error(`Processing error: ${errorMessage}`);
1057
+ return ToolResult3.error(ToolErrorCodes3.InternalError, `Solution validate failed: ${errorMessage}`);
1058
+ } finally {
1059
+ await this.temporaryStorage.cleanup();
1060
+ }
1061
+ });
1062
+ }
1063
+ filterSolutionProjects(solution, projectDesignIds) {
1064
+ if (!projectDesignIds?.length)
1065
+ return solution;
1066
+ const solutionProjectIds = new Set(solution.Projects.map((p) => p.Id));
1067
+ const unknownIds = projectDesignIds.filter((id) => !solutionProjectIds.has(id));
1068
+ if (unknownIds.length > 0) {
1069
+ this.logger.warn(translate3.t("solutionpackager.optionsBuilder.errors.invalidProjectIds", { ids: unknownIds.join(",") }));
1070
+ }
1071
+ const requested = new Set(projectDesignIds);
1072
+ return {
1073
+ ...solution,
1074
+ Projects: solution.Projects.filter((p) => requested.has(p.Id))
1075
+ };
1076
+ }
915
1077
  createOperationContext(options, solution) {
916
1078
  return {
917
1079
  id: crypto.randomUUID(),
918
- solution,
1080
+ projects: solution.Projects,
919
1081
  downloadUrl: options.downloadUrl,
920
1082
  configuration: options.configuration,
921
1083
  targetFramework: options.targetFramework ?? TargetFramework.Portable,
@@ -945,10 +1107,7 @@ class SolutionPackager {
945
1107
  }
946
1108
 
947
1109
  // src/browser-solution-packager-factory.ts
948
- var sharedFileSystem = null;
949
- var GLOBAL_FS_KEY = "__uipath_sharedFileSystem";
950
-
951
- class BrowserSolutionPackagerFactory {
1110
+ class BrowserSolutionPackagerFactory extends BaseBrowserPackagerFactory {
952
1111
  async createAsync(config) {
953
1112
  const logger = new ToolLogger2("SolutionPackagerFactory", "Create");
954
1113
  this.configureLanguage(config);
@@ -960,46 +1119,6 @@ class BrowserSolutionPackagerFactory {
960
1119
  logger.info("SolutionPackager created successfully.");
961
1120
  return solutionPackager;
962
1121
  }
963
- async getOrCreateFileSystem(config) {
964
- if (config?.fileSystem) {
965
- return config.fileSystem;
966
- }
967
- if (!sharedFileSystem) {
968
- sharedFileSystem = globalThis[GLOBAL_FS_KEY] ?? null;
969
- }
970
- if (!sharedFileSystem) {
971
- const fs = new BrowserFileSystem;
972
- try {
973
- await fs.init();
974
- } catch (error) {
975
- if (error instanceof Error && error.message.includes("Mount point is already in use")) {
976
- fs.initialized = true;
977
- } else {
978
- throw error;
979
- }
980
- }
981
- sharedFileSystem = fs;
982
- globalThis[GLOBAL_FS_KEY] = fs;
983
- }
984
- return sharedFileSystem;
985
- }
986
- getOrCreateTelemetryService(config) {
987
- if (config?.telemetryService) {
988
- return config.telemetryService;
989
- }
990
- const provider = new ConsoleTelemetryProvider;
991
- const contextStorage = new BrowserContextStorage;
992
- return new TelemetryService(provider, contextStorage);
993
- }
994
- configureLogHandler(config) {
995
- if (config?.logHandler) {
996
- setGlobalLogHandler(config.logHandler);
997
- }
998
- }
999
- configureLanguage(config) {
1000
- const language = config?.language ?? "en";
1001
- translate3.setLocale(language);
1002
- }
1003
1122
  }
1004
1123
  async function createBrowserSolutionPackager(options) {
1005
1124
  const factory = new BrowserSolutionPackagerFactory;
@@ -1011,19 +1130,19 @@ import {
1011
1130
  RulesConfigFileType
1012
1131
  } from "@uipath/project-packager";
1013
1132
  import {
1014
- BuildConfiguration as BuildConfiguration2
1133
+ BuildConfiguration
1015
1134
  } from "@uipath/solutionpackager-tool-core";
1016
1135
 
1017
1136
  class SolutionPackOptions extends PackagerParameters {
1018
- downloadUrl;
1019
1137
  destinationPath;
1020
- projectsToBuild;
1138
+ projectDesignIds;
1021
1139
  validateOptions = {
1022
1140
  skipAnalyze: false,
1141
+ skipValidate: false,
1023
1142
  governanceFileType: RulesConfigFileType.Default
1024
1143
  };
1025
1144
  package;
1026
- configuration = BuildConfiguration2.Release;
1145
+ configuration = BuildConfiguration.Release;
1027
1146
  signingInfo;
1028
1147
  packOptions;
1029
1148
  publishInfo;
@@ -1034,5 +1153,5 @@ export {
1034
1153
  SolutionPackOptions,
1035
1154
  RulesConfigFileType2 as RulesConfigFileType,
1036
1155
  LogLevel,
1037
- BuildConfiguration3 as BuildConfiguration
1156
+ BuildConfiguration2 as BuildConfiguration
1038
1157
  };