@uipath/case-tool 1.204.0-preview.262 → 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 (24) hide show
  1. package/dist/THIRD-PARTY-NOTICES.md +2 -2
  2. package/dist/{business-rule-export-kg5bk8aw.js → business-rule-export-6mjgtv3v.js} +1 -1
  3. package/dist/{case-debug-studio-web-service-285aqky5.js → case-debug-studio-web-service-kq7zbrwp.js} +1 -1
  4. package/dist/{case-validate-service-kakhmndx.js → case-validate-service-wpy72j8d.js} +1 -1
  5. package/dist/{connector-enrichment-service-ghdt67aq.js → connector-enrichment-service-5a9xtg8m.js} +4 -4
  6. package/dist/{connector-lookup-service-bpfp5f8h.js → connector-lookup-service-r75cdm6v.js} +2 -2
  7. package/dist/{connector-task-spec-xkq1mdfj.js → connector-task-spec-enrbska5.js} +4 -4
  8. package/dist/{embedded-file-reader-v8c2yj2a.js → embedded-file-reader-r66242ey.js} +2 -2
  9. package/dist/{enrichment-service-3f1kygjs.js → enrichment-service-x094caja.js} +1 -1
  10. package/dist/{index-4yanx3rn.js → index-ggkzdj97.js} +616 -160
  11. package/dist/{index-tnvk52gh.js → index-wh4k7h0c.js} +1 -1
  12. package/dist/index.js +1 -1
  13. package/dist/{node-sync-service-ayf2kfq6.js → node-sync-service-qygg106j.js} +2 -2
  14. package/dist/{packager-tool-95z08fyw.js → packager-tool-0f4ef9e1.js} +1 -1
  15. package/dist/{packager-tool-jwkvkv0e.js → packager-tool-3c2x0r9w.js} +2 -2
  16. package/dist/{packager-tool-3hq1g79z.js → packager-tool-6hhsenq3.js} +1 -1
  17. package/dist/{packager-tool-5thp1y40.js → packager-tool-h1cp6d9v.js} +3 -3
  18. package/dist/{packager-tool-q4dabjvq.js → packager-tool-s9ze42b4.js} +21 -21
  19. package/dist/{packager-tool-30rs39w9.js → packager-tool-srn5jecq.js} +3 -3
  20. package/dist/{project-artifacts-rng5m6r2.js → project-artifacts-p66pqx92.js} +1 -1
  21. package/dist/{resourcesSyncService-w4w3q8a7.js → resourcesSyncService-kv0kdb54.js} +2 -2
  22. package/dist/tool.js +1 -1
  23. package/dist/{trigger-enrichment-service-qygdhpwm.js → trigger-enrichment-service-92424nj2.js} +4 -4
  24. package/package.json +2 -2
@@ -2474,6 +2474,19 @@ class NullSecretsProvider {
2474
2474
  }
2475
2475
  }
2476
2476
 
2477
+ // ../../node_modules/@uipath/resource-builder-sdk/dist/providers/feature-flag-provider.js
2478
+ class NullFeatureFlagProvider {
2479
+ getBool(_featureFlagName, defaultValue) {
2480
+ return defaultValue ?? false;
2481
+ }
2482
+ getInt(_featureFlagName, defaultValue) {
2483
+ return defaultValue ?? 0;
2484
+ }
2485
+ getString(_featureFlagName, defaultValue) {
2486
+ return defaultValue ?? "";
2487
+ }
2488
+ }
2489
+
2477
2490
  // ../../node_modules/@uipath/resource-builder-sdk/dist/exceptions/timeout-exception.js
