@uipath/flow-tool 1.204.0-preview.261 → 1.204.0-preview.265

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 (45) hide show
  1. package/dist/THIRD-PARTY-NOTICES.md +2 -2
  2. package/dist/{binding-service-rkyb9epw.js → binding-service-4mpv8w1e.js} +6 -6
  3. package/dist/{connector-service-fgqmwekb.js → connector-service-x6whcvr9.js} +6 -6
  4. package/dist/{debug-conversation-trigger-dkjfpjg2.js → debug-conversation-trigger-hp8b2tp0.js} +2 -2
  5. package/dist/{edge-service-hh98sd42.js → edge-service-6vvvr31x.js} +2 -2
  6. package/dist/{embedded-file-reader-v8c2yj2a.js → embedded-file-reader-r66242ey.js} +2 -2
  7. package/dist/{flow-debug-service-pq5d5h50.js → flow-debug-service-8dtcpk4f.js} +9 -9
  8. package/dist/{flow-eval-node-target-zr05884g.js → flow-eval-node-target-2fxwe9cv.js} +2 -2
  9. package/dist/{flow-eval-run-service-a19zzwhx.js → flow-eval-run-service-3gpnh4pk.js} +9 -9
  10. package/dist/{flow-eval-service-15ja71e7.js → flow-eval-service-13nxya9a.js} +3 -3
  11. package/dist/{flow-init-service-t49pv6d5.js → flow-init-service-pzxcpvtj.js} +4 -4
  12. package/dist/{flow-io-tfr21fxs.js → flow-io-3bew6f71.js} +2 -2
  13. package/dist/{flow-migrate-service-74j0z2ea.js → flow-migrate-service-r19tey4w.js} +2 -2
  14. package/dist/{flow-pack-service-czegjjtg.js → flow-pack-service-dn9xzwyp.js} +10 -10
  15. package/dist/{flow-validate-service-qnyw4yfg.js → flow-validate-service-sz17053r.js} +10 -10
  16. package/dist/{governance-fetcher-295tewqn.js → governance-fetcher-0qwd1cz8.js} +2 -2
  17. package/dist/{hitl-service-5kmnzjt2.js → hitl-service-8yjg7c0r.js} +2 -2
  18. package/dist/{index-aaq9rwfv.js → index-j0rhpk9r.js} +616 -160
  19. package/dist/{index-kwppsfdz.js → index-rdf19yyg.js} +1 -1
  20. package/dist/index.js +3 -3
  21. package/dist/init.js +4 -4
  22. package/dist/{node-ckn6v7gy.js → node-qatwrenm.js} +2 -2
  23. package/dist/{node-service-fpt6macv.js → node-service-mcrhb5f2.js} +6 -6
  24. package/dist/{node-sync-service-c0sxsd3z.js → node-sync-service-g35zr8w7.js} +1 -1
  25. package/dist/{packager-tool-mh6w74y6.js → packager-tool-4b94p6e3.js} +1 -1
  26. package/dist/{packager-tool-09hjyxrs.js → packager-tool-5635avx2.js} +2 -2
  27. package/dist/{packager-tool-ma8afdz8.js → packager-tool-5xxg1jv1.js} +1 -1
  28. package/dist/{packager-tool-5y3cy35y.js → packager-tool-6e7s8jdv.js} +3 -3
  29. package/dist/{packager-tool-7etj0m27.js → packager-tool-7vwchjyr.js} +2 -2
  30. package/dist/{packager-tool-dzr51a2r.js → packager-tool-a0avasex.js} +5 -5
  31. package/dist/{packager-tool-wbtn2rff.js → packager-tool-b858dpbt.js} +2 -2
  32. package/dist/{packager-tool-a447g6wm.js → packager-tool-h64zm4c7.js} +4 -4
  33. package/dist/{packager-tool-kmsvanb4.js → packager-tool-jm8s9kvm.js} +4 -4
  34. package/dist/{packager-tool-rk1cp2n5.js → packager-tool-jskax42b.js} +46 -46
  35. package/dist/{packager-tool-pf1pz71m.js → packager-tool-ny9dk6zz.js} +2 -2
  36. package/dist/{packager-tool-rzvb68y4.js → packager-tool-p7cy43mn.js} +1 -1
  37. package/dist/{packager-tool-h5kmt9q3.js → packager-tool-pqtsr6j9.js} +1 -1
  38. package/dist/{packager-tool-de4xva8z.js → packager-tool-rtwqe68k.js} +1 -1
  39. package/dist/{packager-tool-351ca62h.js → packager-tool-vvwn0bcc.js} +1 -1
  40. package/dist/packager-tool.js +2 -2
  41. package/dist/{tidy-service-xwmyf695.js → tidy-service-75rzxnda.js} +2 -2
  42. package/dist/tool.js +3 -3
  43. package/dist/validation.js +10 -10
  44. package/dist/{variable-service-y0evtd1y.js → variable-service-4cbqy80t.js} +2 -2
  45. package/package.json +2 -2
@@ -2472,6 +2472,19 @@ class NullSecretsProvider {
2472
2472
  }
2473
2473
  }
2474
2474
 
2475
+ // ../../node_modules/@uipath/resource-builder-sdk/dist/providers/feature-flag-provider.js
2476
+ class NullFeatureFlagProvider {
2477
+ getBool(_featureFlagName, defaultValue) {
2478
+ return defaultValue ?? false;
2479
+ }
2480
+ getInt(_featureFlagName, defaultValue) {
2481
+ return defaultValue ?? 0;
2482
+ }
2483
+ getString(_featureFlagName, defaultValue) {
2484
+ return defaultValue ?? "";
2485
+ }
2486
+ }
2487
+
2475
2488
  // ../../node_modules/@uipath/resource-builder-sdk/dist/exceptions/timeout-exception.js
