@uipath/rules-tool 1.204.0-preview.262 → 1.204.0-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.
@@ -3332,6 +3332,19 @@ class NullSecretsProvider {
3332
3332
  }
3333
3333
  }
3334
3334
 
3335
+ // ../../node_modules/@uipath/resource-builder-sdk/dist/providers/feature-flag-provider.js
3336
+ class NullFeatureFlagProvider {
3337
+ getBool(_featureFlagName, defaultValue) {
3338
+ return defaultValue ?? false;
3339
+ }
3340
+ getInt(_featureFlagName, defaultValue) {
3341
+ return defaultValue ?? 0;
3342
+ }
3343
+ getString(_featureFlagName, defaultValue) {
3344
+ return defaultValue ?? "";
3345
+ }
3346
+ }
3347
+
3335
3348
  // ../../node_modules/@uipath/resource-builder-sdk/dist/exceptions/timeout-exception.js
3336
3349
  class TimeoutException extends Error {
3337
3350
  constructor(message, timeoutMs) {
@@ -3486,10 +3499,12 @@ function withFileOperationTimeout2(provider, timeoutMs) {
3486
3499
  // ../../node_modules/@uipath/resource-builder-sdk/dist/solution/solution-context-options.js
3487
3500
  var DEFAULT_SOLUTION_CONTEXT_OPTIONS = {
3488
3501
  lockTimeoutMs: 30000,
3489
- fileOperationTimeoutMs: 30000
3502
+ fileOperationTimeoutMs: 30000,
3503
+ maxDegreeOfParallelism: 1
3490
3504
  };
3491
3505
  var SOLUTION_CONTEXT_TIMEOUT_STORAGE_KEY = "SOL_RB_SOLUTION_CONTEXT_TIMEOUT_MS";
3492
3506
  var FILE_OPERATION_TIMEOUT_STORAGE_KEY = "SOL_RB_FILE_OPERATION_TIMEOUT_MS";
3507
+ var MAX_DEGREE_OF_PARALLELISM_STORAGE_KEY = "SOL_RB_MAX_DEGREE_OF_PARALLELISM";
3493
3508
  function resolveTimeoutMs(storageKey, configured, fallback) {
3494
3509
  const override = readTimeoutOverrideMs(storageKey);
3495
3510
  if (override !== undefined)
@@ -3502,10 +3517,33 @@ function resolveLockTimeoutMs(options) {
3502
3517
  function resolveFileOperationTimeoutMs(options) {
3503
3518
  return resolveTimeoutMs(FILE_OPERATION_TIMEOUT_STORAGE_KEY, options?.fileOperationTimeoutMs, DEFAULT_SOLUTION_CONTEXT_OPTIONS.fileOperationTimeoutMs);
3504
3519
  }
3520
+ function isValidDegreeOfParallelism(value) {
3521
+ return typeof value == "number" && Number.isInteger(value) && value > 0;
3522
+ }
3523
+ function resolveMaxDegreeOfParallelism(options) {
3524
+ const override = readDegreeOfParallelismOverride(MAX_DEGREE_OF_PARALLELISM_STORAGE_KEY);
3525
+ if (override !== undefined)
3526
+ return override;
3527
+ return isValidDegreeOfParallelism(options?.maxDegreeOfParallelism) ? options.maxDegreeOfParallelism : DEFAULT_SOLUTION_CONTEXT_OPTIONS.maxDegreeOfParallelism;
3528
+ }
3529
+ function readDegreeOfParallelismOverride(storageKey) {
3530
+ try {
3531
+ if ("u" < typeof localStorage)
3532
+ return;
3533
+ const raw = localStorage.getItem(storageKey);
3534
+ if (raw === null || raw.trim() === "")
3535
+ return;
3536
+ const parsed = Number(raw);
3537
+ return isValidDegreeOfParallelism(parsed) ? parsed : undefined;
3538
+ } catch {
3539
+ return;
3540
+ }
3541
+ }
3505
3542
  function mergeSolutionContextOptions(options) {
3506
3543
  return {
3507
3544
  lockTimeoutMs: isValidTimeoutMs(options?.lockTimeoutMs) ? options.lockTimeoutMs : DEFAULT_SOLUTION_CONTEXT_OPTIONS.lockTimeoutMs,
3508
- fileOperationTimeoutMs: isValidTimeoutMs(options?.fileOperationTimeoutMs) ? options.fileOperationTimeoutMs : DEFAULT_SOLUTION_CONTEXT_OPTIONS.fileOperationTimeoutMs
3545
+ fileOperationTimeoutMs: isValidTimeoutMs(options?.fileOperationTimeoutMs) ? options.fileOperationTimeoutMs : DEFAULT_SOLUTION_CONTEXT_OPTIONS.fileOperationTimeoutMs,
3546
+ maxDegreeOfParallelism: isValidDegreeOfParallelism(options?.maxDegreeOfParallelism) ? options.maxDegreeOfParallelism : DEFAULT_SOLUTION_CONTEXT_OPTIONS.maxDegreeOfParallelism
3509
3547
  };
3510
3548
  }
3511
3549
 
@@ -4296,6 +4334,16 @@ function getRootFolder(solution) {
4296
4334
  }
4297
4335
 
4298
4336
  // ../../node_modules/@uipath/resource-builder-sdk/dist/solution/multi-file-solution-definition-provider.js
4337
+ function nowMs() {
4338
+ return globalThis.performance?.now?.() ?? Date.now();
4339
+ }
4340
+ function round1(ms) {
4341
+ return Math.round(10 * ms) / 10;
4342
+ }
4343
+ function cancellationError(signal) {
4344
+ return signal?.reason instanceof OperationCancelledException ? signal.reason : new OperationCancelledException;
4345
+ }
4346
+
4299
4347
  class MultiFileSolutionDefinitionProvider {
4300
4348
  get caseInsensitiveSerializer() {
4301
4349
  if (!this._caseInsensitiveSerializer)
@@ -4313,137 +4361,344 @@ class MultiFileSolutionDefinitionProvider {
4313
4361
  }
4314
4362
  async readAsync(context, cancellationToken) {
4315
4363
  this.logger.info("Reading multi-file solution definition for solution %s", context.path);
4316
- const solutionKey = this.getSolutionKey(context);
4317
- const fileStorageProvider = await this.getFileStorageProviderAsync(context, cancellationToken);
4318
- const resources = [];
4319
- const solutionFiles = [];
4320
- let hashes;
4321
- let paths;
4322
- const pathsByKind = this.getPathsByKind(context);
4323
- let tree;
4324
- pathsByKind.clear();
4364
+ const loadStarted = nowMs();
4365
+ let fileCount = 0;
4366
+ let listMs = 0;
4367
+ let readStarted = loadStarted;
4368
+ let readWallMs = 0;
4369
+ let readCompleted = false;
4370
+ let ioMs = 0;
4371
+ let maxFileIoMs = 0;
4372
+ let parseMs = 0;
4373
+ let hashMs = 0;
4374
+ let chars = 0;
4375
+ let loadedCount = 0;
4325
4376
  const parseErrors = [];
4326
4377
  const missingFiles = [];
4327
4378
  const invalidFiles = [];
4328
- context.items[SolutionContextKeys.PARSE_ERRORS_ITEM_KEY] = parseErrors;
4329
- if (!context.isReadOnly) {
4330
- hashes = this.getHashes(context);
4331
- paths = this.getPaths(context);
4332
- tree = this.getTree(context);
4333
- hashes.clear();
4334
- paths.clear();
4335
- tree.length = 0;
4336
- }
4337
- const resourceFiles = await fileStorageProvider.getFilesAsync(SolutionConstants.RESOURCE_FILES_FOLDER_NAME, "*.json", cancellationToken);
4338
- for (const resourceFile of resourceFiles)
4339
- try {
4340
- const stream = await fileStorageProvider.openFileAsync(resourceFile, cancellationToken);
4341
- const content = await this.streamToString(stream);
4342
- const wrapper = this.caseInsensitiveSerializer.deserialize(content);
4343
- if (wrapper?.resource) {
4344
- const rd = this.fromSerializable(wrapper.resource, solutionFiles);
4345
- const relPath = resourceFile.replace(/\\/g, "/");
4346
- const segments = relPath.split("/").filter((s) => s.length > 0);
4347
- const firstSegment = segments[0];
4348
- if (segments.length >= 3 && firstSegment && firstSegment.toLowerCase() === SolutionConstants.RESOURCE_FILES_FOLDER_NAME.toLowerCase()) {
4349
- const hasType = !!rd.type;
4350
- const folderSegmentCount = hasType ? segments.length - 3 : segments.length - 2;
4351
- if (folderSegmentCount < 1)
4352
- rd.folders = [
4353
- {
4354
- fullyQualifiedName: SolutionConstants.ROOT_FOLDER_NAME
4355
- }
4356
- ];
4357
- else {
4358
- const segmentsToUse = segments.slice(1, folderSegmentCount);
4359
- const folderFqn = segmentsToUse.join("/");
4360
- rd.folders = [
4361
- {
4362
- fullyQualifiedName: folderFqn
4363
- }
4364
- ];
4379
+ let metricsLogged = false;
4380
+ const logReadMetrics = (outcome) => {
4381
+ metricsLogged = true;
4382
+ const totalMs = nowMs() - loadStarted;
4383
+ const mergeMs = readCompleted ? nowMs() - readStarted - readWallMs : 0;
4384
+ const metrics = {
4385
+ outcome,
4386
+ path: context.path,
4387
+ fileCount,
4388
+ totalMs: round1(totalMs),
4389
+ listMs: round1(listMs),
4390
+ readWallMs: round1(readWallMs),
4391
+ ioMs: round1(ioMs),
4392
+ maxFileIoMs: round1(maxFileIoMs),
4393
+ parseMs: round1(parseMs),
4394
+ hashMs: round1(hashMs),
4395
+ mergeMs: round1(mergeMs),
4396
+ chars,
4397
+ degreeOfParallelism: resolveMaxDegreeOfParallelism(this.options),
4398
+ isReadOnly: context.isReadOnly,
4399
+ loaded: loadedCount,
4400
+ missing: missingFiles.length,
4401
+ invalid: invalidFiles.length,
4402
+ parseErrors: parseErrors.length
4403
+ };
4404
+ 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}`;
4405
+ if (outcome === "Success")
4406
+ this.logger.info(message, metrics);
4407
+ else
4408
+ this.logger.warn(message, metrics);
4409
+ };
4410
+ const readCore = async () => {
4411
+ const solutionKey = this.getSolutionKey(context);
4412
+ const fileStorageProvider = await this.getFileStorageProviderAsync(context, cancellationToken);
4413
+ const resources = [];
4414
+ const solutionFiles = [];
4415
+ let hashes;
4416
+ let paths;
4417
+ const pathsByKind = this.getPathsByKind(context);
4418
+ let tree;
4419
+ pathsByKind.clear();
4420
+ context.items[SolutionContextKeys.PARSE_ERRORS_ITEM_KEY] = parseErrors;
4421
+ if (!context.isReadOnly) {
4422
+ hashes = this.getHashes(context);
4423
+ paths = this.getPaths(context);
4424
+ tree = this.getTree(context);
4425
+ hashes.clear();
4426
+ paths.clear();
4427
+ tree.length = 0;
4428
+ }
4429
+ const listStarted = nowMs();
4430
+ const resourceFiles = await fileStorageProvider.getFilesAsync(SolutionConstants.RESOURCE_FILES_FOLDER_NAME, "*.json", cancellationToken);
4431
+ listMs = nowMs() - listStarted;
4432
+ fileCount = resourceFiles.length;
4433
+ readStarted = nowMs();
4434
+ const readResults = await this.readResourceFilesAsync(context, fileStorageProvider, resourceFiles, cancellationToken);
4435
+ readWallMs = nowMs() - readStarted;
4436
+ readCompleted = true;
4437
+ let fatal;
4438
+ let hasFatal = false;
4439
+ for (const result of readResults)
4440
+ if (result !== undefined) {
4441
+ if (result.timings) {
4442
+ ioMs += result.timings.ioMs;
4443
+ maxFileIoMs = Math.max(maxFileIoMs, result.timings.ioMs);
4444
+ parseMs += result.timings.parseMs;
4445
+ hashMs += result.timings.hashMs;
4446
+ chars += result.timings.chars;
4447
+ }
4448
+ if (result.fatal !== undefined) {
4449
+ if (!hasFatal) {
4450
+ fatal = result.fatal;
4451
+ hasFatal = true;
4365
4452
  }
4366
- } else
4367
- rd.folders = [
4368
- {
4369
- fullyQualifiedName: SolutionConstants.ROOT_FOLDER_NAME
4453
+ continue;
4454
+ }
4455
+ if (!hasFatal)
4456
+ switch (result.outcome) {
4457
+ case "loaded": {
4458
+ loadedCount++;
4459
+ const rd = result.resource;
4460
+ for (const file of result.files)
4461
+ if (!solutionFiles.some((sf) => sf.name === file.name && sf.kind === file.kind))
4462
+ solutionFiles.push(file);
4463
+ resources.push(rd);
4464
+ const resourceKey = rd.key;
4465
+ const normalizedFullPath = result.normalizedPath;
4466
+ if (!pathsByKind.has(rd.kind))
4467
+ pathsByKind.set(rd.kind, []);
4468
+ const kindPaths = pathsByKind.get(rd.kind);
4469
+ if (kindPaths)
4470
+ kindPaths.push({
4471
+ name: rd.name,
4472
+ key: rd.key,
4473
+ path: normalizedFullPath
4474
+ });
4475
+ if (!context.isReadOnly && hashes && paths) {
4476
+ paths.set(resourceKey, normalizedFullPath);
4477
+ hashes.set(resourceKey, result.hash);
4478
+ }
4479
+ break;
4370
4480
  }
4371
- ];
4372
- resources.push(rd);
4373
- const resourceKey = rd.key;
4374
- const normalizedFullPath = this.getNormalizedPath(resourceFile);
4375
- if (!pathsByKind.has(rd.kind))
4376
- pathsByKind.set(rd.kind, []);
4377
- const kindPaths = pathsByKind.get(rd.kind);
4378
- if (kindPaths)
4379
- kindPaths.push({
4380
- name: rd.name,
4381
- key: rd.key,
4382
- path: normalizedFullPath
4481
+ case "missing":
4482
+ missingFiles.push(result.file);
4483
+ break;
4484
+ case "invalid":
4485
+ invalidFiles.push(result.file);
4486
+ break;
4487
+ case "parseError":
4488
+ parseErrors.push(result.file);
4489
+ break;
4490
+ }
4491
+ }
4492
+ if (hasFatal) {
4493
+ logReadMetrics("Fatal");
4494
+ throw fatal;
4495
+ }
4496
+ if (missingFiles.length > 0) {
4497
+ logReadMetrics("MissingFiles");
4498
+ throw new BadRequestException(ErrorCodes.Resources.MissingFileDependencies, `Solution has missing files: ${missingFiles.join(", ")}`);
4499
+ }
4500
+ if (invalidFiles.length > 0) {
4501
+ logReadMetrics("InvalidFiles");
4502
+ throw new BadRequestException(ErrorCodes.Resources.InvalidResourceFile, `Solution has resource files with invalid content: ${invalidFiles.join(", ")}`);
4503
+ }
4504
+ if (parseErrors.length > 0) {
4505
+ logReadMetrics("ParseErrors");
4506
+ throw new Error(`Failed to read resource files for solution ${context.path}: ${parseErrors.join(", ")}`);
4507
+ }
4508
+ const folderMap = new Map;
4509
+ const rootFolder = this.buildRootFolder(solutionKey, SolutionConstants.ROOT_FOLDER_NAME);
4510
+ folderMap.set(rootFolder.fullyQualifiedName.toLowerCase(), rootFolder);
4511
+ for (const res of resources)
4512
+ for (const fdep of res.folders ?? []) {
4513
+ const fqnLower = fdep.fullyQualifiedName.toLowerCase();
4514
+ if (!folderMap.has(fqnLower)) {
4515
+ const folderKey = this.generateGuidFromString(fdep.fullyQualifiedName);
4516
+ const pathSegments = fdep.fullyQualifiedName.split("/").filter((s) => s.length > 0).map((p) => {
4517
+ if (p.toLowerCase() !== SolutionConstants.ROOT_FOLDER_NAME.toLowerCase())
4518
+ return this.generateGuidFromString(SolutionConstants.ROOT_FOLDER_NAME);
4519
+ return rootFolder.key;
4520
+ });
4521
+ const folderPath = pathSegments.join(".");
4522
+ folderMap.set(fqnLower, {
4523
+ key: folderKey,
4524
+ fullyQualifiedName: fdep.fullyQualifiedName,
4525
+ path: folderPath
4383
4526
  });
4384
- if (!context.isReadOnly && hashes && paths) {
4385
- paths.set(resourceKey, normalizedFullPath);
4386
- hashes.set(resourceKey, await this.computeHash(content));
4387
4527
  }
4388
- } else {
4389
- this.logger.error("Failed to read resource file %s for solution %s: invalid content", undefined, resourceFile, context.path);
4390
- invalidFiles.push(resourceFile);
4391
- }
4392
- } catch (ex) {
4393
- if (ex instanceof OperationCancelledException || cancellationToken?.aborted) {
4394
- this.logger.warn("Operation cancelled while reading file %s for solution %s", resourceFile, context.path);
4395
- throw ex instanceof OperationCancelledException ? ex : new OperationCancelledException;
4396
- }
4397
- if (ex instanceof TimeoutException)
4398
- throw new TimeoutException(`Reading resource file ${resourceFile} for solution ${context.path} timed out: ${ex.message}`, ex.timeoutMs);
4399
- if (isFileNotFoundError(ex)) {
4400
- this.logger.warn("Resource file listed but missing in storage for solution %s: %s", resourceFile, context.path);
4401
- missingFiles.push(resourceFile);
4402
- } else {
4403
- this.logger.error("Failed to read resource file %s for solution %s", ex, resourceFile, context.path);
4404
- parseErrors.push(resourceFile);
4405
4528
  }
4529
+ const solution = {
4530
+ key: solutionKey,
4531
+ docVersion: SolutionConstants.CURRENT_DOC_VERSION,
4532
+ folders: Array.from(folderMap.values()),
4533
+ resources,
4534
+ files: solutionFiles
4535
+ };
4536
+ await this.replaceDuplicateKeysAsync(solution, cancellationToken);
4537
+ if (!context.isReadOnly && tree) {
4538
+ const orderedResourceKeys = getTopologicalIdsOrdering(buildDependencyGraph(solution.resources));
4539
+ tree.push(...orderedResourceKeys);
4406
4540
  }
4407
- if (missingFiles.length > 0)
4408
- throw new BadRequestException(ErrorCodes.Resources.MissingFileDependencies, `Solution has missing files: ${missingFiles.join(", ")}`);
4409
- if (invalidFiles.length > 0)
4410
- throw new BadRequestException(ErrorCodes.Resources.InvalidResourceFile, `Solution has resource files with invalid content: ${invalidFiles.join(", ")}`);
4411
- if (parseErrors.length > 0)
4412
- throw new Error(`Failed to read resource files for solution ${context.path}: ${parseErrors.join(", ")}`);
4413
- const folderMap = new Map;
4414
- const rootFolder = this.buildRootFolder(solutionKey, SolutionConstants.ROOT_FOLDER_NAME);
4415
- folderMap.set(rootFolder.fullyQualifiedName.toLowerCase(), rootFolder);
4416
- for (const res of resources)
4417
- for (const fdep of res.folders ?? []) {
4418
- const fqnLower = fdep.fullyQualifiedName.toLowerCase();
4419
- if (!folderMap.has(fqnLower)) {
4420
- const folderKey = this.generateGuidFromString(fdep.fullyQualifiedName);
4421
- const pathSegments = fdep.fullyQualifiedName.split("/").filter((s) => s.length > 0).map((p) => {
4422
- if (p.toLowerCase() !== SolutionConstants.ROOT_FOLDER_NAME.toLowerCase())
4423
- return this.generateGuidFromString(SolutionConstants.ROOT_FOLDER_NAME);
4424
- return rootFolder.key;
4425
- });
4426
- const folderPath = pathSegments.join(".");
4427
- folderMap.set(fqnLower, {
4428
- key: folderKey,
4429
- fullyQualifiedName: fdep.fullyQualifiedName,
4430
- path: folderPath
4431
- });
4432
- }
4541
+ logReadMetrics("Success");
4542
+ return solution;
4543
+ };
4544
+ try {
4545
+ return await readCore();
4546
+ } catch (ex) {
4547
+ if (!metricsLogged)
4548
+ logReadMetrics("Fatal");
4549
+ throw ex;
4550
+ }
4551
+ }
4552
+ async readResourceFilesAsync(context, fileStorageProvider, resourceFiles, cancellationToken) {
4553
+ const results = Array.from({
4554
+ length: resourceFiles.length
4555
+ }, () => {
4556
+ return;
4557
+ });
4558
+ if (resourceFiles.length === 0)
4559
+ return results;
4560
+ const computeHash = !context.isReadOnly;
4561
+ const degreeOfParallelism = Math.min(resolveMaxDegreeOfParallelism(this.options), resourceFiles.length);
4562
+ let nextIndex = 0;
4563
+ let stopRequested = false;
4564
+ const runWorkerAsync = async () => {
4565
+ while (!stopRequested && nextIndex < resourceFiles.length) {
4566
+ const index = nextIndex++;
4567
+ const resourceFile = resourceFiles[index];
4568
+ const result = await this.readResourceFileAsync(context, fileStorageProvider, resourceFile, computeHash, cancellationToken);
4569
+ results[index] = result;
4570
+ if (result.fatal !== undefined)
4571
+ stopRequested = true;
4433
4572
  }
4434
- const solution = {
4435
- key: solutionKey,
4436
- docVersion: SolutionConstants.CURRENT_DOC_VERSION,
4437
- folders: Array.from(folderMap.values()),
4438
- resources,
4439
- files: solutionFiles
4440
4573
  };
4441
- await this.replaceDuplicateKeysAsync(solution, cancellationToken);
4442
- if (!context.isReadOnly && tree) {
4443
- const orderedResourceKeys = getTopologicalIdsOrdering(buildDependencyGraph(solution.resources));
4444
- tree.push(...orderedResourceKeys);
4574
+ const workers = [];
4575
+ for (let i = 0;i < degreeOfParallelism; i++)
4576
+ workers.push(runWorkerAsync());
4577
+ await Promise.all(workers);
4578
+ if (cancellationToken?.aborted && !results.some((result) => result?.fatal !== undefined))
4579
+ throw cancellationError(cancellationToken);
4580
+ return results;
4581
+ }
4582
+ async readResourceFileAsync(context, fileStorageProvider, resourceFile, computeHash, cancellationToken) {
4583
+ const started = nowMs();
4584
+ let ioMs;
4585
+ let content;
4586
+ const failureTimings = () => {
4587
+ const elapsed = nowMs() - started;
4588
+ return ioMs === undefined ? {
4589
+ ioMs: elapsed,
4590
+ parseMs: 0,
4591
+ hashMs: 0,
4592
+ chars: 0
4593
+ } : {
4594
+ ioMs,
4595
+ parseMs: elapsed - ioMs,
4596
+ hashMs: 0,
4597
+ chars: content?.length ?? 0
4598
+ };
4599
+ };
4600
+ try {
4601
+ if (cancellationToken?.aborted)
4602
+ throw cancellationError(cancellationToken);
4603
+ const stream = await fileStorageProvider.openFileAsync(resourceFile, cancellationToken);
4604
+ content = await this.streamToString(stream);
4605
+ ioMs = nowMs() - started;
4606
+ const parseStarted = nowMs();
4607
+ const wrapper = this.caseInsensitiveSerializer.deserialize(content);
4608
+ if (!wrapper?.resource) {
4609
+ this.logger.error("Failed to read resource file %s for solution %s: invalid content", undefined, resourceFile, context.path);
4610
+ return {
4611
+ file: resourceFile,
4612
+ outcome: "invalid",
4613
+ timings: failureTimings()
4614
+ };
4615
+ }
4616
+ const files = [];
4617
+ const rd = this.fromSerializable(wrapper.resource, files);
4618
+ this.applyFolders(rd, resourceFile);
4619
+ const parseMs = nowMs() - parseStarted;
4620
+ let hash;
4621
+ let hashMs = 0;
4622
+ if (computeHash) {
4623
+ const hashStarted = nowMs();
4624
+ hash = await this.computeHash(content);
4625
+ hashMs = nowMs() - hashStarted;
4626
+ }
4627
+ return {
4628
+ file: resourceFile,
4629
+ outcome: "loaded",
4630
+ resource: rd,
4631
+ files,
4632
+ normalizedPath: this.getNormalizedPath(resourceFile),
4633
+ hash,
4634
+ timings: {
4635
+ ioMs,
4636
+ parseMs,
4637
+ hashMs,
4638
+ chars: content.length
4639
+ }
4640
+ };
4641
+ } catch (ex) {
4642
+ if (ex instanceof OperationCancelledException || cancellationToken?.aborted) {
4643
+ this.logger.warn("Operation cancelled while reading file %s for solution %s", resourceFile, context.path);
4644
+ return {
4645
+ file: resourceFile,
4646
+ outcome: "fatal",
4647
+ fatal: ex instanceof OperationCancelledException ? ex : cancellationError(cancellationToken),
4648
+ timings: failureTimings()
4649
+ };
4650
+ }
4651
+ if (ex instanceof TimeoutException)
4652
+ return {
4653
+ file: resourceFile,
4654
+ outcome: "fatal",
4655
+ fatal: new TimeoutException(`Reading resource file ${resourceFile} for solution ${context.path} timed out: ${ex.message}`, ex.timeoutMs),
4656
+ timings: failureTimings()
4657
+ };
4658
+ if (isFileNotFoundError(ex)) {
4659
+ this.logger.warn("Resource file listed but missing in storage for solution %s: %s", resourceFile, context.path);
4660
+ return {
4661
+ file: resourceFile,
4662
+ outcome: "missing",
4663
+ timings: failureTimings()
4664
+ };
4665
+ }
4666
+ this.logger.error("Failed to read resource file %s for solution %s", ex, resourceFile, context.path);
4667
+ return {
4668
+ file: resourceFile,
4669
+ outcome: "parseError",
4670
+ timings: failureTimings()
4671
+ };
4445
4672
  }
4446
- return solution;
4673
+ }
4674
+ applyFolders(resource, resourceFile) {
4675
+ const relPath = resourceFile.replace(/\\/g, "/");
4676
+ const segments = relPath.split("/").filter((s) => s.length > 0);
4677
+ const firstSegment = segments[0];
4678
+ if (segments.length >= 3 && firstSegment && firstSegment.toLowerCase() === SolutionConstants.RESOURCE_FILES_FOLDER_NAME.toLowerCase()) {
4679
+ const hasType = !!resource.type;
4680
+ const folderSegmentCount = hasType ? segments.length - 3 : segments.length - 2;
4681
+ if (folderSegmentCount < 1)
4682
+ resource.folders = [
4683
+ {
4684
+ fullyQualifiedName: SolutionConstants.ROOT_FOLDER_NAME
4685
+ }
4686
+ ];
4687
+ else {
4688
+ const segmentsToUse = segments.slice(1, folderSegmentCount);
4689
+ const folderFqn = segmentsToUse.join("/");
4690
+ resource.folders = [
4691
+ {
4692
+ fullyQualifiedName: folderFqn
4693
+ }
4694
+ ];
4695
+ }
4696
+ } else
4697
+ resource.folders = [
4698
+ {
4699
+ fullyQualifiedName: SolutionConstants.ROOT_FOLDER_NAME
4700
+ }
4701
+ ];
4447
4702
  }
4448
4703
  async writeAsync(context, solution, cancellationToken) {
4449
4704
  if (context.isReadOnly)
@@ -4748,7 +5003,7 @@ class MultiFileSolutionDefinitionFactory {
4748
5003
  // ../../node_modules/@uipath/resource-builder-sdk/dist/embedded-files-default.js
4749
5004
  async function createDefaultEmbeddedFileReaderAsync() {
4750
5005
  const [{ EmbeddedFileReader }, { JsonSerializerFactory: JsonSerializerFactory2 }] = await Promise.all([
4751
- import("./embedded-file-reader-rf2g1kfj.js"),
5006
+ import("./embedded-file-reader-z4becc02.js"),
4752
5007
  import("./index-dqa169gp.js")
4753
5008
  ]);
4754
5009
  return new EmbeddedFileReader(new JsonSerializerFactory2);
@@ -4766,6 +5021,7 @@ var ServiceTokens = {
4766
5021
  SecretsProvider: "ISecretsProvider",
4767
5022
  FileStorageProviderFactory: "IFileStorageProviderFactory",
4768
5023
  IpRangeBypassSecretProvider: "IIpRangeBypassSecretProvider",
5024
+ FeatureFlagProvider: "IFeatureFlagProvider",
4769
5025
  SolutionDefinitionProvider: "ISolutionDefinitionProvider",
4770
5026
  SolutionDefinitionFactory: "ISolutionDefinitionFactory",
4771
5027
  ArtifactResourceSpecEnhancer: "IArtifactResourceSpecEnhancer",
@@ -5116,6 +5372,9 @@ function getBindingType(resourceKind, resourceType) {
5116
5372
  }
5117
5373
 
5118
5374
  // ../../node_modules/@uipath/resource-builder-sdk/dist/bindings/bindings-metadata-serializer.js
5375
+ var SUPPORTED_SCHEMA_MAJOR_VERSION = 2;
5376
+ var INT32_MAX_VALUE = 2147483647;
5377
+
5119
5378
  class BindingsMetadataSerializer {
5120
5379
  tryDeserialize(input) {
5121
5380
  if (!input)
@@ -5126,30 +5385,52 @@ class BindingsMetadataSerializer {
5126
5385
  let cleanInput = input.charCodeAt(0) === 65279 ? input.slice(1) : input;
5127
5386
  if (cleanInput.charCodeAt(cleanInput.length - 1) === 26)
5128
5387
  cleanInput = cleanInput.slice(0, -1);
5129
- const jsonObject = JSON.parse(cleanInput);
5388
+ const root = JSON.parse(cleanInput);
5389
+ if (root === null || typeof root != "object" || Array.isArray(root)) {
5390
+ this.logger.warn("Invalid bindings: content is not a JSON object");
5391
+ return {
5392
+ success: false
5393
+ };
5394
+ }
5395
+ const jsonObject = root;
5130
5396
  const versionValue = jsonObject[BindingsKnownKeys.Version];
5131
- if (!versionValue)
5397
+ if (typeof versionValue != "string") {
5398
+ this.logger.warn(`Invalid bindings: '${BindingsKnownKeys.Version}' is missing or not a string`);
5132
5399
  return {
5133
5400
  success: false
5134
5401
  };
5135
- const versionParts = versionValue.split(".").map(Number);
5136
- const majorVersion = versionParts[0];
5137
- if (majorVersion !== 2)
5138
- throw new Error("Unsupported bindings schema");
5402
+ }
5403
+ const majorVersion = BindingsMetadataSerializer.tryParseMajorVersion(versionValue);
5404
+ if (majorVersion === undefined) {
5405
+ this.logger.warn(`Invalid bindings: '${BindingsKnownKeys.Version}' is not a valid version`);
5406
+ return {
5407
+ success: false
5408
+ };
5409
+ }
5410
+ if (majorVersion !== SUPPORTED_SCHEMA_MAJOR_VERSION) {
5411
+ this.logger.warn(`Invalid bindings: unsupported schema major version ${majorVersion}`);
5412
+ return {
5413
+ success: false
5414
+ };
5415
+ }
5416
+ const resources = jsonObject[BindingsKnownKeys.Resources];
5417
+ if (!Array.isArray(resources)) {
5418
+ this.logger.warn(`Invalid bindings: '${BindingsKnownKeys.Resources}' is missing or not an array`);
5419
+ return {
5420
+ success: false
5421
+ };
5422
+ }
5139
5423
  const metadata = {
5140
5424
  version: versionValue,
5141
5425
  resources: []
5142
5426
  };
5143
- const resources = jsonObject[BindingsKnownKeys.Resources];
5144
- if (Array.isArray(resources))
5145
- for (const resourceElement of resources) {
5146
- if (resourceElement == null) {
5147
- this.logger.warn("Skipping null bindings resource element");
5148
- continue;
5149
- }
5150
- const resource = this.getBindingsResourceV2(resourceElement);
5151
- metadata.resources.push(resource);
5427
+ for (const resourceElement of resources) {
5428
+ if (resourceElement == null) {
5429
+ this.logger.warn("Skipping null bindings resource element");
5430
+ continue;
5152
5431
  }
5432
+ metadata.resources.push(this.getBindingsResourceV2(resourceElement));
5433
+ }
5153
5434
  this.linkDependencies(metadata.resources);
5154
5435
  return {
5155
5436
  success: true,
@@ -5162,6 +5443,22 @@ class BindingsMetadataSerializer {
5162
5443
  };
5163
5444
  }
5164
5445
  }
5446
+ static tryParseMajorVersion(value) {
5447
+ const parts = value.split(".");
5448
+ if (parts.length < 2 || parts.length > 4)
5449
+ return;
5450
+ let major;
5451
+ for (const [index, part] of parts.entries()) {
5452
+ if (!/^\s*[+-]?\d+\s*$/.test(part))
5453
+ return;
5454
+ const component = Number(part);
5455
+ if (component < 0 || component > INT32_MAX_VALUE)
5456
+ return;
5457
+ if (index === 0)
5458
+ major = component === 0 ? 0 : component;
5459
+ }
5460
+ return major;
5461
+ }
5165
5462
  linkDependencies(resources) {
5166
5463
  for (const resource of resources) {
5167
5464
  const propertyMeta = resource.metadata;
@@ -5321,6 +5618,62 @@ class BindingOverwritesMappingRequest {
5321
5618
  }
5322
5619
  }
5323
5620
 
5621
+ // ../../node_modules/@uipath/resource-builder-sdk/dist/bindings/jit-debug-project-types.js
5622
+ var JIT_DEBUG_PROJECT_TYPES_FEATURE_FLAG = "FE.JitDebugProjectTypes";
5623
+ var PROCESS_KIND = "process";
5624
+ var BUSINESS_RULE_KIND = "businessrule";
5625
+ var APP_KIND = "app";
5626
+ var LOW_CODE_APP_PROJECT_TYPE = "webapp";
5627
+ var LOW_CODE_APP_TYPES = new Set([
5628
+ "workflow action"
5629
+ ]);
5630
+ var CODED_APP_PROJECT_TYPE = "appv2";
5631
+ var CODED_APP_TYPES = new Set([
5632
+ "coded",
5633
+ "codedaction"
5634
+ ]);
5635
+ var DEFAULT_PROCESS_PROJECT_TYPE = "process";
5636
+ var KNOWN_PROCESS_PROJECT_TYPES = new Set([
5637
+ DEFAULT_PROCESS_PROJECT_TYPE,
5638
+ "processorchestration",
5639
+ "agent",
5640
+ "api",
5641
+ "flow",
5642
+ "function",
5643
+ "casemanagement",
5644
+ "webapp",
5645
+ "businessrules"
5646
+ ]);
5647
+ var BUSINESS_RULE_PROJECT_TYPE = "businessrules";
5648
+ function parseJitDebugProjectTypes(flagValue) {
5649
+ if (!flagValue || !flagValue.trim())
5650
+ return [];
5651
+ return flagValue.split(",").map((t) => t.trim()).filter((t) => t.length > 0);
5652
+ }
5653
+ function solutionSupportsJitDebug(solution, flagValue) {
5654
+ const enabledProjectTypes = parseJitDebugProjectTypes(flagValue).map((t) => t.toLowerCase());
5655
+ if (enabledProjectTypes.length === 0)
5656
+ return false;
5657
+ return (solution.resources ?? []).filter((r) => (r.projectKey != null || r.isArtefactResource === true) && isDecisionKind(r.kind)).every((r) => enabledProjectTypes.some((projectType) => matches(projectType, r)));
5658
+ }
5659
+ function isDecisionKind(kind) {
5660
+ const normalized = (kind ?? "").toLowerCase();
5661
+ return normalized === PROCESS_KIND || normalized === BUSINESS_RULE_KIND || normalized === APP_KIND;
5662
+ }
5663
+ function matches(projectType, resource) {
5664
+ if ((resource.kind ?? "").toLowerCase() === BUSINESS_RULE_KIND)
5665
+ return projectType === BUSINESS_RULE_PROJECT_TYPE;
5666
+ if ((resource.kind ?? "").toLowerCase() === APP_KIND) {
5667
+ const appType = (resource.type ?? "").toLowerCase();
5668
+ if (appType === "" || LOW_CODE_APP_TYPES.has(appType))
5669
+ return projectType === LOW_CODE_APP_PROJECT_TYPE;
5670
+ return CODED_APP_TYPES.has(appType) && projectType === CODED_APP_PROJECT_TYPE;
5671
+ }
5672
+ const resourceType = (resource.type ?? "").toLowerCase();
5673
+ const processType = resourceType === "" ? DEFAULT_PROCESS_PROJECT_TYPE : resourceType;
5674
+ return !KNOWN_PROCESS_PROJECT_TYPES.has(processType) || projectType === processType;
5675
+ }
5676
+
5324
5677
  // ../../node_modules/@uipath/resource-builder-sdk/dist/bindings/binding-overwrites-handler.js
5325
5678
  class BindingOverwritesHandler {
5326
5679
  async handleAsync(request, cancellationToken) {
@@ -5336,6 +5689,10 @@ class BindingOverwritesHandler {
5336
5689
  if (bindingResources.length === 0)
5337
5690
  return {};
5338
5691
  const result = {};
5692
+ const solution = await request.context.loadAsync(cancellationToken);
5693
+ const jitDebugProjectTypes = this.featureFlagProvider.getString(JIT_DEBUG_PROJECT_TYPES_FEATURE_FLAG, "");
5694
+ const emptyFolderPathForArtefacts = solutionSupportsJitDebug(solution, jitDebugProjectTypes);
5695
+ this.logger.info(`Binding overwrites for solution ${request.context.path}: JIT debug ${emptyFolderPathForArtefacts ? "on" : "off"} (FE.JitDebugProjectTypes = '${jitDebugProjectTypes}')`);
5339
5696
  const resourceOverwrites = await this.resourceOverwritesService.getResourceOverwritesAsync(request.context, cancellationToken);
5340
5697
  for (const bindingResource of bindingResources) {
5341
5698
  const resourceOverwrite = resourceOverwrites.get(bindingResource.resourceKey.toLowerCase());
@@ -5348,8 +5705,7 @@ class BindingOverwritesHandler {
5348
5705
  [BindingsKnownKeys.FolderKeyPropertyName]: resourceOverwrite.folderKey ?? ""
5349
5706
  };
5350
5707
  else {
5351
- const isBusinessRule = bindingResource.binding.resourceType === models_BindingsResourceType.BusinessRule;
5352
- const folderPath = bindingResource.isArtefactResource && !isBusinessRule ? "" : resourceOverwrite.folderFullyQualifiedName ?? "";
5708
+ const folderPath = emptyFolderPathForArtefacts && bindingResource.isArtefactResource ? "" : resourceOverwrite.folderFullyQualifiedName ?? "";
5353
5709
  overwrite = {
5354
5710
  [BindingsKnownKeys.FolderPathPropertyName]: folderPath,
5355
5711
  [BindingsKnownKeys.NamePropertyName]: resourceOverwrite.resourceName
@@ -5371,9 +5727,10 @@ class BindingOverwritesHandler {
5371
5727
  throw new BadRequestException("Bindings.ValidationFailed", `Binding validation failed: ${failureMessages}`);
5372
5728
  }
5373
5729
  }
5374
- constructor(mediator, resourceOverwritesService, loggerFactory) {
5730
+ constructor(mediator, resourceOverwritesService, loggerFactory, featureFlagProvider) {
5375
5731
  this.mediator = mediator;
5376
5732
  this.resourceOverwritesService = resourceOverwritesService;
5733
+ this.featureFlagProvider = featureFlagProvider;
5377
5734
  this.logger = loggerFactory.create("BindingOverwritesHandler");
5378
5735
  }
5379
5736
  }
@@ -5382,6 +5739,11 @@ function removeTimeTriggerBindings(bindings) {
5382
5739
  }
5383
5740
 
5384
5741
  // ../../node_modules/@uipath/resource-builder-sdk/dist/bindings/binding-overwrites-mapping-handler.js
5742
+ function isCodedAppType(type) {
5743
+ const normalized = type?.toLowerCase();
5744
+ return normalized === "coded" || normalized === "codedaction";
5745
+ }
5746
+
5385
5747
  class BindingOverwritesMappingRequestHandler {
5386
5748
  async handleAsync(request, cancellationToken) {
5387
5749
  const solutionBindings = request.bindings.resources.filter((x) => isSolutionResource(x.metadata));
@@ -5407,7 +5769,8 @@ class BindingOverwritesMappingRequestHandler {
5407
5769
  result.push({
5408
5770
  binding: bindingsResource,
5409
5771
  resourceKey: resource.key,
5410
- isArtefactResource: resource.projectKey != null
5772
+ isArtefactResource: resource.projectKey != null,
5773
+ isCodedApp: bindingsResource.resourceType === models_BindingsResourceType.App && isCodedAppType(resource.type)
5411
5774
  });
5412
5775
  } else {
5413
5776
  this.logger.error(`Solution does not contain binding resource of type ${models_BindingsResourceType[bindingsResource.resourceType]}.`);
@@ -6412,6 +6775,9 @@ class SolutionPublishLocationRequest {
6412
6775
  }
6413
6776
 
6414
6777
  class SolutionPublishLocationRequestV2 {
6778
+ constructor(permissionType) {
6779
+ this.permissionType = permissionType;
6780
+ }
6415
6781
  }
6416
6782
 
6417
6783
  class SettingsRequest {
@@ -6576,12 +6942,13 @@ function _ts_param3(paramIndex, decorator) {
6576
6942
  }
6577
6943
 
6578
6944
  class SolutionPublishLocationRequestV2Handler {
6579
- async handleAsync(_request, cancellationToken) {
6945
+ async handleAsync(request, cancellationToken) {
6580
6946
  try {
6581
6947
  const orchestratorClient = await this.orchestratorClientFactory.getClientAsync(cancellationToken);
6582
6948
  if (!orchestratorClient)
6583
6949
  throw new InvalidOperationException("Failed to create Orchestrator client");
6584
- return await orchestratorClient.getPublishLocationsAsync(cancellationToken);
6950
+ const { permissionType } = request;
6951
+ return permissionType == null ? await orchestratorClient.getPublishLocationsAsync(cancellationToken) : await orchestratorClient.getAccessiblePublishLocationsAsync(permissionType, cancellationToken);
6585
6952
  } catch (error) {
6586
6953
  this.logger.error("An unexpected error occurred while retrieving publish locations from Automation Solutions service.", error);
6587
6954
  throw error;
@@ -8021,8 +8388,8 @@ class SolutionDefinitionHelper {
8021
8388
  if (references.length === 0)
8022
8389
  continue;
8023
8390
  const referenceKind = refProp["referenceKind"];
8024
- const matches = (ref) => ref.name != null && invariantEquals(resource.name, ref.name) && referenceKind != null && invariantEquals(referenceKind, resource.kind);
8025
- const filtered = references.filter((r) => !matches(r));
8391
+ const matches2 = (ref) => ref.name != null && invariantEquals(resource.name, ref.name) && referenceKind != null && invariantEquals(referenceKind, resource.kind);
8392
+ const filtered = references.filter((r) => !matches2(r));
8026
8393
  if (filtered.length !== references.length)
8027
8394
  spec[refProp.property] = isSingleReferenceProperty(refProp) ? filtered[0] ?? null : filtered;
8028
8395
  }
@@ -8611,7 +8978,7 @@ class GetResourceKeyForProjectRequestHandler {
8611
8978
  projectKey: request.projectKey,
8612
8979
  solution: request.context.path
8613
8980
  });
8614
- const cacheKey = `prk:${request.projectKey}`;
8981
+ const cacheKey = `prk:${request.context.path}:${request.projectKey}`;
8615
8982
  const cached = await this.cacheProvider.getAsync(cacheKey, cancellationToken);
8616
8983
  if (cached && typeof cached == "object" && "resourceKey" in cached) {
8617
8984
  this.logger.info("Cache hit for project {projectKey} resource key.", {
@@ -9439,7 +9806,11 @@ class UpdateResourceConfigurationCommandHandler {
9439
9806
  for (const prop of command.properties) {
9440
9807
  const propKey = prop.property.toLowerCase();
9441
9808
  const metadata = propertiesMetadata.get(propKey);
9442
- if (!(!metadata || isAnyReferenceProperty(metadata)) && metadata.readOnly !== true) {
9809
+ if (metadata && metadata.readOnly !== true) {
9810
+ if (isAnyReferenceProperty(metadata)) {
9811
+ updated = this.setSolutionReference(solution, resource, currentConfiguration, propertiesMetadata, metadata, prop.configuredValue) || updated;
9812
+ continue;
9813
+ }
9443
9814
  if (isSecretProperty(metadata)) {
9444
9815
  const secretValue = prop.configuredValue?.toString() || "";
9445
9816
  const existingKey = currentConfiguration[metadata.property]?.toString();
@@ -9483,6 +9854,38 @@ class UpdateResourceConfigurationCommandHandler {
9483
9854
  await command.context.saveChangesAsync(cancellationToken);
9484
9855
  return resourceConfiguration;
9485
9856
  }
9857
+ setSolutionReference(solution, resource, currentConfiguration, propertiesMetadata, metadata, configuredValue) {
9858
+ const referenceKind = metadata["referenceKind"];
9859
+ if (!isSingleReferenceProperty(metadata) || isFileReferenceProperty(metadata) || typeof referenceKind != "string" || !referenceKind)
9860
+ return false;
9861
+ const requested = asReference(configuredValue);
9862
+ const target = requested?.key ? solution.resources.find((r) => invariantEquals(r.key, requested.key) && invariantEquals(r.kind, referenceKind)) : undefined;
9863
+ if (!requested || !target || invariantEquals(target.key, resource.key))
9864
+ return false;
9865
+ const dependencies = resource.dependencies ??= [];
9866
+ const previous = asReference(currentConfiguration[metadata.property]);
9867
+ const previousKey = previous?.key;
9868
+ const isReferencedElsewhere = (key) => [
9869
+ ...propertiesMetadata.values()
9870
+ ].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)));
9871
+ if (previousKey && !invariantEquals(previousKey, target.key) && !isReferencedElsewhere(previousKey)) {
9872
+ const previousName = solution.resources.find((r) => invariantEquals(r.key, previousKey) && invariantEquals(r.kind, target.kind))?.name ?? previous?.name ?? "";
9873
+ resource.dependencies = dependencies.filter((d) => !(invariantEquals(d.kind, target.kind) && invariantEquals(d.name, previousName)));
9874
+ }
9875
+ if (!resource.dependencies.some((d) => invariantEquals(d.kind, target.kind) && invariantEquals(d.name, target.name)))
9876
+ resource.dependencies.push({
9877
+ kind: target.kind,
9878
+ name: target.name
9879
+ });
9880
+ currentConfiguration[metadata.property] = {
9881
+ name: target.name,
9882
+ key: target.key,
9883
+ folderKey: requested.folderKey ?? null,
9884
+ lookupStrategy: null,
9885
+ info: null
9886
+ };
9887
+ return true;
9888
+ }
9486
9889
  async updateReferencesName(solutionDefinition, resource, oldName, cancellationToken) {
9487
9890
  const resourcesToBeChanged = solutionDefinition.resources.filter((r) => r.key !== resource.key && (r.dependencies ?? []).some((d) => invariantEquals(d.kind, resource.kind) && invariantEquals(d.name, oldName)));
9488
9891
  if (resourcesToBeChanged.length === 0)
@@ -9769,6 +10172,28 @@ class UpsertResourceSecretCommandHandler {
9769
10172
  this.secretsProvider = secretsProvider;
9770
10173
  }
9771
10174
  }
10175
+ function asReference(value) {
10176
+ if (!value || typeof value != "object" || Array.isArray(value))
10177
+ return;
10178
+ const record = value;
10179
+ const pick = (name) => {
10180
+ const entry = Object.entries(record).find(([k]) => k.toLowerCase() === name.toLowerCase());
10181
+ return typeof entry?.[1] == "string" ? entry[1] : undefined;
10182
+ };
10183
+ return {
10184
+ key: pick("key"),
10185
+ name: pick("name"),
10186
+ folderKey: pick("folderKey")
10187
+ };
10188
+ }
10189
+ function asReferences(value) {
10190
+ if (Array.isArray(value))
10191
+ return value.map(asReference).filter((r) => r !== undefined);
10192
+ const single = asReference(value);
10193
+ return single ? [
10194
+ single
10195
+ ] : [];
10196
+ }
9772
10197
 
9773
10198
  // ../../node_modules/@uipath/resource-builder-sdk/dist/handlers/solution-handlers.js
9774
10199
  var DUPLICATE_NAMES_SUPPORTED_KINDS = new Set([
@@ -13017,7 +13442,16 @@ class AutomationSolutionsClientProxy2 {
13017
13442
  // ../../node_modules/@uipath/resource-builder-sdk/dist/clients/orchestrator/orchestrator-client.js
13018
13443
  class OrchestratorClient {
13019
13444
  async getPublishLocationsAsync(cancellationToken) {
13020
- const url = `${this.options.baseUrl}api/v2/AutomationSolutions/publish_locations`;
13445
+ return this.getPublishLocationsFromAsync(this.publishLocationsUrl(), cancellationToken);
13446
+ }
13447
+ async getAccessiblePublishLocationsAsync(permissionType, cancellationToken) {
13448
+ const url = `${this.publishLocationsUrl()}?permissionType=${encodeURIComponent(permissionType)}`;
13449
+ return this.getPublishLocationsFromAsync(url, cancellationToken);
13450
+ }
13451
+ publishLocationsUrl() {
13452
+ return `${this.options.baseUrl}api/v2/AutomationSolutions/publish_locations`;
13453
+ }
13454
+ async getPublishLocationsFromAsync(url, cancellationToken) {
13021
13455
  const headers = OrchestratorClientFactory.buildHeaders(this.options.securityData);
13022
13456
  const response = await fetch(url, {
13023
13457
  method: "GET",
@@ -13707,7 +14141,7 @@ class ReconcileProjectsCommandHandler {
13707
14141
  } : {
13708
14142
  resourceKey: undefined
13709
14143
  };
13710
- await this.cacheProvider.setAsync(`prk:${projectKey}`, result, cancellationToken);
14144
+ await this.cacheProvider.setAsync(`prk:${context.path}:${projectKey}`, result, cancellationToken);
13711
14145
  }
13712
14146
  groupByProjectKey(artefactResources) {
13713
14147
  const map = new Map;
@@ -14581,6 +15015,11 @@ class ResourceBuilder {
14581
15015
  const request = new SolutionPublishLocationRequestV2;
14582
15016
  return this._mediator.sendAsync(request, cancellationToken);
14583
15017
  }
15018
+ async getAccessiblePublishLocationsAsync(permissionType, cancellationToken) {
15019
+ this.throwIfCancelled(cancellationToken);
15020
+ const request = new SolutionPublishLocationRequestV2(permissionType);
15021
+ return this._mediator.sendAsync(request, cancellationToken);
15022
+ }
14584
15023
  async getSettingsAsync(cancellationToken) {
14585
15024
  this.throwIfCancelled(cancellationToken);
14586
15025
  const request = new SettingsRequest;
@@ -15140,9 +15579,9 @@ class UnconfiguredEmbeddedFileReader {
15140
15579
  }
15141
15580
 
15142
15581
  // ../../node_modules/@uipath/resource-builder-sdk/dist/container.js
15143
- function createContainer(accessProvider, cacheProvider, secretsProvider, fileStorageProviderFactory, ipRangeBypassSecretProvider, solutionDefinitionProvider, solutionDefinitionFactory, artifactResourceSpecEnhancer, httpReaderOptions, loggerFactory, embeddedFileReader, solutionContextOptions) {
15582
+ function createContainer(accessProvider, cacheProvider, secretsProvider, fileStorageProviderFactory, ipRangeBypassSecretProvider, solutionDefinitionProvider, solutionDefinitionFactory, artifactResourceSpecEnhancer, httpReaderOptions, loggerFactory, embeddedFileReader, solutionContextOptions, featureFlagProvider) {
15144
15583
  const childContainer = import_tsyringe6.container.createChildContainer();
15145
- registerProviders(childContainer, accessProvider, cacheProvider, secretsProvider, fileStorageProviderFactory, ipRangeBypassSecretProvider, solutionDefinitionProvider, solutionDefinitionFactory, artifactResourceSpecEnhancer, httpReaderOptions, loggerFactory, solutionContextOptions);
15584
+ registerProviders(childContainer, accessProvider, cacheProvider, secretsProvider, fileStorageProviderFactory, ipRangeBypassSecretProvider, solutionDefinitionProvider, solutionDefinitionFactory, artifactResourceSpecEnhancer, httpReaderOptions, loggerFactory, solutionContextOptions, featureFlagProvider);
15146
15585
  registerServices(childContainer, embeddedFileReader);
15147
15586
  registerHandlers(childContainer);
15148
15587
  childContainer.register(ServiceTokens.Mediator, {
@@ -15166,11 +15605,15 @@ function registerProvider(diContainer, token, provider) {
15166
15605
  break;
15167
15606
  }
15168
15607
  }
15169
- function registerProviders(diContainer, accessProvider, cacheProvider, secretsProvider, fileStorageProviderFactory, ipRangeBypassSecretProvider, solutionDefinitionProvider, solutionDefinitionFactory, artifactResourceSpecEnhancer, httpReaderOptions, loggerFactory, solutionContextOptions) {
15608
+ function registerProviders(diContainer, accessProvider, cacheProvider, secretsProvider, fileStorageProviderFactory, ipRangeBypassSecretProvider, solutionDefinitionProvider, solutionDefinitionFactory, artifactResourceSpecEnhancer, httpReaderOptions, loggerFactory, solutionContextOptions, featureFlagProvider) {
15170
15609
  registerProvider(diContainer, ServiceTokens.AccessProvider, accessProvider);
15171
15610
  registerProvider(diContainer, ServiceTokens.CacheProvider, cacheProvider);
15172
15611
  registerProvider(diContainer, ServiceTokens.SecretsProvider, secretsProvider);
15173
15612
  registerProvider(diContainer, ServiceTokens.IpRangeBypassSecretProvider, ipRangeBypassSecretProvider);
15613
+ registerProvider(diContainer, ServiceTokens.FeatureFlagProvider, featureFlagProvider ?? {
15614
+ instance: new NullFeatureFlagProvider,
15615
+ lifetime: service_tokens_ServiceLifetime.Singleton
15616
+ });
15174
15617
  registerProvider(diContainer, ServiceTokens.FileStorageProviderFactory, fileStorageProviderFactory);
15175
15618
  registerProvider(diContainer, ServiceTokens.SolutionDefinitionProvider, solutionDefinitionProvider);
15176
15619
  registerProvider(diContainer, ServiceTokens.SolutionDefinitionFactory, solutionDefinitionFactory);
@@ -15607,7 +16050,8 @@ function registerHandlers(diContainer) {
15607
16050
  const mediator = c.resolve(ServiceTokens.Mediator);
15608
16051
  const resourceOverwritesService = c.resolve(Tokens.IResourceOverwritesService);
15609
16052
  const loggerFactory = c.resolve(ServiceTokens.LoggerFactory);
15610
- return new BindingOverwritesHandler(mediator, resourceOverwritesService, loggerFactory);
16053
+ const featureFlagProvider = c.resolve(ServiceTokens.FeatureFlagProvider);
16054
+ return new BindingOverwritesHandler(mediator, resourceOverwritesService, loggerFactory, featureFlagProvider);
15611
16055
  }
15612
16056
  });
15613
16057
  diContainer.register(createCommandHandlerToken(BindingOverwritesValidationCommand.name), {
@@ -15615,7 +16059,8 @@ function registerHandlers(diContainer) {
15615
16059
  const mediator = c.resolve(ServiceTokens.Mediator);
15616
16060
  const resourceOverwritesService = c.resolve(Tokens.IResourceOverwritesService);
15617
16061
  const loggerFactory = c.resolve(ServiceTokens.LoggerFactory);
15618
- return new BindingOverwritesHandler(mediator, resourceOverwritesService, loggerFactory);
16062
+ const featureFlagProvider = c.resolve(ServiceTokens.FeatureFlagProvider);
16063
+ return new BindingOverwritesHandler(mediator, resourceOverwritesService, loggerFactory, featureFlagProvider);
15619
16064
  }
15620
16065
  });
15621
16066
  diContainer.register(createRequestHandlerToken(BindingOverwritesMappingRequest.name), {
@@ -15897,6 +16342,11 @@ class ResourceBuilderConfiguration {
15897
16342
  this._ipRangeBypassSecretProviderLifetime = lifetime;
15898
16343
  return this;
15899
16344
  }
16345
+ addFeatureFlagProvider(provider, lifetime = service_tokens_ServiceLifetime.Scoped) {
16346
+ this._featureFlagProviderProvider = provider;
16347
+ this._featureFlagProviderLifetime = lifetime;
16348
+ return this;
16349
+ }
15900
16350
  addSolutionDefinitionProvider(provider, lifetime = service_tokens_ServiceLifetime.Scoped) {
15901
16351
  this._solutionDefinitionProviderProvider = provider;
15902
16352
  this._solutionDefinitionProviderLifetime = lifetime;
@@ -15950,6 +16400,11 @@ class ResourceBuilderConfiguration {
15950
16400
  instance: ipRangeBypassSecretProviderInstance,
15951
16401
  lifetime: this._ipRangeBypassSecretProviderLifetime
15952
16402
  };
16403
+ const featureFlagProviderInstance = this._featureFlagProviderProvider ? await resolveProvider(this._featureFlagProviderProvider) : new NullFeatureFlagProvider;
16404
+ const featureFlagProvider = {
16405
+ instance: featureFlagProviderInstance,
16406
+ lifetime: this._featureFlagProviderLifetime
16407
+ };
15953
16408
  const secretsProviderInstance = this._secretsProviderProvider ? await resolveProvider(this._secretsProviderProvider) : new NullSecretsProvider;
15954
16409
  const secretsProvider = {
15955
16410
  instance: secretsProviderInstance,
@@ -15993,7 +16448,7 @@ class ResourceBuilderConfiguration {
15993
16448
  lifetime: this._artifactResourceSpecEnhancerLifetime
15994
16449
  };
15995
16450
  const embeddedFileReader = await createDefaultEmbeddedFileReaderAsync();
15996
- const container3 = createContainer(accessProvider, cacheProvider, secretsProvider, fileStorageProviderFactory, ipRangeBypassSecretProvider, solutionDefinitionProvider, solutionDefinitionFactory, artifactResourceSpecEnhancer, this._httpReaderOptions, loggerFactory, embeddedFileReader, this._solutionContextOptions);
16451
+ const container3 = createContainer(accessProvider, cacheProvider, secretsProvider, fileStorageProviderFactory, ipRangeBypassSecretProvider, solutionDefinitionProvider, solutionDefinitionFactory, artifactResourceSpecEnhancer, this._httpReaderOptions, loggerFactory, embeddedFileReader, this._solutionContextOptions, featureFlagProvider);
15997
16452
  return new ResourceBuilderServices(container3);
15998
16453
  }
15999
16454
  async buildServices() {
@@ -16005,6 +16460,7 @@ class ResourceBuilderConfiguration {
16005
16460
  this._secretsProviderLifetime = service_tokens_ServiceLifetime.Scoped;
16006
16461
  this._fileStorageProviderFactoryLifetime = service_tokens_ServiceLifetime.Singleton;
16007
16462
  this._ipRangeBypassSecretProviderLifetime = service_tokens_ServiceLifetime.Scoped;
16463
+ this._featureFlagProviderLifetime = service_tokens_ServiceLifetime.Scoped;
16008
16464
  this._solutionDefinitionProviderLifetime = service_tokens_ServiceLifetime.Scoped;
16009
16465
  this._solutionDefinitionFactoryLifetime = service_tokens_ServiceLifetime.Scoped;
16010
16466
  this._artifactResourceSpecEnhancerLifetime = service_tokens_ServiceLifetime.Scoped;
@@ -17379,12 +17835,12 @@ async function findResourceByKeyInRcs(builder, kind, expectedKey, folderPath, pr
17379
17835
  return;
17380
17836
  }
17381
17837
  async function searchRcsResources(builder, kind, name) {
17382
- const [searchError, matches] = await catchError(searchRcsResourcesStrict(builder, kind, name));
17838
+ const [searchError, matches2] = await catchError(searchRcsResourcesStrict(builder, kind, name));
17383
17839
  if (searchError) {
17384
17840
  logger.warn(`Failed to search ${kind} resources in RCS: ${searchError.message}`);
17385
17841
  return [];
17386
17842
  }
17387
- return matches;
17843
+ return matches2;
17388
17844
  }
17389
17845
  async function searchRcsResourcesStrict(builder, kind, name) {
17390
17846
  let pageCursor;
@@ -17392,8 +17848,8 @@ async function searchRcsResourcesStrict(builder, kind, name) {
17392
17848
  do {
17393
17849
  const result = await builder.searchResourcesAsync(kind, undefined, name, pageCursor, 50, undefined, false);
17394
17850
  for (const folderResources of result.availableResources) {
17395
- const matches = folderResources.resources.filter((r) => r.name.toLowerCase() === name.toLowerCase());
17396
- for (const match of matches) {
17851
+ const matches2 = folderResources.resources.filter((r) => r.name.toLowerCase() === name.toLowerCase());
17852
+ for (const match of matches2) {
17397
17853
  allMatches.push({
17398
17854
  key: match.key,
17399
17855
  name: match.name,
@@ -17875,4 +18331,4 @@ function sortKeysDeep(value) {
17875
18331
  }
17876
18332
  export { getSolutionAuthContext, assertSolutionManifest, readSolutionManifest, resolveProjectDirFromManifest, EntryPointSpecEnhancer, computeEntryPointSpec, applyEntryPointEnhancementAsync, createResourceBuilderServices, findProjectFile, ProjectManifestError, isProjectManifestError, isMissingProjectTypeError, readProjectFile, readSolutionFile, resolveSolutionFilePath, writeSolutionFile, restoreSolutionFile, createProjectInSolutionBuilder, normalizeFolderPath, findMatchingLocalResource, findMatchingMemberResource, findMemberCloneResources, addProjectArtifactsToSolutionAsync, hasBareTemplateRow, hasAnyTemplateRow, getRemoteResourceClients, findCatalogEntityAsync, toResourceReference, toCatalogReference, exportResourceDefinitionAsync, readSpecProperty, readSpecEntryPoints, normalizeResourceCasing, saveCasingNormalized, normalizeResourceFileCasing, MAX_RESOURCE_NAME_LENGTH, validateResourceName, assertValidResourceName, formatResourceSubtypes, sameResourceSubtype, syncResourcesFromBindings, uniqueNameForResource, findResourceByKeyInRcs, searchRcsResources, searchRcsResourcesStrict, findResourceInRcs, createResourceKindMetadataResolver, resolveResourceKindMetadata, createLocalResource, readUipxProjects, syncAndLog, resourceRefreshAsync, resourceRemoteSyncAsync };
17877
18333
 
17878
- //# debugId=56F8A3547F83091564756E2164756E21
18334
+ //# debugId=B6191646990A5AF364756E2164756E21