2478
2491
  class TimeoutException extends Error {
2479
2492
  constructor(message, timeoutMs) {
@@ -2628,10 +2641,12 @@ function withFileOperationTimeout2(provider, timeoutMs) {
2628
2641
  // ../../node_modules/@uipath/resource-builder-sdk/dist/solution/solution-context-options.js
2629
2642
  var DEFAULT_SOLUTION_CONTEXT_OPTIONS = {
2630
2643
  lockTimeoutMs: 30000,
2631
- fileOperationTimeoutMs: 30000
2644
+ fileOperationTimeoutMs: 30000,
2645
+ maxDegreeOfParallelism: 1
2632
2646
  };
2633
2647
  var SOLUTION_CONTEXT_TIMEOUT_STORAGE_KEY = "SOL_RB_SOLUTION_CONTEXT_TIMEOUT_MS";
2634
2648
  var FILE_OPERATION_TIMEOUT_STORAGE_KEY = "SOL_RB_FILE_OPERATION_TIMEOUT_MS";
2649
+ var MAX_DEGREE_OF_PARALLELISM_STORAGE_KEY = "SOL_RB_MAX_DEGREE_OF_PARALLELISM";
2635
2650
  function resolveTimeoutMs(storageKey, configured, fallback) {
2636
2651
  const override = readTimeoutOverrideMs(storageKey);
2637
2652
  if (override !== undefined)
@@ -2644,10 +2659,33 @@ function resolveLockTimeoutMs(options) {
2644
2659
  function resolveFileOperationTimeoutMs(options) {
2645
2660
  return resolveTimeoutMs(FILE_OPERATION_TIMEOUT_STORAGE_KEY, options?.fileOperationTimeoutMs, DEFAULT_SOLUTION_CONTEXT_OPTIONS.fileOperationTimeoutMs);
2646
2661
  }
2662
+ function isValidDegreeOfParallelism(value) {
2663
+ return typeof value == "number" && Number.isInteger(value) && value > 0;
2664
+ }
2665
+ function resolveMaxDegreeOfParallelism(options) {
2666
+ const override = readDegreeOfParallelismOverride(MAX_DEGREE_OF_PARALLELISM_STORAGE_KEY);
2667
+ if (override !== undefined)
2668
+ return override;
2669
+ return isValidDegreeOfParallelism(options?.maxDegreeOfParallelism) ? options.maxDegreeOfParallelism : DEFAULT_SOLUTION_CONTEXT_OPTIONS.maxDegreeOfParallelism;
2670
+ }
2671
+ function readDegreeOfParallelismOverride(storageKey) {
2672
+ try {
2673
+ if ("u" < typeof localStorage)
2674
+ return;
2675
+ const raw = localStorage.getItem(storageKey);
2676
+ if (raw === null || raw.trim() === "")
2677
+ return;
2678
+ const parsed = Number(raw);
2679
+ return isValidDegreeOfParallelism(parsed) ? parsed : undefined;
2680
+ } catch {
2681
+ return;
2682
+ }
2683
+ }
2647
2684
  function mergeSolutionContextOptions(options) {
2648
2685
  return {
2649
2686
  lockTimeoutMs: isValidTimeoutMs(options?.lockTimeoutMs) ? options.lockTimeoutMs : DEFAULT_SOLUTION_CONTEXT_OPTIONS.lockTimeoutMs,
2650
- fileOperationTimeoutMs: isValidTimeoutMs(options?.fileOperationTimeoutMs) ? options.fileOperationTimeoutMs : DEFAULT_SOLUTION_CONTEXT_OPTIONS.fileOperationTimeoutMs
2687
+ fileOperationTimeoutMs: isValidTimeoutMs(options?.fileOperationTimeoutMs) ? options.fileOperationTimeoutMs : DEFAULT_SOLUTION_CONTEXT_OPTIONS.fileOperationTimeoutMs,
2688
+ maxDegreeOfParallelism: isValidDegreeOfParallelism(options?.maxDegreeOfParallelism) ? options.maxDegreeOfParallelism : DEFAULT_SOLUTION_CONTEXT_OPTIONS.maxDegreeOfParallelism
2651
2689
  };
2652
2690
  }
2653
2691
 
@@ -3438,6 +3476,16 @@ function getRootFolder(solution) {
3438
3476
  }
3439
3477
 
3440
3478
  // ../../node_modules/@uipath/resource-builder-sdk/dist/solution/multi-file-solution-definition-provider.js
3479
+ function nowMs() {
3480
+ return globalThis.performance?.now?.() ?? Date.now();
3481
+ }
3482
+ function round1(ms) {
3483
+ return Math.round(10 * ms) / 10;
3484
+ }
3485
+ function cancellationError(signal) {
3486
+ return signal?.reason instanceof OperationCancelledException ? signal.reason : new OperationCancelledException;
3487
+ }
3488
+
3441
3489
  class MultiFileSolutionDefinitionProvider {
3442
3490
  get caseInsensitiveSerializer() {
3443
3491
  if (!this._caseInsensitiveSerializer)
@@ -3455,137 +3503,344 @@ class MultiFileSolutionDefinitionProvider {
3455
3503
  }
3456
3504
  async readAsync(context, cancellationToken) {
3457
3505
  this.logger.info("Reading multi-file solution definition for solution %s", context.path);
3458
- const solutionKey = this.getSolutionKey(context);
3459
- const fileStorageProvider = await this.getFileStorageProviderAsync(context, cancellationToken);
3460
- const resources = [];
3461
- const solutionFiles = [];
3462
- let hashes;
3463
- let paths;
3464
- const pathsByKind = this.getPathsByKind(context);
3465
- let tree;
3466
- pathsByKind.clear();
3506
+ const loadStarted = nowMs();
3507
+ let fileCount = 0;
3508
+ let listMs = 0;
3509
+ let readStarted = loadStarted;
3510
+ let readWallMs = 0;
3511
+ let readCompleted = false;
3512
+ let ioMs = 0;
3513
+ let maxFileIoMs = 0;
3514
+ let parseMs = 0;
3515
+ let hashMs = 0;
3516
+ let chars = 0;
3517
+ let loadedCount = 0;
3467
3518
  const parseErrors = [];
3468
3519
  const missingFiles = [];
3469
3520
  const invalidFiles = [];
3470
- context.items[SolutionContextKeys.PARSE_ERRORS_ITEM_KEY] = parseErrors;
3471
- if (!context.isReadOnly) {
3472
- hashes = this.getHashes(context);
3473
- paths = this.getPaths(context);
3474
- tree = this.getTree(context);
3475
- hashes.clear();
3476
- paths.clear();
3477
- tree.length = 0;
3478
- }
3479
- const resourceFiles = await fileStorageProvider.getFilesAsync(SolutionConstants.RESOURCE_FILES_FOLDER_NAME, "*.json", cancellationToken);
3480
- for (const resourceFile of resourceFiles)
3481
- try {
3482
- const stream = await fileStorageProvider.openFileAsync(resourceFile, cancellationToken);
3483
- const content = await this.streamToString(stream);
3484
- const wrapper = this.caseInsensitiveSerializer.deserialize(content);
3485
- if (wrapper?.resource) {
3486
- const rd = this.fromSerializable(wrapper.resource, solutionFiles);
3487
- const relPath = resourceFile.replace(/\\/g, "/");
3488
- const segments = relPath.split("/").filter((s) => s.length > 0);
3489
- const firstSegment = segments[0];
3490
- if (segments.length >= 3 && firstSegment && firstSegment.toLowerCase() === SolutionConstants.RESOURCE_FILES_FOLDER_NAME.toLowerCase()) {
3491
- const hasType = !!rd.type;
3492
- const folderSegmentCount = hasType ? segments.length - 3 : segments.length - 2;
3493
- if (folderSegmentCount < 1)
3494
- rd.folders = [
3495
- {
3496
- fullyQualifiedName: SolutionConstants.ROOT_FOLDER_NAME
3497
- }
3498
- ];
3499
- else {
3500
- const segmentsToUse = segments.slice(1, folderSegmentCount);
3501
- const folderFqn = segmentsToUse.join("/");
3502
- rd.folders = [
3503
- {
3504
- fullyQualifiedName: folderFqn
3505
- }
3506
- ];
3521
+ let metricsLogged = false;
3522
+ const logReadMetrics = (outcome) => {
3523
+ metricsLogged = true;
3524
+ const totalMs = nowMs() - loadStarted;
3525
+ const mergeMs = readCompleted ? nowMs() - readStarted - readWallMs : 0;
3526
+ const metrics = {
3527
+ outcome,
3528
+ path: context.path,
3529
+ fileCount,
3530
+ totalMs: round1(totalMs),
3531
+ listMs: round1(listMs),
3532
+ readWallMs: round1(readWallMs),
3533
+ ioMs: round1(ioMs),
3534
+ maxFileIoMs: round1(maxFileIoMs),
3535
+ parseMs: round1(parseMs),
3536
+ hashMs: round1(hashMs),
3537
+ mergeMs: round1(mergeMs),
3538
+ chars,
3539
+ degreeOfParallelism: resolveMaxDegreeOfParallelism(this.options),
3540
+ isReadOnly: context.isReadOnly,
3541
+ loaded: loadedCount,
3542
+ missing: missingFiles.length,
3543
+ invalid: invalidFiles.length,
3544
+ parseErrors: parseErrors.length
3545
+ };
3546
+ 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}`;
3547
+ if (outcome === "Success")
3548
+ this.logger.info(message, metrics);
3549
+ else
3550
+ this.logger.warn(message, metrics);
3551
+ };
3552
+ const readCore = async () => {
3553
+ const solutionKey = this.getSolutionKey(context);
3554
+ const fileStorageProvider = await this.getFileStorageProviderAsync(context, cancellationToken);
3555
+ const resources = [];
3556
+ const solutionFiles = [];
3557
+ let hashes;
3558
+ let paths;
3559
+ const pathsByKind = this.getPathsByKind(context);
3560
+ let tree;
3561
+ pathsByKind.clear();
3562
+ context.items[SolutionContextKeys.PARSE_ERRORS_ITEM_KEY] = parseErrors;
3563
+ if (!context.isReadOnly) {
3564
+ hashes = this.getHashes(context);
3565
+ paths = this.getPaths(context);
3566
+ tree = this.getTree(context);
3567
+ hashes.clear();
3568
+ paths.clear();
3569
+ tree.length = 0;
3570
+ }
3571
+ const listStarted = nowMs();
3572
+ const resourceFiles = await fileStorageProvider.getFilesAsync(SolutionConstants.RESOURCE_FILES_FOLDER_NAME, "*.json", cancellationToken);
3573
+ listMs = nowMs() - listStarted;
3574
+ fileCount = resourceFiles.length;
3575
+ readStarted = nowMs();
3576
+ const readResults = await this.readResourceFilesAsync(context, fileStorageProvider, resourceFiles, cancellationToken);
3577
+ readWallMs = nowMs() - readStarted;
3578
+ readCompleted = true;
3579
+ let fatal;
3580
+ let hasFatal = false;
3581
+ for (const result of readResults)
3582
+ if (result !== undefined) {
3583
+ if (result.timings) {
3584
+ ioMs += result.timings.ioMs;
3585
+ maxFileIoMs = Math.max(maxFileIoMs, result.timings.ioMs);
3586
+ parseMs += result.timings.parseMs;
3587
+ hashMs += result.timings.hashMs;
3588
+ chars += result.timings.chars;
3589
+ }
3590
+ if (result.fatal !== undefined) {
3591
+ if (!hasFatal) {
3592
+ fatal = result.fatal;
3593
+ hasFatal = true;
3507
3594
  }
3508
- } else
3509
- rd.folders = [
3510
- {
3511
- fullyQualifiedName: SolutionConstants.ROOT_FOLDER_NAME
3595
+ continue;
3596
+ }
3597
+ if (!hasFatal)
3598
+ switch (result.outcome) {
3599
+ case "loaded": {
3600
+ loadedCount++;
3601
+ const rd = result.resource;
3602
+ for (const file of result.files)
3603
+ if (!solutionFiles.some((sf) => sf.name === file.name && sf.kind === file.kind))
3604
+ solutionFiles.push(file);
3605
+ resources.push(rd);
3606
+ const resourceKey = rd.key;
3607
+ const normalizedFullPath = result.normalizedPath;
3608
+ if (!pathsByKind.has(rd.kind))
3609
+ pathsByKind.set(rd.kind, []);
3610
+ const kindPaths = pathsByKind.get(rd.kind);
3611
+ if (kindPaths)
3612
+ kindPaths.push({
3613
+ name: rd.name,
3614
+ key: rd.key,
3615
+ path: normalizedFullPath
3616
+ });
3617
+ if (!context.isReadOnly && hashes && paths) {
3618
+ paths.set(resourceKey, normalizedFullPath);
3619
+ hashes.set(resourceKey, result.hash);
3620
+ }
3621
+ break;
3512
3622
  }
3513
- ];
3514
- resources.push(rd);
3515
- const resourceKey = rd.key;
3516
- const normalizedFullPath = this.getNormalizedPath(resourceFile);
3517
- if (!pathsByKind.has(rd.kind))
3518
- pathsByKind.set(rd.kind, []);
3519
- const kindPaths = pathsByKind.get(rd.kind);
3520
- if (kindPaths)
3521
- kindPaths.push({
3522
- name: rd.name,
3523
- key: rd.key,
3524
- path: normalizedFullPath
3623
+ case "missing":
3624
+ missingFiles.push(result.file);
3625
+ break;
3626
+ case "invalid":
3627
+ invalidFiles.push(result.file);
3628
+ break;
3629
+ case "parseError":
3630
+ parseErrors.push(result.file);
3631
+ break;
3632
+ }
3633
+ }
3634
+ if (hasFatal) {
3635
+ logReadMetrics("Fatal");
3636
+ throw fatal;
3637
+ }
3638
+ if (missingFiles.length > 0) {
3639
+ logReadMetrics("MissingFiles");
3640
+ throw new BadRequestException(ErrorCodes.Resources.MissingFileDependencies, `Solution has missing files: ${missingFiles.join(", ")}`);
3641
+ }
3642
+ if (invalidFiles.length > 0) {
3643
+ logReadMetrics("InvalidFiles");
3644
+ throw new BadRequestException(ErrorCodes.Resources.InvalidResourceFile, `Solution has resource files with invalid content: ${invalidFiles.join(", ")}`);
3645
+ }
3646
+ if (parseErrors.length > 0) {
3647
+ logReadMetrics("ParseErrors");
3648
+ throw new Error(`Failed to read resource files for solution ${context.path}: ${parseErrors.join(", ")}`);
3649
+ }
3650
+ const folderMap = new Map;
3651
+ const rootFolder = this.buildRootFolder(solutionKey, SolutionConstants.ROOT_FOLDER_NAME);
3652
+ folderMap.set(rootFolder.fullyQualifiedName.toLowerCase(), rootFolder);
3653
+ for (const res of resources)
3654
+ for (const fdep of res.folders ?? []) {
3655
+ const fqnLower = fdep.fullyQualifiedName.toLowerCase();
3656
+ if (!folderMap.has(fqnLower)) {
3657
+ const folderKey = this.generateGuidFromString(fdep.fullyQualifiedName);
3658
+ const pathSegments = fdep.fullyQualifiedName.split("/").filter((s) => s.length > 0).map((p) => {
3659
+ if (p.toLowerCase() !== SolutionConstants.ROOT_FOLDER_NAME.toLowerCase())
3660
+ return this.generateGuidFromString(SolutionConstants.ROOT_FOLDER_NAME);
3661
+ return rootFolder.key;
3662
+ });
3663
+ const folderPath = pathSegments.join(".");
3664
+ folderMap.set(fqnLower, {
3665
+ key: folderKey,
3666
+ fullyQualifiedName: fdep.fullyQualifiedName,
3667
+ path: folderPath
3525
3668
  });
3526
- if (!context.isReadOnly && hashes && paths) {
3527
- paths.set(resourceKey, normalizedFullPath);
3528
- hashes.set(resourceKey, await this.computeHash(content));
3529
3669
  }
3530
- } else {
3531
- this.logger.error("Failed to read resource file %s for solution %s: invalid content", undefined, resourceFile, context.path);
3532
- invalidFiles.push(resourceFile);
3533
- }
3534
- } catch (ex) {
3535
- if (ex instanceof OperationCancelledException || cancellationToken?.aborted) {
3536
- this.logger.warn("Operation cancelled while reading file %s for solution %s", resourceFile, context.path);
3537
- throw ex instanceof OperationCancelledException ? ex : new OperationCancelledException;
3538
- }
3539
- if (ex instanceof TimeoutException)
3540
- throw new TimeoutException(`Reading resource file ${resourceFile} for solution ${context.path} timed out: ${ex.message}`, ex.timeoutMs);
3541
- if (isFileNotFoundError(ex)) {
3542
- this.logger.warn("Resource file listed but missing in storage for solution %s: %s", resourceFile, context.path);
3543
- missingFiles.push(resourceFile);
3544
- } else {
3545
- this.logger.error("Failed to read resource file %s for solution %s", ex, resourceFile, context.path);
3546
- parseErrors.push(resourceFile);
3547
3670
  }
3671
+ const solution = {
3672
+ key: solutionKey,
3673
+ docVersion: SolutionConstants.CURRENT_DOC_VERSION,
3674
+ folders: Array.from(folderMap.values()),
3675
+ resources,
3676
+ files: solutionFiles
3677
+ };
3678
+ await this.replaceDuplicateKeysAsync(solution, cancellationToken);
3679
+ if (!context.isReadOnly && tree) {
3680
+ const orderedResourceKeys = getTopologicalIdsOrdering(buildDependencyGraph(solution.resources));
3681
+ tree.push(...orderedResourceKeys);
3548
3682
  }
3549
- if (missingFiles.length > 0)
3550
- throw new BadRequestException(ErrorCodes.Resources.MissingFileDependencies, `Solution has missing files: ${missingFiles.join(", ")}`);
3551
- if (invalidFiles.length > 0)
3552
- throw new BadRequestException(ErrorCodes.Resources.InvalidResourceFile, `Solution has resource files with invalid content: ${invalidFiles.join(", ")}`);
3553
- if (parseErrors.length > 0)
3554
- throw new Error(`Failed to read resource files for solution ${context.path}: ${parseErrors.join(", ")}`);
3555
- const folderMap = new Map;
3556
- const rootFolder = this.buildRootFolder(solutionKey, SolutionConstants.ROOT_FOLDER_NAME);
3557
- folderMap.set(rootFolder.fullyQualifiedName.toLowerCase(), rootFolder);
3558
- for (const res of resources)
3559
- for (const fdep of res.folders ?? []) {
3560
- const fqnLower = fdep.fullyQualifiedName.toLowerCase();
3561
- if (!folderMap.has(fqnLower)) {
3562
- const folderKey = this.generateGuidFromString(fdep.fullyQualifiedName);
3563
- const pathSegments = fdep.fullyQualifiedName.split("/").filter((s) => s.length > 0).map((p) => {
3564
- if (p.toLowerCase() !== SolutionConstants.ROOT_FOLDER_NAME.toLowerCase())
3565
- return this.generateGuidFromString(SolutionConstants.ROOT_FOLDER_NAME);
3566
- return rootFolder.key;
3567
- });
3568
- const folderPath = pathSegments.join(".");
3569
- folderMap.set(fqnLower, {
3570
- key: folderKey,
3571
- fullyQualifiedName: fdep.fullyQualifiedName,
3572
- path: folderPath
3573
- });
3574
- }
3683
+ logReadMetrics("Success");
3684
+ return solution;
3685
+ };
3686
+ try {
3687
+ return await readCore();
3688
+ } catch (ex) {
3689
+ if (!metricsLogged)
3690
+ logReadMetrics("Fatal");
3691
+ throw ex;
3692
+ }
3693
+ }
3694
+ async readResourceFilesAsync(context, fileStorageProvider, resourceFiles, cancellationToken) {
3695
+ const results = Array.from({
3696
+ length: resourceFiles.length
3697
+ }, () => {
3698
+ return;
3699
+ });
3700
+ if (resourceFiles.length === 0)
3701
+ return results;
3702
+ const computeHash = !context.isReadOnly;
3703
+ const degreeOfParallelism = Math.min(resolveMaxDegreeOfParallelism(this.options), resourceFiles.length);
3704
+ let nextIndex = 0;
3705
+ let stopRequested = false;
3706
+ const runWorkerAsync = async () => {
3707
+ while (!stopRequested && nextIndex < resourceFiles.length) {
3708
+ const index = nextIndex++;
3709
+ const resourceFile = resourceFiles[index];
3710
+ const result = await this.readResourceFileAsync(context, fileStorageProvider, resourceFile, computeHash, cancellationToken);
3711
+ results[index] = result;
3712
+ if (result.fatal !== undefined)
3713
+ stopRequested = true;
3575
3714
  }
3576
- const solution = {
3577
- key: solutionKey,
3578
- docVersion: SolutionConstants.CURRENT_DOC_VERSION,
3579
- folders: Array.from(folderMap.values()),
3580
- resources,
3581
- files: solutionFiles
3582
3715
  };
3583
- await this.replaceDuplicateKeysAsync(solution, cancellationToken);
3584
- if (!context.isReadOnly && tree) {
3585
- const orderedResourceKeys = getTopologicalIdsOrdering(buildDependencyGraph(solution.resources));
3586
- tree.push(...orderedResourceKeys);
3716
+ const workers = [];
3717
+ for (let i = 0;i < degreeOfParallelism; i++)
3718
+ workers.push(runWorkerAsync());
3719
+ await Promise.all(workers);
3720
+ if (cancellationToken?.aborted && !results.some((result) => result?.fatal !== undefined))
3721
+ throw cancellationError(cancellationToken);
3722
+ return results;
3723
+ }
3724
+ async readResourceFileAsync(context, fileStorageProvider, resourceFile, computeHash, cancellationToken) {
3725
+ const started = nowMs();
3726
+ let ioMs;
3727
+ let content;
3728
+ const failureTimings = () => {
3729
+ const elapsed = nowMs() - started;
3730
+ return ioMs === undefined ? {
3731
+ ioMs: elapsed,
3732
+ parseMs: 0,
3733
+ hashMs: 0,
3734
+ chars: 0
3735
+ } : {
3736
+ ioMs,
3737
+ parseMs: elapsed - ioMs,
3738
+ hashMs: 0,
3739
+ chars: content?.length ?? 0
3740
+ };
3741
+ };
3742
+ try {
3743
+ if (cancellationToken?.aborted)
3744
+ throw cancellationError(cancellationToken);
3745
+ const stream = await fileStorageProvider.openFileAsync(resourceFile, cancellationToken);
3746
+ content = await this.streamToString(stream);
3747
+ ioMs = nowMs() - started;
3748
+ const parseStarted = nowMs();
3749
+ const wrapper = this.caseInsensitiveSerializer.deserialize(content);
3750
+ if (!wrapper?.resource) {
3751
+ this.logger.error("Failed to read resource file %s for solution %s: invalid content", undefined, resourceFile, context.path);
3752
+ return {
3753
+ file: resourceFile,
3754
+ outcome: "invalid",
3755
+ timings: failureTimings()
3756
+ };
3757
+ }
3758
+ const files = [];
3759
+ const rd = this.fromSerializable(wrapper.resource, files);
3760
+ this.applyFolders(rd, resourceFile);
3761
+ const parseMs = nowMs() - parseStarted;
3762
+ let hash;
3763
+ let hashMs = 0;
3764
+ if (computeHash) {
3765
+ const hashStarted = nowMs();
3766
+ hash = await this.computeHash(content);
3767
+ hashMs = nowMs() - hashStarted;
3768
+ }
3769
+ return {
3770
+ file: resourceFile,
3771
+ outcome: "loaded",
3772
+ resource: rd,
3773
+ files,
3774
+ normalizedPath: this.getNormalizedPath(resourceFile),
3775
+ hash,
3776
+ timings: {
3777
+ ioMs,
3778
+ parseMs,
3779
+ hashMs,
3780
+ chars: content.length
3781
+ }
3782
+ };
3783
+ } catch (ex) {
3784
+ if (ex instanceof OperationCancelledException || cancellationToken?.aborted) {
3785
+ this.logger.warn("Operation cancelled while reading file %s for solution %s", resourceFile, context.path);
3786
+ return {
3787
+ file: resourceFile,
3788
+ outcome: "fatal",
3789
+ fatal: ex instanceof OperationCancelledException ? ex : cancellationError(cancellationToken),
3790
+ timings: failureTimings()
3791
+ };
3792
+ }
3793
+ if (ex instanceof TimeoutException)
3794
+ return {
3795
+ file: resourceFile,
3796
+ outcome: "fatal",
3797
+ fatal: new TimeoutException(`Reading resource file ${resourceFile} for solution ${context.path} timed out: ${ex.message}`, ex.timeoutMs),
3798
+ timings: failureTimings()
3799
+ };
3800
+ if (isFileNotFoundError(ex)) {
3801
+ this.logger.warn("Resource file listed but missing in storage for solution %s: %s", resourceFile, context.path);
3802
+ return {
3803
+ file: resourceFile,
3804
+ outcome: "missing",
3805
+ timings: failureTimings()
3806
+ };
3807
+ }
3808
+ this.logger.error("Failed to read resource file %s for solution %s", ex, resourceFile, context.path);
3809
+ return {
3810
+ file: resourceFile,
3811
+ outcome: "parseError",
3812
+ timings: failureTimings()
3813
+ };
3587
3814
  }
3588
- return solution;
3815
+ }
3816
+ applyFolders(resource, resourceFile) {
3817
+ const relPath = resourceFile.replace(/\\/g, "/");
3818
+ const segments = relPath.split("/").filter((s) => s.length > 0);
3819
+ const firstSegment = segments[0];
3820
+ if (segments.length >= 3 && firstSegment && firstSegment.toLowerCase() === SolutionConstants.RESOURCE_FILES_FOLDER_NAME.toLowerCase()) {
3821
+ const hasType = !!resource.type;
3822
+ const folderSegmentCount = hasType ? segments.length - 3 : segments.length - 2;
3823
+ if (folderSegmentCount < 1)
3824
+ resource.folders = [
3825
+ {
3826
+ fullyQualifiedName: SolutionConstants.ROOT_FOLDER_NAME
3827
+ }
3828
+ ];
3829
+ else {
3830
+ const segmentsToUse = segments.slice(1, folderSegmentCount);
3831
+ const folderFqn = segmentsToUse.join("/");
3832
+ resource.folders = [
3833
+ {
3834
+ fullyQualifiedName: folderFqn
3835
+ }
3836
+ ];
3837
+ }
3838
+ } else
3839
+ resource.folders = [
3840
+ {
3841
+ fullyQualifiedName: SolutionConstants.ROOT_FOLDER_NAME
3842
+ }
3843
+ ];
3589
3844
  }
3590
3845
  async writeAsync(context, solution, cancellationToken) {
3591
3846
  if (context.isReadOnly)
@@ -3890,7 +4145,7 @@ class MultiFileSolutionDefinitionFactory {
3890
4145
  // ../../node_modules/@uipath/resource-builder-sdk/dist/embedded-files-default.js
3891
4146
  async function createDefaultEmbeddedFileReaderAsync() {
3892
4147
  const [{ EmbeddedFileReader }, { JsonSerializerFactory: JsonSerializerFactory2 }] = await Promise.all([
3893
- import("./embedded-file-reader-v8c2yj2a.js"),
4148
+ import("./embedded-file-reader-r66242ey.js"),
3894
4149
  import("./index-kmp9fmhb.js")
3895
4150
  ]);
3896
4151
  return new EmbeddedFileReader(new JsonSerializerFactory2);
@@ -3908,6 +4163,7 @@ var ServiceTokens = {
3908
4163
  SecretsProvider: "ISecretsProvider",
3909
4164
  FileStorageProviderFactory: "IFileStorageProviderFactory",
3910
4165
  IpRangeBypassSecretProvider: "IIpRangeBypassSecretProvider",
4166
+ FeatureFlagProvider: "IFeatureFlagProvider",
3911
4167
  SolutionDefinitionProvider: "ISolutionDefinitionProvider",
3912
4168
  SolutionDefinitionFactory: "ISolutionDefinitionFactory",
3913
4169
  ArtifactResourceSpecEnhancer: "IArtifactResourceSpecEnhancer",
@@ -4258,6 +4514,9 @@ function getBindingType(resourceKind, resourceType) {
4258
4514
  }
4259
4515
 
4260
4516
  // ../../node_modules/@uipath/resource-builder-sdk/dist/bindings/bindings-metadata-serializer.js
4517
+ var SUPPORTED_SCHEMA_MAJOR_VERSION = 2;
4518
+ var INT32_MAX_VALUE = 2147483647;
4519
+
4261
4520
  class BindingsMetadataSerializer {
4262
4521
  tryDeserialize(input) {
4263
4522
  if (!input)
@@ -4268,30 +4527,52 @@ class BindingsMetadataSerializer {
4268
4527
  let cleanInput = input.charCodeAt(0) === 65279 ? input.slice(1) : input;
4269
4528
  if (cleanInput.charCodeAt(cleanInput.length - 1) === 26)
4270
4529
  cleanInput = cleanInput.slice(0, -1);
4271
- const jsonObject = JSON.parse(cleanInput);
4530
+ const root = JSON.parse(cleanInput);
4531
+ if (root === null || typeof root != "object" || Array.isArray(root)) {
4532
+ this.logger.warn("Invalid bindings: content is not a JSON object");
4533
+ return {
4534
+ success: false
4535
+ };
4536
+ }
4537
+ const jsonObject = root;
4272
4538
  const versionValue = jsonObject[BindingsKnownKeys.Version];
4273
- if (!versionValue)
4539
+ if (typeof versionValue != "string") {
4540
+ this.logger.warn(`Invalid bindings: '${BindingsKnownKeys.Version}' is missing or not a string`);
4274
4541
  return {
4275
4542
  success: false
4276
4543
  };
4277
- const versionParts = versionValue.split(".").map(Number);
4278
- const majorVersion = versionParts[0];
4279
- if (majorVersion !== 2)
4280
- throw new Error("Unsupported bindings schema");
4544
+ }
4545
+ const majorVersion = BindingsMetadataSerializer.tryParseMajorVersion(versionValue);
4546
+ if (majorVersion === undefined) {
4547
+ this.logger.warn(`Invalid bindings: '${BindingsKnownKeys.Version}' is not a valid version`);
4548
+ return {
4549
+ success: false
4550
+ };
4551
+ }
4552
+ if (majorVersion !== SUPPORTED_SCHEMA_MAJOR_VERSION) {
4553
+ this.logger.warn(`Invalid bindings: unsupported schema major version ${majorVersion}`);
4554
+ return {
4555
+ success: false
4556
+ };
4557
+ }
4558
+ const resources = jsonObject[BindingsKnownKeys.Resources];
4559
+ if (!Array.isArray(resources)) {
4560
+ this.logger.warn(`Invalid bindings: '${BindingsKnownKeys.Resources}' is missing or not an array`);
4561
+ return {
4562
+ success: false
4563
+ };
4564
+ }
4281
4565
  const metadata = {
4282
4566
  version: versionValue,
4283
4567
  resources: []
4284
4568
  };
4285
- const resources = jsonObject[BindingsKnownKeys.Resources];
4286
- if (Array.isArray(resources))
4287
- for (const resourceElement of resources) {
4288
- if (resourceElement == null) {
4289
- this.logger.warn("Skipping null bindings resource element");
4290
- continue;
4291
- }
4292
- const resource = this.getBindingsResourceV2(resourceElement);
4293
- metadata.resources.push(resource);
4569
+ for (const resourceElement of resources) {
4570
+ if (resourceElement == null) {
4571
+ this.logger.warn("Skipping null bindings resource element");
4572
+ continue;
4294
4573
  }
4574
+ metadata.resources.push(this.getBindingsResourceV2(resourceElement));
4575
+ }
4295
4576
  this.linkDependencies(metadata.resources);
4296
4577
  return {
4297
4578
  success: true,
@@ -4304,6 +4585,22 @@ class BindingsMetadataSerializer {
4304
4585
  };
4305
4586
  }
4306
4587
  }
4588
+ static tryParseMajorVersion(value) {
4589
+ const parts = value.split(".");
4590
+ if (parts.length < 2 || parts.length > 4)
4591
+ return;
4592
+ let major;
4593
+ for (const [index, part] of parts.entries()) {
4594
+ if (!/^\s*[+-]?\d+\s*$/.test(part))
4595
+ return;
4596
+ const component = Number(part);
4597
+ if (component < 0 || component > INT32_MAX_VALUE)
4598
+ return;
4599
+ if (index === 0)
4600
+ major = component === 0 ? 0 : component;
4601
+ }
4602
+ return major;
4603
+ }
4307
4604
  linkDependencies(resources) {
4308
4605
  for (const resource of resources) {
4309
4606
  const propertyMeta = resource.metadata;
@@ -4463,6 +4760,62 @@ class BindingOverwritesMappingRequest {
4463
4760
  }
4464
4761
  }
4465
4762
 
4763
+ // ../../node_modules/@uipath/resource-builder-sdk/dist/bindings/jit-debug-project-types.js
4764
+ var JIT_DEBUG_PROJECT_TYPES_FEATURE_FLAG = "FE.JitDebugProjectTypes";
4765
+ var PROCESS_KIND = "process";
4766
+ var BUSINESS_RULE_KIND = "businessrule";
4767
+ var APP_KIND = "app";
4768
+ var LOW_CODE_APP_PROJECT_TYPE = "webapp";
4769
+ var LOW_CODE_APP_TYPES = new Set([
4770
+ "workflow action"
4771
+ ]);
4772
+ var CODED_APP_PROJECT_TYPE = "appv2";
4773
+ var CODED_APP_TYPES = new Set([
4774
+ "coded",
4775
+ "codedaction"
4776
+ ]);
4777
+ var DEFAULT_PROCESS_PROJECT_TYPE = "process";
4778
+ var KNOWN_PROCESS_PROJECT_TYPES = new Set([
4779
+ DEFAULT_PROCESS_PROJECT_TYPE,
4780
+ "processorchestration",
4781
+ "agent",
4782
+ "api",
4783
+ "flow",
4784
+ "function",
4785
+ "casemanagement",
4786
+ "webapp",
4787
+ "businessrules"
4788
+ ]);
4789
+ var BUSINESS_RULE_PROJECT_TYPE = "businessrules";
4790
+ function parseJitDebugProjectTypes(flagValue) {
4791
+ if (!flagValue || !flagValue.trim())
4792
+ return [];
4793
+ return flagValue.split(",").map((t) => t.trim()).filter((t) => t.length > 0);
4794
+ }
4795
+ function solutionSupportsJitDebug(solution, flagValue) {
4796
+ const enabledProjectTypes = parseJitDebugProjectTypes(flagValue).map((t) => t.toLowerCase());
4797
+ if (enabledProjectTypes.length === 0)
4798
+ return false;
4799
+ return (solution.resources ?? []).filter((r) => (r.projectKey != null || r.isArtefactResource === true) && isDecisionKind(r.kind)).every((r) => enabledProjectTypes.some((projectType) => matches(projectType, r)));
4800
+ }
4801
+ function isDecisionKind(kind) {
4802
+ const normalized = (kind ?? "").toLowerCase();
4803
+ return normalized === PROCESS_KIND || normalized === BUSINESS_RULE_KIND || normalized === APP_KIND;
4804
+ }
4805
+ function matches(projectType, resource) {
4806
+ if ((resource.kind ?? "").toLowerCase() === BUSINESS_RULE_KIND)
4807
+ return projectType === BUSINESS_RULE_PROJECT_TYPE;
4808
+ if ((resource.kind ?? "").toLowerCase() === APP_KIND) {
4809
+ const appType = (resource.type ?? "").toLowerCase();
4810
+ if (appType === "" || LOW_CODE_APP_TYPES.has(appType))
4811
+ return projectType === LOW_CODE_APP_PROJECT_TYPE;
4812
+ return CODED_APP_TYPES.has(appType) && projectType === CODED_APP_PROJECT_TYPE;
4813
+ }
4814
+ const resourceType = (resource.type ?? "").toLowerCase();
4815
+ const processType = resourceType === "" ? DEFAULT_PROCESS_PROJECT_TYPE : resourceType;
4816
+ return !KNOWN_PROCESS_PROJECT_TYPES.has(processType) || projectType === processType;
4817
+ }
4818
+
4466
4819
  // ../../node_modules/@uipath/resource-builder-sdk/dist/bindings/binding-overwrites-handler.js
4467
4820
  class BindingOverwritesHandler {
4468
4821
  async handleAsync(request, cancellationToken) {
@@ -4478,6 +4831,10 @@ class BindingOverwritesHandler {
4478
4831
  if (bindingResources.length === 0)
4479
4832
  return {};
4480
4833
  const result = {};
4834
+ const solution = await request.context.loadAsync(cancellationToken);
4835
+ const jitDebugProjectTypes = this.featureFlagProvider.getString(JIT_DEBUG_PROJECT_TYPES_FEATURE_FLAG, "");
4836
+ const emptyFolderPathForArtefacts = solutionSupportsJitDebug(solution, jitDebugProjectTypes);
4837
+ this.logger.info(`Binding overwrites for solution ${request.context.path}: JIT debug ${emptyFolderPathForArtefacts ? "on" : "off"} (FE.JitDebugProjectTypes = '${jitDebugProjectTypes}')`);
4481
4838
  const resourceOverwrites = await this.resourceOverwritesService.getResourceOverwritesAsync(request.context, cancellationToken);
4482
4839
  for (const bindingResource of bindingResources) {
4483
4840
  const resourceOverwrite = resourceOverwrites.get(bindingResource.resourceKey.toLowerCase());
@@ -4490,8 +4847,7 @@ class BindingOverwritesHandler {
4490
4847
  [BindingsKnownKeys.FolderKeyPropertyName]: resourceOverwrite.folderKey ?? ""
4491
4848
  };
4492
4849
  else {
4493
- const isBusinessRule = bindingResource.binding.resourceType === models_BindingsResourceType.BusinessRule;
4494
- const folderPath = bindingResource.isArtefactResource && !isBusinessRule ? "" : resourceOverwrite.folderFullyQualifiedName ?? "";
4850
+ const folderPath = emptyFolderPathForArtefacts && bindingResource.isArtefactResource ? "" : resourceOverwrite.folderFullyQualifiedName ?? "";
4495
4851
  overwrite = {
4496
4852
  [BindingsKnownKeys.FolderPathPropertyName]: folderPath,
4497
4853
  [BindingsKnownKeys.NamePropertyName]: resourceOverwrite.resourceName
@@ -4513,9 +4869,10 @@ class BindingOverwritesHandler {
4513
4869
  throw new BadRequestException("Bindings.ValidationFailed", `Binding validation failed: ${failureMessages}`);
4514
4870
  }
4515
4871
  }
4516
- constructor(mediator, resourceOverwritesService, loggerFactory) {
4872
+ constructor(mediator, resourceOverwritesService, loggerFactory, featureFlagProvider) {
4517
4873
  this.mediator = mediator;
4518
4874
  this.resourceOverwritesService = resourceOverwritesService;
4875
+ this.featureFlagProvider = featureFlagProvider;
4519
4876
  this.logger = loggerFactory.create("BindingOverwritesHandler");
4520
4877
  }
4521
4878
  }
@@ -4524,6 +4881,11 @@ function removeTimeTriggerBindings(bindings) {
4524
4881
  }
4525
4882
 
4526
4883
  // ../../node_modules/@uipath/resource-builder-sdk/dist/bindings/binding-overwrites-mapping-handler.js
4884
+ function isCodedAppType(type) {
4885
+ const normalized = type?.toLowerCase();
4886
+ return normalized === "coded" || normalized === "codedaction";
4887
+ }
4888
+
4527
4889
  class BindingOverwritesMappingRequestHandler {
4528
4890
  async handleAsync(request, cancellationToken) {
4529
4891
  const solutionBindings = request.bindings.resources.filter((x) => isSolutionResource(x.metadata));
@@ -4549,7 +4911,8 @@ class BindingOverwritesMappingRequestHandler {
4549
4911
  result.push({
4550
4912
  binding: bindingsResource,
4551
4913
  resourceKey: resource.key,
4552
- isArtefactResource: resource.projectKey != null
4914
+ isArtefactResource: resource.projectKey != null,
4915
+ isCodedApp: bindingsResource.resourceType === models_BindingsResourceType.App && isCodedAppType(resource.type)
4553
4916
  });
4554
4917
  } else {
4555
4918
  this.logger.error(`Solution does not contain binding resource of type ${models_BindingsResourceType[bindingsResource.resourceType]}.`);
@@ -5554,6 +5917,9 @@ class SolutionPublishLocationRequest {
5554
5917
  }
5555
5918
 
5556
5919
  class SolutionPublishLocationRequestV2 {
5920
+ constructor(permissionType) {
5921
+ this.permissionType = permissionType;
5922
+ }
5557
5923
  }
5558
5924
 
5559
5925
  class SettingsRequest {
@@ -5718,12 +6084,13 @@ function _ts_param3(paramIndex, decorator) {
5718
6084
  }
5719
6085
 
5720
6086
  class SolutionPublishLocationRequestV2Handler {
5721
- async handleAsync(_request, cancellationToken) {
6087
+ async handleAsync(request, cancellationToken) {
5722
6088
  try {
5723
6089
  const orchestratorClient = await this.orchestratorClientFactory.getClientAsync(cancellationToken);
5724
6090
  if (!orchestratorClient)
5725
6091
  throw new InvalidOperationException("Failed to create Orchestrator client");
5726
- return await orchestratorClient.getPublishLocationsAsync(cancellationToken);
6092
+ const { permissionType } = request;
6093
+ return permissionType == null ? await orchestratorClient.getPublishLocationsAsync(cancellationToken) : await orchestratorClient.getAccessiblePublishLocationsAsync(permissionType, cancellationToken);
5727
6094
  } catch (error) {
5728
6095
  this.logger.error("An unexpected error occurred while retrieving publish locations from Automation Solutions service.", error);
5729
6096
  throw error;
@@ -7163,8 +7530,8 @@ class SolutionDefinitionHelper {
7163
7530
  if (references.length === 0)
7164
7531
  continue;
7165
7532
  const referenceKind = refProp["referenceKind"];
7166
- const matches = (ref) => ref.name != null && invariantEquals(resource.name, ref.name) && referenceKind != null && invariantEquals(referenceKind, resource.kind);
7167
- const filtered = references.filter((r) => !matches(r));
7533
+ const matches2 = (ref) => ref.name != null && invariantEquals(resource.name, ref.name) && referenceKind != null && invariantEquals(referenceKind, resource.kind);
7534
+ const filtered = references.filter((r) => !matches2(r));
7168
7535
  if (filtered.length !== references.length)
7169
7536
  spec[refProp.property] = isSingleReferenceProperty(refProp) ? filtered[0] ?? null : filtered;
7170
7537
  }
@@ -7753,7 +8120,7 @@ class GetResourceKeyForProjectRequestHandler {
7753
8120
  projectKey: request.projectKey,
7754
8121
  solution: request.context.path
7755
8122
  });
7756
- const cacheKey = `prk:${request.projectKey}`;
8123
+ const cacheKey = `prk:${request.context.path}:${request.projectKey}`;
7757
8124
  const cached = await this.cacheProvider.getAsync(cacheKey, cancellationToken);
7758
8125
  if (cached && typeof cached == "object" && "resourceKey" in cached) {
7759
8126
  this.logger.info("Cache hit for project {projectKey} resource key.", {
@@ -8581,7 +8948,11 @@ class UpdateResourceConfigurationCommandHandler {
8581
8948
  for (const prop of command.properties) {
8582
8949
  const propKey = prop.property.toLowerCase();
8583
8950
  const metadata = propertiesMetadata.get(propKey);
8584
- if (!(!metadata || isAnyReferenceProperty(metadata)) && metadata.readOnly !== true) {
8951
+ if (metadata && metadata.readOnly !== true) {
8952
+ if (isAnyReferenceProperty(metadata)) {
8953
+ updated = this.setSolutionReference(solution, resource, currentConfiguration, propertiesMetadata, metadata, prop.configuredValue) || updated;
8954
+ continue;
8955
+ }
8585
8956
  if (isSecretProperty(metadata)) {
8586
8957
  const secretValue = prop.configuredValue?.toString() || "";
8587
8958
  const existingKey = currentConfiguration[metadata.property]?.toString();
@@ -8625,6 +8996,38 @@ class UpdateResourceConfigurationCommandHandler {
8625
8996
  await command.context.saveChangesAsync(cancellationToken);
8626
8997
  return resourceConfiguration;
8627
8998
  }
8999
+ setSolutionReference(solution, resource, currentConfiguration, propertiesMetadata, metadata, configuredValue) {
9000
+ const referenceKind = metadata["referenceKind"];
9001
+ if (!isSingleReferenceProperty(metadata) || isFileReferenceProperty(metadata) || typeof referenceKind != "string" || !referenceKind)
9002
+ return false;
9003
+ const requested = asReference(configuredValue);
9004
+ const target = requested?.key ? solution.resources.find((r) => invariantEquals(r.key, requested.key) && invariantEquals(r.kind, referenceKind)) : undefined;
9005
+ if (!requested || !target || invariantEquals(target.key, resource.key))
9006
+ return false;
9007
+ const dependencies = resource.dependencies ??= [];
9008
+ const previous = asReference(currentConfiguration[metadata.property]);
9009
+ const previousKey = previous?.key;
9010
+ const isReferencedElsewhere = (key) => [
9011
+ ...propertiesMetadata.values()
9012
+ ].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)));
9013
+ if (previousKey && !invariantEquals(previousKey, target.key) && !isReferencedElsewhere(previousKey)) {
9014
+ const previousName = solution.resources.find((r) => invariantEquals(r.key, previousKey) && invariantEquals(r.kind, target.kind))?.name ?? previous?.name ?? "";
9015
+ resource.dependencies = dependencies.filter((d) => !(invariantEquals(d.kind, target.kind) && invariantEquals(d.name, previousName)));
9016
+ }
9017
+ if (!resource.dependencies.some((d) => invariantEquals(d.kind, target.kind) && invariantEquals(d.name, target.name)))
9018
+ resource.dependencies.push({
9019
+ kind: target.kind,
9020
+ name: target.name
9021
+ });
9022
+ currentConfiguration[metadata.property] = {
9023
+ name: target.name,
9024
+ key: target.key,
9025
+ folderKey: requested.folderKey ?? null,
9026
+ lookupStrategy: null,
9027
+ info: null
9028
+ };
9029
+ return true;
9030
+ }
8628
9031
  async updateReferencesName(solutionDefinition, resource, oldName, cancellationToken) {
8629
9032
  const resourcesToBeChanged = solutionDefinition.resources.filter((r) => r.key !== resource.key && (r.dependencies ?? []).some((d) => invariantEquals(d.kind, resource.kind) && invariantEquals(d.name, oldName)));
8630
9033
  if (resourcesToBeChanged.length === 0)
@@ -8911,6 +9314,28 @@ class UpsertResourceSecretCommandHandler {
8911
9314
  this.secretsProvider = secretsProvider;
8912
9315
  }
8913
9316
  }
9317
+ function asReference(value) {
9318
+ if (!value || typeof value != "object" || Array.isArray(value))
9319
+ return;
9320
+ const record = value;
9321
+ const pick = (name) => {
9322
+ const entry = Object.entries(record).find(([k]) => k.toLowerCase() === name.toLowerCase());
9323
+ return typeof entry?.[1] == "string" ? entry[1] : undefined;
9324
+ };
9325
+ return {
9326
+ key: pick("key"),
9327
+ name: pick("name"),
9328
+ folderKey: pick("folderKey")
9329
+ };
9330
+ }
9331
+ function asReferences(value) {
9332
+ if (Array.isArray(value))
9333
+ return value.map(asReference).filter((r) => r !== undefined);
9334
+ const single = asReference(value);
9335
+ return single ? [
9336
+ single
9337
+ ] : [];
9338
+ }
8914
9339
 
8915
9340
  // ../../node_modules/@uipath/resource-builder-sdk/dist/handlers/solution-handlers.js
8916
9341
  var DUPLICATE_NAMES_SUPPORTED_KINDS = new Set([
@@ -12159,7 +12584,16 @@ class AutomationSolutionsClientProxy2 {
12159
12584
  // ../../node_modules/@uipath/resource-builder-sdk/dist/clients/orchestrator/orchestrator-client.js
12160
12585
  class OrchestratorClient {
12161
12586
  async getPublishLocationsAsync(cancellationToken) {
12162
- const url = `${this.options.baseUrl}api/v2/AutomationSolutions/publish_locations`;
12587
+ return this.getPublishLocationsFromAsync(this.publishLocationsUrl(), cancellationToken);
12588
+ }
12589
+ async getAccessiblePublishLocationsAsync(permissionType, cancellationToken) {
12590
+ const url = `${this.publishLocationsUrl()}?permissionType=${encodeURIComponent(permissionType)}`;
12591
+ return this.getPublishLocationsFromAsync(url, cancellationToken);
12592
+ }
12593
+ publishLocationsUrl() {
12594
+ return `${this.options.baseUrl}api/v2/AutomationSolutions/publish_locations`;
12595
+ }
12596
+ async getPublishLocationsFromAsync(url, cancellationToken) {
12163
12597
  const headers = OrchestratorClientFactory.buildHeaders(this.options.securityData);
12164
12598
  const response = await fetch(url, {
12165
12599
  method: "GET",
@@ -12849,7 +13283,7 @@ class ReconcileProjectsCommandHandler {
12849
13283
  } : {
12850
13284
  resourceKey: undefined
12851
13285
  };
12852
- await this.cacheProvider.setAsync(`prk:${projectKey}`, result, cancellationToken);
13286
+ await this.cacheProvider.setAsync(`prk:${context.path}:${projectKey}`, result, cancellationToken);
12853
13287
  }
12854
13288
  groupByProjectKey(artefactResources) {
12855
13289
  const map = new Map;
@@ -13723,6 +14157,11 @@ class ResourceBuilder {
13723
14157
  const request = new SolutionPublishLocationRequestV2;
13724
14158
  return this._mediator.sendAsync(request, cancellationToken);
13725
14159
  }
14160
+ async getAccessiblePublishLocationsAsync(permissionType, cancellationToken) {
14161
+ this.throwIfCancelled(cancellationToken);
14162
+ const request = new SolutionPublishLocationRequestV2(permissionType);
14163
+ return this._mediator.sendAsync(request, cancellationToken);
14164
+ }
13726
14165
  async getSettingsAsync(cancellationToken) {
13727
14166
  this.throwIfCancelled(cancellationToken);
13728
14167
  const request = new SettingsRequest;
@@ -14282,9 +14721,9 @@ class UnconfiguredEmbeddedFileReader {
14282
14721
  }
14283
14722
 
14284
14723
  // ../../node_modules/@uipath/resource-builder-sdk/dist/container.js
14285
- function createContainer(accessProvider, cacheProvider, secretsProvider, fileStorageProviderFactory, ipRangeBypassSecretProvider, solutionDefinitionProvider, solutionDefinitionFactory, artifactResourceSpecEnhancer, httpReaderOptions, loggerFactory, embeddedFileReader, solutionContextOptions) {
14724
+ function createContainer(accessProvider, cacheProvider, secretsProvider, fileStorageProviderFactory, ipRangeBypassSecretProvider, solutionDefinitionProvider, solutionDefinitionFactory, artifactResourceSpecEnhancer, httpReaderOptions, loggerFactory, embeddedFileReader, solutionContextOptions, featureFlagProvider) {
14286
14725
  const childContainer = import_tsyringe6.container.createChildContainer();
14287
- registerProviders(childContainer, accessProvider, cacheProvider, secretsProvider, fileStorageProviderFactory, ipRangeBypassSecretProvider, solutionDefinitionProvider, solutionDefinitionFactory, artifactResourceSpecEnhancer, httpReaderOptions, loggerFactory, solutionContextOptions);
14726
+ registerProviders(childContainer, accessProvider, cacheProvider, secretsProvider, fileStorageProviderFactory, ipRangeBypassSecretProvider, solutionDefinitionProvider, solutionDefinitionFactory, artifactResourceSpecEnhancer, httpReaderOptions, loggerFactory, solutionContextOptions, featureFlagProvider);
14288
14727
  registerServices(childContainer, embeddedFileReader);
14289
14728
  registerHandlers(childContainer);
14290
14729
  childContainer.register(ServiceTokens.Mediator, {
@@ -14308,11 +14747,15 @@ function registerProvider(diContainer, token, provider) {
14308
14747
  break;
14309
14748
  }
14310
14749
  }
14311
- function registerProviders(diContainer, accessProvider, cacheProvider, secretsProvider, fileStorageProviderFactory, ipRangeBypassSecretProvider, solutionDefinitionProvider, solutionDefinitionFactory, artifactResourceSpecEnhancer, httpReaderOptions, loggerFactory, solutionContextOptions) {
14750
+ function registerProviders(diContainer, accessProvider, cacheProvider, secretsProvider, fileStorageProviderFactory, ipRangeBypassSecretProvider, solutionDefinitionProvider, solutionDefinitionFactory, artifactResourceSpecEnhancer, httpReaderOptions, loggerFactory, solutionContextOptions, featureFlagProvider) {
14312
14751
  registerProvider(diContainer, ServiceTokens.AccessProvider, accessProvider);
14313
14752
  registerProvider(diContainer, ServiceTokens.CacheProvider, cacheProvider);
14314
14753
  registerProvider(diContainer, ServiceTokens.SecretsProvider, secretsProvider);
14315
14754
  registerProvider(diContainer, ServiceTokens.IpRangeBypassSecretProvider, ipRangeBypassSecretProvider);
14755
+ registerProvider(diContainer, ServiceTokens.FeatureFlagProvider, featureFlagProvider ?? {
14756
+ instance: new NullFeatureFlagProvider,
14757
+ lifetime: service_tokens_ServiceLifetime.Singleton
14758
+ });
14316
14759
  registerProvider(diContainer, ServiceTokens.FileStorageProviderFactory, fileStorageProviderFactory);
14317
14760
  registerProvider(diContainer, ServiceTokens.SolutionDefinitionProvider, solutionDefinitionProvider);
14318
14761
  registerProvider(diContainer, ServiceTokens.SolutionDefinitionFactory, solutionDefinitionFactory);
@@ -14749,7 +15192,8 @@ function registerHandlers(diContainer) {
14749
15192
  const mediator = c.resolve(ServiceTokens.Mediator);
14750
15193
  const resourceOverwritesService = c.resolve(Tokens.IResourceOverwritesService);
14751
15194
  const loggerFactory = c.resolve(ServiceTokens.LoggerFactory);
14752
- return new BindingOverwritesHandler(mediator, resourceOverwritesService, loggerFactory);
15195
+ const featureFlagProvider = c.resolve(ServiceTokens.FeatureFlagProvider);
15196
+ return new BindingOverwritesHandler(mediator, resourceOverwritesService, loggerFactory, featureFlagProvider);
14753
15197
  }
14754
15198
  });
14755
15199
  diContainer.register(createCommandHandlerToken(BindingOverwritesValidationCommand.name), {
@@ -14757,7 +15201,8 @@ function registerHandlers(diContainer) {
14757
15201
  const mediator = c.resolve(ServiceTokens.Mediator);
14758
15202
  const resourceOverwritesService = c.resolve(Tokens.IResourceOverwritesService);
14759
15203
  const loggerFactory = c.resolve(ServiceTokens.LoggerFactory);
14760
- return new BindingOverwritesHandler(mediator, resourceOverwritesService, loggerFactory);
15204
+ const featureFlagProvider = c.resolve(ServiceTokens.FeatureFlagProvider);
15205
+ return new BindingOverwritesHandler(mediator, resourceOverwritesService, loggerFactory, featureFlagProvider);
14761
15206
  }
14762
15207
  });
14763
15208
  diContainer.register(createRequestHandlerToken(BindingOverwritesMappingRequest.name), {
@@ -15039,6 +15484,11 @@ class ResourceBuilderConfiguration {
15039
15484
  this._ipRangeBypassSecretProviderLifetime = lifetime;
15040
15485
  return this;
15041
15486
  }
15487
+ addFeatureFlagProvider(provider, lifetime = service_tokens_ServiceLifetime.Scoped) {
15488
+ this._featureFlagProviderProvider = provider;
15489
+ this._featureFlagProviderLifetime = lifetime;
15490
+ return this;
15491
+ }
15042
15492
  addSolutionDefinitionProvider(provider, lifetime = service_tokens_ServiceLifetime.Scoped) {
15043
15493
  this._solutionDefinitionProviderProvider = provider;
15044
15494
  this._solutionDefinitionProviderLifetime = lifetime;
@@ -15092,6 +15542,11 @@ class ResourceBuilderConfiguration {
15092
15542
  instance: ipRangeBypassSecretProviderInstance,
15093
15543
  lifetime: this._ipRangeBypassSecretProviderLifetime
15094
15544
  };
15545
+ const featureFlagProviderInstance = this._featureFlagProviderProvider ? await resolveProvider(this._featureFlagProviderProvider) : new NullFeatureFlagProvider;
15546
+ const featureFlagProvider = {
15547
+ instance: featureFlagProviderInstance,
15548
+ lifetime: this._featureFlagProviderLifetime
15549
+ };
15095
15550
  const secretsProviderInstance = this._secretsProviderProvider ? await resolveProvider(this._secretsProviderProvider) : new NullSecretsProvider;
15096
15551
  const secretsProvider = {
15097
15552
  instance: secretsProviderInstance,
@@ -15135,7 +15590,7 @@ class ResourceBuilderConfiguration {
15135
15590
  lifetime: this._artifactResourceSpecEnhancerLifetime
15136
15591
  };
15137
15592
  const embeddedFileReader = await createDefaultEmbeddedFileReaderAsync();
15138
- const container3 = createContainer(accessProvider, cacheProvider, secretsProvider, fileStorageProviderFactory, ipRangeBypassSecretProvider, solutionDefinitionProvider, solutionDefinitionFactory, artifactResourceSpecEnhancer, this._httpReaderOptions, loggerFactory, embeddedFileReader, this._solutionContextOptions);
15593
+ const container3 = createContainer(accessProvider, cacheProvider, secretsProvider, fileStorageProviderFactory, ipRangeBypassSecretProvider, solutionDefinitionProvider, solutionDefinitionFactory, artifactResourceSpecEnhancer, this._httpReaderOptions, loggerFactory, embeddedFileReader, this._solutionContextOptions, featureFlagProvider);
15139
15594
  return new ResourceBuilderServices(container3);
15140
15595
  }
15141
15596
  async buildServices() {
@@ -15147,6 +15602,7 @@ class ResourceBuilderConfiguration {
15147
15602
  this._secretsProviderLifetime = service_tokens_ServiceLifetime.Scoped;
15148
15603
  this._fileStorageProviderFactoryLifetime = service_tokens_ServiceLifetime.Singleton;
15149
15604
  this._ipRangeBypassSecretProviderLifetime = service_tokens_ServiceLifetime.Scoped;
15605
+ this._featureFlagProviderLifetime = service_tokens_ServiceLifetime.Scoped;
15150
15606
  this._solutionDefinitionProviderLifetime = service_tokens_ServiceLifetime.Scoped;
15151
15607
  this._solutionDefinitionFactoryLifetime = service_tokens_ServiceLifetime.Scoped;
15152
15608
  this._artifactResourceSpecEnhancerLifetime = service_tokens_ServiceLifetime.Scoped;
@@ -16501,12 +16957,12 @@ async function findResourceByKeyInRcs(builder, kind, expectedKey, folderPath, pr
16501
16957
  return;
16502
16958
  }
16503
16959
  async function searchRcsResources(builder, kind, name) {
16504
- const [searchError, matches] = await catchError(searchRcsResourcesStrict(builder, kind, name));
16960
+ const [searchError, matches2] = await catchError(searchRcsResourcesStrict(builder, kind, name));
16505
16961
  if (searchError) {
16506
16962
  logger.warn(`Failed to search ${kind} resources in RCS: ${searchError.message}`);
16507
16963
  return [];
16508
16964
  }
16509
- return matches;
16965
+ return matches2;
16510
16966
  }
16511
16967
  async function searchRcsResourcesStrict(builder, kind, name) {
16512
16968
  let pageCursor;
@@ -16514,8 +16970,8 @@ async function searchRcsResourcesStrict(builder, kind, name) {
16514
16970
  do {
16515
16971
  const result = await builder.searchResourcesAsync(kind, undefined, name, pageCursor, 50, undefined, false);
16516
16972
  for (const folderResources of result.availableResources) {
16517
- const matches = folderResources.resources.filter((r) => r.name.toLowerCase() === name.toLowerCase());
16518
- for (const match of matches) {
16973
+ const matches2 = folderResources.resources.filter((r) => r.name.toLowerCase() === name.toLowerCase());
16974
+ for (const match of matches2) {
16519
16975
  allMatches.push({
16520
16976
  key: match.key,
16521
16977
  name: match.name,
@@ -17050,4 +17506,4 @@ export {
17050
17506
  writeSolutionFile
17051
17507
  };
17052
17508
 
17053
- //# debugId=341DEBC9DC0AE67064756E2164756E21
17509
+ //# debugId=13EA9BBF3EDD5D2064756E2164756E21