@uipath/codedapp-tool 1.204.1-preview.262 → 1.204.1-preview.264

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.
@@ -2469,6 +2469,19 @@ class NullSecretsProvider {
2469
2469
  }
2470
2470
  }
2471
2471
 
2472
+ // ../../node_modules/@uipath/resource-builder-sdk/dist/providers/feature-flag-provider.js
2473
+ class NullFeatureFlagProvider {
2474
+ getBool(_featureFlagName, defaultValue) {
2475
+ return defaultValue ?? false;
2476
+ }
2477
+ getInt(_featureFlagName, defaultValue) {
2478
+ return defaultValue ?? 0;
2479
+ }
2480
+ getString(_featureFlagName, defaultValue) {
2481
+ return defaultValue ?? "";
2482
+ }
2483
+ }
2484
+
2472
2485
  // ../../node_modules/@uipath/resource-builder-sdk/dist/exceptions/timeout-exception.js
2473
2486
  class TimeoutException extends Error {
2474
2487
  constructor(message, timeoutMs) {
@@ -2623,10 +2636,12 @@ function withFileOperationTimeout2(provider, timeoutMs) {
2623
2636
  // ../../node_modules/@uipath/resource-builder-sdk/dist/solution/solution-context-options.js
2624
2637
  var DEFAULT_SOLUTION_CONTEXT_OPTIONS = {
2625
2638
  lockTimeoutMs: 30000,
2626
- fileOperationTimeoutMs: 30000
2639
+ fileOperationTimeoutMs: 30000,
2640
+ maxDegreeOfParallelism: 1
2627
2641
  };
2628
2642
  var SOLUTION_CONTEXT_TIMEOUT_STORAGE_KEY = "SOL_RB_SOLUTION_CONTEXT_TIMEOUT_MS";
2629
2643
  var FILE_OPERATION_TIMEOUT_STORAGE_KEY = "SOL_RB_FILE_OPERATION_TIMEOUT_MS";
2644
+ var MAX_DEGREE_OF_PARALLELISM_STORAGE_KEY = "SOL_RB_MAX_DEGREE_OF_PARALLELISM";
2630
2645
  function resolveTimeoutMs(storageKey, configured, fallback) {
2631
2646
  const override = readTimeoutOverrideMs(storageKey);
2632
2647
  if (override !== undefined)
@@ -2639,10 +2654,33 @@ function resolveLockTimeoutMs(options) {
2639
2654
  function resolveFileOperationTimeoutMs(options) {
2640
2655
  return resolveTimeoutMs(FILE_OPERATION_TIMEOUT_STORAGE_KEY, options?.fileOperationTimeoutMs, DEFAULT_SOLUTION_CONTEXT_OPTIONS.fileOperationTimeoutMs);
2641
2656
  }
2657
+ function isValidDegreeOfParallelism(value) {
2658
+ return typeof value == "number" && Number.isInteger(value) && value > 0;
2659
+ }
2660
+ function resolveMaxDegreeOfParallelism(options) {
2661
+ const override = readDegreeOfParallelismOverride(MAX_DEGREE_OF_PARALLELISM_STORAGE_KEY);
2662
+ if (override !== undefined)
2663
+ return override;
2664
+ return isValidDegreeOfParallelism(options?.maxDegreeOfParallelism) ? options.maxDegreeOfParallelism : DEFAULT_SOLUTION_CONTEXT_OPTIONS.maxDegreeOfParallelism;
2665
+ }
2666
+ function readDegreeOfParallelismOverride(storageKey) {
2667
+ try {
2668
+ if ("u" < typeof localStorage)
2669
+ return;
2670
+ const raw = localStorage.getItem(storageKey);
2671
+ if (raw === null || raw.trim() === "")
2672
+ return;
2673
+ const parsed = Number(raw);
2674
+ return isValidDegreeOfParallelism(parsed) ? parsed : undefined;
2675
+ } catch {
2676
+ return;
2677
+ }
2678
+ }
2642
2679
  function mergeSolutionContextOptions(options) {
2643
2680
  return {
2644
2681
  lockTimeoutMs: isValidTimeoutMs(options?.lockTimeoutMs) ? options.lockTimeoutMs : DEFAULT_SOLUTION_CONTEXT_OPTIONS.lockTimeoutMs,
2645
- fileOperationTimeoutMs: isValidTimeoutMs(options?.fileOperationTimeoutMs) ? options.fileOperationTimeoutMs : DEFAULT_SOLUTION_CONTEXT_OPTIONS.fileOperationTimeoutMs
2682
+ fileOperationTimeoutMs: isValidTimeoutMs(options?.fileOperationTimeoutMs) ? options.fileOperationTimeoutMs : DEFAULT_SOLUTION_CONTEXT_OPTIONS.fileOperationTimeoutMs,
2683
+ maxDegreeOfParallelism: isValidDegreeOfParallelism(options?.maxDegreeOfParallelism) ? options.maxDegreeOfParallelism : DEFAULT_SOLUTION_CONTEXT_OPTIONS.maxDegreeOfParallelism
2646
2684
  };
2647
2685
  }
2648
2686
 
@@ -3433,6 +3471,16 @@ function getRootFolder(solution) {
3433
3471
  }
3434
3472
 
3435
3473
  // ../../node_modules/@uipath/resource-builder-sdk/dist/solution/multi-file-solution-definition-provider.js
3474
+ function nowMs() {
3475
+ return globalThis.performance?.now?.() ?? Date.now();
3476
+ }
3477
+ function round1(ms) {
3478
+ return Math.round(10 * ms) / 10;
3479
+ }
3480
+ function cancellationError(signal) {
3481
+ return signal?.reason instanceof OperationCancelledException ? signal.reason : new OperationCancelledException;
3482
+ }
3483
+
3436
3484
  class MultiFileSolutionDefinitionProvider {
3437
3485
  get caseInsensitiveSerializer() {
3438
3486
  if (!this._caseInsensitiveSerializer)
@@ -3450,137 +3498,344 @@ class MultiFileSolutionDefinitionProvider {
3450
3498
  }
3451
3499
  async readAsync(context, cancellationToken) {
3452
3500
  this.logger.info("Reading multi-file solution definition for solution %s", context.path);
3453
- const solutionKey = this.getSolutionKey(context);
3454
- const fileStorageProvider = await this.getFileStorageProviderAsync(context, cancellationToken);
3455
- const resources = [];
3456
- const solutionFiles = [];
3457
- let hashes;
3458
- let paths;
3459
- const pathsByKind = this.getPathsByKind(context);
3460
- let tree;
3461
- pathsByKind.clear();
3501
+ const loadStarted = nowMs();
3502
+ let fileCount = 0;
3503
+ let listMs = 0;
3504
+ let readStarted = loadStarted;
3505
+ let readWallMs = 0;
3506
+ let readCompleted = false;
3507
+ let ioMs = 0;
3508
+ let maxFileIoMs = 0;
3509
+ let parseMs = 0;
3510
+ let hashMs = 0;
3511
+ let chars = 0;
3512
+ let loadedCount = 0;
3462
3513
  const parseErrors = [];
3463
3514
  const missingFiles = [];
3464
3515
  const invalidFiles = [];
3465
- context.items[SolutionContextKeys.PARSE_ERRORS_ITEM_KEY] = parseErrors;
3466
- if (!context.isReadOnly) {
3467
- hashes = this.getHashes(context);
3468
- paths = this.getPaths(context);
3469
- tree = this.getTree(context);
3470
- hashes.clear();
3471
- paths.clear();
3472
- tree.length = 0;
3473
- }
3474
- const resourceFiles = await fileStorageProvider.getFilesAsync(SolutionConstants.RESOURCE_FILES_FOLDER_NAME, "*.json", cancellationToken);
3475
- for (const resourceFile of resourceFiles)
3476
- try {
3477
- const stream = await fileStorageProvider.openFileAsync(resourceFile, cancellationToken);
3478
- const content = await this.streamToString(stream);
3479
- const wrapper = this.caseInsensitiveSerializer.deserialize(content);
3480
- if (wrapper?.resource) {
3481
- const rd = this.fromSerializable(wrapper.resource, solutionFiles);
3482
- const relPath = resourceFile.replace(/\\/g, "/");
3483
- const segments = relPath.split("/").filter((s) => s.length > 0);
3484
- const firstSegment = segments[0];
3485
- if (segments.length >= 3 && firstSegment && firstSegment.toLowerCase() === SolutionConstants.RESOURCE_FILES_FOLDER_NAME.toLowerCase()) {
3486
- const hasType = !!rd.type;
3487
- const folderSegmentCount = hasType ? segments.length - 3 : segments.length - 2;
3488
- if (folderSegmentCount < 1)
3489
- rd.folders = [
3490
- {
3491
- fullyQualifiedName: SolutionConstants.ROOT_FOLDER_NAME
3492
- }
3493
- ];
3494
- else {
3495
- const segmentsToUse = segments.slice(1, folderSegmentCount);
3496
- const folderFqn = segmentsToUse.join("/");
3497
- rd.folders = [
3498
- {
3499
- fullyQualifiedName: folderFqn
3500
- }
3501
- ];
3516
+ let metricsLogged = false;
3517
+ const logReadMetrics = (outcome) => {
3518
+ metricsLogged = true;
3519
+ const totalMs = nowMs() - loadStarted;
3520
+ const mergeMs = readCompleted ? nowMs() - readStarted - readWallMs : 0;
3521
+ const metrics = {
3522
+ outcome,
3523
+ path: context.path,
3524
+ fileCount,
3525
+ totalMs: round1(totalMs),
3526
+ listMs: round1(listMs),
3527
+ readWallMs: round1(readWallMs),
3528
+ ioMs: round1(ioMs),
3529
+ maxFileIoMs: round1(maxFileIoMs),
3530
+ parseMs: round1(parseMs),
3531
+ hashMs: round1(hashMs),
3532
+ mergeMs: round1(mergeMs),
3533
+ chars,
3534
+ degreeOfParallelism: resolveMaxDegreeOfParallelism(this.options),
3535
+ isReadOnly: context.isReadOnly,
3536
+ loaded: loadedCount,
3537
+ missing: missingFiles.length,
3538
+ invalid: invalidFiles.length,
3539
+ parseErrors: parseErrors.length
3540
+ };
3541
+ 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}`;
3542
+ if (outcome === "Success")
3543
+ this.logger.info(message, metrics);
3544
+ else
3545
+ this.logger.warn(message, metrics);
3546
+ };
3547
+ const readCore = async () => {
3548
+ const solutionKey = this.getSolutionKey(context);
3549
+ const fileStorageProvider = await this.getFileStorageProviderAsync(context, cancellationToken);
3550
+ const resources = [];
3551
+ const solutionFiles = [];
3552
+ let hashes;
3553
+ let paths;
3554
+ const pathsByKind = this.getPathsByKind(context);
3555
+ let tree;
3556
+ pathsByKind.clear();
3557
+ context.items[SolutionContextKeys.PARSE_ERRORS_ITEM_KEY] = parseErrors;
3558
+ if (!context.isReadOnly) {
3559
+ hashes = this.getHashes(context);
3560
+ paths = this.getPaths(context);
3561
+ tree = this.getTree(context);
3562
+ hashes.clear();
3563
+ paths.clear();
3564
+ tree.length = 0;
3565
+ }
3566
+ const listStarted = nowMs();
3567
+ const resourceFiles = await fileStorageProvider.getFilesAsync(SolutionConstants.RESOURCE_FILES_FOLDER_NAME, "*.json", cancellationToken);
3568
+ listMs = nowMs() - listStarted;
3569
+ fileCount = resourceFiles.length;
3570
+ readStarted = nowMs();
3571
+ const readResults = await this.readResourceFilesAsync(context, fileStorageProvider, resourceFiles, cancellationToken);
3572
+ readWallMs = nowMs() - readStarted;
3573
+ readCompleted = true;
3574
+ let fatal;
3575
+ let hasFatal = false;
3576
+ for (const result of readResults)
3577
+ if (result !== undefined) {
3578
+ if (result.timings) {
3579
+ ioMs += result.timings.ioMs;
3580
+ maxFileIoMs = Math.max(maxFileIoMs, result.timings.ioMs);
3581
+ parseMs += result.timings.parseMs;
3582
+ hashMs += result.timings.hashMs;
3583
+ chars += result.timings.chars;
3584
+ }
3585
+ if (result.fatal !== undefined) {
3586
+ if (!hasFatal) {
3587
+ fatal = result.fatal;
3588
+ hasFatal = true;
3502
3589
  }
3503
- } else
3504
- rd.folders = [
3505
- {
3506
- fullyQualifiedName: SolutionConstants.ROOT_FOLDER_NAME
3590
+ continue;
3591
+ }
3592
+ if (!hasFatal)
3593
+ switch (result.outcome) {
3594
+ case "loaded": {
3595
+ loadedCount++;
3596
+ const rd = result.resource;
3597
+ for (const file of result.files)
3598
+ if (!solutionFiles.some((sf) => sf.name === file.name && sf.kind === file.kind))
3599
+ solutionFiles.push(file);
3600
+ resources.push(rd);
3601
+ const resourceKey = rd.key;
3602
+ const normalizedFullPath = result.normalizedPath;
3603
+ if (!pathsByKind.has(rd.kind))
3604
+ pathsByKind.set(rd.kind, []);
3605
+ const kindPaths = pathsByKind.get(rd.kind);
3606
+ if (kindPaths)
3607
+ kindPaths.push({
3608
+ name: rd.name,
3609
+ key: rd.key,
3610
+ path: normalizedFullPath
3611
+ });
3612
+ if (!context.isReadOnly && hashes && paths) {
3613
+ paths.set(resourceKey, normalizedFullPath);
3614
+ hashes.set(resourceKey, result.hash);
3615
+ }
3616
+ break;
3507
3617
  }
3508
- ];
3509
- resources.push(rd);
3510
- const resourceKey = rd.key;
3511
- const normalizedFullPath = this.getNormalizedPath(resourceFile);
3512
- if (!pathsByKind.has(rd.kind))
3513
- pathsByKind.set(rd.kind, []);
3514
- const kindPaths = pathsByKind.get(rd.kind);
3515
- if (kindPaths)
3516
- kindPaths.push({
3517
- name: rd.name,
3518
- key: rd.key,
3519
- path: normalizedFullPath
3618
+ case "missing":
3619
+ missingFiles.push(result.file);
3620
+ break;
3621
+ case "invalid":
3622
+ invalidFiles.push(result.file);
3623
+ break;
3624
+ case "parseError":
3625
+ parseErrors.push(result.file);
3626
+ break;
3627
+ }
3628
+ }
3629
+ if (hasFatal) {
3630
+ logReadMetrics("Fatal");
3631
+ throw fatal;
3632
+ }
3633
+ if (missingFiles.length > 0) {
3634
+ logReadMetrics("MissingFiles");
3635
+ throw new BadRequestException(ErrorCodes.Resources.MissingFileDependencies, `Solution has missing files: ${missingFiles.join(", ")}`);
3636
+ }
3637
+ if (invalidFiles.length > 0) {
3638
+ logReadMetrics("InvalidFiles");
3639
+ throw new BadRequestException(ErrorCodes.Resources.InvalidResourceFile, `Solution has resource files with invalid content: ${invalidFiles.join(", ")}`);
3640
+ }
3641
+ if (parseErrors.length > 0) {
3642
+ logReadMetrics("ParseErrors");
3643
+ throw new Error(`Failed to read resource files for solution ${context.path}: ${parseErrors.join(", ")}`);
3644
+ }
3645
+ const folderMap = new Map;
3646
+ const rootFolder = this.buildRootFolder(solutionKey, SolutionConstants.ROOT_FOLDER_NAME);
3647
+ folderMap.set(rootFolder.fullyQualifiedName.toLowerCase(), rootFolder);
3648
+ for (const res of resources)
3649
+ for (const fdep of res.folders ?? []) {
3650
+ const fqnLower = fdep.fullyQualifiedName.toLowerCase();
3651
+ if (!folderMap.has(fqnLower)) {
3652
+ const folderKey = this.generateGuidFromString(fdep.fullyQualifiedName);
3653
+ const pathSegments = fdep.fullyQualifiedName.split("/").filter((s) => s.length > 0).map((p) => {
3654
+ if (p.toLowerCase() !== SolutionConstants.ROOT_FOLDER_NAME.toLowerCase())
3655
+ return this.generateGuidFromString(SolutionConstants.ROOT_FOLDER_NAME);
3656
+ return rootFolder.key;
3657
+ });
3658
+ const folderPath = pathSegments.join(".");
3659
+ folderMap.set(fqnLower, {
3660
+ key: folderKey,
3661
+ fullyQualifiedName: fdep.fullyQualifiedName,
3662
+ path: folderPath
3520
3663
  });
3521
- if (!context.isReadOnly && hashes && paths) {
3522
- paths.set(resourceKey, normalizedFullPath);
3523
- hashes.set(resourceKey, await this.computeHash(content));
3524
3664
  }
3525
- } else {
3526
- this.logger.error("Failed to read resource file %s for solution %s: invalid content", undefined, resourceFile, context.path);
3527
- invalidFiles.push(resourceFile);
3528
- }
3529
- } catch (ex) {
3530
- if (ex instanceof OperationCancelledException || cancellationToken?.aborted) {
3531
- this.logger.warn("Operation cancelled while reading file %s for solution %s", resourceFile, context.path);
3532
- throw ex instanceof OperationCancelledException ? ex : new OperationCancelledException;
3533
- }
3534
- if (ex instanceof TimeoutException)
3535
- throw new TimeoutException(`Reading resource file ${resourceFile} for solution ${context.path} timed out: ${ex.message}`, ex.timeoutMs);
3536
- if (isFileNotFoundError(ex)) {
3537
- this.logger.warn("Resource file listed but missing in storage for solution %s: %s", resourceFile, context.path);
3538
- missingFiles.push(resourceFile);
3539
- } else {
3540
- this.logger.error("Failed to read resource file %s for solution %s", ex, resourceFile, context.path);
3541
- parseErrors.push(resourceFile);
3542
3665
  }
3666
+ const solution = {
3667
+ key: solutionKey,
3668
+ docVersion: SolutionConstants.CURRENT_DOC_VERSION,
3669
+ folders: Array.from(folderMap.values()),
3670
+ resources,
3671
+ files: solutionFiles
3672
+ };
3673
+ await this.replaceDuplicateKeysAsync(solution, cancellationToken);
3674
+ if (!context.isReadOnly && tree) {
3675
+ const orderedResourceKeys = getTopologicalIdsOrdering(buildDependencyGraph(solution.resources));
3676
+ tree.push(...orderedResourceKeys);
3543
3677
  }
3544
- if (missingFiles.length > 0)
3545
- throw new BadRequestException(ErrorCodes.Resources.MissingFileDependencies, `Solution has missing files: ${missingFiles.join(", ")}`);
3546
- if (invalidFiles.length > 0)
3547
- throw new BadRequestException(ErrorCodes.Resources.InvalidResourceFile, `Solution has resource files with invalid content: ${invalidFiles.join(", ")}`);
3548
- if (parseErrors.length > 0)
3549
- throw new Error(`Failed to read resource files for solution ${context.path}: ${parseErrors.join(", ")}`);
3550
- const folderMap = new Map;
3551
- const rootFolder = this.buildRootFolder(solutionKey, SolutionConstants.ROOT_FOLDER_NAME);
3552
- folderMap.set(rootFolder.fullyQualifiedName.toLowerCase(), rootFolder);
3553
- for (const res of resources)
3554
- for (const fdep of res.folders ?? []) {
3555
- const fqnLower = fdep.fullyQualifiedName.toLowerCase();
3556
- if (!folderMap.has(fqnLower)) {
3557
- const folderKey = this.generateGuidFromString(fdep.fullyQualifiedName);
3558
- const pathSegments = fdep.fullyQualifiedName.split("/").filter((s) => s.length > 0).map((p) => {
3559
- if (p.toLowerCase() !== SolutionConstants.ROOT_FOLDER_NAME.toLowerCase())
3560
- return this.generateGuidFromString(SolutionConstants.ROOT_FOLDER_NAME);
3561
- return rootFolder.key;
3562
- });
3563
- const folderPath = pathSegments.join(".");
3564
- folderMap.set(fqnLower, {
3565
- key: folderKey,
3566
- fullyQualifiedName: fdep.fullyQualifiedName,
3567
- path: folderPath
3568
- });
3569
- }
3678
+ logReadMetrics("Success");
3679
+ return solution;
3680
+ };
3681
+ try {
3682
+ return await readCore();
3683
+ } catch (ex) {
3684
+ if (!metricsLogged)
3685
+ logReadMetrics("Fatal");
3686
+ throw ex;
3687
+ }
3688
+ }
3689
+ async readResourceFilesAsync(context, fileStorageProvider, resourceFiles, cancellationToken) {
3690
+ const results = Array.from({
3691
+ length: resourceFiles.length
3692
+ }, () => {
3693
+ return;
3694
+ });
3695
+ if (resourceFiles.length === 0)
3696
+ return results;
3697
+ const computeHash = !context.isReadOnly;
3698
+ const degreeOfParallelism = Math.min(resolveMaxDegreeOfParallelism(this.options), resourceFiles.length);
3699
+ let nextIndex = 0;
3700
+ let stopRequested = false;
3701
+ const runWorkerAsync = async () => {
3702
+ while (!stopRequested && nextIndex < resourceFiles.length) {
3703
+ const index = nextIndex++;
3704
+ const resourceFile = resourceFiles[index];
3705
+ const result = await this.readResourceFileAsync(context, fileStorageProvider, resourceFile, computeHash, cancellationToken);
3706
+ results[index] = result;
3707
+ if (result.fatal !== undefined)
3708
+ stopRequested = true;
3570
3709
  }
3571
- const solution = {
3572
- key: solutionKey,
3573
- docVersion: SolutionConstants.CURRENT_DOC_VERSION,
3574
- folders: Array.from(folderMap.values()),
3575
- resources,
3576
- files: solutionFiles
3577
3710
  };
3578
- await this.replaceDuplicateKeysAsync(solution, cancellationToken);
3579
- if (!context.isReadOnly && tree) {
3580
- const orderedResourceKeys = getTopologicalIdsOrdering(buildDependencyGraph(solution.resources));
3581
- tree.push(...orderedResourceKeys);
3711
+ const workers = [];
3712
+ for (let i = 0;i < degreeOfParallelism; i++)
3713
+ workers.push(runWorkerAsync());
3714
+ await Promise.all(workers);
3715
+ if (cancellationToken?.aborted && !results.some((result) => result?.fatal !== undefined))
3716
+ throw cancellationError(cancellationToken);
3717
+ return results;
3718
+ }
3719
+ async readResourceFileAsync(context, fileStorageProvider, resourceFile, computeHash, cancellationToken) {
3720
+ const started = nowMs();
3721
+ let ioMs;
3722
+ let content;
3723
+ const failureTimings = () => {
3724
+ const elapsed = nowMs() - started;
3725
+ return ioMs === undefined ? {
3726
+ ioMs: elapsed,
3727
+ parseMs: 0,
3728
+ hashMs: 0,
3729
+ chars: 0
3730
+ } : {
3731
+ ioMs,
3732
+ parseMs: elapsed - ioMs,
3733
+ hashMs: 0,
3734
+ chars: content?.length ?? 0
3735
+ };
3736
+ };
3737
+ try {
3738
+ if (cancellationToken?.aborted)
3739
+ throw cancellationError(cancellationToken);
3740
+ const stream = await fileStorageProvider.openFileAsync(resourceFile, cancellationToken);
3741
+ content = await this.streamToString(stream);
3742
+ ioMs = nowMs() - started;
3743
+ const parseStarted = nowMs();
3744
+ const wrapper = this.caseInsensitiveSerializer.deserialize(content);
3745
+ if (!wrapper?.resource) {
3746
+ this.logger.error("Failed to read resource file %s for solution %s: invalid content", undefined, resourceFile, context.path);
3747
+ return {
3748
+ file: resourceFile,
3749
+ outcome: "invalid",
3750
+ timings: failureTimings()
3751
+ };
3752
+ }
3753
+ const files = [];
3754
+ const rd = this.fromSerializable(wrapper.resource, files);
3755
+ this.applyFolders(rd, resourceFile);
3756
+ const parseMs = nowMs() - parseStarted;
3757
+ let hash;
3758
+ let hashMs = 0;
3759
+ if (computeHash) {
3760
+ const hashStarted = nowMs();
3761
+ hash = await this.computeHash(content);
3762
+ hashMs = nowMs() - hashStarted;
3763
+ }
3764
+ return {
3765
+ file: resourceFile,
3766
+ outcome: "loaded",
3767
+ resource: rd,
3768
+ files,
3769
+ normalizedPath: this.getNormalizedPath(resourceFile),
3770
+ hash,
3771
+ timings: {
3772
+ ioMs,
3773
+ parseMs,
3774
+ hashMs,
3775
+ chars: content.length
3776
+ }
3777
+ };
3778
+ } catch (ex) {
3779
+ if (ex instanceof OperationCancelledException || cancellationToken?.aborted) {
3780
+ this.logger.warn("Operation cancelled while reading file %s for solution %s", resourceFile, context.path);
3781
+ return {
3782
+ file: resourceFile,
3783
+ outcome: "fatal",
3784
+ fatal: ex instanceof OperationCancelledException ? ex : cancellationError(cancellationToken),
3785
+ timings: failureTimings()
3786
+ };
3787
+ }
3788
+ if (ex instanceof TimeoutException)
3789
+ return {
3790
+ file: resourceFile,
3791
+ outcome: "fatal",
3792
+ fatal: new TimeoutException(`Reading resource file ${resourceFile} for solution ${context.path} timed out: ${ex.message}`, ex.timeoutMs),
3793
+ timings: failureTimings()
3794
+ };
3795
+ if (isFileNotFoundError(ex)) {
3796
+ this.logger.warn("Resource file listed but missing in storage for solution %s: %s", resourceFile, context.path);
3797
+ return {
3798
+ file: resourceFile,
3799
+ outcome: "missing",
3800
+ timings: failureTimings()
3801
+ };
3802
+ }
3803
+ this.logger.error("Failed to read resource file %s for solution %s", ex, resourceFile, context.path);
3804
+ return {
3805
+ file: resourceFile,
3806
+ outcome: "parseError",
3807
+ timings: failureTimings()
3808
+ };
3582
3809
  }
3583
- return solution;
3810
+ }
3811
+ applyFolders(resource, resourceFile) {
3812
+ const relPath = resourceFile.replace(/\\/g, "/");
3813
+ const segments = relPath.split("/").filter((s) => s.length > 0);
3814
+ const firstSegment = segments[0];
3815
+ if (segments.length >= 3 && firstSegment && firstSegment.toLowerCase() === SolutionConstants.RESOURCE_FILES_FOLDER_NAME.toLowerCase()) {
3816
+ const hasType = !!resource.type;
3817
+ const folderSegmentCount = hasType ? segments.length - 3 : segments.length - 2;
3818
+ if (folderSegmentCount < 1)
3819
+ resource.folders = [
3820
+ {
3821
+ fullyQualifiedName: SolutionConstants.ROOT_FOLDER_NAME
3822
+ }
3823
+ ];
3824
+ else {
3825
+ const segmentsToUse = segments.slice(1, folderSegmentCount);
3826
+ const folderFqn = segmentsToUse.join("/");
3827
+ resource.folders = [
3828
+ {
3829
+ fullyQualifiedName: folderFqn
3830
+ }
3831
+ ];
3832
+ }
3833
+ } else
3834
+ resource.folders = [
3835
+ {
3836
+ fullyQualifiedName: SolutionConstants.ROOT_FOLDER_NAME
3837
+ }
3838
+ ];
3584
3839
  }
3585
3840
  async writeAsync(context, solution, cancellationToken) {
3586
3841
  if (context.isReadOnly)
@@ -3885,7 +4140,7 @@ class MultiFileSolutionDefinitionFactory {
3885
4140
  // ../../node_modules/@uipath/resource-builder-sdk/dist/embedded-files-default.js
3886
4141
  async function createDefaultEmbeddedFileReaderAsync() {
3887
4142
  const [{ EmbeddedFileReader }, { JsonSerializerFactory: JsonSerializerFactory2 }] = await Promise.all([
3888
- import("./embedded-file-reader-v8c2yj2a.js"),
4143
+ import("./embedded-file-reader-r66242ey.js"),
3889
4144
  import("./index-kmp9fmhb.js")
3890
4145
  ]);
3891
4146
  return new EmbeddedFileReader(new JsonSerializerFactory2);
@@ -3903,6 +4158,7 @@ var ServiceTokens = {
3903
4158
  SecretsProvider: "ISecretsProvider",
3904
4159
  FileStorageProviderFactory: "IFileStorageProviderFactory",
3905
4160
  IpRangeBypassSecretProvider: "IIpRangeBypassSecretProvider",
4161
+ FeatureFlagProvider: "IFeatureFlagProvider",
3906
4162
  SolutionDefinitionProvider: "ISolutionDefinitionProvider",
3907
4163
  SolutionDefinitionFactory: "ISolutionDefinitionFactory",
3908
4164
  ArtifactResourceSpecEnhancer: "IArtifactResourceSpecEnhancer",
@@ -4253,6 +4509,9 @@ function getBindingType(resourceKind, resourceType) {
4253
4509
  }
4254
4510
 
4255
4511
  // ../../node_modules/@uipath/resource-builder-sdk/dist/bindings/bindings-metadata-serializer.js
4512
+ var SUPPORTED_SCHEMA_MAJOR_VERSION = 2;
4513
+ var INT32_MAX_VALUE = 2147483647;
4514
+
4256
4515
  class BindingsMetadataSerializer {
4257
4516
  tryDeserialize(input) {
4258
4517
  if (!input)
@@ -4263,30 +4522,52 @@ class BindingsMetadataSerializer {
4263
4522
  let cleanInput = input.charCodeAt(0) === 65279 ? input.slice(1) : input;
4264
4523
  if (cleanInput.charCodeAt(cleanInput.length - 1) === 26)
4265
4524
  cleanInput = cleanInput.slice(0, -1);
4266
- const jsonObject = JSON.parse(cleanInput);
4525
+ const root = JSON.parse(cleanInput);
4526
+ if (root === null || typeof root != "object" || Array.isArray(root)) {
4527
+ this.logger.warn("Invalid bindings: content is not a JSON object");
4528
+ return {
4529
+ success: false
4530
+ };
4531
+ }
4532
+ const jsonObject = root;
4267
4533
  const versionValue = jsonObject[BindingsKnownKeys.Version];
4268
- if (!versionValue)
4534
+ if (typeof versionValue != "string") {
4535
+ this.logger.warn(`Invalid bindings: '${BindingsKnownKeys.Version}' is missing or not a string`);
4269
4536
  return {
4270
4537
  success: false
4271
4538
  };
4272
- const versionParts = versionValue.split(".").map(Number);
4273
- const majorVersion = versionParts[0];
4274
- if (majorVersion !== 2)
4275
- throw new Error("Unsupported bindings schema");
4539
+ }
4540
+ const majorVersion = BindingsMetadataSerializer.tryParseMajorVersion(versionValue);
4541
+ if (majorVersion === undefined) {
4542
+ this.logger.warn(`Invalid bindings: '${BindingsKnownKeys.Version}' is not a valid version`);
4543
+ return {
4544
+ success: false
4545
+ };
4546
+ }
4547
+ if (majorVersion !== SUPPORTED_SCHEMA_MAJOR_VERSION) {
4548
+ this.logger.warn(`Invalid bindings: unsupported schema major version ${majorVersion}`);
4549
+ return {
4550
+ success: false
4551
+ };
4552
+ }
4553
+ const resources = jsonObject[BindingsKnownKeys.Resources];
4554
+ if (!Array.isArray(resources)) {
4555
+ this.logger.warn(`Invalid bindings: '${BindingsKnownKeys.Resources}' is missing or not an array`);
4556
+ return {
4557
+ success: false
4558
+ };
4559
+ }
4276
4560
  const metadata = {
4277
4561
  version: versionValue,
4278
4562
  resources: []
4279
4563
  };
4280
- const resources = jsonObject[BindingsKnownKeys.Resources];
4281
- if (Array.isArray(resources))
4282
- for (const resourceElement of resources) {
4283
- if (resourceElement == null) {
4284
- this.logger.warn("Skipping null bindings resource element");
4285
- continue;
4286
- }
4287
- const resource = this.getBindingsResourceV2(resourceElement);
4288
- metadata.resources.push(resource);
4564
+ for (const resourceElement of resources) {
4565
+ if (resourceElement == null) {
4566
+ this.logger.warn("Skipping null bindings resource element");
4567
+ continue;
4289
4568
  }
4569
+ metadata.resources.push(this.getBindingsResourceV2(resourceElement));
4570
+ }
4290
4571
  this.linkDependencies(metadata.resources);
4291
4572
  return {
4292
4573
  success: true,
@@ -4299,6 +4580,22 @@ class BindingsMetadataSerializer {
4299
4580
  };
4300
4581
  }
4301
4582
  }
4583
+ static tryParseMajorVersion(value) {
4584
+ const parts = value.split(".");
4585
+ if (parts.length < 2 || parts.length > 4)
4586
+ return;
4587
+ let major;
4588
+ for (const [index, part] of parts.entries()) {
4589
+ if (!/^\s*[+-]?\d+\s*$/.test(part))
4590
+ return;
4591
+ const component = Number(part);
4592
+ if (component < 0 || component > INT32_MAX_VALUE)
4593
+ return;
4594
+ if (index === 0)
4595
+ major = component === 0 ? 0 : component;
4596
+ }
4597
+ return major;
4598
+ }
4302
4599
  linkDependencies(resources) {
4303
4600
  for (const resource of resources) {
4304
4601
  const propertyMeta = resource.metadata;
@@ -4458,6 +4755,62 @@ class BindingOverwritesMappingRequest {
4458
4755
  }
4459
4756
  }
4460
4757
 
4758
+ // ../../node_modules/@uipath/resource-builder-sdk/dist/bindings/jit-debug-project-types.js
4759
+ var JIT_DEBUG_PROJECT_TYPES_FEATURE_FLAG = "FE.JitDebugProjectTypes";
4760
+ var PROCESS_KIND = "process";
4761
+ var BUSINESS_RULE_KIND = "businessrule";
4762
+ var APP_KIND = "app";
4763
+ var LOW_CODE_APP_PROJECT_TYPE = "webapp";
4764
+ var LOW_CODE_APP_TYPES = new Set([
4765
+ "workflow action"
4766
+ ]);
4767
+ var CODED_APP_PROJECT_TYPE = "appv2";
4768
+ var CODED_APP_TYPES = new Set([
4769
+ "coded",
4770
+ "codedaction"
4771
+ ]);
4772
+ var DEFAULT_PROCESS_PROJECT_TYPE = "process";
4773
+ var KNOWN_PROCESS_PROJECT_TYPES = new Set([
4774
+ DEFAULT_PROCESS_PROJECT_TYPE,
4775
+ "processorchestration",
4776
+ "agent",
4777
+ "api",
4778
+ "flow",
4779
+ "function",
4780
+ "casemanagement",
4781
+ "webapp",
4782
+ "businessrules"
4783
+ ]);
4784
+ var BUSINESS_RULE_PROJECT_TYPE = "businessrules";
4785
+ function parseJitDebugProjectTypes(flagValue) {
4786
+ if (!flagValue || !flagValue.trim())
4787
+ return [];
4788
+ return flagValue.split(",").map((t) => t.trim()).filter((t) => t.length > 0);
4789
+ }
4790
+ function solutionSupportsJitDebug(solution, flagValue) {
4791
+ const enabledProjectTypes = parseJitDebugProjectTypes(flagValue).map((t) => t.toLowerCase());
4792
+ if (enabledProjectTypes.length === 0)
4793
+ return false;
4794
+ return (solution.resources ?? []).filter((r) => (r.projectKey != null || r.isArtefactResource === true) && isDecisionKind(r.kind)).every((r) => enabledProjectTypes.some((projectType) => matches(projectType, r)));
4795
+ }
4796
+ function isDecisionKind(kind) {
4797
+ const normalized = (kind ?? "").toLowerCase();
4798
+ return normalized === PROCESS_KIND || normalized === BUSINESS_RULE_KIND || normalized === APP_KIND;
4799
+ }
4800
+ function matches(projectType, resource) {
4801
+ if ((resource.kind ?? "").toLowerCase() === BUSINESS_RULE_KIND)
4802
+ return projectType === BUSINESS_RULE_PROJECT_TYPE;
4803
+ if ((resource.kind ?? "").toLowerCase() === APP_KIND) {
4804
+ const appType = (resource.type ?? "").toLowerCase();
4805
+ if (appType === "" || LOW_CODE_APP_TYPES.has(appType))
4806
+ return projectType === LOW_CODE_APP_PROJECT_TYPE;
4807
+ return CODED_APP_TYPES.has(appType) && projectType === CODED_APP_PROJECT_TYPE;
4808
+ }
4809
+ const resourceType = (resource.type ?? "").toLowerCase();
4810
+ const processType = resourceType === "" ? DEFAULT_PROCESS_PROJECT_TYPE : resourceType;
4811
+ return !KNOWN_PROCESS_PROJECT_TYPES.has(processType) || projectType === processType;
4812
+ }
4813
+
4461
4814
  // ../../node_modules/@uipath/resource-builder-sdk/dist/bindings/binding-overwrites-handler.js
4462
4815
  class BindingOverwritesHandler {
4463
4816
  async handleAsync(request, cancellationToken) {
@@ -4473,6 +4826,10 @@ class BindingOverwritesHandler {
4473
4826
  if (bindingResources.length === 0)
4474
4827
  return {};
4475
4828
  const result = {};
4829
+ const solution = await request.context.loadAsync(cancellationToken);
4830
+ const jitDebugProjectTypes = this.featureFlagProvider.getString(JIT_DEBUG_PROJECT_TYPES_FEATURE_FLAG, "");
4831
+ const emptyFolderPathForArtefacts = solutionSupportsJitDebug(solution, jitDebugProjectTypes);
4832
+ this.logger.info(`Binding overwrites for solution ${request.context.path}: JIT debug ${emptyFolderPathForArtefacts ? "on" : "off"} (FE.JitDebugProjectTypes = '${jitDebugProjectTypes}')`);
4476
4833
  const resourceOverwrites = await this.resourceOverwritesService.getResourceOverwritesAsync(request.context, cancellationToken);
4477
4834
  for (const bindingResource of bindingResources) {
4478
4835
  const resourceOverwrite = resourceOverwrites.get(bindingResource.resourceKey.toLowerCase());
@@ -4485,8 +4842,7 @@ class BindingOverwritesHandler {
4485
4842
  [BindingsKnownKeys.FolderKeyPropertyName]: resourceOverwrite.folderKey ?? ""
4486
4843
  };
4487
4844
  else {
4488
- const isBusinessRule = bindingResource.binding.resourceType === models_BindingsResourceType.BusinessRule;
4489
- const folderPath = bindingResource.isArtefactResource && !isBusinessRule ? "" : resourceOverwrite.folderFullyQualifiedName ?? "";
4845
+ const folderPath = emptyFolderPathForArtefacts && bindingResource.isArtefactResource ? "" : resourceOverwrite.folderFullyQualifiedName ?? "";
4490
4846
  overwrite = {
4491
4847
  [BindingsKnownKeys.FolderPathPropertyName]: folderPath,
4492
4848
  [BindingsKnownKeys.NamePropertyName]: resourceOverwrite.resourceName
@@ -4508,9 +4864,10 @@ class BindingOverwritesHandler {
4508
4864
  throw new BadRequestException("Bindings.ValidationFailed", `Binding validation failed: ${failureMessages}`);
4509
4865
  }
4510
4866
  }
4511
- constructor(mediator, resourceOverwritesService, loggerFactory) {
4867
+ constructor(mediator, resourceOverwritesService, loggerFactory, featureFlagProvider) {
4512
4868
  this.mediator = mediator;
4513
4869
  this.resourceOverwritesService = resourceOverwritesService;
4870
+ this.featureFlagProvider = featureFlagProvider;
4514
4871
  this.logger = loggerFactory.create("BindingOverwritesHandler");
4515
4872
  }
4516
4873
  }
@@ -4519,6 +4876,11 @@ function removeTimeTriggerBindings(bindings) {
4519
4876
  }
4520
4877
 
4521
4878
  // ../../node_modules/@uipath/resource-builder-sdk/dist/bindings/binding-overwrites-mapping-handler.js
4879
+ function isCodedAppType(type) {
4880
+ const normalized = type?.toLowerCase();
4881
+ return normalized === "coded" || normalized === "codedaction";
4882
+ }
4883
+
4522
4884
  class BindingOverwritesMappingRequestHandler {
4523
4885
  async handleAsync(request, cancellationToken) {
4524
4886
  const solutionBindings = request.bindings.resources.filter((x) => isSolutionResource(x.metadata));
@@ -4544,7 +4906,8 @@ class BindingOverwritesMappingRequestHandler {
4544
4906
  result.push({
4545
4907
  binding: bindingsResource,
4546
4908
  resourceKey: resource.key,
4547
- isArtefactResource: resource.projectKey != null
4909
+ isArtefactResource: resource.projectKey != null,
4910
+ isCodedApp: bindingsResource.resourceType === models_BindingsResourceType.App && isCodedAppType(resource.type)
4548
4911
  });
4549
4912
  } else {
4550
4913
  this.logger.error(`Solution does not contain binding resource of type ${models_BindingsResourceType[bindingsResource.resourceType]}.`);
@@ -5549,6 +5912,9 @@ class SolutionPublishLocationRequest {
5549
5912
  }
5550
5913
 
5551
5914
  class SolutionPublishLocationRequestV2 {
5915
+ constructor(permissionType) {
5916
+ this.permissionType = permissionType;
5917
+ }
5552
5918
  }
5553
5919
 
5554
5920
  class SettingsRequest {
@@ -5713,12 +6079,13 @@ function _ts_param3(paramIndex, decorator) {
5713
6079
  }
5714
6080
 
5715
6081
  class SolutionPublishLocationRequestV2Handler {
5716
- async handleAsync(_request, cancellationToken) {
6082
+ async handleAsync(request, cancellationToken) {
5717
6083
  try {
5718
6084
  const orchestratorClient = await this.orchestratorClientFactory.getClientAsync(cancellationToken);
5719
6085
  if (!orchestratorClient)
5720
6086
  throw new InvalidOperationException("Failed to create Orchestrator client");
5721
- return await orchestratorClient.getPublishLocationsAsync(cancellationToken);
6087
+ const { permissionType } = request;
6088
+ return permissionType == null ? await orchestratorClient.getPublishLocationsAsync(cancellationToken) : await orchestratorClient.getAccessiblePublishLocationsAsync(permissionType, cancellationToken);
5722
6089
  } catch (error) {
5723
6090
  this.logger.error("An unexpected error occurred while retrieving publish locations from Automation Solutions service.", error);
5724
6091
  throw error;
@@ -7158,8 +7525,8 @@ class SolutionDefinitionHelper {
7158
7525
  if (references.length === 0)
7159
7526
  continue;
7160
7527
  const referenceKind = refProp["referenceKind"];
7161
- const matches = (ref) => ref.name != null && invariantEquals(resource.name, ref.name) && referenceKind != null && invariantEquals(referenceKind, resource.kind);
7162
- const filtered = references.filter((r) => !matches(r));
7528
+ const matches2 = (ref) => ref.name != null && invariantEquals(resource.name, ref.name) && referenceKind != null && invariantEquals(referenceKind, resource.kind);
7529
+ const filtered = references.filter((r) => !matches2(r));
7163
7530
  if (filtered.length !== references.length)
7164
7531
  spec[refProp.property] = isSingleReferenceProperty(refProp) ? filtered[0] ?? null : filtered;
7165
7532
  }
@@ -7748,7 +8115,7 @@ class GetResourceKeyForProjectRequestHandler {
7748
8115
  projectKey: request.projectKey,
7749
8116
  solution: request.context.path
7750
8117
  });
7751
- const cacheKey = `prk:${request.projectKey}`;
8118
+ const cacheKey = `prk:${request.context.path}:${request.projectKey}`;
7752
8119
  const cached = await this.cacheProvider.getAsync(cacheKey, cancellationToken);
7753
8120
  if (cached && typeof cached == "object" && "resourceKey" in cached) {
7754
8121
  this.logger.info("Cache hit for project {projectKey} resource key.", {
@@ -8576,7 +8943,11 @@ class UpdateResourceConfigurationCommandHandler {
8576
8943
  for (const prop of command.properties) {
8577
8944
  const propKey = prop.property.toLowerCase();
8578
8945
  const metadata = propertiesMetadata.get(propKey);
8579
- if (!(!metadata || isAnyReferenceProperty(metadata)) && metadata.readOnly !== true) {
8946
+ if (metadata && metadata.readOnly !== true) {
8947
+ if (isAnyReferenceProperty(metadata)) {
8948
+ updated = this.setSolutionReference(solution, resource, currentConfiguration, propertiesMetadata, metadata, prop.configuredValue) || updated;
8949
+ continue;
8950
+ }
8580
8951
  if (isSecretProperty(metadata)) {
8581
8952
  const secretValue = prop.configuredValue?.toString() || "";
8582
8953
  const existingKey = currentConfiguration[metadata.property]?.toString();
@@ -8620,6 +8991,38 @@ class UpdateResourceConfigurationCommandHandler {
8620
8991
  await command.context.saveChangesAsync(cancellationToken);
8621
8992
  return resourceConfiguration;
8622
8993
  }
8994
+ setSolutionReference(solution, resource, currentConfiguration, propertiesMetadata, metadata, configuredValue) {
8995
+ const referenceKind = metadata["referenceKind"];
8996
+ if (!isSingleReferenceProperty(metadata) || isFileReferenceProperty(metadata) || typeof referenceKind != "string" || !referenceKind)
8997
+ return false;
8998
+ const requested = asReference(configuredValue);
8999
+ const target = requested?.key ? solution.resources.find((r) => invariantEquals(r.key, requested.key) && invariantEquals(r.kind, referenceKind)) : undefined;
9000
+ if (!requested || !target || invariantEquals(target.key, resource.key))
9001
+ return false;
9002
+ const dependencies = resource.dependencies ??= [];
9003
+ const previous = asReference(currentConfiguration[metadata.property]);
9004
+ const previousKey = previous?.key;
9005
+ const isReferencedElsewhere = (key) => [
9006
+ ...propertiesMetadata.values()
9007
+ ].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)));
9008
+ if (previousKey && !invariantEquals(previousKey, target.key) && !isReferencedElsewhere(previousKey)) {
9009
+ const previousName = solution.resources.find((r) => invariantEquals(r.key, previousKey) && invariantEquals(r.kind, target.kind))?.name ?? previous?.name ?? "";
9010
+ resource.dependencies = dependencies.filter((d) => !(invariantEquals(d.kind, target.kind) && invariantEquals(d.name, previousName)));
9011
+ }
9012
+ if (!resource.dependencies.some((d) => invariantEquals(d.kind, target.kind) && invariantEquals(d.name, target.name)))
9013
+ resource.dependencies.push({
9014
+ kind: target.kind,
9015
+ name: target.name
9016
+ });
9017
+ currentConfiguration[metadata.property] = {
9018
+ name: target.name,
9019
+ key: target.key,
9020
+ folderKey: requested.folderKey ?? null,
9021
+ lookupStrategy: null,
9022
+ info: null
9023
+ };
9024
+ return true;
9025
+ }
8623
9026
  async updateReferencesName(solutionDefinition, resource, oldName, cancellationToken) {
8624
9027
  const resourcesToBeChanged = solutionDefinition.resources.filter((r) => r.key !== resource.key && (r.dependencies ?? []).some((d) => invariantEquals(d.kind, resource.kind) && invariantEquals(d.name, oldName)));
8625
9028
  if (resourcesToBeChanged.length === 0)
@@ -8906,6 +9309,28 @@ class UpsertResourceSecretCommandHandler {
8906
9309
  this.secretsProvider = secretsProvider;
8907
9310
  }
8908
9311
  }
9312
+ function asReference(value) {
9313
+ if (!value || typeof value != "object" || Array.isArray(value))
9314
+ return;
9315
+ const record = value;
9316
+ const pick = (name) => {
9317
+ const entry = Object.entries(record).find(([k]) => k.toLowerCase() === name.toLowerCase());
9318
+ return typeof entry?.[1] == "string" ? entry[1] : undefined;
9319
+ };
9320
+ return {
9321
+ key: pick("key"),
9322
+ name: pick("name"),
9323
+ folderKey: pick("folderKey")
9324
+ };
9325
+ }
9326
+ function asReferences(value) {
9327
+ if (Array.isArray(value))
9328
+ return value.map(asReference).filter((r) => r !== undefined);
9329
+ const single = asReference(value);
9330
+ return single ? [
9331
+ single
9332
+ ] : [];
9333
+ }
8909
9334
 
8910
9335
  // ../../node_modules/@uipath/resource-builder-sdk/dist/handlers/solution-handlers.js
8911
9336
  var DUPLICATE_NAMES_SUPPORTED_KINDS = new Set([
@@ -12154,7 +12579,16 @@ class AutomationSolutionsClientProxy2 {
12154
12579
  // ../../node_modules/@uipath/resource-builder-sdk/dist/clients/orchestrator/orchestrator-client.js
12155
12580
  class OrchestratorClient {
12156
12581
  async getPublishLocationsAsync(cancellationToken) {
12157
- const url = `${this.options.baseUrl}api/v2/AutomationSolutions/publish_locations`;
12582
+ return this.getPublishLocationsFromAsync(this.publishLocationsUrl(), cancellationToken);
12583
+ }
12584
+ async getAccessiblePublishLocationsAsync(permissionType, cancellationToken) {
12585
+ const url = `${this.publishLocationsUrl()}?permissionType=${encodeURIComponent(permissionType)}`;
12586
+ return this.getPublishLocationsFromAsync(url, cancellationToken);
12587
+ }
12588
+ publishLocationsUrl() {
12589
+ return `${this.options.baseUrl}api/v2/AutomationSolutions/publish_locations`;
12590
+ }
12591
+ async getPublishLocationsFromAsync(url, cancellationToken) {
12158
12592
  const headers = OrchestratorClientFactory.buildHeaders(this.options.securityData);
12159
12593
  const response = await fetch(url, {
12160
12594
  method: "GET",
@@ -12844,7 +13278,7 @@ class ReconcileProjectsCommandHandler {
12844
13278
  } : {
12845
13279
  resourceKey: undefined
12846
13280
  };
12847
- await this.cacheProvider.setAsync(`prk:${projectKey}`, result, cancellationToken);
13281
+ await this.cacheProvider.setAsync(`prk:${context.path}:${projectKey}`, result, cancellationToken);
12848
13282
  }
12849
13283
  groupByProjectKey(artefactResources) {
12850
13284
  const map = new Map;
@@ -13718,6 +14152,11 @@ class ResourceBuilder {
13718
14152
  const request = new SolutionPublishLocationRequestV2;
13719
14153
  return this._mediator.sendAsync(request, cancellationToken);
13720
14154
  }
14155
+ async getAccessiblePublishLocationsAsync(permissionType, cancellationToken) {
14156
+ this.throwIfCancelled(cancellationToken);
14157
+ const request = new SolutionPublishLocationRequestV2(permissionType);
14158
+ return this._mediator.sendAsync(request, cancellationToken);
14159
+ }
13721
14160
  async getSettingsAsync(cancellationToken) {
13722
14161
  this.throwIfCancelled(cancellationToken);
13723
14162
  const request = new SettingsRequest;
@@ -14277,9 +14716,9 @@ class UnconfiguredEmbeddedFileReader {
14277
14716
  }
14278
14717
 
14279
14718
  // ../../node_modules/@uipath/resource-builder-sdk/dist/container.js
14280
- function createContainer(accessProvider, cacheProvider, secretsProvider, fileStorageProviderFactory, ipRangeBypassSecretProvider, solutionDefinitionProvider, solutionDefinitionFactory, artifactResourceSpecEnhancer, httpReaderOptions, loggerFactory, embeddedFileReader, solutionContextOptions) {
14719
+ function createContainer(accessProvider, cacheProvider, secretsProvider, fileStorageProviderFactory, ipRangeBypassSecretProvider, solutionDefinitionProvider, solutionDefinitionFactory, artifactResourceSpecEnhancer, httpReaderOptions, loggerFactory, embeddedFileReader, solutionContextOptions, featureFlagProvider) {
14281
14720
  const childContainer = import_tsyringe6.container.createChildContainer();
14282
- registerProviders(childContainer, accessProvider, cacheProvider, secretsProvider, fileStorageProviderFactory, ipRangeBypassSecretProvider, solutionDefinitionProvider, solutionDefinitionFactory, artifactResourceSpecEnhancer, httpReaderOptions, loggerFactory, solutionContextOptions);
14721
+ registerProviders(childContainer, accessProvider, cacheProvider, secretsProvider, fileStorageProviderFactory, ipRangeBypassSecretProvider, solutionDefinitionProvider, solutionDefinitionFactory, artifactResourceSpecEnhancer, httpReaderOptions, loggerFactory, solutionContextOptions, featureFlagProvider);
14283
14722
  registerServices(childContainer, embeddedFileReader);
14284
14723
  registerHandlers(childContainer);
14285
14724
  childContainer.register(ServiceTokens.Mediator, {
@@ -14303,11 +14742,15 @@ function registerProvider(diContainer, token, provider) {
14303
14742
  break;
14304
14743
  }
14305
14744
  }
14306
- function registerProviders(diContainer, accessProvider, cacheProvider, secretsProvider, fileStorageProviderFactory, ipRangeBypassSecretProvider, solutionDefinitionProvider, solutionDefinitionFactory, artifactResourceSpecEnhancer, httpReaderOptions, loggerFactory, solutionContextOptions) {
14745
+ function registerProviders(diContainer, accessProvider, cacheProvider, secretsProvider, fileStorageProviderFactory, ipRangeBypassSecretProvider, solutionDefinitionProvider, solutionDefinitionFactory, artifactResourceSpecEnhancer, httpReaderOptions, loggerFactory, solutionContextOptions, featureFlagProvider) {
14307
14746
  registerProvider(diContainer, ServiceTokens.AccessProvider, accessProvider);
14308
14747
  registerProvider(diContainer, ServiceTokens.CacheProvider, cacheProvider);
14309
14748
  registerProvider(diContainer, ServiceTokens.SecretsProvider, secretsProvider);
14310
14749
  registerProvider(diContainer, ServiceTokens.IpRangeBypassSecretProvider, ipRangeBypassSecretProvider);
14750
+ registerProvider(diContainer, ServiceTokens.FeatureFlagProvider, featureFlagProvider ?? {
14751
+ instance: new NullFeatureFlagProvider,
14752
+ lifetime: service_tokens_ServiceLifetime.Singleton
14753
+ });
14311
14754
  registerProvider(diContainer, ServiceTokens.FileStorageProviderFactory, fileStorageProviderFactory);
14312
14755
  registerProvider(diContainer, ServiceTokens.SolutionDefinitionProvider, solutionDefinitionProvider);
14313
14756
  registerProvider(diContainer, ServiceTokens.SolutionDefinitionFactory, solutionDefinitionFactory);
@@ -14744,7 +15187,8 @@ function registerHandlers(diContainer) {
14744
15187
  const mediator = c.resolve(ServiceTokens.Mediator);
14745
15188
  const resourceOverwritesService = c.resolve(Tokens.IResourceOverwritesService);
14746
15189
  const loggerFactory = c.resolve(ServiceTokens.LoggerFactory);
14747
- return new BindingOverwritesHandler(mediator, resourceOverwritesService, loggerFactory);
15190
+ const featureFlagProvider = c.resolve(ServiceTokens.FeatureFlagProvider);
15191
+ return new BindingOverwritesHandler(mediator, resourceOverwritesService, loggerFactory, featureFlagProvider);
14748
15192
  }
14749
15193
  });
14750
15194
  diContainer.register(createCommandHandlerToken(BindingOverwritesValidationCommand.name), {
@@ -14752,7 +15196,8 @@ function registerHandlers(diContainer) {
14752
15196
  const mediator = c.resolve(ServiceTokens.Mediator);
14753
15197
  const resourceOverwritesService = c.resolve(Tokens.IResourceOverwritesService);
14754
15198
  const loggerFactory = c.resolve(ServiceTokens.LoggerFactory);
14755
- return new BindingOverwritesHandler(mediator, resourceOverwritesService, loggerFactory);
15199
+ const featureFlagProvider = c.resolve(ServiceTokens.FeatureFlagProvider);
15200
+ return new BindingOverwritesHandler(mediator, resourceOverwritesService, loggerFactory, featureFlagProvider);
14756
15201
  }
14757
15202
  });
14758
15203
  diContainer.register(createRequestHandlerToken(BindingOverwritesMappingRequest.name), {
@@ -15034,6 +15479,11 @@ class ResourceBuilderConfiguration {
15034
15479
  this._ipRangeBypassSecretProviderLifetime = lifetime;
15035
15480
  return this;
15036
15481
  }
15482
+ addFeatureFlagProvider(provider, lifetime = service_tokens_ServiceLifetime.Scoped) {
15483
+ this._featureFlagProviderProvider = provider;
15484
+ this._featureFlagProviderLifetime = lifetime;
15485
+ return this;
15486
+ }
15037
15487
  addSolutionDefinitionProvider(provider, lifetime = service_tokens_ServiceLifetime.Scoped) {
15038
15488
  this._solutionDefinitionProviderProvider = provider;
15039
15489
  this._solutionDefinitionProviderLifetime = lifetime;
@@ -15087,6 +15537,11 @@ class ResourceBuilderConfiguration {
15087
15537
  instance: ipRangeBypassSecretProviderInstance,
15088
15538
  lifetime: this._ipRangeBypassSecretProviderLifetime
15089
15539
  };
15540
+ const featureFlagProviderInstance = this._featureFlagProviderProvider ? await resolveProvider(this._featureFlagProviderProvider) : new NullFeatureFlagProvider;
15541
+ const featureFlagProvider = {
15542
+ instance: featureFlagProviderInstance,
15543
+ lifetime: this._featureFlagProviderLifetime
15544
+ };
15090
15545
  const secretsProviderInstance = this._secretsProviderProvider ? await resolveProvider(this._secretsProviderProvider) : new NullSecretsProvider;
15091
15546
  const secretsProvider = {
15092
15547
  instance: secretsProviderInstance,
@@ -15130,7 +15585,7 @@ class ResourceBuilderConfiguration {
15130
15585
  lifetime: this._artifactResourceSpecEnhancerLifetime
15131
15586
  };
15132
15587
  const embeddedFileReader = await createDefaultEmbeddedFileReaderAsync();
15133
- const container3 = createContainer(accessProvider, cacheProvider, secretsProvider, fileStorageProviderFactory, ipRangeBypassSecretProvider, solutionDefinitionProvider, solutionDefinitionFactory, artifactResourceSpecEnhancer, this._httpReaderOptions, loggerFactory, embeddedFileReader, this._solutionContextOptions);
15588
+ const container3 = createContainer(accessProvider, cacheProvider, secretsProvider, fileStorageProviderFactory, ipRangeBypassSecretProvider, solutionDefinitionProvider, solutionDefinitionFactory, artifactResourceSpecEnhancer, this._httpReaderOptions, loggerFactory, embeddedFileReader, this._solutionContextOptions, featureFlagProvider);
15134
15589
  return new ResourceBuilderServices(container3);
15135
15590
  }
15136
15591
  async buildServices() {
@@ -15142,6 +15597,7 @@ class ResourceBuilderConfiguration {
15142
15597
  this._secretsProviderLifetime = service_tokens_ServiceLifetime.Scoped;
15143
15598
  this._fileStorageProviderFactoryLifetime = service_tokens_ServiceLifetime.Singleton;
15144
15599
  this._ipRangeBypassSecretProviderLifetime = service_tokens_ServiceLifetime.Scoped;
15600
+ this._featureFlagProviderLifetime = service_tokens_ServiceLifetime.Scoped;
15145
15601
  this._solutionDefinitionProviderLifetime = service_tokens_ServiceLifetime.Scoped;
15146
15602
  this._solutionDefinitionFactoryLifetime = service_tokens_ServiceLifetime.Scoped;
15147
15603
  this._artifactResourceSpecEnhancerLifetime = service_tokens_ServiceLifetime.Scoped;
@@ -18328,12 +18784,12 @@ async function findResourceByKeyInRcs(builder, kind, expectedKey, folderPath, pr
18328
18784
  return;
18329
18785
  }
18330
18786
  async function searchRcsResources(builder, kind, name) {
18331
- const [searchError, matches] = await catchError(searchRcsResourcesStrict(builder, kind, name));
18787
+ const [searchError, matches2] = await catchError(searchRcsResourcesStrict(builder, kind, name));
18332
18788
  if (searchError) {
18333
18789
  logger.warn(`Failed to search ${kind} resources in RCS: ${searchError.message}`);
18334
18790
  return [];
18335
18791
  }
18336
- return matches;
18792
+ return matches2;
18337
18793
  }
18338
18794
  async function searchRcsResourcesStrict(builder, kind, name) {
18339
18795
  let pageCursor;
@@ -18341,8 +18797,8 @@ async function searchRcsResourcesStrict(builder, kind, name) {
18341
18797
  do {
18342
18798
  const result = await builder.searchResourcesAsync(kind, undefined, name, pageCursor, 50, undefined, false);
18343
18799
  for (const folderResources of result.availableResources) {
18344
- const matches = folderResources.resources.filter((r) => r.name.toLowerCase() === name.toLowerCase());
18345
- for (const match of matches) {
18800
+ const matches2 = folderResources.resources.filter((r) => r.name.toLowerCase() === name.toLowerCase());
18801
+ for (const match of matches2) {
18346
18802
  allMatches.push({
18347
18803
  key: match.key,
18348
18804
  name: match.name,
@@ -18877,4 +19333,4 @@ export {
18877
19333
  writeSolutionFile
18878
19334
  };
18879
19335
 
18880
- //# debugId=517915E73766E64064756E2164756E21
19336
+ //# debugId=FCE72DD42616127D64756E2164756E21