2476
2489
  class TimeoutException extends Error {
2477
2490
  constructor(message, timeoutMs) {
@@ -2626,10 +2639,12 @@ function withFileOperationTimeout2(provider, timeoutMs) {
2626
2639
  // ../../node_modules/@uipath/resource-builder-sdk/dist/solution/solution-context-options.js
2627
2640
  var DEFAULT_SOLUTION_CONTEXT_OPTIONS = {
2628
2641
  lockTimeoutMs: 30000,
2629
- fileOperationTimeoutMs: 30000
2642
+ fileOperationTimeoutMs: 30000,
2643
+ maxDegreeOfParallelism: 1
2630
2644
  };
2631
2645
  var SOLUTION_CONTEXT_TIMEOUT_STORAGE_KEY = "SOL_RB_SOLUTION_CONTEXT_TIMEOUT_MS";
2632
2646
  var FILE_OPERATION_TIMEOUT_STORAGE_KEY = "SOL_RB_FILE_OPERATION_TIMEOUT_MS";
2647
+ var MAX_DEGREE_OF_PARALLELISM_STORAGE_KEY = "SOL_RB_MAX_DEGREE_OF_PARALLELISM";
2633
2648
  function resolveTimeoutMs(storageKey, configured, fallback) {
2634
2649
  const override = readTimeoutOverrideMs(storageKey);
2635
2650
  if (override !== undefined)
@@ -2642,10 +2657,33 @@ function resolveLockTimeoutMs(options) {
2642
2657
  function resolveFileOperationTimeoutMs(options) {
2643
2658
  return resolveTimeoutMs(FILE_OPERATION_TIMEOUT_STORAGE_KEY, options?.fileOperationTimeoutMs, DEFAULT_SOLUTION_CONTEXT_OPTIONS.fileOperationTimeoutMs);
2644
2659
  }
2660
+ function isValidDegreeOfParallelism(value) {
2661
+ return typeof value == "number" && Number.isInteger(value) && value > 0;
2662
+ }
2663
+ function resolveMaxDegreeOfParallelism(options) {
2664
+ const override = readDegreeOfParallelismOverride(MAX_DEGREE_OF_PARALLELISM_STORAGE_KEY);
2665
+ if (override !== undefined)
2666
+ return override;
2667
+ return isValidDegreeOfParallelism(options?.maxDegreeOfParallelism) ? options.maxDegreeOfParallelism : DEFAULT_SOLUTION_CONTEXT_OPTIONS.maxDegreeOfParallelism;
2668
+ }
2669
+ function readDegreeOfParallelismOverride(storageKey) {
2670
+ try {
2671
+ if ("u" < typeof localStorage)
2672
+ return;
2673
+ const raw = localStorage.getItem(storageKey);
2674
+ if (raw === null || raw.trim() === "")
2675
+ return;
2676
+ const parsed = Number(raw);
2677
+ return isValidDegreeOfParallelism(parsed) ? parsed : undefined;
2678
+ } catch {
2679
+ return;
2680
+ }
2681
+ }
2645
2682
  function mergeSolutionContextOptions(options) {
2646
2683
  return {
2647
2684
  lockTimeoutMs: isValidTimeoutMs(options?.lockTimeoutMs) ? options.lockTimeoutMs : DEFAULT_SOLUTION_CONTEXT_OPTIONS.lockTimeoutMs,
2648
- fileOperationTimeoutMs: isValidTimeoutMs(options?.fileOperationTimeoutMs) ? options.fileOperationTimeoutMs : DEFAULT_SOLUTION_CONTEXT_OPTIONS.fileOperationTimeoutMs
2685
+ fileOperationTimeoutMs: isValidTimeoutMs(options?.fileOperationTimeoutMs) ? options.fileOperationTimeoutMs : DEFAULT_SOLUTION_CONTEXT_OPTIONS.fileOperationTimeoutMs,
2686
+ maxDegreeOfParallelism: isValidDegreeOfParallelism(options?.maxDegreeOfParallelism) ? options.maxDegreeOfParallelism : DEFAULT_SOLUTION_CONTEXT_OPTIONS.maxDegreeOfParallelism
2649
2687
  };
2650
2688
  }
2651
2689
 
@@ -3436,6 +3474,16 @@ function getRootFolder(solution) {
3436
3474
  }
3437
3475
 
3438
3476
  // ../../node_modules/@uipath/resource-builder-sdk/dist/solution/multi-file-solution-definition-provider.js
3477
+ function nowMs() {
3478
+ return globalThis.performance?.now?.() ?? Date.now();
3479
+ }
3480
+ function round1(ms) {
3481
+ return Math.round(10 * ms) / 10;
3482
+ }
3483
+ function cancellationError(signal) {
3484
+ return signal?.reason instanceof OperationCancelledException ? signal.reason : new OperationCancelledException;
3485
+ }
3486
+
3439
3487
  class MultiFileSolutionDefinitionProvider {
3440
3488
  get caseInsensitiveSerializer() {
3441
3489
  if (!this._caseInsensitiveSerializer)
@@ -3453,137 +3501,344 @@ class MultiFileSolutionDefinitionProvider {
3453
3501
  }
3454
3502
  async readAsync(context, cancellationToken) {
3455
3503
  this.logger.info("Reading multi-file solution definition for solution %s", context.path);
3456
- const solutionKey = this.getSolutionKey(context);
3457
- const fileStorageProvider = await this.getFileStorageProviderAsync(context, cancellationToken);
3458
- const resources = [];
3459
- const solutionFiles = [];
3460
- let hashes;
3461
- let paths;
3462
- const pathsByKind = this.getPathsByKind(context);
3463
- let tree;
3464
- pathsByKind.clear();
3504
+ const loadStarted = nowMs();
3505
+ let fileCount = 0;
3506
+ let listMs = 0;
3507
+ let readStarted = loadStarted;
3508
+ let readWallMs = 0;
3509
+ let readCompleted = false;
3510
+ let ioMs = 0;
3511
+ let maxFileIoMs = 0;
3512
+ let parseMs = 0;
3513
+ let hashMs = 0;
3514
+ let chars = 0;
3515
+ let loadedCount = 0;
3465
3516
  const parseErrors = [];
3466
3517
  const missingFiles = [];
3467
3518
  const invalidFiles = [];
3468
- context.items[SolutionContextKeys.PARSE_ERRORS_ITEM_KEY] = parseErrors;
3469
- if (!context.isReadOnly) {
3470
- hashes = this.getHashes(context);
3471
- paths = this.getPaths(context);
3472
- tree = this.getTree(context);
3473
- hashes.clear();
3474
- paths.clear();
3475
- tree.length = 0;
3476
- }
3477
- const resourceFiles = await fileStorageProvider.getFilesAsync(SolutionConstants.RESOURCE_FILES_FOLDER_NAME, "*.json", cancellationToken);
3478
- for (const resourceFile of resourceFiles)
3479
- try {
3480
- const stream = await fileStorageProvider.openFileAsync(resourceFile, cancellationToken);
3481
- const content = await this.streamToString(stream);
3482
- const wrapper = this.caseInsensitiveSerializer.deserialize(content);
3483
- if (wrapper?.resource) {
3484
- const rd = this.fromSerializable(wrapper.resource, solutionFiles);
3485
- const relPath = resourceFile.replace(/\\/g, "/");
3486
- const segments = relPath.split("/").filter((s) => s.length > 0);
3487
- const firstSegment = segments[0];
3488
- if (segments.length >= 3 && firstSegment && firstSegment.toLowerCase() === SolutionConstants.RESOURCE_FILES_FOLDER_NAME.toLowerCase()) {
3489
- const hasType = !!rd.type;
3490
- const folderSegmentCount = hasType ? segments.length - 3 : segments.length - 2;
3491
- if (folderSegmentCount < 1)
3492
- rd.folders = [
3493
- {
3494
- fullyQualifiedName: SolutionConstants.ROOT_FOLDER_NAME
3495
- }
3496
- ];
3497
- else {
3498
- const segmentsToUse = segments.slice(1, folderSegmentCount);
3499
- const folderFqn = segmentsToUse.join("/");
3500
- rd.folders = [
3501
- {
3502
- fullyQualifiedName: folderFqn
3503
- }
3504
- ];
3519
+ let metricsLogged = false;
3520
+ const logReadMetrics = (outcome) => {
3521
+ metricsLogged = true;
3522
+ const totalMs = nowMs() - loadStarted;
3523
+ const mergeMs = readCompleted ? nowMs() - readStarted - readWallMs : 0;
3524
+ const metrics = {
3525
+ outcome,
3526
+ path: context.path,
3527
+ fileCount,
3528
+ totalMs: round1(totalMs),
3529
+ listMs: round1(listMs),
3530
+ readWallMs: round1(readWallMs),
3531
+ ioMs: round1(ioMs),
3532
+ maxFileIoMs: round1(maxFileIoMs),
3533
+ parseMs: round1(parseMs),
3534
+ hashMs: round1(hashMs),
3535
+ mergeMs: round1(mergeMs),
3536
+ chars,
3537
+ degreeOfParallelism: resolveMaxDegreeOfParallelism(this.options),
3538
+ isReadOnly: context.isReadOnly,
3539
+ loaded: loadedCount,
3540
+ missing: missingFiles.length,
3541
+ invalid: invalidFiles.length,
3542
+ parseErrors: parseErrors.length
3543
+ };
3544
+ const message = `Solution read ${outcome} for solution ${context.path}: ${metrics.fileCount} files in ${metrics.totalMs} ms (list ${metrics.listMs} ms, read ${metrics.readWallMs} ms wall, io ${metrics.ioMs} ms summed, max file io ${metrics.maxFileIoMs} ms, parse ${metrics.parseMs} ms, hash ${metrics.hashMs} ms, merge ${metrics.mergeMs} ms); ${metrics.chars} chars; parallelism ${metrics.degreeOfParallelism}; readOnly ${metrics.isReadOnly}; loaded ${metrics.loaded}, missing ${metrics.missing}, invalid ${metrics.invalid}, parseErrors ${metrics.parseErrors}`;
3545
+ if (outcome === "Success")
3546
+ this.logger.info(message, metrics);
3547
+ else
3548
+ this.logger.warn(message, metrics);
3549
+ };
3550
+ const readCore = async () => {
3551
+ const solutionKey = this.getSolutionKey(context);
3552
+ const fileStorageProvider = await this.getFileStorageProviderAsync(context, cancellationToken);
3553
+ const resources = [];
3554
+ const solutionFiles = [];
3555
+ let hashes;
3556
+ let paths;
3557
+ const pathsByKind = this.getPathsByKind(context);
3558
+ let tree;
3559
+ pathsByKind.clear();
3560
+ context.items[SolutionContextKeys.PARSE_ERRORS_ITEM_KEY] = parseErrors;
3561
+ if (!context.isReadOnly) {
3562
+ hashes = this.getHashes(context);
3563
+ paths = this.getPaths(context);
3564
+ tree = this.getTree(context);
3565
+ hashes.clear();
3566
+ paths.clear();
3567
+ tree.length = 0;
3568
+ }
3569
+ const listStarted = nowMs();
3570
+ const resourceFiles = await fileStorageProvider.getFilesAsync(SolutionConstants.RESOURCE_FILES_FOLDER_NAME, "*.json", cancellationToken);
3571
+ listMs = nowMs() - listStarted;
3572
+ fileCount = resourceFiles.length;
3573
+ readStarted = nowMs();
3574
+ const readResults = await this.readResourceFilesAsync(context, fileStorageProvider, resourceFiles, cancellationToken);
3575
+ readWallMs = nowMs() - readStarted;
3576
+ readCompleted = true;
3577
+ let fatal;
3578
+ let hasFatal = false;
3579
+ for (const result of readResults)
3580
+ if (result !== undefined) {
3581
+ if (result.timings) {
3582
+ ioMs += result.timings.ioMs;
3583
+ maxFileIoMs = Math.max(maxFileIoMs, result.timings.ioMs);
3584
+ parseMs += result.timings.parseMs;
3585
+ hashMs += result.timings.hashMs;
3586
+ chars += result.timings.chars;
3587
+ }
3588
+ if (result.fatal !== undefined) {
3589
+ if (!hasFatal) {
3590
+ fatal = result.fatal;
3591
+ hasFatal = true;
3505
3592
  }
3506
- } else
3507
- rd.folders = [
3508
- {
3509
- fullyQualifiedName: SolutionConstants.ROOT_FOLDER_NAME
3593
+ continue;
3594
+ }
3595
+ if (!hasFatal)
3596
+ switch (result.outcome) {
3597
+ case "loaded": {
3598
+ loadedCount++;
3599
+ const rd = result.resource;
3600
+ for (const file of result.files)
3601
+ if (!solutionFiles.some((sf) => sf.name === file.name && sf.kind === file.kind))
3602
+ solutionFiles.push(file);
3603
+ resources.push(rd);
3604
+ const resourceKey = rd.key;
3605
+ const normalizedFullPath = result.normalizedPath;
3606
+ if (!pathsByKind.has(rd.kind))
3607
+ pathsByKind.set(rd.kind, []);
3608
+ const kindPaths = pathsByKind.get(rd.kind);
3609
+ if (kindPaths)
3610
+ kindPaths.push({
3611
+ name: rd.name,
3612
+ key: rd.key,
3613
+ path: normalizedFullPath
3614
+ });
3615
+ if (!context.isReadOnly && hashes && paths) {
3616
+ paths.set(resourceKey, normalizedFullPath);
3617
+ hashes.set(resourceKey, result.hash);
3618
+ }
3619
+ break;
3510
3620
  }
3511
- ];
3512
- resources.push(rd);
3513
- const resourceKey = rd.key;
3514
- const normalizedFullPath = this.getNormalizedPath(resourceFile);
3515
- if (!pathsByKind.has(rd.kind))
3516
- pathsByKind.set(rd.kind, []);
3517
- const kindPaths = pathsByKind.get(rd.kind);
3518
- if (kindPaths)
3519
- kindPaths.push({
3520
- name: rd.name,
3521
- key: rd.key,
3522
- path: normalizedFullPath
3621
+ case "missing":
3622
+ missingFiles.push(result.file);
3623
+ break;
3624
+ case "invalid":
3625
+ invalidFiles.push(result.file);
3626
+ break;
3627
+ case "parseError":
3628
+ parseErrors.push(result.file);
3629
+ break;
3630
+ }
3631
+ }
3632
+ if (hasFatal) {
3633
+ logReadMetrics("Fatal");
3634
+ throw fatal;
3635
+ }
3636
+ if (missingFiles.length > 0) {
3637
+ logReadMetrics("MissingFiles");
3638
+ throw new BadRequestException(ErrorCodes.Resources.MissingFileDependencies, `Solution has missing files: ${missingFiles.join(", ")}`);
3639
+ }
3640
+ if (invalidFiles.length > 0) {
3641
+ logReadMetrics("InvalidFiles");
3642
+ throw new BadRequestException(ErrorCodes.Resources.InvalidResourceFile, `Solution has resource files with invalid content: ${invalidFiles.join(", ")}`);
3643
+ }
3644
+ if (parseErrors.length > 0) {
3645
+ logReadMetrics("ParseErrors");
3646
+ throw new Error(`Failed to read resource files for solution ${context.path}: ${parseErrors.join(", ")}`);
3647
+ }
3648
+ const folderMap = new Map;
3649
+ const rootFolder = this.buildRootFolder(solutionKey, SolutionConstants.ROOT_FOLDER_NAME);
3650
+ folderMap.set(rootFolder.fullyQualifiedName.toLowerCase(), rootFolder);
3651
+ for (const res of resources)
3652
+ for (const fdep of res.folders ?? []) {
3653
+ const fqnLower = fdep.fullyQualifiedName.toLowerCase();
3654
+ if (!folderMap.has(fqnLower)) {
3655
+ const folderKey = this.generateGuidFromString(fdep.fullyQualifiedName);
3656
+ const pathSegments = fdep.fullyQualifiedName.split("/").filter((s) => s.length > 0).map((p) => {
3657
+ if (p.toLowerCase() !== SolutionConstants.ROOT_FOLDER_NAME.toLowerCase())
3658
+ return this.generateGuidFromString(SolutionConstants.ROOT_FOLDER_NAME);
3659
+ return rootFolder.key;
3660
+ });
3661
+ const folderPath = pathSegments.join(".");
3662
+ folderMap.set(fqnLower, {
3663
+ key: folderKey,
3664
+ fullyQualifiedName: fdep.fullyQualifiedName,
3665
+ path: folderPath
3523
3666
  });
3524
- if (!context.isReadOnly && hashes && paths) {
3525
- paths.set(resourceKey, normalizedFullPath);
3526
- hashes.set(resourceKey, await this.computeHash(content));
3527
3667
  }
3528
- } else {
3529
- this.logger.error("Failed to read resource file %s for solution %s: invalid content", undefined, resourceFile, context.path);
3530
- invalidFiles.push(resourceFile);
3531
- }
3532
- } catch (ex) {
3533
- if (ex instanceof OperationCancelledException || cancellationToken?.aborted) {
3534
- this.logger.warn("Operation cancelled while reading file %s for solution %s", resourceFile, context.path);
3535
- throw ex instanceof OperationCancelledException ? ex : new OperationCancelledException;
3536
- }
3537
- if (ex instanceof TimeoutException)
3538
- throw new TimeoutException(`Reading resource file ${resourceFile} for solution ${context.path} timed out: ${ex.message}`, ex.timeoutMs);
3539
- if (isFileNotFoundError(ex)) {
3540
- this.logger.warn("Resource file listed but missing in storage for solution %s: %s", resourceFile, context.path);
3541
- missingFiles.push(resourceFile);
3542
- } else {
3543
- this.logger.error("Failed to read resource file %s for solution %s", ex, resourceFile, context.path);
3544
- parseErrors.push(resourceFile);
3545
3668
  }
3669
+ const solution = {
3670
+ key: solutionKey,
3671
+ docVersion: SolutionConstants.CURRENT_DOC_VERSION,
3672
+ folders: Array.from(folderMap.values()),
3673
+ resources,
3674
+ files: solutionFiles
3675
+ };
3676
+ await this.replaceDuplicateKeysAsync(solution, cancellationToken);
3677
+ if (!context.isReadOnly && tree) {
3678
+ const orderedResourceKeys = getTopologicalIdsOrdering(buildDependencyGraph(solution.resources));
3679
+ tree.push(...orderedResourceKeys);
3546
3680
  }
3547
- if (missingFiles.length > 0)
3548
- throw new BadRequestException(ErrorCodes.Resources.MissingFileDependencies, `Solution has missing files: ${missingFiles.join(", ")}`);
3549
- if (invalidFiles.length > 0)
3550
- throw new BadRequestException(ErrorCodes.Resources.InvalidResourceFile, `Solution has resource files with invalid content: ${invalidFiles.join(", ")}`);
3551
- if (parseErrors.length > 0)
3552
- throw new Error(`Failed to read resource files for solution ${context.path}: ${parseErrors.join(", ")}`);
3553
- const folderMap = new Map;
3554
- const rootFolder = this.buildRootFolder(solutionKey, SolutionConstants.ROOT_FOLDER_NAME);
3555
- folderMap.set(rootFolder.fullyQualifiedName.toLowerCase(), rootFolder);
3556
- for (const res of resources)
3557
- for (const fdep of res.folders ?? []) {
3558
- const fqnLower = fdep.fullyQualifiedName.toLowerCase();
3559
- if (!folderMap.has(fqnLower)) {
3560
- const folderKey = this.generateGuidFromString(fdep.fullyQualifiedName);
3561
- const pathSegments = fdep.fullyQualifiedName.split("/").filter((s) => s.length > 0).map((p) => {
3562
- if (p.toLowerCase() !== SolutionConstants.ROOT_FOLDER_NAME.toLowerCase())
3563
- return this.generateGuidFromString(SolutionConstants.ROOT_FOLDER_NAME);
3564
- return rootFolder.key;
3565
- });
3566
- const folderPath = pathSegments.join(".");
3567
- folderMap.set(fqnLower, {
3568
- key: folderKey,
3569
- fullyQualifiedName: fdep.fullyQualifiedName,
3570
- path: folderPath
3571
- });
3572
- }
3681
+ logReadMetrics("Success");
3682
+ return solution;
3683
+ };
3684
+ try {
3685
+ return await readCore();
3686
+ } catch (ex) {
3687
+ if (!metricsLogged)
3688
+ logReadMetrics("Fatal");
3689
+ throw ex;
3690
+ }
3691
+ }
3692
+ async readResourceFilesAsync(context, fileStorageProvider, resourceFiles, cancellationToken) {
3693
+ const results = Array.from({
3694
+ length: resourceFiles.length
3695
+ }, () => {
3696
+ return;
3697
+ });
3698
+ if (resourceFiles.length === 0)
3699
+ return results;
3700
+ const computeHash = !context.isReadOnly;
3701
+ const degreeOfParallelism = Math.min(resolveMaxDegreeOfParallelism(this.options), resourceFiles.length);
3702
+ let nextIndex = 0;
3703
+ let stopRequested = false;
3704
+ const runWorkerAsync = async () => {
3705
+ while (!stopRequested && nextIndex < resourceFiles.length) {
3706
+ const index = nextIndex++;
3707
+ const resourceFile = resourceFiles[index];
3708
+ const result = await this.readResourceFileAsync(context, fileStorageProvider, resourceFile, computeHash, cancellationToken);
3709
+ results[index] = result;
3710
+ if (result.fatal !== undefined)
3711
+ stopRequested = true;
3573
3712
  }
3574
- const solution = {
3575
- key: solutionKey,
3576
- docVersion: SolutionConstants.CURRENT_DOC_VERSION,
3577
- folders: Array.from(folderMap.values()),
3578
- resources,
3579
- files: solutionFiles
3580
3713
  };
3581
- await this.replaceDuplicateKeysAsync(solution, cancellationToken);
3582
- if (!context.isReadOnly && tree) {
3583
- const orderedResourceKeys = getTopologicalIdsOrdering(buildDependencyGraph(solution.resources));
3584
- tree.push(...orderedResourceKeys);
3714
+ const workers = [];
3715
+ for (let i = 0;i < degreeOfParallelism; i++)
3716
+ workers.push(runWorkerAsync());
3717
+ await Promise.all(workers);
3718
+ if (cancellationToken?.aborted && !results.some((result) => result?.fatal !== undefined))
3719
+ throw cancellationError(cancellationToken);
3720
+ return results;
3721
+ }
3722
+ async readResourceFileAsync(context, fileStorageProvider, resourceFile, computeHash, cancellationToken) {
3723
+ const started = nowMs();
3724
+ let ioMs;
3725
+ let content;
3726
+ const failureTimings = () => {
3727
+ const elapsed = nowMs() - started;
3728
+ return ioMs === undefined ? {
3729
+ ioMs: elapsed,
3730
+ parseMs: 0,
3731
+ hashMs: 0,
3732
+ chars: 0
3733
+ } : {
3734
+ ioMs,
3735
+ parseMs: elapsed - ioMs,
3736
+ hashMs: 0,
3737
+ chars: content?.length ?? 0
3738
+ };
3739
+ };
3740
+ try {
3741
+ if (cancellationToken?.aborted)
3742
+ throw cancellationError(cancellationToken);
3743
+ const stream = await fileStorageProvider.openFileAsync(resourceFile, cancellationToken);
3744
+ content = await this.streamToString(stream);
3745
+ ioMs = nowMs() - started;
3746
+ const parseStarted = nowMs();
3747
+ const wrapper = this.caseInsensitiveSerializer.deserialize(content);
3748
+ if (!wrapper?.resource) {
3749
+ this.logger.error("Failed to read resource file %s for solution %s: invalid content", undefined, resourceFile, context.path);
3750
+ return {
3751
+ file: resourceFile,
3752
+ outcome: "invalid",
3753
+ timings: failureTimings()
3754
+ };
3755
+ }
3756
+ const files = [];
3757
+ const rd = this.fromSerializable(wrapper.resource, files);
3758
+ this.applyFolders(rd, resourceFile);
3759
+ const parseMs = nowMs() - parseStarted;
3760
+ let hash;
3761
+ let hashMs = 0;
3762
+ if (computeHash) {
3763
+ const hashStarted = nowMs();
3764
+ hash = await this.computeHash(content);
3765
+ hashMs = nowMs() - hashStarted;
3766
+ }
3767
+ return {
3768
+ file: resourceFile,
3769
+ outcome: "loaded",
3770
+ resource: rd,
3771
+ files,
3772
+ normalizedPath: this.getNormalizedPath(resourceFile),
3773
+ hash,
3774
+ timings: {
3775
+ ioMs,
3776
+ parseMs,
3777
+ hashMs,
3778
+ chars: content.length
3779
+ }
3780
+ };
3781
+ } catch (ex) {
3782
+ if (ex instanceof OperationCancelledException || cancellationToken?.aborted) {
3783
+ this.logger.warn("Operation cancelled while reading file %s for solution %s", resourceFile, context.path);
3784
+ return {
3785
+ file: resourceFile,
3786
+ outcome: "fatal",
3787
+ fatal: ex instanceof OperationCancelledException ? ex : cancellationError(cancellationToken),
3788
+ timings: failureTimings()
3789
+ };
3790
+ }
3791
+ if (ex instanceof TimeoutException)
3792
+ return {
3793
+ file: resourceFile,
3794
+ outcome: "fatal",
3795
+ fatal: new TimeoutException(`Reading resource file ${resourceFile} for solution ${context.path} timed out: ${ex.message}`, ex.timeoutMs),
3796
+ timings: failureTimings()
3797
+ };
3798
+ if (isFileNotFoundError(ex)) {
3799
+ this.logger.warn("Resource file listed but missing in storage for solution %s: %s", resourceFile, context.path);
3800
+ return {
3801
+ file: resourceFile,
3802
+ outcome: "missing",
3803
+ timings: failureTimings()
3804
+ };
3805
+ }
3806
+ this.logger.error("Failed to read resource file %s for solution %s", ex, resourceFile, context.path);
3807
+ return {
3808
+ file: resourceFile,
3809
+ outcome: "parseError",
3810
+ timings: failureTimings()
3811
+ };
3585
3812
  }
3586
- return solution;
3813
+ }
3814
+ applyFolders(resource, resourceFile) {
3815
+ const relPath = resourceFile.replace(/\\/g, "/");
3816
+ const segments = relPath.split("/").filter((s) => s.length > 0);
3817
+ const firstSegment = segments[0];
3818
+ if (segments.length >= 3 && firstSegment && firstSegment.toLowerCase() === SolutionConstants.RESOURCE_FILES_FOLDER_NAME.toLowerCase()) {
3819
+ const hasType = !!resource.type;
3820
+ const folderSegmentCount = hasType ? segments.length - 3 : segments.length - 2;
3821
+ if (folderSegmentCount < 1)
3822
+ resource.folders = [
3823
+ {
3824
+ fullyQualifiedName: SolutionConstants.ROOT_FOLDER_NAME
3825
+ }
3826
+ ];
3827
+ else {
3828
+ const segmentsToUse = segments.slice(1, folderSegmentCount);
3829
+ const folderFqn = segmentsToUse.join("/");
3830
+ resource.folders = [
3831
+ {
3832
+ fullyQualifiedName: folderFqn
3833
+ }
3834
+ ];
3835
+ }
3836
+ } else
3837
+ resource.folders = [
3838
+ {
3839
+ fullyQualifiedName: SolutionConstants.ROOT_FOLDER_NAME
3840
+ }
3841
+ ];
3587
3842
  }
3588
3843
  async writeAsync(context, solution, cancellationToken) {
3589
3844
  if (context.isReadOnly)
@@ -3888,7 +4143,7 @@ class MultiFileSolutionDefinitionFactory {
3888
4143
  // ../../node_modules/@uipath/resource-builder-sdk/dist/embedded-files-default.js
3889
4144
  async function createDefaultEmbeddedFileReaderAsync() {
3890
4145
  const [{ EmbeddedFileReader }, { JsonSerializerFactory: JsonSerializerFactory2 }] = await Promise.all([
3891
- import("./embedded-file-reader-v8c2yj2a.js"),
4146
+ import("./embedded-file-reader-r66242ey.js"),
3892
4147
  import("./index-kmp9fmhb.js")
3893
4148
  ]);
3894
4149
  return new EmbeddedFileReader(new JsonSerializerFactory2);
@@ -3906,6 +4161,7 @@ var ServiceTokens = {
3906
4161
  SecretsProvider: "ISecretsProvider",
3907
4162
  FileStorageProviderFactory: "IFileStorageProviderFactory",
3908
4163
  IpRangeBypassSecretProvider: "IIpRangeBypassSecretProvider",
4164
+ FeatureFlagProvider: "IFeatureFlagProvider",
3909
4165
  SolutionDefinitionProvider: "ISolutionDefinitionProvider",
3910
4166
  SolutionDefinitionFactory: "ISolutionDefinitionFactory",
3911
4167
  ArtifactResourceSpecEnhancer: "IArtifactResourceSpecEnhancer",
@@ -4256,6 +4512,9 @@ function getBindingType(resourceKind, resourceType) {
4256
4512
  }
4257
4513
 
4258
4514
  // ../../node_modules/@uipath/resource-builder-sdk/dist/bindings/bindings-metadata-serializer.js
4515
+ var SUPPORTED_SCHEMA_MAJOR_VERSION = 2;
4516
+ var INT32_MAX_VALUE = 2147483647;
4517
+
4259
4518
  class BindingsMetadataSerializer {
4260
4519
  tryDeserialize(input) {
4261
4520
  if (!input)
@@ -4266,30 +4525,52 @@ class BindingsMetadataSerializer {
4266
4525
  let cleanInput = input.charCodeAt(0) === 65279 ? input.slice(1) : input;
4267
4526
  if (cleanInput.charCodeAt(cleanInput.length - 1) === 26)
4268
4527
  cleanInput = cleanInput.slice(0, -1);
4269
- const jsonObject = JSON.parse(cleanInput);
4528
+ const root = JSON.parse(cleanInput);
4529
+ if (root === null || typeof root != "object" || Array.isArray(root)) {
4530
+ this.logger.warn("Invalid bindings: content is not a JSON object");
4531
+ return {
4532
+ success: false
4533
+ };
4534
+ }
4535
+ const jsonObject = root;
4270
4536
  const versionValue = jsonObject[BindingsKnownKeys.Version];
4271
- if (!versionValue)
4537
+ if (typeof versionValue != "string") {
4538
+ this.logger.warn(`Invalid bindings: '${BindingsKnownKeys.Version}' is missing or not a string`);
4272
4539
  return {
4273
4540
  success: false
4274
4541
  };
4275
- const versionParts = versionValue.split(".").map(Number);
4276
- const majorVersion = versionParts[0];
4277
- if (majorVersion !== 2)
4278
- throw new Error("Unsupported bindings schema");
4542
+ }
4543
+ const majorVersion = BindingsMetadataSerializer.tryParseMajorVersion(versionValue);
4544
+ if (majorVersion === undefined) {
4545
+ this.logger.warn(`Invalid bindings: '${BindingsKnownKeys.Version}' is not a valid version`);
4546
+ return {
4547
+ success: false
4548
+ };
4549
+ }
4550
+ if (majorVersion !== SUPPORTED_SCHEMA_MAJOR_VERSION) {
4551
+ this.logger.warn(`Invalid bindings: unsupported schema major version ${majorVersion}`);
4552
+ return {
4553
+ success: false
4554
+ };
4555
+ }
4556
+ const resources = jsonObject[BindingsKnownKeys.Resources];
4557
+ if (!Array.isArray(resources)) {
4558
+ this.logger.warn(`Invalid bindings: '${BindingsKnownKeys.Resources}' is missing or not an array`);
4559
+ return {
4560
+ success: false
4561
+ };
4562
+ }
4279
4563
  const metadata = {
4280
4564
  version: versionValue,
4281
4565
  resources: []
4282
4566
  };
4283
- const resources = jsonObject[BindingsKnownKeys.Resources];
4284
- if (Array.isArray(resources))
4285
- for (const resourceElement of resources) {
4286
- if (resourceElement == null) {
4287
- this.logger.warn("Skipping null bindings resource element");
4288
- continue;
4289
- }
4290
- const resource = this.getBindingsResourceV2(resourceElement);
4291
- metadata.resources.push(resource);
4567
+ for (const resourceElement of resources) {
4568
+ if (resourceElement == null) {
4569
+ this.logger.warn("Skipping null bindings resource element");
4570
+ continue;
4292
4571
  }
4572
+ metadata.resources.push(this.getBindingsResourceV2(resourceElement));
4573
+ }
4293
4574
  this.linkDependencies(metadata.resources);
4294
4575
  return {
4295
4576
  success: true,
@@ -4302,6 +4583,22 @@ class BindingsMetadataSerializer {
4302
4583
  };
4303
4584
  }
4304
4585
  }
4586
+ static tryParseMajorVersion(value) {
4587
+ const parts = value.split(".");
4588
+ if (parts.length < 2 || parts.length > 4)
4589
+ return;
4590
+ let major;
4591
+ for (const [index, part] of parts.entries()) {
4592
+ if (!/^\s*[+-]?\d+\s*$/.test(part))
4593
+ return;
4594
+ const component = Number(part);
4595
+ if (component < 0 || component > INT32_MAX_VALUE)
4596
+ return;
4597
+ if (index === 0)
4598
+ major = component === 0 ? 0 : component;
4599
+ }
4600
+ return major;
4601
+ }
4305
4602
  linkDependencies(resources) {
4306
4603
  for (const resource of resources) {
4307
4604
  const propertyMeta = resource.metadata;
@@ -4461,6 +4758,62 @@ class BindingOverwritesMappingRequest {
4461
4758
  }
4462
4759
  }
4463
4760
 
4761
+ // ../../node_modules/@uipath/resource-builder-sdk/dist/bindings/jit-debug-project-types.js
4762
+ var JIT_DEBUG_PROJECT_TYPES_FEATURE_FLAG = "FE.JitDebugProjectTypes";
4763
+ var PROCESS_KIND = "process";
4764
+ var BUSINESS_RULE_KIND = "businessrule";
4765
+ var APP_KIND = "app";
4766
+ var LOW_CODE_APP_PROJECT_TYPE = "webapp";
4767
+ var LOW_CODE_APP_TYPES = new Set([
4768
+ "workflow action"
4769
+ ]);
4770
+ var CODED_APP_PROJECT_TYPE = "appv2";
4771
+ var CODED_APP_TYPES = new Set([
4772
+ "coded",
4773
+ "codedaction"
4774
+ ]);
4775
+ var DEFAULT_PROCESS_PROJECT_TYPE = "process";
4776
+ var KNOWN_PROCESS_PROJECT_TYPES = new Set([
4777
+ DEFAULT_PROCESS_PROJECT_TYPE,
4778
+ "processorchestration",
4779
+ "agent",
4780
+ "api",
4781
+ "flow",
4782
+ "function",
4783
+ "casemanagement",
4784
+ "webapp",
4785
+ "businessrules"
4786
+ ]);
4787
+ var BUSINESS_RULE_PROJECT_TYPE = "businessrules";
4788
+ function parseJitDebugProjectTypes(flagValue) {
4789
+ if (!flagValue || !flagValue.trim())
4790
+ return [];
4791
+ return flagValue.split(",").map((t) => t.trim()).filter((t) => t.length > 0);
4792
+ }
4793
+ function solutionSupportsJitDebug(solution, flagValue) {
4794
+ const enabledProjectTypes = parseJitDebugProjectTypes(flagValue).map((t) => t.toLowerCase());
4795
+ if (enabledProjectTypes.length === 0)
4796
+ return false;
4797
+ return (solution.resources ?? []).filter((r) => (r.projectKey != null || r.isArtefactResource === true) && isDecisionKind(r.kind)).every((r) => enabledProjectTypes.some((projectType) => matches(projectType, r)));
4798
+ }
4799
+ function isDecisionKind(kind) {
4800
+ const normalized = (kind ?? "").toLowerCase();
4801
+ return normalized === PROCESS_KIND || normalized === BUSINESS_RULE_KIND || normalized === APP_KIND;
4802
+ }
4803
+ function matches(projectType, resource) {
4804
+ if ((resource.kind ?? "").toLowerCase() === BUSINESS_RULE_KIND)
4805
+ return projectType === BUSINESS_RULE_PROJECT_TYPE;
4806
+ if ((resource.kind ?? "").toLowerCase() === APP_KIND) {
4807
+ const appType = (resource.type ?? "").toLowerCase();
4808
+ if (appType === "" || LOW_CODE_APP_TYPES.has(appType))
4809
+ return projectType === LOW_CODE_APP_PROJECT_TYPE;
4810
+ return CODED_APP_TYPES.has(appType) && projectType === CODED_APP_PROJECT_TYPE;
4811
+ }
4812
+ const resourceType = (resource.type ?? "").toLowerCase();
4813
+ const processType = resourceType === "" ? DEFAULT_PROCESS_PROJECT_TYPE : resourceType;
4814
+ return !KNOWN_PROCESS_PROJECT_TYPES.has(processType) || projectType === processType;
4815
+ }
4816
+
4464
4817
  // ../../node_modules/@uipath/resource-builder-sdk/dist/bindings/binding-overwrites-handler.js
4465
4818
  class BindingOverwritesHandler {
4466
4819
  async handleAsync(request, cancellationToken) {
@@ -4476,6 +4829,10 @@ class BindingOverwritesHandler {
4476
4829
  if (bindingResources.length === 0)
4477
4830
  return {};
4478
4831
  const result = {};
4832
+ const solution = await request.context.loadAsync(cancellationToken);
4833
+ const jitDebugProjectTypes = this.featureFlagProvider.getString(JIT_DEBUG_PROJECT_TYPES_FEATURE_FLAG, "");
4834
+ const emptyFolderPathForArtefacts = solutionSupportsJitDebug(solution, jitDebugProjectTypes);
4835
+ this.logger.info(`Binding overwrites for solution ${request.context.path}: JIT debug ${emptyFolderPathForArtefacts ? "on" : "off"} (FE.JitDebugProjectTypes = '${jitDebugProjectTypes}')`);
4479
4836
  const resourceOverwrites = await this.resourceOverwritesService.getResourceOverwritesAsync(request.context, cancellationToken);
4480
4837
  for (const bindingResource of bindingResources) {
4481
4838
  const resourceOverwrite = resourceOverwrites.get(bindingResource.resourceKey.toLowerCase());
@@ -4488,8 +4845,7 @@ class BindingOverwritesHandler {
4488
4845
  [BindingsKnownKeys.FolderKeyPropertyName]: resourceOverwrite.folderKey ?? ""
4489
4846
  };
4490
4847
  else {
4491
- const isBusinessRule = bindingResource.binding.resourceType === models_BindingsResourceType.BusinessRule;
4492
- const folderPath = bindingResource.isArtefactResource && !isBusinessRule ? "" : resourceOverwrite.folderFullyQualifiedName ?? "";
4848
+ const folderPath = emptyFolderPathForArtefacts && bindingResource.isArtefactResource ? "" : resourceOverwrite.folderFullyQualifiedName ?? "";
4493
4849
  overwrite = {
4494
4850
  [BindingsKnownKeys.FolderPathPropertyName]: folderPath,
4495
4851
  [BindingsKnownKeys.NamePropertyName]: resourceOverwrite.resourceName
@@ -4511,9 +4867,10 @@ class BindingOverwritesHandler {
4511
4867
  throw new BadRequestException("Bindings.ValidationFailed", `Binding validation failed: ${failureMessages}`);
4512
4868
  }
4513
4869
  }
4514
- constructor(mediator, resourceOverwritesService, loggerFactory) {
4870
+ constructor(mediator, resourceOverwritesService, loggerFactory, featureFlagProvider) {
4515
4871
  this.mediator = mediator;
4516
4872
  this.resourceOverwritesService = resourceOverwritesService;
4873
+ this.featureFlagProvider = featureFlagProvider;
4517
4874
  this.logger = loggerFactory.create("BindingOverwritesHandler");
4518
4875
  }
4519
4876
  }
@@ -4522,6 +4879,11 @@ function removeTimeTriggerBindings(bindings) {
4522
4879
  }
4523
4880
 
4524
4881
  // ../../node_modules/@uipath/resource-builder-sdk/dist/bindings/binding-overwrites-mapping-handler.js
4882
+ function isCodedAppType(type) {
4883
+ const normalized = type?.toLowerCase();
4884
+ return normalized === "coded" || normalized === "codedaction";
4885
+ }
4886
+
4525
4887
  class BindingOverwritesMappingRequestHandler {
4526
4888
  async handleAsync(request, cancellationToken) {
4527
4889
  const solutionBindings = request.bindings.resources.filter((x) => isSolutionResource(x.metadata));
@@ -4547,7 +4909,8 @@ class BindingOverwritesMappingRequestHandler {
4547
4909
  result.push({
4548
4910
  binding: bindingsResource,
4549
4911
  resourceKey: resource.key,
4550
- isArtefactResource: resource.projectKey != null
4912
+ isArtefactResource: resource.projectKey != null,
4913
+ isCodedApp: bindingsResource.resourceType === models_BindingsResourceType.App && isCodedAppType(resource.type)
4551
4914
  });
4552
4915
  } else {
4553
4916
  this.logger.error(`Solution does not contain binding resource of type ${models_BindingsResourceType[bindingsResource.resourceType]}.`);
@@ -5552,6 +5915,9 @@ class SolutionPublishLocationRequest {
5552
5915
  }
5553
5916
 
5554
5917
  class SolutionPublishLocationRequestV2 {
5918
+ constructor(permissionType) {
5919
+ this.permissionType = permissionType;
5920
+ }
5555
5921
  }
5556
5922
 
5557
5923
  class SettingsRequest {
@@ -5716,12 +6082,13 @@ function _ts_param3(paramIndex, decorator) {
5716
6082
  }
5717
6083
 
5718
6084
  class SolutionPublishLocationRequestV2Handler {
5719
- async handleAsync(_request, cancellationToken) {
6085
+ async handleAsync(request, cancellationToken) {
5720
6086
  try {
5721
6087
  const orchestratorClient = await this.orchestratorClientFactory.getClientAsync(cancellationToken);
5722
6088
  if (!orchestratorClient)
5723
6089
  throw new InvalidOperationException("Failed to create Orchestrator client");
5724
- return await orchestratorClient.getPublishLocationsAsync(cancellationToken);
6090
+ const { permissionType } = request;
6091
+ return permissionType == null ? await orchestratorClient.getPublishLocationsAsync(cancellationToken) : await orchestratorClient.getAccessiblePublishLocationsAsync(permissionType, cancellationToken);
5725
6092
  } catch (error) {
5726
6093
  this.logger.error("An unexpected error occurred while retrieving publish locations from Automation Solutions service.", error);
5727
6094
  throw error;
@@ -7161,8 +7528,8 @@ class SolutionDefinitionHelper {
7161
7528
  if (references.length === 0)
7162
7529
  continue;
7163
7530
  const referenceKind = refProp["referenceKind"];
7164
- const matches = (ref) => ref.name != null && invariantEquals(resource.name, ref.name) && referenceKind != null && invariantEquals(referenceKind, resource.kind);
7165
- const filtered = references.filter((r) => !matches(r));
7531
+ const matches2 = (ref) => ref.name != null && invariantEquals(resource.name, ref.name) && referenceKind != null && invariantEquals(referenceKind, resource.kind);
7532
+ const filtered = references.filter((r) => !matches2(r));
7166
7533
  if (filtered.length !== references.length)
7167
7534
  spec[refProp.property] = isSingleReferenceProperty(refProp) ? filtered[0] ?? null : filtered;
7168
7535
  }
@@ -7751,7 +8118,7 @@ class GetResourceKeyForProjectRequestHandler {
7751
8118
  projectKey: request.projectKey,
7752
8119
  solution: request.context.path
7753
8120
  });
7754
- const cacheKey = `prk:${request.projectKey}`;
8121
+ const cacheKey = `prk:${request.context.path}:${request.projectKey}`;
7755
8122
  const cached = await this.cacheProvider.getAsync(cacheKey, cancellationToken);
7756
8123
  if (cached && typeof cached == "object" && "resourceKey" in cached) {
7757
8124
  this.logger.info("Cache hit for project {projectKey} resource key.", {
@@ -8579,7 +8946,11 @@ class UpdateResourceConfigurationCommandHandler {
8579
8946
  for (const prop of command.properties) {
8580
8947
  const propKey = prop.property.toLowerCase();
8581
8948
  const metadata = propertiesMetadata.get(propKey);
8582
- if (!(!metadata || isAnyReferenceProperty(metadata)) && metadata.readOnly !== true) {
8949
+ if (metadata && metadata.readOnly !== true) {
8950
+ if (isAnyReferenceProperty(metadata)) {
8951
+ updated = this.setSolutionReference(solution, resource, currentConfiguration, propertiesMetadata, metadata, prop.configuredValue) || updated;
8952
+ continue;
8953
+ }
8583
8954
  if (isSecretProperty(metadata)) {
8584
8955
  const secretValue = prop.configuredValue?.toString() || "";
8585
8956
  const existingKey = currentConfiguration[metadata.property]?.toString();
@@ -8623,6 +8994,38 @@ class UpdateResourceConfigurationCommandHandler {
8623
8994
  await command.context.saveChangesAsync(cancellationToken);
8624
8995
  return resourceConfiguration;
8625
8996
  }
8997
+ setSolutionReference(solution, resource, currentConfiguration, propertiesMetadata, metadata, configuredValue) {
8998
+ const referenceKind = metadata["referenceKind"];
8999
+ if (!isSingleReferenceProperty(metadata) || isFileReferenceProperty(metadata) || typeof referenceKind != "string" || !referenceKind)
9000
+ return false;
9001
+ const requested = asReference(configuredValue);
9002
+ const target = requested?.key ? solution.resources.find((r) => invariantEquals(r.key, requested.key) && invariantEquals(r.kind, referenceKind)) : undefined;
9003
+ if (!requested || !target || invariantEquals(target.key, resource.key))
9004
+ return false;
9005
+ const dependencies = resource.dependencies ??= [];
9006
+ const previous = asReference(currentConfiguration[metadata.property]);
9007
+ const previousKey = previous?.key;
9008
+ const isReferencedElsewhere = (key) => [
9009
+ ...propertiesMetadata.values()
9010
+ ].some((p) => isAnyReferenceProperty(p) && !isFileReferenceProperty(p) && typeof p["referenceKind"] == "string" && invariantEquals(p["referenceKind"], target.kind) && !invariantEquals(p.property, metadata.property) && asReferences(currentConfiguration[p.property]).some((r) => r.key !== undefined && invariantEquals(r.key, key)));
9011
+ if (previousKey && !invariantEquals(previousKey, target.key) && !isReferencedElsewhere(previousKey)) {
9012
+ const previousName = solution.resources.find((r) => invariantEquals(r.key, previousKey) && invariantEquals(r.kind, target.kind))?.name ?? previous?.name ?? "";
9013
+ resource.dependencies = dependencies.filter((d) => !(invariantEquals(d.kind, target.kind) && invariantEquals(d.name, previousName)));
9014
+ }
9015
+ if (!resource.dependencies.some((d) => invariantEquals(d.kind, target.kind) && invariantEquals(d.name, target.name)))
9016
+ resource.dependencies.push({
9017
+ kind: target.kind,
9018
+ name: target.name
9019
+ });
9020
+ currentConfiguration[metadata.property] = {
9021
+ name: target.name,
9022
+ key: target.key,
9023
+ folderKey: requested.folderKey ?? null,
9024
+ lookupStrategy: null,
9025
+ info: null
9026
+ };
9027
+ return true;
9028
+ }
8626
9029
  async updateReferencesName(solutionDefinition, resource, oldName, cancellationToken) {
8627
9030
  const resourcesToBeChanged = solutionDefinition.resources.filter((r) => r.key !== resource.key && (r.dependencies ?? []).some((d) => invariantEquals(d.kind, resource.kind) && invariantEquals(d.name, oldName)));
8628
9031
  if (resourcesToBeChanged.length === 0)
@@ -8909,6 +9312,28 @@ class UpsertResourceSecretCommandHandler {
8909
9312
  this.secretsProvider = secretsProvider;
8910
9313
  }
8911
9314
  }
9315
+ function asReference(value) {
9316
+ if (!value || typeof value != "object" || Array.isArray(value))
9317
+ return;
9318
+ const record = value;
9319
+ const pick = (name) => {
9320
+ const entry = Object.entries(record).find(([k]) => k.toLowerCase() === name.toLowerCase());
9321
+ return typeof entry?.[1] == "string" ? entry[1] : undefined;
9322
+ };
9323
+ return {
9324
+ key: pick("key"),
9325
+ name: pick("name"),
9326
+ folderKey: pick("folderKey")
9327
+ };
9328
+ }
9329
+ function asReferences(value) {
9330
+ if (Array.isArray(value))
9331
+ return value.map(asReference).filter((r) => r !== undefined);
9332
+ const single = asReference(value);
9333
+ return single ? [
9334
+ single
9335
+ ] : [];
9336
+ }
8912
9337
 
8913
9338
  // ../../node_modules/@uipath/resource-builder-sdk/dist/handlers/solution-handlers.js
8914
9339
  var DUPLICATE_NAMES_SUPPORTED_KINDS = new Set([
@@ -12157,7 +12582,16 @@ class AutomationSolutionsClientProxy2 {
12157
12582
  // ../../node_modules/@uipath/resource-builder-sdk/dist/clients/orchestrator/orchestrator-client.js
12158
12583
  class OrchestratorClient {
12159
12584
  async getPublishLocationsAsync(cancellationToken) {
12160
- const url = `${this.options.baseUrl}api/v2/AutomationSolutions/publish_locations`;
12585
+ return this.getPublishLocationsFromAsync(this.publishLocationsUrl(), cancellationToken);
12586
+ }
12587
+ async getAccessiblePublishLocationsAsync(permissionType, cancellationToken) {
12588
+ const url = `${this.publishLocationsUrl()}?permissionType=${encodeURIComponent(permissionType)}`;
12589
+ return this.getPublishLocationsFromAsync(url, cancellationToken);
12590
+ }
12591
+ publishLocationsUrl() {
12592
+ return `${this.options.baseUrl}api/v2/AutomationSolutions/publish_locations`;
12593
+ }
12594
+ async getPublishLocationsFromAsync(url, cancellationToken) {
12161
12595
  const headers = OrchestratorClientFactory.buildHeaders(this.options.securityData);
12162
12596
  const response = await fetch(url, {
12163
12597
  method: "GET",
@@ -12847,7 +13281,7 @@ class ReconcileProjectsCommandHandler {
12847
13281
  } : {
12848
13282
  resourceKey: undefined
12849
13283
  };
12850
- await this.cacheProvider.setAsync(`prk:${projectKey}`, result, cancellationToken);
13284
+ await this.cacheProvider.setAsync(`prk:${context.path}:${projectKey}`, result, cancellationToken);
12851
13285
  }
12852
13286
  groupByProjectKey(artefactResources) {
12853
13287
  const map = new Map;
@@ -13721,6 +14155,11 @@ class ResourceBuilder {
13721
14155
  const request = new SolutionPublishLocationRequestV2;
13722
14156
  return this._mediator.sendAsync(request, cancellationToken);
13723
14157
  }
14158
+ async getAccessiblePublishLocationsAsync(permissionType, cancellationToken) {
14159
+ this.throwIfCancelled(cancellationToken);
14160
+ const request = new SolutionPublishLocationRequestV2(permissionType);
14161
+ return this._mediator.sendAsync(request, cancellationToken);
14162
+ }
13724
14163
  async getSettingsAsync(cancellationToken) {
13725
14164
  this.throwIfCancelled(cancellationToken);
13726
14165
  const request = new SettingsRequest;
@@ -14280,9 +14719,9 @@ class UnconfiguredEmbeddedFileReader {
14280
14719
  }
14281
14720
 
14282
14721
  // ../../node_modules/@uipath/resource-builder-sdk/dist/container.js
14283
- function createContainer(accessProvider, cacheProvider, secretsProvider, fileStorageProviderFactory, ipRangeBypassSecretProvider, solutionDefinitionProvider, solutionDefinitionFactory, artifactResourceSpecEnhancer, httpReaderOptions, loggerFactory, embeddedFileReader, solutionContextOptions) {
14722
+ function createContainer(accessProvider, cacheProvider, secretsProvider, fileStorageProviderFactory, ipRangeBypassSecretProvider, solutionDefinitionProvider, solutionDefinitionFactory, artifactResourceSpecEnhancer, httpReaderOptions, loggerFactory, embeddedFileReader, solutionContextOptions, featureFlagProvider) {
14284
14723
  const childContainer = import_tsyringe6.container.createChildContainer();
14285
- registerProviders(childContainer, accessProvider, cacheProvider, secretsProvider, fileStorageProviderFactory, ipRangeBypassSecretProvider, solutionDefinitionProvider, solutionDefinitionFactory, artifactResourceSpecEnhancer, httpReaderOptions, loggerFactory, solutionContextOptions);
14724
+ registerProviders(childContainer, accessProvider, cacheProvider, secretsProvider, fileStorageProviderFactory, ipRangeBypassSecretProvider, solutionDefinitionProvider, solutionDefinitionFactory, artifactResourceSpecEnhancer, httpReaderOptions, loggerFactory, solutionContextOptions, featureFlagProvider);
14286
14725
  registerServices(childContainer, embeddedFileReader);
14287
14726
  registerHandlers(childContainer);
14288
14727
  childContainer.register(ServiceTokens.Mediator, {
@@ -14306,11 +14745,15 @@ function registerProvider(diContainer, token, provider) {
14306
14745
  break;
14307
14746
  }
14308
14747
  }
14309
- function registerProviders(diContainer, accessProvider, cacheProvider, secretsProvider, fileStorageProviderFactory, ipRangeBypassSecretProvider, solutionDefinitionProvider, solutionDefinitionFactory, artifactResourceSpecEnhancer, httpReaderOptions, loggerFactory, solutionContextOptions) {
14748
+ function registerProviders(diContainer, accessProvider, cacheProvider, secretsProvider, fileStorageProviderFactory, ipRangeBypassSecretProvider, solutionDefinitionProvider, solutionDefinitionFactory, artifactResourceSpecEnhancer, httpReaderOptions, loggerFactory, solutionContextOptions, featureFlagProvider) {
14310
14749
  registerProvider(diContainer, ServiceTokens.AccessProvider, accessProvider);
14311
14750
  registerProvider(diContainer, ServiceTokens.CacheProvider, cacheProvider);
14312
14751
  registerProvider(diContainer, ServiceTokens.SecretsProvider, secretsProvider);
14313
14752
  registerProvider(diContainer, ServiceTokens.IpRangeBypassSecretProvider, ipRangeBypassSecretProvider);
14753
+ registerProvider(diContainer, ServiceTokens.FeatureFlagProvider, featureFlagProvider ?? {
14754
+ instance: new NullFeatureFlagProvider,
14755
+ lifetime: service_tokens_ServiceLifetime.Singleton
14756
+ });
14314
14757
  registerProvider(diContainer, ServiceTokens.FileStorageProviderFactory, fileStorageProviderFactory);
14315
14758
  registerProvider(diContainer, ServiceTokens.SolutionDefinitionProvider, solutionDefinitionProvider);
14316
14759
  registerProvider(diContainer, ServiceTokens.SolutionDefinitionFactory, solutionDefinitionFactory);
@@ -14747,7 +15190,8 @@ function registerHandlers(diContainer) {
14747
15190
  const mediator = c.resolve(ServiceTokens.Mediator);
14748
15191
  const resourceOverwritesService = c.resolve(Tokens.IResourceOverwritesService);
14749
15192
  const loggerFactory = c.resolve(ServiceTokens.LoggerFactory);
14750
- return new BindingOverwritesHandler(mediator, resourceOverwritesService, loggerFactory);
15193
+ const featureFlagProvider = c.resolve(ServiceTokens.FeatureFlagProvider);
15194
+ return new BindingOverwritesHandler(mediator, resourceOverwritesService, loggerFactory, featureFlagProvider);
14751
15195
  }
14752
15196
  });
14753
15197
  diContainer.register(createCommandHandlerToken(BindingOverwritesValidationCommand.name), {
@@ -14755,7 +15199,8 @@ function registerHandlers(diContainer) {
14755
15199
  const mediator = c.resolve(ServiceTokens.Mediator);
14756
15200
  const resourceOverwritesService = c.resolve(Tokens.IResourceOverwritesService);
14757
15201
  const loggerFactory = c.resolve(ServiceTokens.LoggerFactory);
14758
- return new BindingOverwritesHandler(mediator, resourceOverwritesService, loggerFactory);
15202
+ const featureFlagProvider = c.resolve(ServiceTokens.FeatureFlagProvider);
15203
+ return new BindingOverwritesHandler(mediator, resourceOverwritesService, loggerFactory, featureFlagProvider);
14759
15204
  }
14760
15205
  });
14761
15206
  diContainer.register(createRequestHandlerToken(BindingOverwritesMappingRequest.name), {
@@ -15037,6 +15482,11 @@ class ResourceBuilderConfiguration {
15037
15482
  this._ipRangeBypassSecretProviderLifetime = lifetime;
15038
15483
  return this;
15039
15484
  }
15485
+ addFeatureFlagProvider(provider, lifetime = service_tokens_ServiceLifetime.Scoped) {
15486
+ this._featureFlagProviderProvider = provider;
15487
+ this._featureFlagProviderLifetime = lifetime;
15488
+ return this;
15489
+ }
15040
15490
  addSolutionDefinitionProvider(provider, lifetime = service_tokens_ServiceLifetime.Scoped) {
15041
15491
  this._solutionDefinitionProviderProvider = provider;
15042
15492
  this._solutionDefinitionProviderLifetime = lifetime;
@@ -15090,6 +15540,11 @@ class ResourceBuilderConfiguration {
15090
15540
  instance: ipRangeBypassSecretProviderInstance,
15091
15541
  lifetime: this._ipRangeBypassSecretProviderLifetime
15092
15542
  };
15543
+ const featureFlagProviderInstance = this._featureFlagProviderProvider ? await resolveProvider(this._featureFlagProviderProvider) : new NullFeatureFlagProvider;
15544
+ const featureFlagProvider = {
15545
+ instance: featureFlagProviderInstance,
15546
+ lifetime: this._featureFlagProviderLifetime
15547
+ };
15093
15548
  const secretsProviderInstance = this._secretsProviderProvider ? await resolveProvider(this._secretsProviderProvider) : new NullSecretsProvider;
15094
15549
  const secretsProvider = {
15095
15550
  instance: secretsProviderInstance,
@@ -15133,7 +15588,7 @@ class ResourceBuilderConfiguration {
15133
15588
  lifetime: this._artifactResourceSpecEnhancerLifetime
15134
15589
  };
15135
15590
  const embeddedFileReader = await createDefaultEmbeddedFileReaderAsync();
15136
- const container3 = createContainer(accessProvider, cacheProvider, secretsProvider, fileStorageProviderFactory, ipRangeBypassSecretProvider, solutionDefinitionProvider, solutionDefinitionFactory, artifactResourceSpecEnhancer, this._httpReaderOptions, loggerFactory, embeddedFileReader, this._solutionContextOptions);
15591
+ const container3 = createContainer(accessProvider, cacheProvider, secretsProvider, fileStorageProviderFactory, ipRangeBypassSecretProvider, solutionDefinitionProvider, solutionDefinitionFactory, artifactResourceSpecEnhancer, this._httpReaderOptions, loggerFactory, embeddedFileReader, this._solutionContextOptions, featureFlagProvider);
15137
15592
  return new ResourceBuilderServices(container3);
15138
15593
  }
15139
15594
  async buildServices() {
@@ -15145,6 +15600,7 @@ class ResourceBuilderConfiguration {
15145
15600
  this._secretsProviderLifetime = service_tokens_ServiceLifetime.Scoped;
15146
15601
  this._fileStorageProviderFactoryLifetime = service_tokens_ServiceLifetime.Singleton;
15147
15602
  this._ipRangeBypassSecretProviderLifetime = service_tokens_ServiceLifetime.Scoped;
15603
+ this._featureFlagProviderLifetime = service_tokens_ServiceLifetime.Scoped;
15148
15604
  this._solutionDefinitionProviderLifetime = service_tokens_ServiceLifetime.Scoped;
15149
15605
  this._solutionDefinitionFactoryLifetime = service_tokens_ServiceLifetime.Scoped;
15150
15606
  this._artifactResourceSpecEnhancerLifetime = service_tokens_ServiceLifetime.Scoped;
@@ -16519,12 +16975,12 @@ async function findResourceByKeyInRcs(builder, kind, expectedKey, folderPath, pr
16519
16975
  return;
16520
16976
  }
16521
16977
  async function searchRcsResources(builder, kind, name) {
16522
- const [searchError, matches] = await catchError(searchRcsResourcesStrict(builder, kind, name));
16978
+ const [searchError, matches2] = await catchError(searchRcsResourcesStrict(builder, kind, name));
16523
16979
  if (searchError) {
16524
16980
  logger.warn(`Failed to search ${kind} resources in RCS: ${searchError.message}`);
16525
16981
  return [];
16526
16982
  }
16527
- return matches;
16983
+ return matches2;
16528
16984
  }
16529
16985
  async function searchRcsResourcesStrict(builder, kind, name) {
16530
16986
  let pageCursor;
@@ -16532,8 +16988,8 @@ async function searchRcsResourcesStrict(builder, kind, name) {
16532
16988
  do {
16533
16989
  const result = await builder.searchResourcesAsync(kind, undefined, name, pageCursor, 50, undefined, false);
16534
16990
  for (const folderResources of result.availableResources) {
16535
- const matches = folderResources.resources.filter((r) => r.name.toLowerCase() === name.toLowerCase());
16536
- for (const match of matches) {
16991
+ const matches2 = folderResources.resources.filter((r) => r.name.toLowerCase() === name.toLowerCase());
16992
+ for (const match of matches2) {
16537
16993
  allMatches.push({
16538
16994
  key: match.key,
16539
16995
  name: match.name,
@@ -17068,4 +17524,4 @@ export {
17068
17524
  writeSolutionFile
17069
17525
  };
17070
17526
 
17071
- //# debugId=DD659B11A166BFC064756E2164756E21
17527
+ //# debugId=B84D0FB0F7D0619764756E2164756E21