@uipath/solution-sdk 1.204.0 → 1.205.0-preview.258

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/dist/THIRD-PARTY-NOTICES.md +2 -2
  2. package/dist/deployment-search.js +182 -0
  3. package/dist/{embedded-file-reader-rf2g1kfj.js → embedded-file-reader-z4becc02.js} +2 -2
  4. package/dist/index-78paj2kz.js +1908 -0
  5. package/dist/index-cs3g624n.js +28 -0
  6. package/dist/index-eav127tv.js +3004 -0
  7. package/dist/{index-fb21bjwj.js → index-enc2hqq5.js} +255 -1409
  8. package/dist/{index-6gp5j7j5.js → index-hkexw5er.js} +193 -118
  9. package/dist/{index-g0hcxnae.js → index-y4vgqz1w.js} +11 -1
  10. package/dist/index-zmneg45c.js +1184 -0
  11. package/dist/index.js +1551 -4214
  12. package/dist/package-search.js +105 -0
  13. package/dist/resources/index.js +1183 -1177
  14. package/dist/solution-auth.js +4 -3
  15. package/dist/src/deployment-search.d.ts +104 -0
  16. package/dist/src/legacy-deployment-search-v3.d.ts +24 -0
  17. package/dist/src/legacy-package-search.d.ts +25 -0
  18. package/dist/src/package-search.d.ts +41 -0
  19. package/dist/src/pipelines-route.d.ts +43 -0
  20. package/dist/src/resources/index.d.ts +3 -0
  21. package/dist/src/resources/providers/artefact-pair-binding-provider.d.ts +4 -0
  22. package/dist/src/resources/services/catalog-lookup-failure.d.ts +50 -0
  23. package/dist/src/resources/services/remote-resources.d.ts +2 -0
  24. package/dist/src/resources/services/resource-configurations.d.ts +44 -0
  25. package/dist/src/resources/services/resource-lookup.d.ts +29 -0
  26. package/dist/src/resources/services/resource-refresh-service.d.ts +13 -0
  27. package/dist/src/resources/services/sync-resources-from-bindings.d.ts +43 -6
  28. package/dist/src/zip-utils.d.ts +5 -0
  29. package/package.json +10 -2
@@ -7,26 +7,31 @@ import {
7
7
  import {
8
8
  FirstPartyServiceApi
9
9
  } from "../index-53w8skv5.js";
10
+ import {
11
+ findSolutionFileUpward,
12
+ normalizeProjectType,
13
+ toPortableRelativePath
14
+ } from "../index-zmneg45c.js";
15
+ import {
16
+ getSolutionAuthContext
17
+ } from "../index-cs3g624n.js";
10
18
  import {
11
19
  addSdkUserAgentHeader,
12
20
  catchError,
13
21
  extractErrorMessage,
14
- findSolutionFileUpward,
15
22
  getSdkUserAgentToken,
16
23
  installSdkUserAgentHeader,
17
24
  isGuid,
18
- logger,
19
- normalizeProjectType,
20
- toPortableRelativePath
21
- } from "../index-fb21bjwj.js";
25
+ logger
26
+ } from "../index-enc2hqq5.js";
22
27
  import {
23
28
  getAuthContext,
24
29
  getLoginStatusAsync,
25
- getSolutionAuthContext
26
- } from "../index-6gp5j7j5.js";
30
+ resolveSessionIdentity
31
+ } from "../index-hkexw5er.js";
27
32
  import {
28
33
  getFileSystem
29
- } from "../index-g0hcxnae.js";
34
+ } from "../index-y4vgqz1w.js";
30
35
  import {
31
36
  __commonJS,
32
37
  __require,
@@ -3334,6 +3339,19 @@ class NullSecretsProvider {
3334
3339
  }
3335
3340
  }
3336
3341
 
3342
+ // ../../node_modules/@uipath/resource-builder-sdk/dist/providers/feature-flag-provider.js
3343
+ class NullFeatureFlagProvider {
3344
+ getBool(_featureFlagName, defaultValue) {
3345
+ return defaultValue ?? false;
3346
+ }
3347
+ getInt(_featureFlagName, defaultValue) {
3348
+ return defaultValue ?? 0;
3349
+ }
3350
+ getString(_featureFlagName, defaultValue) {
3351
+ return defaultValue ?? "";
3352
+ }
3353
+ }
3354
+
3337
3355
  // ../../node_modules/@uipath/resource-builder-sdk/dist/exceptions/timeout-exception.js
3338
3356
  class TimeoutException extends Error {
3339
3357
  constructor(message, timeoutMs) {
@@ -3488,10 +3506,12 @@ function withFileOperationTimeout2(provider, timeoutMs) {
3488
3506
  // ../../node_modules/@uipath/resource-builder-sdk/dist/solution/solution-context-options.js
3489
3507
  var DEFAULT_SOLUTION_CONTEXT_OPTIONS = {
3490
3508
  lockTimeoutMs: 30000,
3491
- fileOperationTimeoutMs: 30000
3509
+ fileOperationTimeoutMs: 30000,
3510
+ maxDegreeOfParallelism: 1
3492
3511
  };
3493
3512
  var SOLUTION_CONTEXT_TIMEOUT_STORAGE_KEY = "SOL_RB_SOLUTION_CONTEXT_TIMEOUT_MS";
3494
3513
  var FILE_OPERATION_TIMEOUT_STORAGE_KEY = "SOL_RB_FILE_OPERATION_TIMEOUT_MS";
3514
+ var MAX_DEGREE_OF_PARALLELISM_STORAGE_KEY = "SOL_RB_MAX_DEGREE_OF_PARALLELISM";
3495
3515
  function resolveTimeoutMs(storageKey, configured, fallback) {
3496
3516
  const override = readTimeoutOverrideMs(storageKey);
3497
3517
  if (override !== undefined)
@@ -3504,10 +3524,33 @@ function resolveLockTimeoutMs(options) {
3504
3524
  function resolveFileOperationTimeoutMs(options) {
3505
3525
  return resolveTimeoutMs(FILE_OPERATION_TIMEOUT_STORAGE_KEY, options?.fileOperationTimeoutMs, DEFAULT_SOLUTION_CONTEXT_OPTIONS.fileOperationTimeoutMs);
3506
3526
  }
3527
+ function isValidDegreeOfParallelism(value) {
3528
+ return typeof value == "number" && Number.isInteger(value) && value > 0;
3529
+ }
3530
+ function resolveMaxDegreeOfParallelism(options) {
3531
+ const override = readDegreeOfParallelismOverride(MAX_DEGREE_OF_PARALLELISM_STORAGE_KEY);
3532
+ if (override !== undefined)
3533
+ return override;
3534
+ return isValidDegreeOfParallelism(options?.maxDegreeOfParallelism) ? options.maxDegreeOfParallelism : DEFAULT_SOLUTION_CONTEXT_OPTIONS.maxDegreeOfParallelism;
3535
+ }
3536
+ function readDegreeOfParallelismOverride(storageKey) {
3537
+ try {
3538
+ if ("u" < typeof localStorage)
3539
+ return;
3540
+ const raw = localStorage.getItem(storageKey);
3541
+ if (raw === null || raw.trim() === "")
3542
+ return;
3543
+ const parsed = Number(raw);
3544
+ return isValidDegreeOfParallelism(parsed) ? parsed : undefined;
3545
+ } catch {
3546
+ return;
3547
+ }
3548
+ }
3507
3549
  function mergeSolutionContextOptions(options) {
3508
3550
  return {
3509
3551
  lockTimeoutMs: isValidTimeoutMs(options?.lockTimeoutMs) ? options.lockTimeoutMs : DEFAULT_SOLUTION_CONTEXT_OPTIONS.lockTimeoutMs,
3510
- fileOperationTimeoutMs: isValidTimeoutMs(options?.fileOperationTimeoutMs) ? options.fileOperationTimeoutMs : DEFAULT_SOLUTION_CONTEXT_OPTIONS.fileOperationTimeoutMs
3552
+ fileOperationTimeoutMs: isValidTimeoutMs(options?.fileOperationTimeoutMs) ? options.fileOperationTimeoutMs : DEFAULT_SOLUTION_CONTEXT_OPTIONS.fileOperationTimeoutMs,
3553
+ maxDegreeOfParallelism: isValidDegreeOfParallelism(options?.maxDegreeOfParallelism) ? options.maxDegreeOfParallelism : DEFAULT_SOLUTION_CONTEXT_OPTIONS.maxDegreeOfParallelism
3511
3554
  };
3512
3555
  }
3513
3556
 
@@ -4298,6 +4341,16 @@ function getRootFolder(solution) {
4298
4341
  }
4299
4342
 
4300
4343
  // ../../node_modules/@uipath/resource-builder-sdk/dist/solution/multi-file-solution-definition-provider.js
4344
+ function nowMs() {
4345
+ return globalThis.performance?.now?.() ?? Date.now();
4346
+ }
4347
+ function round1(ms) {
4348
+ return Math.round(10 * ms) / 10;
4349
+ }
4350
+ function cancellationError(signal) {
4351
+ return signal?.reason instanceof OperationCancelledException ? signal.reason : new OperationCancelledException;
4352
+ }
4353
+
4301
4354
  class MultiFileSolutionDefinitionProvider {
4302
4355
  get caseInsensitiveSerializer() {
4303
4356
  if (!this._caseInsensitiveSerializer)
@@ -4315,137 +4368,344 @@ class MultiFileSolutionDefinitionProvider {
4315
4368
  }
4316
4369
  async readAsync(context, cancellationToken) {
4317
4370
  this.logger.info("Reading multi-file solution definition for solution %s", context.path);
4318
- const solutionKey = this.getSolutionKey(context);
4319
- const fileStorageProvider = await this.getFileStorageProviderAsync(context, cancellationToken);
4320
- const resources = [];
4321
- const solutionFiles = [];
4322
- let hashes;
4323
- let paths;
4324
- const pathsByKind = this.getPathsByKind(context);
4325
- let tree;
4326
- pathsByKind.clear();
4371
+ const loadStarted = nowMs();
4372
+ let fileCount = 0;
4373
+ let listMs = 0;
4374
+ let readStarted = loadStarted;
4375
+ let readWallMs = 0;
4376
+ let readCompleted = false;
4377
+ let ioMs = 0;
4378
+ let maxFileIoMs = 0;
4379
+ let parseMs = 0;
4380
+ let hashMs = 0;
4381
+ let chars = 0;
4382
+ let loadedCount = 0;
4327
4383
  const parseErrors = [];
4328
4384
  const missingFiles = [];
4329
4385
  const invalidFiles = [];
4330
- context.items[SolutionContextKeys.PARSE_ERRORS_ITEM_KEY] = parseErrors;
4331
- if (!context.isReadOnly) {
4332
- hashes = this.getHashes(context);
4333
- paths = this.getPaths(context);
4334
- tree = this.getTree(context);
4335
- hashes.clear();
4336
- paths.clear();
4337
- tree.length = 0;
4338
- }
4339
- const resourceFiles = await fileStorageProvider.getFilesAsync(SolutionConstants.RESOURCE_FILES_FOLDER_NAME, "*.json", cancellationToken);
4340
- for (const resourceFile of resourceFiles)
4341
- try {
4342
- const stream = await fileStorageProvider.openFileAsync(resourceFile, cancellationToken);
4343
- const content = await this.streamToString(stream);
4344
- const wrapper = this.caseInsensitiveSerializer.deserialize(content);
4345
- if (wrapper?.resource) {
4346
- const rd = this.fromSerializable(wrapper.resource, solutionFiles);
4347
- const relPath = resourceFile.replace(/\\/g, "/");
4348
- const segments = relPath.split("/").filter((s) => s.length > 0);
4349
- const firstSegment = segments[0];
4350
- if (segments.length >= 3 && firstSegment && firstSegment.toLowerCase() === SolutionConstants.RESOURCE_FILES_FOLDER_NAME.toLowerCase()) {
4351
- const hasType = !!rd.type;
4352
- const folderSegmentCount = hasType ? segments.length - 3 : segments.length - 2;
4353
- if (folderSegmentCount < 1)
4354
- rd.folders = [
4355
- {
4356
- fullyQualifiedName: SolutionConstants.ROOT_FOLDER_NAME
4357
- }
4358
- ];
4359
- else {
4360
- const segmentsToUse = segments.slice(1, folderSegmentCount);
4361
- const folderFqn = segmentsToUse.join("/");
4362
- rd.folders = [
4363
- {
4364
- fullyQualifiedName: folderFqn
4365
- }
4366
- ];
4386
+ let metricsLogged = false;
4387
+ const logReadMetrics = (outcome) => {
4388
+ metricsLogged = true;
4389
+ const totalMs = nowMs() - loadStarted;
4390
+ const mergeMs = readCompleted ? nowMs() - readStarted - readWallMs : 0;
4391
+ const metrics = {
4392
+ outcome,
4393
+ path: context.path,
4394
+ fileCount,
4395
+ totalMs: round1(totalMs),
4396
+ listMs: round1(listMs),
4397
+ readWallMs: round1(readWallMs),
4398
+ ioMs: round1(ioMs),
4399
+ maxFileIoMs: round1(maxFileIoMs),
4400
+ parseMs: round1(parseMs),
4401
+ hashMs: round1(hashMs),
4402
+ mergeMs: round1(mergeMs),
4403
+ chars,
4404
+ degreeOfParallelism: resolveMaxDegreeOfParallelism(this.options),
4405
+ isReadOnly: context.isReadOnly,
4406
+ loaded: loadedCount,
4407
+ missing: missingFiles.length,
4408
+ invalid: invalidFiles.length,
4409
+ parseErrors: parseErrors.length
4410
+ };
4411
+ 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}`;
4412
+ if (outcome === "Success")
4413
+ this.logger.info(message, metrics);
4414
+ else
4415
+ this.logger.warn(message, metrics);
4416
+ };
4417
+ const readCore = async () => {
4418
+ const solutionKey = this.getSolutionKey(context);
4419
+ const fileStorageProvider = await this.getFileStorageProviderAsync(context, cancellationToken);
4420
+ const resources = [];
4421
+ const solutionFiles = [];
4422
+ let hashes;
4423
+ let paths;
4424
+ const pathsByKind = this.getPathsByKind(context);
4425
+ let tree;
4426
+ pathsByKind.clear();
4427
+ context.items[SolutionContextKeys.PARSE_ERRORS_ITEM_KEY] = parseErrors;
4428
+ if (!context.isReadOnly) {
4429
+ hashes = this.getHashes(context);
4430
+ paths = this.getPaths(context);
4431
+ tree = this.getTree(context);
4432
+ hashes.clear();
4433
+ paths.clear();
4434
+ tree.length = 0;
4435
+ }
4436
+ const listStarted = nowMs();
4437
+ const resourceFiles = await fileStorageProvider.getFilesAsync(SolutionConstants.RESOURCE_FILES_FOLDER_NAME, "*.json", cancellationToken);
4438
+ listMs = nowMs() - listStarted;
4439
+ fileCount = resourceFiles.length;
4440
+ readStarted = nowMs();
4441
+ const readResults = await this.readResourceFilesAsync(context, fileStorageProvider, resourceFiles, cancellationToken);
4442
+ readWallMs = nowMs() - readStarted;
4443
+ readCompleted = true;
4444
+ let fatal;
4445
+ let hasFatal = false;
4446
+ for (const result of readResults)
4447
+ if (result !== undefined) {
4448
+ if (result.timings) {
4449
+ ioMs += result.timings.ioMs;
4450
+ maxFileIoMs = Math.max(maxFileIoMs, result.timings.ioMs);
4451
+ parseMs += result.timings.parseMs;
4452
+ hashMs += result.timings.hashMs;
4453
+ chars += result.timings.chars;
4454
+ }
4455
+ if (result.fatal !== undefined) {
4456
+ if (!hasFatal) {
4457
+ fatal = result.fatal;
4458
+ hasFatal = true;
4367
4459
  }
4368
- } else
4369
- rd.folders = [
4370
- {
4371
- fullyQualifiedName: SolutionConstants.ROOT_FOLDER_NAME
4460
+ continue;
4461
+ }
4462
+ if (!hasFatal)
4463
+ switch (result.outcome) {
4464
+ case "loaded": {
4465
+ loadedCount++;
4466
+ const rd = result.resource;
4467
+ for (const file of result.files)
4468
+ if (!solutionFiles.some((sf) => sf.name === file.name && sf.kind === file.kind))
4469
+ solutionFiles.push(file);
4470
+ resources.push(rd);
4471
+ const resourceKey = rd.key;
4472
+ const normalizedFullPath = result.normalizedPath;
4473
+ if (!pathsByKind.has(rd.kind))
4474
+ pathsByKind.set(rd.kind, []);
4475
+ const kindPaths = pathsByKind.get(rd.kind);
4476
+ if (kindPaths)
4477
+ kindPaths.push({
4478
+ name: rd.name,
4479
+ key: rd.key,
4480
+ path: normalizedFullPath
4481
+ });
4482
+ if (!context.isReadOnly && hashes && paths) {
4483
+ paths.set(resourceKey, normalizedFullPath);
4484
+ hashes.set(resourceKey, result.hash);
4485
+ }
4486
+ break;
4372
4487
  }
4373
- ];
4374
- resources.push(rd);
4375
- const resourceKey = rd.key;
4376
- const normalizedFullPath = this.getNormalizedPath(resourceFile);
4377
- if (!pathsByKind.has(rd.kind))
4378
- pathsByKind.set(rd.kind, []);
4379
- const kindPaths = pathsByKind.get(rd.kind);
4380
- if (kindPaths)
4381
- kindPaths.push({
4382
- name: rd.name,
4383
- key: rd.key,
4384
- path: normalizedFullPath
4488
+ case "missing":
4489
+ missingFiles.push(result.file);
4490
+ break;
4491
+ case "invalid":
4492
+ invalidFiles.push(result.file);
4493
+ break;
4494
+ case "parseError":
4495
+ parseErrors.push(result.file);
4496
+ break;
4497
+ }
4498
+ }
4499
+ if (hasFatal) {
4500
+ logReadMetrics("Fatal");
4501
+ throw fatal;
4502
+ }
4503
+ if (missingFiles.length > 0) {
4504
+ logReadMetrics("MissingFiles");
4505
+ throw new BadRequestException(ErrorCodes.Resources.MissingFileDependencies, `Solution has missing files: ${missingFiles.join(", ")}`);
4506
+ }
4507
+ if (invalidFiles.length > 0) {
4508
+ logReadMetrics("InvalidFiles");
4509
+ throw new BadRequestException(ErrorCodes.Resources.InvalidResourceFile, `Solution has resource files with invalid content: ${invalidFiles.join(", ")}`);
4510
+ }
4511
+ if (parseErrors.length > 0) {
4512
+ logReadMetrics("ParseErrors");
4513
+ throw new Error(`Failed to read resource files for solution ${context.path}: ${parseErrors.join(", ")}`);
4514
+ }
4515
+ const folderMap = new Map;
4516
+ const rootFolder = this.buildRootFolder(solutionKey, SolutionConstants.ROOT_FOLDER_NAME);
4517
+ folderMap.set(rootFolder.fullyQualifiedName.toLowerCase(), rootFolder);
4518
+ for (const res of resources)
4519
+ for (const fdep of res.folders ?? []) {
4520
+ const fqnLower = fdep.fullyQualifiedName.toLowerCase();
4521
+ if (!folderMap.has(fqnLower)) {
4522
+ const folderKey = this.generateGuidFromString(fdep.fullyQualifiedName);
4523
+ const pathSegments = fdep.fullyQualifiedName.split("/").filter((s) => s.length > 0).map((p) => {
4524
+ if (p.toLowerCase() !== SolutionConstants.ROOT_FOLDER_NAME.toLowerCase())
4525
+ return this.generateGuidFromString(SolutionConstants.ROOT_FOLDER_NAME);
4526
+ return rootFolder.key;
4527
+ });
4528
+ const folderPath = pathSegments.join(".");
4529
+ folderMap.set(fqnLower, {
4530
+ key: folderKey,
4531
+ fullyQualifiedName: fdep.fullyQualifiedName,
4532
+ path: folderPath
4385
4533
  });
4386
- if (!context.isReadOnly && hashes && paths) {
4387
- paths.set(resourceKey, normalizedFullPath);
4388
- hashes.set(resourceKey, await this.computeHash(content));
4389
4534
  }
4390
- } else {
4391
- this.logger.error("Failed to read resource file %s for solution %s: invalid content", undefined, resourceFile, context.path);
4392
- invalidFiles.push(resourceFile);
4393
- }
4394
- } catch (ex) {
4395
- if (ex instanceof OperationCancelledException || cancellationToken?.aborted) {
4396
- this.logger.warn("Operation cancelled while reading file %s for solution %s", resourceFile, context.path);
4397
- throw ex instanceof OperationCancelledException ? ex : new OperationCancelledException;
4398
- }
4399
- if (ex instanceof TimeoutException)
4400
- throw new TimeoutException(`Reading resource file ${resourceFile} for solution ${context.path} timed out: ${ex.message}`, ex.timeoutMs);
4401
- if (isFileNotFoundError(ex)) {
4402
- this.logger.warn("Resource file listed but missing in storage for solution %s: %s", resourceFile, context.path);
4403
- missingFiles.push(resourceFile);
4404
- } else {
4405
- this.logger.error("Failed to read resource file %s for solution %s", ex, resourceFile, context.path);
4406
- parseErrors.push(resourceFile);
4407
4535
  }
4536
+ const solution = {
4537
+ key: solutionKey,
4538
+ docVersion: SolutionConstants.CURRENT_DOC_VERSION,
4539
+ folders: Array.from(folderMap.values()),
4540
+ resources,
4541
+ files: solutionFiles
4542
+ };
4543
+ await this.replaceDuplicateKeysAsync(solution, cancellationToken);
4544
+ if (!context.isReadOnly && tree) {
4545
+ const orderedResourceKeys = getTopologicalIdsOrdering(buildDependencyGraph(solution.resources));
4546
+ tree.push(...orderedResourceKeys);
4408
4547
  }
4409
- if (missingFiles.length > 0)
4410
- throw new BadRequestException(ErrorCodes.Resources.MissingFileDependencies, `Solution has missing files: ${missingFiles.join(", ")}`);
4411
- if (invalidFiles.length > 0)
4412
- throw new BadRequestException(ErrorCodes.Resources.InvalidResourceFile, `Solution has resource files with invalid content: ${invalidFiles.join(", ")}`);
4413
- if (parseErrors.length > 0)
4414
- throw new Error(`Failed to read resource files for solution ${context.path}: ${parseErrors.join(", ")}`);
4415
- const folderMap = new Map;
4416
- const rootFolder = this.buildRootFolder(solutionKey, SolutionConstants.ROOT_FOLDER_NAME);
4417
- folderMap.set(rootFolder.fullyQualifiedName.toLowerCase(), rootFolder);
4418
- for (const res of resources)
4419
- for (const fdep of res.folders ?? []) {
4420
- const fqnLower = fdep.fullyQualifiedName.toLowerCase();
4421
- if (!folderMap.has(fqnLower)) {
4422
- const folderKey = this.generateGuidFromString(fdep.fullyQualifiedName);
4423
- const pathSegments = fdep.fullyQualifiedName.split("/").filter((s) => s.length > 0).map((p) => {
4424
- if (p.toLowerCase() !== SolutionConstants.ROOT_FOLDER_NAME.toLowerCase())
4425
- return this.generateGuidFromString(SolutionConstants.ROOT_FOLDER_NAME);
4426
- return rootFolder.key;
4427
- });
4428
- const folderPath = pathSegments.join(".");
4429
- folderMap.set(fqnLower, {
4430
- key: folderKey,
4431
- fullyQualifiedName: fdep.fullyQualifiedName,
4432
- path: folderPath
4433
- });
4434
- }
4548
+ logReadMetrics("Success");
4549
+ return solution;
4550
+ };
4551
+ try {
4552
+ return await readCore();
4553
+ } catch (ex) {
4554
+ if (!metricsLogged)
4555
+ logReadMetrics("Fatal");
4556
+ throw ex;
4557
+ }
4558
+ }
4559
+ async readResourceFilesAsync(context, fileStorageProvider, resourceFiles, cancellationToken) {
4560
+ const results = Array.from({
4561
+ length: resourceFiles.length
4562
+ }, () => {
4563
+ return;
4564
+ });
4565
+ if (resourceFiles.length === 0)
4566
+ return results;
4567
+ const computeHash = !context.isReadOnly;
4568
+ const degreeOfParallelism = Math.min(resolveMaxDegreeOfParallelism(this.options), resourceFiles.length);
4569
+ let nextIndex = 0;
4570
+ let stopRequested = false;
4571
+ const runWorkerAsync = async () => {
4572
+ while (!stopRequested && nextIndex < resourceFiles.length) {
4573
+ const index = nextIndex++;
4574
+ const resourceFile = resourceFiles[index];
4575
+ const result = await this.readResourceFileAsync(context, fileStorageProvider, resourceFile, computeHash, cancellationToken);
4576
+ results[index] = result;
4577
+ if (result.fatal !== undefined)
4578
+ stopRequested = true;
4435
4579
  }
4436
- const solution = {
4437
- key: solutionKey,
4438
- docVersion: SolutionConstants.CURRENT_DOC_VERSION,
4439
- folders: Array.from(folderMap.values()),
4440
- resources,
4441
- files: solutionFiles
4442
4580
  };
4443
- await this.replaceDuplicateKeysAsync(solution, cancellationToken);
4444
- if (!context.isReadOnly && tree) {
4445
- const orderedResourceKeys = getTopologicalIdsOrdering(buildDependencyGraph(solution.resources));
4446
- tree.push(...orderedResourceKeys);
4581
+ const workers = [];
4582
+ for (let i = 0;i < degreeOfParallelism; i++)
4583
+ workers.push(runWorkerAsync());
4584
+ await Promise.all(workers);
4585
+ if (cancellationToken?.aborted && !results.some((result) => result?.fatal !== undefined))
4586
+ throw cancellationError(cancellationToken);
4587
+ return results;
4588
+ }
4589
+ async readResourceFileAsync(context, fileStorageProvider, resourceFile, computeHash, cancellationToken) {
4590
+ const started = nowMs();
4591
+ let ioMs;
4592
+ let content;
4593
+ const failureTimings = () => {
4594
+ const elapsed = nowMs() - started;
4595
+ return ioMs === undefined ? {
4596
+ ioMs: elapsed,
4597
+ parseMs: 0,
4598
+ hashMs: 0,
4599
+ chars: 0
4600
+ } : {
4601
+ ioMs,
4602
+ parseMs: elapsed - ioMs,
4603
+ hashMs: 0,
4604
+ chars: content?.length ?? 0
4605
+ };
4606
+ };
4607
+ try {
4608
+ if (cancellationToken?.aborted)
4609
+ throw cancellationError(cancellationToken);
4610
+ const stream = await fileStorageProvider.openFileAsync(resourceFile, cancellationToken);
4611
+ content = await this.streamToString(stream);
4612
+ ioMs = nowMs() - started;
4613
+ const parseStarted = nowMs();
4614
+ const wrapper = this.caseInsensitiveSerializer.deserialize(content);
4615
+ if (!wrapper?.resource) {
4616
+ this.logger.error("Failed to read resource file %s for solution %s: invalid content", undefined, resourceFile, context.path);
4617
+ return {
4618
+ file: resourceFile,
4619
+ outcome: "invalid",
4620
+ timings: failureTimings()
4621
+ };
4622
+ }
4623
+ const files = [];
4624
+ const rd = this.fromSerializable(wrapper.resource, files);
4625
+ this.applyFolders(rd, resourceFile);
4626
+ const parseMs = nowMs() - parseStarted;
4627
+ let hash;
4628
+ let hashMs = 0;
4629
+ if (computeHash) {
4630
+ const hashStarted = nowMs();
4631
+ hash = await this.computeHash(content);
4632
+ hashMs = nowMs() - hashStarted;
4633
+ }
4634
+ return {
4635
+ file: resourceFile,
4636
+ outcome: "loaded",
4637
+ resource: rd,
4638
+ files,
4639
+ normalizedPath: this.getNormalizedPath(resourceFile),
4640
+ hash,
4641
+ timings: {
4642
+ ioMs,
4643
+ parseMs,
4644
+ hashMs,
4645
+ chars: content.length
4646
+ }
4647
+ };
4648
+ } catch (ex) {
4649
+ if (ex instanceof OperationCancelledException || cancellationToken?.aborted) {
4650
+ this.logger.warn("Operation cancelled while reading file %s for solution %s", resourceFile, context.path);
4651
+ return {
4652
+ file: resourceFile,
4653
+ outcome: "fatal",
4654
+ fatal: ex instanceof OperationCancelledException ? ex : cancellationError(cancellationToken),
4655
+ timings: failureTimings()
4656
+ };
4657
+ }
4658
+ if (ex instanceof TimeoutException)
4659
+ return {
4660
+ file: resourceFile,
4661
+ outcome: "fatal",
4662
+ fatal: new TimeoutException(`Reading resource file ${resourceFile} for solution ${context.path} timed out: ${ex.message}`, ex.timeoutMs),
4663
+ timings: failureTimings()
4664
+ };
4665
+ if (isFileNotFoundError(ex)) {
4666
+ this.logger.warn("Resource file listed but missing in storage for solution %s: %s", resourceFile, context.path);
4667
+ return {
4668
+ file: resourceFile,
4669
+ outcome: "missing",
4670
+ timings: failureTimings()
4671
+ };
4672
+ }
4673
+ this.logger.error("Failed to read resource file %s for solution %s", ex, resourceFile, context.path);
4674
+ return {
4675
+ file: resourceFile,
4676
+ outcome: "parseError",
4677
+ timings: failureTimings()
4678
+ };
4447
4679
  }
4448
- return solution;
4680
+ }
4681
+ applyFolders(resource, resourceFile) {
4682
+ const relPath = resourceFile.replace(/\\/g, "/");
4683
+ const segments = relPath.split("/").filter((s) => s.length > 0);
4684
+ const firstSegment = segments[0];
4685
+ if (segments.length >= 3 && firstSegment && firstSegment.toLowerCase() === SolutionConstants.RESOURCE_FILES_FOLDER_NAME.toLowerCase()) {
4686
+ const hasType = !!resource.type;
4687
+ const folderSegmentCount = hasType ? segments.length - 3 : segments.length - 2;
4688
+ if (folderSegmentCount < 1)
4689
+ resource.folders = [
4690
+ {
4691
+ fullyQualifiedName: SolutionConstants.ROOT_FOLDER_NAME
4692
+ }
4693
+ ];
4694
+ else {
4695
+ const segmentsToUse = segments.slice(1, folderSegmentCount);
4696
+ const folderFqn = segmentsToUse.join("/");
4697
+ resource.folders = [
4698
+ {
4699
+ fullyQualifiedName: folderFqn
4700
+ }
4701
+ ];
4702
+ }
4703
+ } else
4704
+ resource.folders = [
4705
+ {
4706
+ fullyQualifiedName: SolutionConstants.ROOT_FOLDER_NAME
4707
+ }
4708
+ ];
4449
4709
  }
4450
4710
  async writeAsync(context, solution, cancellationToken) {
4451
4711
  if (context.isReadOnly)
@@ -4750,7 +5010,7 @@ class MultiFileSolutionDefinitionFactory {
4750
5010
  // ../../node_modules/@uipath/resource-builder-sdk/dist/embedded-files-default.js
4751
5011
  async function createDefaultEmbeddedFileReaderAsync() {
4752
5012
  const [{ EmbeddedFileReader }, { JsonSerializerFactory: JsonSerializerFactory2 }] = await Promise.all([
4753
- import("../embedded-file-reader-rf2g1kfj.js"),
5013
+ import("../embedded-file-reader-z4becc02.js"),
4754
5014
  import("../index-dqa169gp.js")
4755
5015
  ]);
4756
5016
  return new EmbeddedFileReader(new JsonSerializerFactory2);
@@ -4768,6 +5028,7 @@ var ServiceTokens = {
4768
5028
  SecretsProvider: "ISecretsProvider",
4769
5029
  FileStorageProviderFactory: "IFileStorageProviderFactory",
4770
5030
  IpRangeBypassSecretProvider: "IIpRangeBypassSecretProvider",
5031
+ FeatureFlagProvider: "IFeatureFlagProvider",
4771
5032
  SolutionDefinitionProvider: "ISolutionDefinitionProvider",
4772
5033
  SolutionDefinitionFactory: "ISolutionDefinitionFactory",
4773
5034
  ArtifactResourceSpecEnhancer: "IArtifactResourceSpecEnhancer",
@@ -5118,6 +5379,9 @@ function getBindingType(resourceKind, resourceType) {
5118
5379
  }
5119
5380
 
5120
5381
  // ../../node_modules/@uipath/resource-builder-sdk/dist/bindings/bindings-metadata-serializer.js
5382
+ var SUPPORTED_SCHEMA_MAJOR_VERSION = 2;
5383
+ var INT32_MAX_VALUE = 2147483647;
5384
+
5121
5385
  class BindingsMetadataSerializer {
5122
5386
  tryDeserialize(input) {
5123
5387
  if (!input)
@@ -5128,30 +5392,52 @@ class BindingsMetadataSerializer {
5128
5392
  let cleanInput = input.charCodeAt(0) === 65279 ? input.slice(1) : input;
5129
5393
  if (cleanInput.charCodeAt(cleanInput.length - 1) === 26)
5130
5394
  cleanInput = cleanInput.slice(0, -1);
5131
- const jsonObject = JSON.parse(cleanInput);
5395
+ const root = JSON.parse(cleanInput);
5396
+ if (root === null || typeof root != "object" || Array.isArray(root)) {
5397
+ this.logger.warn("Invalid bindings: content is not a JSON object");
5398
+ return {
5399
+ success: false
5400
+ };
5401
+ }
5402
+ const jsonObject = root;
5132
5403
  const versionValue = jsonObject[BindingsKnownKeys.Version];
5133
- if (!versionValue)
5404
+ if (typeof versionValue != "string") {
5405
+ this.logger.warn(`Invalid bindings: '${BindingsKnownKeys.Version}' is missing or not a string`);
5406
+ return {
5407
+ success: false
5408
+ };
5409
+ }
5410
+ const majorVersion = BindingsMetadataSerializer.tryParseMajorVersion(versionValue);
5411
+ if (majorVersion === undefined) {
5412
+ this.logger.warn(`Invalid bindings: '${BindingsKnownKeys.Version}' is not a valid version`);
5134
5413
  return {
5135
5414
  success: false
5136
5415
  };
5137
- const versionParts = versionValue.split(".").map(Number);
5138
- const majorVersion = versionParts[0];
5139
- if (majorVersion !== 2)
5140
- throw new Error("Unsupported bindings schema");
5416
+ }
5417
+ if (majorVersion !== SUPPORTED_SCHEMA_MAJOR_VERSION) {
5418
+ this.logger.warn(`Invalid bindings: unsupported schema major version ${majorVersion}`);
5419
+ return {
5420
+ success: false
5421
+ };
5422
+ }
5423
+ const resources = jsonObject[BindingsKnownKeys.Resources];
5424
+ if (!Array.isArray(resources)) {
5425
+ this.logger.warn(`Invalid bindings: '${BindingsKnownKeys.Resources}' is missing or not an array`);
5426
+ return {
5427
+ success: false
5428
+ };
5429
+ }
5141
5430
  const metadata = {
5142
5431
  version: versionValue,
5143
5432
  resources: []
5144
5433
  };
5145
- const resources = jsonObject[BindingsKnownKeys.Resources];
5146
- if (Array.isArray(resources))
5147
- for (const resourceElement of resources) {
5148
- if (resourceElement == null) {
5149
- this.logger.warn("Skipping null bindings resource element");
5150
- continue;
5151
- }
5152
- const resource = this.getBindingsResourceV2(resourceElement);
5153
- metadata.resources.push(resource);
5434
+ for (const resourceElement of resources) {
5435
+ if (resourceElement == null) {
5436
+ this.logger.warn("Skipping null bindings resource element");
5437
+ continue;
5154
5438
  }
5439
+ metadata.resources.push(this.getBindingsResourceV2(resourceElement));
5440
+ }
5155
5441
  this.linkDependencies(metadata.resources);
5156
5442
  return {
5157
5443
  success: true,
@@ -5164,6 +5450,22 @@ class BindingsMetadataSerializer {
5164
5450
  };
5165
5451
  }
5166
5452
  }
5453
+ static tryParseMajorVersion(value) {
5454
+ const parts = value.split(".");
5455
+ if (parts.length < 2 || parts.length > 4)
5456
+ return;
5457
+ let major;
5458
+ for (const [index, part] of parts.entries()) {
5459
+ if (!/^\s*[+-]?\d+\s*$/.test(part))
5460
+ return;
5461
+ const component = Number(part);
5462
+ if (component < 0 || component > INT32_MAX_VALUE)
5463
+ return;
5464
+ if (index === 0)
5465
+ major = component === 0 ? 0 : component;
5466
+ }
5467
+ return major;
5468
+ }
5167
5469
  linkDependencies(resources) {
5168
5470
  for (const resource of resources) {
5169
5471
  const propertyMeta = resource.metadata;
@@ -5350,8 +5652,7 @@ class BindingOverwritesHandler {
5350
5652
  [BindingsKnownKeys.FolderKeyPropertyName]: resourceOverwrite.folderKey ?? ""
5351
5653
  };
5352
5654
  else {
5353
- const isBusinessRule = bindingResource.binding.resourceType === models_BindingsResourceType.BusinessRule;
5354
- const folderPath = bindingResource.isArtefactResource && !isBusinessRule ? "" : resourceOverwrite.folderFullyQualifiedName ?? "";
5655
+ const folderPath = bindingResource.isArtefactResource && !bindingResource.isCodedApp ? "" : resourceOverwrite.folderFullyQualifiedName ?? "";
5355
5656
  overwrite = {
5356
5657
  [BindingsKnownKeys.FolderPathPropertyName]: folderPath,
5357
5658
  [BindingsKnownKeys.NamePropertyName]: resourceOverwrite.resourceName
@@ -5384,6 +5685,11 @@ function removeTimeTriggerBindings(bindings) {
5384
5685
  }
5385
5686
 
5386
5687
  // ../../node_modules/@uipath/resource-builder-sdk/dist/bindings/binding-overwrites-mapping-handler.js
5688
+ function isCodedAppType(type) {
5689
+ const normalized = type?.toLowerCase();
5690
+ return normalized === "coded" || normalized === "codedaction";
5691
+ }
5692
+
5387
5693
  class BindingOverwritesMappingRequestHandler {
5388
5694
  async handleAsync(request, cancellationToken) {
5389
5695
  const solutionBindings = request.bindings.resources.filter((x) => isSolutionResource(x.metadata));
@@ -5409,7 +5715,8 @@ class BindingOverwritesMappingRequestHandler {
5409
5715
  result.push({
5410
5716
  binding: bindingsResource,
5411
5717
  resourceKey: resource.key,
5412
- isArtefactResource: resource.projectKey != null
5718
+ isArtefactResource: resource.projectKey != null,
5719
+ isCodedApp: bindingsResource.resourceType === models_BindingsResourceType.App && isCodedAppType(resource.type)
5413
5720
  });
5414
5721
  } else {
5415
5722
  this.logger.error(`Solution does not contain binding resource of type ${models_BindingsResourceType[bindingsResource.resourceType]}.`);
@@ -6414,6 +6721,9 @@ class SolutionPublishLocationRequest {
6414
6721
  }
6415
6722
 
6416
6723
  class SolutionPublishLocationRequestV2 {
6724
+ constructor(permissionType) {
6725
+ this.permissionType = permissionType;
6726
+ }
6417
6727
  }
6418
6728
 
6419
6729
  class SettingsRequest {
@@ -6578,12 +6888,13 @@ function _ts_param3(paramIndex, decorator) {
6578
6888
  }
6579
6889
 
6580
6890
  class SolutionPublishLocationRequestV2Handler {
6581
- async handleAsync(_request, cancellationToken) {
6891
+ async handleAsync(request, cancellationToken) {
6582
6892
  try {
6583
6893
  const orchestratorClient = await this.orchestratorClientFactory.getClientAsync(cancellationToken);
6584
6894
  if (!orchestratorClient)
6585
6895
  throw new InvalidOperationException("Failed to create Orchestrator client");
6586
- return await orchestratorClient.getPublishLocationsAsync(cancellationToken);
6896
+ const { permissionType } = request;
6897
+ return permissionType == null ? await orchestratorClient.getPublishLocationsAsync(cancellationToken) : await orchestratorClient.getAccessiblePublishLocationsAsync(permissionType, cancellationToken);
6587
6898
  } catch (error) {
6588
6899
  this.logger.error("An unexpected error occurred while retrieving publish locations from Automation Solutions service.", error);
6589
6900
  throw error;
@@ -8613,7 +8924,7 @@ class GetResourceKeyForProjectRequestHandler {
8613
8924
  projectKey: request.projectKey,
8614
8925
  solution: request.context.path
8615
8926
  });
8616
- const cacheKey = `prk:${request.projectKey}`;
8927
+ const cacheKey = `prk:${request.context.path}:${request.projectKey}`;
8617
8928
  const cached = await this.cacheProvider.getAsync(cacheKey, cancellationToken);
8618
8929
  if (cached && typeof cached == "object" && "resourceKey" in cached) {
8619
8930
  this.logger.info("Cache hit for project {projectKey} resource key.", {
@@ -9441,7 +9752,11 @@ class UpdateResourceConfigurationCommandHandler {
9441
9752
  for (const prop of command.properties) {
9442
9753
  const propKey = prop.property.toLowerCase();
9443
9754
  const metadata = propertiesMetadata.get(propKey);
9444
- if (!(!metadata || isAnyReferenceProperty(metadata)) && metadata.readOnly !== true) {
9755
+ if (metadata && metadata.readOnly !== true) {
9756
+ if (isAnyReferenceProperty(metadata)) {
9757
+ updated = this.setSolutionReference(solution, resource, currentConfiguration, propertiesMetadata, metadata, prop.configuredValue) || updated;
9758
+ continue;
9759
+ }
9445
9760
  if (isSecretProperty(metadata)) {
9446
9761
  const secretValue = prop.configuredValue?.toString() || "";
9447
9762
  const existingKey = currentConfiguration[metadata.property]?.toString();
@@ -9485,6 +9800,38 @@ class UpdateResourceConfigurationCommandHandler {
9485
9800
  await command.context.saveChangesAsync(cancellationToken);
9486
9801
  return resourceConfiguration;
9487
9802
  }
9803
+ setSolutionReference(solution, resource, currentConfiguration, propertiesMetadata, metadata, configuredValue) {
9804
+ const referenceKind = metadata["referenceKind"];
9805
+ if (!isSingleReferenceProperty(metadata) || isFileReferenceProperty(metadata) || typeof referenceKind != "string" || !referenceKind)
9806
+ return false;
9807
+ const requested = asReference(configuredValue);
9808
+ const target = requested?.key ? solution.resources.find((r) => invariantEquals(r.key, requested.key) && invariantEquals(r.kind, referenceKind)) : undefined;
9809
+ if (!requested || !target || invariantEquals(target.key, resource.key))
9810
+ return false;
9811
+ const dependencies = resource.dependencies ??= [];
9812
+ const previous = asReference(currentConfiguration[metadata.property]);
9813
+ const previousKey = previous?.key;
9814
+ const isReferencedElsewhere = (key) => [
9815
+ ...propertiesMetadata.values()
9816
+ ].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)));
9817
+ if (previousKey && !invariantEquals(previousKey, target.key) && !isReferencedElsewhere(previousKey)) {
9818
+ const previousName = solution.resources.find((r) => invariantEquals(r.key, previousKey) && invariantEquals(r.kind, target.kind))?.name ?? previous?.name ?? "";
9819
+ resource.dependencies = dependencies.filter((d) => !(invariantEquals(d.kind, target.kind) && invariantEquals(d.name, previousName)));
9820
+ }
9821
+ if (!resource.dependencies.some((d) => invariantEquals(d.kind, target.kind) && invariantEquals(d.name, target.name)))
9822
+ resource.dependencies.push({
9823
+ kind: target.kind,
9824
+ name: target.name
9825
+ });
9826
+ currentConfiguration[metadata.property] = {
9827
+ name: target.name,
9828
+ key: target.key,
9829
+ folderKey: requested.folderKey ?? null,
9830
+ lookupStrategy: null,
9831
+ info: null
9832
+ };
9833
+ return true;
9834
+ }
9488
9835
  async updateReferencesName(solutionDefinition, resource, oldName, cancellationToken) {
9489
9836
  const resourcesToBeChanged = solutionDefinition.resources.filter((r) => r.key !== resource.key && (r.dependencies ?? []).some((d) => invariantEquals(d.kind, resource.kind) && invariantEquals(d.name, oldName)));
9490
9837
  if (resourcesToBeChanged.length === 0)
@@ -9771,6 +10118,28 @@ class UpsertResourceSecretCommandHandler {
9771
10118
  this.secretsProvider = secretsProvider;
9772
10119
  }
9773
10120
  }
10121
+ function asReference(value) {
10122
+ if (!value || typeof value != "object" || Array.isArray(value))
10123
+ return;
10124
+ const record = value;
10125
+ const pick = (name) => {
10126
+ const entry = Object.entries(record).find(([k]) => k.toLowerCase() === name.toLowerCase());
10127
+ return typeof entry?.[1] == "string" ? entry[1] : undefined;
10128
+ };
10129
+ return {
10130
+ key: pick("key"),
10131
+ name: pick("name"),
10132
+ folderKey: pick("folderKey")
10133
+ };
10134
+ }
10135
+ function asReferences(value) {
10136
+ if (Array.isArray(value))
10137
+ return value.map(asReference).filter((r) => r !== undefined);
10138
+ const single = asReference(value);
10139
+ return single ? [
10140
+ single
10141
+ ] : [];
10142
+ }
9774
10143
 
9775
10144
  // ../../node_modules/@uipath/resource-builder-sdk/dist/handlers/solution-handlers.js
9776
10145
  var DUPLICATE_NAMES_SUPPORTED_KINDS = new Set([
@@ -10742,6 +11111,9 @@ class ResourceCatalogApi extends HttpClient {
10742
11111
  // ../../node_modules/@uipath/resource-builder-sdk/dist/clients/resource-catalog/resource-catalog-client.factory.js
10743
11112
  var RESOURCE_CATALOG_SCOPE = "RCS.FolderAuthorization";
10744
11113
  var RESOURCE_CATALOG_SERVICE_NAME = "resourcecatalog";
11114
+ function trimTrailingSlashes(url) {
11115
+ return url.replace(/\/+$/, "");
11116
+ }
10745
11117
 
10746
11118
  class ResourceCatalogClientFactory {
10747
11119
  async getClientAsync(cancellationToken) {
@@ -10755,9 +11127,8 @@ class ResourceCatalogClientFactory {
10755
11127
  ], true, cancellationToken);
10756
11128
  const ipRangeBypassSecret = await this.ipRangeBypassSecretProvider?.getIpRangeBypassSecretAsync(cancellationToken);
10757
11129
  const gatewayIntegrationEnabled = this.resourceBuilderAccessProvider.isGatewayIntegrationEnabled();
10758
- const normalizedBaseUrl = baseUrl.endsWith("/") ? baseUrl : baseUrl + "/";
10759
11130
  const client = new ResourceCatalogApi({
10760
- baseUrl: normalizedBaseUrl,
11131
+ baseUrl: trimTrailingSlashes(baseUrl),
10761
11132
  securityWorker: (securityData) => {
10762
11133
  if (!securityData)
10763
11134
  return {};
@@ -10800,7 +11171,7 @@ class ResourceCatalogClientFactory {
10800
11171
  if (!accountKey)
10801
11172
  throw new Error("Unable to obtain account key");
10802
11173
  const client = new ResourceCatalogApi({
10803
- baseUrl,
11174
+ baseUrl: trimTrailingSlashes(baseUrl),
10804
11175
  securityWorker: (securityData) => {
10805
11176
  if (!securityData)
10806
11177
  return {};
@@ -13019,7 +13390,16 @@ class AutomationSolutionsClientProxy2 {
13019
13390
  // ../../node_modules/@uipath/resource-builder-sdk/dist/clients/orchestrator/orchestrator-client.js
13020
13391
  class OrchestratorClient {
13021
13392
  async getPublishLocationsAsync(cancellationToken) {
13022
- const url = `${this.options.baseUrl}api/v2/AutomationSolutions/publish_locations`;
13393
+ return this.getPublishLocationsFromAsync(this.publishLocationsUrl(), cancellationToken);
13394
+ }
13395
+ async getAccessiblePublishLocationsAsync(permissionType, cancellationToken) {
13396
+ const url = `${this.publishLocationsUrl()}?permissionType=${encodeURIComponent(permissionType)}`;
13397
+ return this.getPublishLocationsFromAsync(url, cancellationToken);
13398
+ }
13399
+ publishLocationsUrl() {
13400
+ return `${this.options.baseUrl}api/v2/AutomationSolutions/publish_locations`;
13401
+ }
13402
+ async getPublishLocationsFromAsync(url, cancellationToken) {
13023
13403
  const headers = OrchestratorClientFactory.buildHeaders(this.options.securityData);
13024
13404
  const response = await fetch(url, {
13025
13405
  method: "GET",
@@ -13709,7 +14089,7 @@ class ReconcileProjectsCommandHandler {
13709
14089
  } : {
13710
14090
  resourceKey: undefined
13711
14091
  };
13712
- await this.cacheProvider.setAsync(`prk:${projectKey}`, result, cancellationToken);
14092
+ await this.cacheProvider.setAsync(`prk:${context.path}:${projectKey}`, result, cancellationToken);
13713
14093
  }
13714
14094
  groupByProjectKey(artefactResources) {
13715
14095
  const map = new Map;
@@ -14583,6 +14963,11 @@ class ResourceBuilder {
14583
14963
  const request = new SolutionPublishLocationRequestV2;
14584
14964
  return this._mediator.sendAsync(request, cancellationToken);
14585
14965
  }
14966
+ async getAccessiblePublishLocationsAsync(permissionType, cancellationToken) {
14967
+ this.throwIfCancelled(cancellationToken);
14968
+ const request = new SolutionPublishLocationRequestV2(permissionType);
14969
+ return this._mediator.sendAsync(request, cancellationToken);
14970
+ }
14586
14971
  async getSettingsAsync(cancellationToken) {
14587
14972
  this.throwIfCancelled(cancellationToken);
14588
14973
  const request = new SettingsRequest;
@@ -15142,9 +15527,9 @@ class UnconfiguredEmbeddedFileReader {
15142
15527
  }
15143
15528
 
15144
15529
  // ../../node_modules/@uipath/resource-builder-sdk/dist/container.js
15145
- function createContainer(accessProvider, cacheProvider, secretsProvider, fileStorageProviderFactory, ipRangeBypassSecretProvider, solutionDefinitionProvider, solutionDefinitionFactory, artifactResourceSpecEnhancer, httpReaderOptions, loggerFactory, embeddedFileReader, solutionContextOptions) {
15530
+ function createContainer(accessProvider, cacheProvider, secretsProvider, fileStorageProviderFactory, ipRangeBypassSecretProvider, solutionDefinitionProvider, solutionDefinitionFactory, artifactResourceSpecEnhancer, httpReaderOptions, loggerFactory, embeddedFileReader, solutionContextOptions, featureFlagProvider) {
15146
15531
  const childContainer = import_tsyringe6.container.createChildContainer();
15147
- registerProviders(childContainer, accessProvider, cacheProvider, secretsProvider, fileStorageProviderFactory, ipRangeBypassSecretProvider, solutionDefinitionProvider, solutionDefinitionFactory, artifactResourceSpecEnhancer, httpReaderOptions, loggerFactory, solutionContextOptions);
15532
+ registerProviders(childContainer, accessProvider, cacheProvider, secretsProvider, fileStorageProviderFactory, ipRangeBypassSecretProvider, solutionDefinitionProvider, solutionDefinitionFactory, artifactResourceSpecEnhancer, httpReaderOptions, loggerFactory, solutionContextOptions, featureFlagProvider);
15148
15533
  registerServices(childContainer, embeddedFileReader);
15149
15534
  registerHandlers(childContainer);
15150
15535
  childContainer.register(ServiceTokens.Mediator, {
@@ -15168,11 +15553,15 @@ function registerProvider(diContainer, token, provider) {
15168
15553
  break;
15169
15554
  }
15170
15555
  }
15171
- function registerProviders(diContainer, accessProvider, cacheProvider, secretsProvider, fileStorageProviderFactory, ipRangeBypassSecretProvider, solutionDefinitionProvider, solutionDefinitionFactory, artifactResourceSpecEnhancer, httpReaderOptions, loggerFactory, solutionContextOptions) {
15556
+ function registerProviders(diContainer, accessProvider, cacheProvider, secretsProvider, fileStorageProviderFactory, ipRangeBypassSecretProvider, solutionDefinitionProvider, solutionDefinitionFactory, artifactResourceSpecEnhancer, httpReaderOptions, loggerFactory, solutionContextOptions, featureFlagProvider) {
15172
15557
  registerProvider(diContainer, ServiceTokens.AccessProvider, accessProvider);
15173
15558
  registerProvider(diContainer, ServiceTokens.CacheProvider, cacheProvider);
15174
15559
  registerProvider(diContainer, ServiceTokens.SecretsProvider, secretsProvider);
15175
15560
  registerProvider(diContainer, ServiceTokens.IpRangeBypassSecretProvider, ipRangeBypassSecretProvider);
15561
+ registerProvider(diContainer, ServiceTokens.FeatureFlagProvider, featureFlagProvider ?? {
15562
+ instance: new NullFeatureFlagProvider,
15563
+ lifetime: service_tokens_ServiceLifetime.Singleton
15564
+ });
15176
15565
  registerProvider(diContainer, ServiceTokens.FileStorageProviderFactory, fileStorageProviderFactory);
15177
15566
  registerProvider(diContainer, ServiceTokens.SolutionDefinitionProvider, solutionDefinitionProvider);
15178
15567
  registerProvider(diContainer, ServiceTokens.SolutionDefinitionFactory, solutionDefinitionFactory);
@@ -15899,6 +16288,11 @@ class ResourceBuilderConfiguration {
15899
16288
  this._ipRangeBypassSecretProviderLifetime = lifetime;
15900
16289
  return this;
15901
16290
  }
16291
+ addFeatureFlagProvider(provider, lifetime = service_tokens_ServiceLifetime.Scoped) {
16292
+ this._featureFlagProviderProvider = provider;
16293
+ this._featureFlagProviderLifetime = lifetime;
16294
+ return this;
16295
+ }
15902
16296
  addSolutionDefinitionProvider(provider, lifetime = service_tokens_ServiceLifetime.Scoped) {
15903
16297
  this._solutionDefinitionProviderProvider = provider;
15904
16298
  this._solutionDefinitionProviderLifetime = lifetime;
@@ -15952,6 +16346,11 @@ class ResourceBuilderConfiguration {
15952
16346
  instance: ipRangeBypassSecretProviderInstance,
15953
16347
  lifetime: this._ipRangeBypassSecretProviderLifetime
15954
16348
  };
16349
+ const featureFlagProviderInstance = this._featureFlagProviderProvider ? await resolveProvider(this._featureFlagProviderProvider) : new NullFeatureFlagProvider;
16350
+ const featureFlagProvider = {
16351
+ instance: featureFlagProviderInstance,
16352
+ lifetime: this._featureFlagProviderLifetime
16353
+ };
15955
16354
  const secretsProviderInstance = this._secretsProviderProvider ? await resolveProvider(this._secretsProviderProvider) : new NullSecretsProvider;
15956
16355
  const secretsProvider = {
15957
16356
  instance: secretsProviderInstance,
@@ -15995,7 +16394,7 @@ class ResourceBuilderConfiguration {
15995
16394
  lifetime: this._artifactResourceSpecEnhancerLifetime
15996
16395
  };
15997
16396
  const embeddedFileReader = await createDefaultEmbeddedFileReaderAsync();
15998
- const container3 = createContainer(accessProvider, cacheProvider, secretsProvider, fileStorageProviderFactory, ipRangeBypassSecretProvider, solutionDefinitionProvider, solutionDefinitionFactory, artifactResourceSpecEnhancer, this._httpReaderOptions, loggerFactory, embeddedFileReader, this._solutionContextOptions);
16397
+ const container3 = createContainer(accessProvider, cacheProvider, secretsProvider, fileStorageProviderFactory, ipRangeBypassSecretProvider, solutionDefinitionProvider, solutionDefinitionFactory, artifactResourceSpecEnhancer, this._httpReaderOptions, loggerFactory, embeddedFileReader, this._solutionContextOptions, featureFlagProvider);
15999
16398
  return new ResourceBuilderServices(container3);
16000
16399
  }
16001
16400
  async buildServices() {
@@ -16007,6 +16406,7 @@ class ResourceBuilderConfiguration {
16007
16406
  this._secretsProviderLifetime = service_tokens_ServiceLifetime.Scoped;
16008
16407
  this._fileStorageProviderFactoryLifetime = service_tokens_ServiceLifetime.Singleton;
16009
16408
  this._ipRangeBypassSecretProviderLifetime = service_tokens_ServiceLifetime.Scoped;
16409
+ this._featureFlagProviderLifetime = service_tokens_ServiceLifetime.Scoped;
16010
16410
  this._solutionDefinitionProviderLifetime = service_tokens_ServiceLifetime.Scoped;
16011
16411
  this._solutionDefinitionFactoryLifetime = service_tokens_ServiceLifetime.Scoped;
16012
16412
  this._artifactResourceSpecEnhancerLifetime = service_tokens_ServiceLifetime.Scoped;
@@ -16118,8 +16518,59 @@ var ARTEFACT_KIND_APP = "app";
16118
16518
  var ARTEFACT_KIND_APP_VERSION = "appversion";
16119
16519
  var ARTEFACT_KIND_PACKAGE = "package";
16120
16520
  var SPEC_KEY_PACKAGE = "package";
16521
+ var RESOURCE_FILES_FOLDER_NAME = "resources";
16522
+ var RESOURCE_FILE_PATTERN = "*.json";
16523
+ var FIX_SHARED_KEY = "Delete all but one file for each key, then retry.";
16524
+ var FIX_KEYLESS = 'Give each file without a key its own unique "key", then retry.';
16525
+
16526
+ class DuplicateKeysError extends Error {
16527
+ keys;
16528
+ constructor(keys) {
16529
+ super(`Duplicate resource keys: ${keys.map(describeKey).join(", ")}`);
16530
+ this.keys = keys;
16531
+ }
16532
+ }
16121
16533
 
16122
16534
  class ArtefactPairBindingProvider extends MultiFileSolutionDefinitionProvider {
16535
+ async readAsync(context, cancellationToken) {
16536
+ const [readError, solution] = await catchError(super.readAsync(context, cancellationToken));
16537
+ if (!readError)
16538
+ return solution;
16539
+ if (!(readError instanceof DuplicateKeysError))
16540
+ throw readError;
16541
+ const [describeError, message] = await catchError(this.describeDuplicateKeys(context, readError.keys, cancellationToken));
16542
+ throw describeError ? readError : new Error(message);
16543
+ }
16544
+ async replaceDuplicateKeysAsync(solution) {
16545
+ const keys = findDuplicateKeys(solution);
16546
+ if (keys.length > 0)
16547
+ throw new DuplicateKeysError(keys);
16548
+ }
16549
+ async describeDuplicateKeys(context, keys, cancellationToken) {
16550
+ const storage = await this.getFileStorageProviderAsync(context, cancellationToken);
16551
+ const files = await storage.getFilesAsync(RESOURCE_FILES_FOLDER_NAME, RESOURCE_FILE_PATTERN, cancellationToken);
16552
+ const pathsByKey = new Map(keys.map((key) => [key, []]));
16553
+ for (const file of [...files].sort()) {
16554
+ const [readError, key] = await catchError(this.readResourceKey(storage, file, cancellationToken));
16555
+ if (readError)
16556
+ continue;
16557
+ pathsByKey.get(key)?.push(toPortableRelativePath(file));
16558
+ }
16559
+ const lines = [...pathsByKey].map(([key, paths]) => `Resource key ${describeKey(key)} is used by: ${paths.join(", ")}`);
16560
+ const fixes = [
16561
+ keys.some((key) => !isKeyless(key)) && FIX_SHARED_KEY,
16562
+ keys.some(isKeyless) && FIX_KEYLESS
16563
+ ].filter(Boolean);
16564
+ return [...lines, ...fixes].join(`
16565
+ `);
16566
+ }
16567
+ async readResourceKey(storage, file, cancellationToken) {
16568
+ const content = await storage.readFileToEndAsync(file, cancellationToken);
16569
+ const wrapper = this.caseInsensitiveSerializer.deserialize(content);
16570
+ if (!wrapper?.resource)
16571
+ throw new Error(`No resource in ${file}`);
16572
+ return wrapper.resource.key;
16573
+ }
16123
16574
  async writeAsync(context, solution, cancellationToken) {
16124
16575
  patchAppPackageLinkage(solution);
16125
16576
  return super.writeAsync(context, solution, cancellationToken);
@@ -16131,6 +16582,22 @@ class ArtefactPairBindingSolutionDefinitionFactory extends MultiFileSolutionDefi
16131
16582
  return new ArtefactPairBindingProvider(this.fileStorageProviderFactory, this.jsonSerializerFactory, this.loggerFactory);
16132
16583
  }
16133
16584
  }
16585
+ function findDuplicateKeys(solution) {
16586
+ const counts = new Map;
16587
+ for (const resource of solution.resources ?? []) {
16588
+ const key = resource.key;
16589
+ counts.set(key, (counts.get(key) ?? 0) + 1);
16590
+ }
16591
+ return [...counts].filter(([, count]) => count > 1).map(([key]) => key);
16592
+ }
16593
+ function isKeyless(key) {
16594
+ return typeof key !== "string" || !key;
16595
+ }
16596
+ function describeKey(key) {
16597
+ if (typeof key === "string" && key)
16598
+ return key;
16599
+ return key === undefined ? "(missing)" : JSON.stringify(key);
16600
+ }
16134
16601
  function patchAppPackageLinkage(solution) {
16135
16602
  const resources = solution.resources ?? [];
16136
16603
  const projectKeys = new Set;
@@ -16624,7 +17091,7 @@ var package_default = {
16624
17091
  name: "@uipath/orchestrator-sdk",
16625
17092
  author: "UiPath",
16626
17093
  license: "SEE LICENSE IN LICENSE.txt",
16627
- version: "1.204.0",
17094
+ version: "1.205.0",
16628
17095
  repository: {
16629
17096
  type: "git",
16630
17097
  url: "https://github.com/UiPath/cli.git",
@@ -16676,77 +17143,6 @@ var package_default = {
16676
17143
  // ../orchestrator-sdk/src/user-agent.ts
16677
17144
  var SDK_USER_AGENT = getSdkUserAgentToken(package_default);
16678
17145
  installSdkUserAgentHeader(BaseAPI, SDK_USER_AGENT);
16679
- // ../orchestrator-sdk/generated/src/models/PrivilegeOfAccessType.ts
16680
- function PrivilegeOfAccessTypeFromJSON(json) {
16681
- return PrivilegeOfAccessTypeFromJSONTyped(json, false);
16682
- }
16683
- function PrivilegeOfAccessTypeFromJSONTyped(json, ignoreDiscriminator) {
16684
- if (json == null) {
16685
- return json;
16686
- }
16687
- return {
16688
- value: json["value"] == null ? undefined : json["value"],
16689
- type: json["type"] == null ? undefined : json["type"]
16690
- };
16691
- }
16692
-
16693
- // ../orchestrator-sdk/generated/src/models/PrivilegeGroupDto.ts
16694
- function PrivilegeGroupDtoFromJSON(json) {
16695
- return PrivilegeGroupDtoFromJSONTyped(json, false);
16696
- }
16697
- function PrivilegeGroupDtoFromJSONTyped(json, ignoreDiscriminator) {
16698
- if (json == null) {
16699
- return json;
16700
- }
16701
- return {
16702
- name: json["name"] == null ? undefined : json["name"],
16703
- id: json["id"] == null ? undefined : json["id"]
16704
- };
16705
- }
16706
-
16707
- // ../orchestrator-sdk/generated/src/models/InheritedPrivilegeOfAccessType.ts
16708
- function InheritedPrivilegeOfAccessTypeFromJSON(json) {
16709
- return InheritedPrivilegeOfAccessTypeFromJSONTyped(json, false);
16710
- }
16711
- function InheritedPrivilegeOfAccessTypeFromJSONTyped(json, ignoreDiscriminator) {
16712
- if (json == null) {
16713
- return json;
16714
- }
16715
- return {
16716
- groups: json["groups"] == null ? undefined : json["groups"].map(PrivilegeGroupDtoFromJSON),
16717
- type: json["type"] == null ? undefined : json["type"],
16718
- value: json["value"] == null ? undefined : json["value"]
16719
- };
16720
- }
16721
-
16722
- // ../orchestrator-sdk/generated/src/models/ExplicitPrivilegeOfAccessType.ts
16723
- function ExplicitPrivilegeOfAccessTypeFromJSON(json) {
16724
- return ExplicitPrivilegeOfAccessTypeFromJSONTyped(json, false);
16725
- }
16726
- function ExplicitPrivilegeOfAccessTypeFromJSONTyped(json, ignoreDiscriminator) {
16727
- if (json == null) {
16728
- return json;
16729
- }
16730
- return {
16731
- type: json["type"] == null ? undefined : json["type"],
16732
- value: json["value"] == null ? undefined : json["value"]
16733
- };
16734
- }
16735
-
16736
- // ../orchestrator-sdk/generated/src/models/AccessPrivilege.ts
16737
- function AccessPrivilegeFromJSON(json) {
16738
- return AccessPrivilegeFromJSONTyped(json, false);
16739
- }
16740
- function AccessPrivilegeFromJSONTyped(json, ignoreDiscriminator) {
16741
- if (json == null) {
16742
- return json;
16743
- }
16744
- return {
16745
- explicit: json["explicit"] == null ? undefined : ExplicitPrivilegeOfAccessTypeFromJSON(json["explicit"]),
16746
- inherited: json["inherited"] == null ? undefined : json["inherited"].map(InheritedPrivilegeOfAccessTypeFromJSON),
16747
- effective: json["effective"] == null ? undefined : PrivilegeOfAccessTypeFromJSON(json["effective"])
16748
- };
16749
- }
16750
17146
  // ../orchestrator-sdk/generated/src/models/AttendedRobotDto.ts
16751
17147
  function AttendedRobotDtoFromJSON(json) {
16752
17148
  return AttendedRobotDtoFromJSONTyped(json, false);
@@ -16776,127 +17172,29 @@ function AttendedRobotDtoToJSONTyped(value, ignoreDiscriminator = false) {
16776
17172
  RobotType: value["robotType"]
16777
17173
  };
16778
17174
  }
16779
- // ../orchestrator-sdk/generated/src/models/ExplicitPrivilegeOfBoolean.ts
16780
- function ExplicitPrivilegeOfBooleanFromJSON(json) {
16781
- return ExplicitPrivilegeOfBooleanFromJSONTyped(json, false);
17175
+ // ../orchestrator-sdk/generated/src/models/UpdatePolicyDto.ts
17176
+ function UpdatePolicyDtoFromJSON(json) {
17177
+ return UpdatePolicyDtoFromJSONTyped(json, false);
16782
17178
  }
16783
- function ExplicitPrivilegeOfBooleanFromJSONTyped(json, ignoreDiscriminator) {
17179
+ function UpdatePolicyDtoFromJSONTyped(json, ignoreDiscriminator) {
16784
17180
  if (json == null) {
16785
17181
  return json;
16786
17182
  }
16787
17183
  return {
16788
- type: json["type"] == null ? undefined : json["type"],
16789
- value: json["value"] == null ? undefined : json["value"]
17184
+ type: json["Type"] == null ? undefined : json["Type"],
17185
+ specificVersion: json["SpecificVersion"] == null ? undefined : json["SpecificVersion"]
16790
17186
  };
16791
17187
  }
16792
-
16793
- // ../orchestrator-sdk/generated/src/models/InheritedPrivilegeOfBoolean.ts
16794
- function InheritedPrivilegeOfBooleanFromJSON(json) {
16795
- return InheritedPrivilegeOfBooleanFromJSONTyped(json, false);
17188
+ function UpdatePolicyDtoToJSON(json) {
17189
+ return UpdatePolicyDtoToJSONTyped(json, false);
16796
17190
  }
16797
- function InheritedPrivilegeOfBooleanFromJSONTyped(json, ignoreDiscriminator) {
16798
- if (json == null) {
16799
- return json;
17191
+ function UpdatePolicyDtoToJSONTyped(value, ignoreDiscriminator = false) {
17192
+ if (value == null) {
17193
+ return value;
16800
17194
  }
16801
17195
  return {
16802
- groups: json["groups"] == null ? undefined : json["groups"].map(PrivilegeGroupDtoFromJSON),
16803
- type: json["type"] == null ? undefined : json["type"],
16804
- value: json["value"] == null ? undefined : json["value"]
16805
- };
16806
- }
16807
-
16808
- // ../orchestrator-sdk/generated/src/models/PrivilegeOfBoolean.ts
16809
- function PrivilegeOfBooleanFromJSON(json) {
16810
- return PrivilegeOfBooleanFromJSONTyped(json, false);
16811
- }
16812
- function PrivilegeOfBooleanFromJSONTyped(json, ignoreDiscriminator) {
16813
- if (json == null) {
16814
- return json;
16815
- }
16816
- return {
16817
- value: json["value"] == null ? undefined : json["value"],
16818
- type: json["type"] == null ? undefined : json["type"]
16819
- };
16820
- }
16821
-
16822
- // ../orchestrator-sdk/generated/src/models/BooleanPrivilege.ts
16823
- function BooleanPrivilegeFromJSON(json) {
16824
- return BooleanPrivilegeFromJSONTyped(json, false);
16825
- }
16826
- function BooleanPrivilegeFromJSONTyped(json, ignoreDiscriminator) {
16827
- if (json == null) {
16828
- return json;
16829
- }
16830
- return {
16831
- explicit: json["explicit"] == null ? undefined : ExplicitPrivilegeOfBooleanFromJSON(json["explicit"]),
16832
- inherited: json["inherited"] == null ? undefined : InheritedPrivilegeOfBooleanFromJSON(json["inherited"]),
16833
- effective: json["effective"] == null ? undefined : PrivilegeOfBooleanFromJSON(json["effective"])
16834
- };
16835
- }
16836
- // ../orchestrator-sdk/generated/src/models/RolePrivilegeDto.ts
16837
- function RolePrivilegeDtoFromJSON(json) {
16838
- return RolePrivilegeDtoFromJSONTyped(json, false);
16839
- }
16840
- function RolePrivilegeDtoFromJSONTyped(json, ignoreDiscriminator) {
16841
- if (json == null) {
16842
- return json;
16843
- }
16844
- return {
16845
- name: json["name"] == null ? undefined : json["name"],
16846
- id: json["id"] == null ? undefined : json["id"]
16847
- };
16848
- }
16849
-
16850
- // ../orchestrator-sdk/generated/src/models/ExplicitPrivilegeOfRolePrivilegeDto.ts
16851
- function ExplicitPrivilegeOfRolePrivilegeDtoFromJSON(json) {
16852
- return ExplicitPrivilegeOfRolePrivilegeDtoFromJSONTyped(json, false);
16853
- }
16854
- function ExplicitPrivilegeOfRolePrivilegeDtoFromJSONTyped(json, ignoreDiscriminator) {
16855
- if (json == null) {
16856
- return json;
16857
- }
16858
- return {
16859
- type: json["type"] == null ? undefined : json["type"],
16860
- value: json["value"] == null ? undefined : RolePrivilegeDtoFromJSON(json["value"])
16861
- };
16862
- }
16863
- // ../orchestrator-sdk/generated/src/models/UpdatePolicyDto.ts
16864
- function UpdatePolicyDtoFromJSON(json) {
16865
- return UpdatePolicyDtoFromJSONTyped(json, false);
16866
- }
16867
- function UpdatePolicyDtoFromJSONTyped(json, ignoreDiscriminator) {
16868
- if (json == null) {
16869
- return json;
16870
- }
16871
- return {
16872
- type: json["Type"] == null ? undefined : json["Type"],
16873
- specificVersion: json["SpecificVersion"] == null ? undefined : json["SpecificVersion"]
16874
- };
16875
- }
16876
- function UpdatePolicyDtoToJSON(json) {
16877
- return UpdatePolicyDtoToJSONTyped(json, false);
16878
- }
16879
- function UpdatePolicyDtoToJSONTyped(value, ignoreDiscriminator = false) {
16880
- if (value == null) {
16881
- return value;
16882
- }
16883
- return {
16884
- Type: value["type"],
16885
- SpecificVersion: value["specificVersion"]
16886
- };
16887
- }
16888
-
16889
- // ../orchestrator-sdk/generated/src/models/ExplicitPrivilegeOfUpdatePolicyDto.ts
16890
- function ExplicitPrivilegeOfUpdatePolicyDtoFromJSON(json) {
16891
- return ExplicitPrivilegeOfUpdatePolicyDtoFromJSONTyped(json, false);
16892
- }
16893
- function ExplicitPrivilegeOfUpdatePolicyDtoFromJSONTyped(json, ignoreDiscriminator) {
16894
- if (json == null) {
16895
- return json;
16896
- }
16897
- return {
16898
- type: json["type"] == null ? undefined : json["type"],
16899
- value: json["value"] == null ? undefined : UpdatePolicyDtoFromJSON(json["value"])
17196
+ Type: value["type"],
17197
+ SpecificVersion: value["specificVersion"]
16900
17198
  };
16901
17199
  }
16902
17200
  // ../orchestrator-sdk/generated/src/models/OrganizationUnitDto.ts
@@ -17048,7 +17346,6 @@ function UnattendedRobotDtoToJSONTyped(value, ignoreDiscriminator = false) {
17048
17346
  MachineMappingsCount: value["machineMappingsCount"]
17049
17347
  };
17050
17348
  }
17051
-
17052
17349
  // ../orchestrator-sdk/generated/src/models/UserDto.ts
17053
17350
  function UserDtoFromJSON(json) {
17054
17351
  return UserDtoFromJSONTyped(json, false);
@@ -17158,158 +17455,6 @@ function UserDtoToJSONTyped(value, ignoreDiscriminator = false) {
17158
17455
  Id: value["id"]
17159
17456
  };
17160
17457
  }
17161
- // ../orchestrator-sdk/generated/src/models/FolderDto.ts
17162
- function FolderDtoFromJSON(json) {
17163
- return FolderDtoFromJSONTyped(json, false);
17164
- }
17165
- function FolderDtoFromJSONTyped(json, ignoreDiscriminator) {
17166
- if (json == null) {
17167
- return json;
17168
- }
17169
- return {
17170
- key: json["Key"] == null ? undefined : json["Key"],
17171
- displayName: json["DisplayName"],
17172
- fullyQualifiedName: json["FullyQualifiedName"] == null ? undefined : json["FullyQualifiedName"],
17173
- description: json["Description"] == null ? undefined : json["Description"],
17174
- folderType: json["FolderType"] == null ? undefined : json["FolderType"],
17175
- isPersonal: json["IsPersonal"] == null ? undefined : json["IsPersonal"],
17176
- provisionType: json["ProvisionType"] == null ? undefined : json["ProvisionType"],
17177
- permissionModel: json["PermissionModel"] == null ? undefined : json["PermissionModel"],
17178
- parentId: json["ParentId"] == null ? undefined : json["ParentId"],
17179
- parentKey: json["ParentKey"] == null ? undefined : json["ParentKey"],
17180
- feedType: json["FeedType"] == null ? undefined : json["FeedType"],
17181
- id: json["Id"] == null ? undefined : json["Id"]
17182
- };
17183
- }
17184
-
17185
- // ../orchestrator-sdk/generated/src/models/UserPreferencesDto.ts
17186
- function UserPreferencesDtoFromJSON(json) {
17187
- return UserPreferencesDtoFromJSONTyped(json, false);
17188
- }
17189
- function UserPreferencesDtoFromJSONTyped(json, ignoreDiscriminator) {
17190
- if (json == null) {
17191
- return json;
17192
- }
17193
- return {
17194
- redesignPreference: json["redesignPreference"] == null ? undefined : json["redesignPreference"],
17195
- remoteControlPreference: json["remoteControlPreference"] == null ? undefined : json["remoteControlPreference"]
17196
- };
17197
- }
17198
-
17199
- // ../orchestrator-sdk/generated/src/models/ExtendedUserDto.ts
17200
- function ExtendedUserDtoFromJSON(json) {
17201
- return ExtendedUserDtoFromJSONTyped(json, false);
17202
- }
17203
- function ExtendedUserDtoFromJSONTyped(json, ignoreDiscriminator) {
17204
- if (json == null) {
17205
- return json;
17206
- }
17207
- return {
17208
- personalWorkspace: json["PersonalWorkspace"] == null ? undefined : FolderDtoFromJSON(json["PersonalWorkspace"]),
17209
- personalWorskpaceFeedId: json["PersonalWorskpaceFeedId"] == null ? undefined : json["PersonalWorskpaceFeedId"],
17210
- virtualFolderId: json["VirtualFolderId"] == null ? undefined : json["VirtualFolderId"],
17211
- virtualFolderPath: json["VirtualFolderPath"] == null ? undefined : json["VirtualFolderPath"],
17212
- preferences: json["Preferences"] == null ? undefined : UserPreferencesDtoFromJSON(json["Preferences"]),
17213
- name: json["Name"] == null ? undefined : json["Name"],
17214
- surname: json["Surname"] == null ? undefined : json["Surname"],
17215
- userName: json["UserName"] == null ? undefined : json["UserName"],
17216
- domain: json["Domain"] == null ? undefined : json["Domain"],
17217
- directoryIdentifier: json["DirectoryIdentifier"] == null ? undefined : json["DirectoryIdentifier"],
17218
- fullName: json["FullName"] == null ? undefined : json["FullName"],
17219
- emailAddress: json["EmailAddress"] == null ? undefined : json["EmailAddress"],
17220
- lastLoginTime: json["LastLoginTime"] == null ? undefined : new Date(json["LastLoginTime"]),
17221
- isActive: json["IsActive"] == null ? undefined : json["IsActive"],
17222
- creationTime: json["CreationTime"] == null ? undefined : new Date(json["CreationTime"]),
17223
- authenticationSource: json["AuthenticationSource"] == null ? undefined : json["AuthenticationSource"],
17224
- organizationUnits: json["OrganizationUnits"] == null ? undefined : json["OrganizationUnits"].map(OrganizationUnitDtoFromJSON),
17225
- password: json["Password"] == null ? undefined : json["Password"],
17226
- isExternalLicensed: json["IsExternalLicensed"] == null ? undefined : json["IsExternalLicensed"],
17227
- userRoles: json["UserRoles"] == null ? undefined : json["UserRoles"].map(UserRoleDtoFromJSON),
17228
- rolesList: json["RolesList"] == null ? undefined : json["RolesList"],
17229
- loginProviders: json["LoginProviders"] == null ? undefined : json["LoginProviders"],
17230
- tenantId: json["TenantId"] == null ? undefined : json["TenantId"],
17231
- tenancyName: json["TenancyName"] == null ? undefined : json["TenancyName"],
17232
- tenantDisplayName: json["TenantDisplayName"] == null ? undefined : json["TenantDisplayName"],
17233
- tenantKey: json["TenantKey"] == null ? undefined : json["TenantKey"],
17234
- type: json["Type"] == null ? undefined : json["Type"],
17235
- provisionType: json["ProvisionType"] == null ? undefined : json["ProvisionType"],
17236
- licenseType: json["LicenseType"] == null ? undefined : json["LicenseType"],
17237
- robotProvision: json["RobotProvision"] == null ? undefined : AttendedRobotDtoFromJSON(json["RobotProvision"]),
17238
- unattendedRobot: json["UnattendedRobot"] == null ? undefined : UnattendedRobotDtoFromJSON(json["UnattendedRobot"]),
17239
- notificationSubscription: json["NotificationSubscription"] == null ? undefined : UserNotificationSubscriptionFromJSON(json["NotificationSubscription"]),
17240
- key: json["Key"] == null ? undefined : json["Key"],
17241
- mayHaveUserSession: json["MayHaveUserSession"] == null ? undefined : json["MayHaveUserSession"],
17242
- mayHaveRobotSession: json["MayHaveRobotSession"] == null ? undefined : json["MayHaveRobotSession"],
17243
- mayHaveUnattendedSession: json["MayHaveUnattendedSession"] == null ? undefined : json["MayHaveUnattendedSession"],
17244
- mayHavePersonalWorkspace: json["MayHavePersonalWorkspace"] == null ? undefined : json["MayHavePersonalWorkspace"],
17245
- restrictToPersonalWorkspace: json["RestrictToPersonalWorkspace"] == null ? undefined : json["RestrictToPersonalWorkspace"],
17246
- updatePolicy: json["UpdatePolicy"] == null ? undefined : UpdatePolicyDtoFromJSON(json["UpdatePolicy"]),
17247
- accountId: json["AccountId"] == null ? undefined : json["AccountId"],
17248
- hasOnlyInheritedPrivileges: json["HasOnlyInheritedPrivileges"] == null ? undefined : json["HasOnlyInheritedPrivileges"],
17249
- explicitMayHaveUserSession: json["ExplicitMayHaveUserSession"] == null ? undefined : json["ExplicitMayHaveUserSession"],
17250
- explicitMayHaveRobotSession: json["ExplicitMayHaveRobotSession"] == null ? undefined : json["ExplicitMayHaveRobotSession"],
17251
- explicitMayHavePersonalWorkspace: json["ExplicitMayHavePersonalWorkspace"] == null ? undefined : json["ExplicitMayHavePersonalWorkspace"],
17252
- explicitRestrictToPersonalWorkspace: json["ExplicitRestrictToPersonalWorkspace"] == null ? undefined : json["ExplicitRestrictToPersonalWorkspace"],
17253
- lastModificationTime: json["LastModificationTime"] == null ? undefined : new Date(json["LastModificationTime"]),
17254
- lastModifierUserId: json["LastModifierUserId"] == null ? undefined : json["LastModifierUserId"],
17255
- creatorUserId: json["CreatorUserId"] == null ? undefined : json["CreatorUserId"],
17256
- id: json["Id"] == null ? undefined : json["Id"]
17257
- };
17258
- }
17259
- // ../orchestrator-sdk/generated/src/models/GetUsersModel.ts
17260
- function GetUsersModelToJSON(json) {
17261
- return GetUsersModelToJSONTyped(json, false);
17262
- }
17263
- function GetUsersModelToJSONTyped(value, ignoreDiscriminator = false) {
17264
- if (value == null) {
17265
- return value;
17266
- }
17267
- return {
17268
- permissions: value["permissions"],
17269
- folderKeys: value["folderKeys"],
17270
- token: value["token"]
17271
- };
17272
- }
17273
- // ../orchestrator-sdk/generated/src/models/InheritedPrivilegeOfRolePrivilegeDto.ts
17274
- function InheritedPrivilegeOfRolePrivilegeDtoFromJSON(json) {
17275
- return InheritedPrivilegeOfRolePrivilegeDtoFromJSONTyped(json, false);
17276
- }
17277
- function InheritedPrivilegeOfRolePrivilegeDtoFromJSONTyped(json, ignoreDiscriminator) {
17278
- if (json == null) {
17279
- return json;
17280
- }
17281
- return {
17282
- groups: json["groups"] == null ? undefined : json["groups"].map(PrivilegeGroupDtoFromJSON),
17283
- type: json["type"] == null ? undefined : json["type"],
17284
- value: json["value"] == null ? undefined : RolePrivilegeDtoFromJSON(json["value"])
17285
- };
17286
- }
17287
- // ../orchestrator-sdk/generated/src/models/InheritedPrivilegeOfUpdatePolicyDto.ts
17288
- function InheritedPrivilegeOfUpdatePolicyDtoFromJSON(json) {
17289
- return InheritedPrivilegeOfUpdatePolicyDtoFromJSONTyped(json, false);
17290
- }
17291
- function InheritedPrivilegeOfUpdatePolicyDtoFromJSONTyped(json, ignoreDiscriminator) {
17292
- if (json == null) {
17293
- return json;
17294
- }
17295
- return {
17296
- groups: json["groups"] == null ? undefined : json["groups"].map(PrivilegeGroupDtoFromJSON),
17297
- type: json["type"] == null ? undefined : json["type"],
17298
- value: json["value"] == null ? undefined : UpdatePolicyDtoFromJSON(json["value"])
17299
- };
17300
- }
17301
- // ../orchestrator-sdk/generated/src/models/ODataValueOfIDictionaryOfInt64Boolean.ts
17302
- function ODataValueOfIDictionaryOfInt64BooleanFromJSON(json) {
17303
- return ODataValueOfIDictionaryOfInt64BooleanFromJSONTyped(json, false);
17304
- }
17305
- function ODataValueOfIDictionaryOfInt64BooleanFromJSONTyped(json, ignoreDiscriminator) {
17306
- if (json == null) {
17307
- return json;
17308
- }
17309
- return {
17310
- value: json["value"] == null ? undefined : json["value"]
17311
- };
17312
- }
17313
17458
  // ../orchestrator-sdk/generated/src/models/ODataValueOfIEnumerableOfUserDto.ts
17314
17459
  function ODataValueOfIEnumerableOfUserDtoFromJSON(json) {
17315
17460
  return ODataValueOfIEnumerableOfUserDtoFromJSONTyped(json, false);
@@ -17322,39 +17467,6 @@ function ODataValueOfIEnumerableOfUserDtoFromJSONTyped(json, ignoreDiscriminator
17322
17467
  value: json["value"] == null ? undefined : json["value"].map(UserDtoFromJSON)
17323
17468
  };
17324
17469
  }
17325
- // ../orchestrator-sdk/generated/src/models/UserPermissionsExtended.ts
17326
- function UserPermissionsExtendedFromJSON(json) {
17327
- return UserPermissionsExtendedFromJSONTyped(json, false);
17328
- }
17329
- function UserPermissionsExtendedFromJSONTyped(json, ignoreDiscriminator) {
17330
- if (json == null) {
17331
- return json;
17332
- }
17333
- return {
17334
- userId: json["UserId"] == null ? undefined : json["UserId"],
17335
- folderKey: json["FolderKey"] == null ? undefined : json["FolderKey"],
17336
- folderName: json["FolderName"] == null ? undefined : json["FolderName"],
17337
- folderType: json["FolderType"] == null ? undefined : json["FolderType"],
17338
- folderPath: json["FolderPath"] == null ? undefined : json["FolderPath"],
17339
- folderCode: json["FolderCode"] == null ? undefined : json["FolderCode"],
17340
- isPersonalWorkspace: json["IsPersonalWorkspace"] == null ? undefined : json["IsPersonalWorkspace"],
17341
- path: json["Path"] == null ? undefined : json["Path"],
17342
- permissions: json["Permissions"] == null ? undefined : json["Permissions"]
17343
- };
17344
- }
17345
-
17346
- // ../orchestrator-sdk/generated/src/models/ODataValueOfIEnumerableOfUserPermissionsExtended.ts
17347
- function ODataValueOfIEnumerableOfUserPermissionsExtendedFromJSON(json) {
17348
- return ODataValueOfIEnumerableOfUserPermissionsExtendedFromJSONTyped(json, false);
17349
- }
17350
- function ODataValueOfIEnumerableOfUserPermissionsExtendedFromJSONTyped(json, ignoreDiscriminator) {
17351
- if (json == null) {
17352
- return json;
17353
- }
17354
- return {
17355
- value: json["value"] == null ? undefined : json["value"].map(UserPermissionsExtendedFromJSON)
17356
- };
17357
- }
17358
17470
  // ../orchestrator-sdk/generated/src/models/ODataValueOfInt64.ts
17359
17471
  function ODataValueOfInt64FromJSON(json) {
17360
17472
  return ODataValueOfInt64FromJSONTyped(json, false);
@@ -17367,72 +17479,6 @@ function ODataValueOfInt64FromJSONTyped(json, ignoreDiscriminator) {
17367
17479
  value: json["value"] == null ? undefined : json["value"]
17368
17480
  };
17369
17481
  }
17370
- // ../orchestrator-sdk/generated/src/models/PrivilegeOfRolePrivilegeDto.ts
17371
- function PrivilegeOfRolePrivilegeDtoFromJSON(json) {
17372
- return PrivilegeOfRolePrivilegeDtoFromJSONTyped(json, false);
17373
- }
17374
- function PrivilegeOfRolePrivilegeDtoFromJSONTyped(json, ignoreDiscriminator) {
17375
- if (json == null) {
17376
- return json;
17377
- }
17378
- return {
17379
- value: json["value"] == null ? undefined : RolePrivilegeDtoFromJSON(json["value"]),
17380
- type: json["type"] == null ? undefined : json["type"]
17381
- };
17382
- }
17383
- // ../orchestrator-sdk/generated/src/models/PrivilegeOfUpdatePolicyDto.ts
17384
- function PrivilegeOfUpdatePolicyDtoFromJSON(json) {
17385
- return PrivilegeOfUpdatePolicyDtoFromJSONTyped(json, false);
17386
- }
17387
- function PrivilegeOfUpdatePolicyDtoFromJSONTyped(json, ignoreDiscriminator) {
17388
- if (json == null) {
17389
- return json;
17390
- }
17391
- return {
17392
- value: json["value"] == null ? undefined : UpdatePolicyDtoFromJSON(json["value"]),
17393
- type: json["type"] == null ? undefined : json["type"]
17394
- };
17395
- }
17396
- // ../orchestrator-sdk/generated/src/models/RevokeExplicitPrivilegesRequest.ts
17397
- function RevokeExplicitPrivilegesRequestToJSON(json) {
17398
- return RevokeExplicitPrivilegesRequestToJSONTyped(json, false);
17399
- }
17400
- function RevokeExplicitPrivilegesRequestToJSONTyped(value, ignoreDiscriminator = false) {
17401
- if (value == null) {
17402
- return value;
17403
- }
17404
- return {
17405
- userIds: value["userIds"]
17406
- };
17407
- }
17408
- // ../orchestrator-sdk/generated/src/models/RolePrivileges.ts
17409
- function RolePrivilegesFromJSON(json) {
17410
- return RolePrivilegesFromJSONTyped(json, false);
17411
- }
17412
- function RolePrivilegesFromJSONTyped(json, ignoreDiscriminator) {
17413
- if (json == null) {
17414
- return json;
17415
- }
17416
- return {
17417
- explicit: json["explicit"] == null ? undefined : json["explicit"].map(ExplicitPrivilegeOfRolePrivilegeDtoFromJSON),
17418
- inherited: json["inherited"] == null ? undefined : json["inherited"].map(InheritedPrivilegeOfRolePrivilegeDtoFromJSON),
17419
- effective: json["effective"] == null ? undefined : json["effective"].map(PrivilegeOfRolePrivilegeDtoFromJSON)
17420
- };
17421
- }
17422
- // ../orchestrator-sdk/generated/src/models/UpdatePolicyPrivilege.ts
17423
- function UpdatePolicyPrivilegeFromJSON(json) {
17424
- return UpdatePolicyPrivilegeFromJSONTyped(json, false);
17425
- }
17426
- function UpdatePolicyPrivilegeFromJSONTyped(json, ignoreDiscriminator) {
17427
- if (json == null) {
17428
- return json;
17429
- }
17430
- return {
17431
- explicit: json["explicit"] == null ? undefined : ExplicitPrivilegeOfUpdatePolicyDtoFromJSON(json["explicit"]),
17432
- inherited: json["inherited"] == null ? undefined : json["inherited"].map(InheritedPrivilegeOfUpdatePolicyDtoFromJSON),
17433
- effective: json["effective"] == null ? undefined : PrivilegeOfUpdatePolicyDtoFromJSON(json["effective"])
17434
- };
17435
- }
17436
17482
  // ../orchestrator-sdk/generated/src/models/UserAssignRolesRequest.ts
17437
17483
  function UserAssignRolesRequestToJSON(json) {
17438
17484
  return UserAssignRolesRequestToJSONTyped(json, false);
@@ -17445,197 +17491,31 @@ function UserAssignRolesRequestToJSONTyped(value, ignoreDiscriminator = false) {
17445
17491
  roleIds: value["roleIds"]
17446
17492
  };
17447
17493
  }
17448
- // ../orchestrator-sdk/generated/src/models/UserChangeCultureRequest.ts
17449
- function UserChangeCultureRequestToJSON(json) {
17450
- return UserChangeCultureRequestToJSONTyped(json, false);
17451
- }
17452
- function UserChangeCultureRequestToJSONTyped(value, ignoreDiscriminator = false) {
17453
- if (value == null) {
17454
- return value;
17455
- }
17456
- return {
17457
- culture: value["culture"]
17458
- };
17459
- }
17460
- // ../orchestrator-sdk/generated/src/models/UserIdTypeDto.ts
17461
- function UserIdTypeDtoFromJSON(json) {
17462
- return UserIdTypeDtoFromJSONTyped(json, false);
17463
- }
17464
- function UserIdTypeDtoFromJSONTyped(json, ignoreDiscriminator) {
17465
- if (json == null) {
17466
- return json;
17494
+ // ../orchestrator-sdk/generated/src/apis/UsersApi.ts
17495
+ class UsersApi extends BaseAPI {
17496
+ async usersAssignRolesByIdRaw(requestParameters, initOverrides) {
17497
+ if (requestParameters["key"] == null) {
17498
+ throw new RequiredError("key", 'Required parameter "key" was null or undefined when calling usersAssignRolesById().');
17499
+ }
17500
+ const queryParameters = {};
17501
+ const headerParameters = {};
17502
+ headerParameters["Content-Type"] = "application/json;odata.metadata=minimal;odata.streaming=true";
17503
+ if (this.configuration && this.configuration.accessToken) {
17504
+ headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", []);
17505
+ }
17506
+ let urlPath = `/odata/Users({key})/UiPath.Server.Configuration.OData.AssignRoles`;
17507
+ urlPath = urlPath.replace(`{${"key"}}`, encodeURIComponent(String(requestParameters["key"])));
17508
+ const response = await this.request({
17509
+ path: urlPath,
17510
+ method: "POST",
17511
+ headers: headerParameters,
17512
+ query: queryParameters,
17513
+ body: UserAssignRolesRequestToJSON(requestParameters["body"])
17514
+ }, initOverrides);
17515
+ return new VoidApiResponse(response);
17467
17516
  }
17468
- return {
17469
- id: json["id"] == null ? undefined : json["id"],
17470
- type: json["type"] == null ? undefined : json["type"]
17471
- };
17472
- }
17473
-
17474
- // ../orchestrator-sdk/generated/src/models/UserIdTypeCollectionDto.ts
17475
- function UserIdTypeCollectionDtoFromJSON(json) {
17476
- return UserIdTypeCollectionDtoFromJSONTyped(json, false);
17477
- }
17478
- function UserIdTypeCollectionDtoFromJSONTyped(json, ignoreDiscriminator) {
17479
- if (json == null) {
17480
- return json;
17481
- }
17482
- return {
17483
- users: json["users"] == null ? undefined : json["users"].map(UserIdTypeDtoFromJSON),
17484
- token: json["token"] == null ? undefined : json["token"]
17485
- };
17486
- }
17487
- // ../orchestrator-sdk/generated/src/models/UserPermissionsCollection.ts
17488
- function UserPermissionsCollectionFromJSON(json) {
17489
- return UserPermissionsCollectionFromJSONTyped(json, false);
17490
- }
17491
- function UserPermissionsCollectionFromJSONTyped(json, ignoreDiscriminator) {
17492
- if (json == null) {
17493
- return json;
17494
- }
17495
- return {
17496
- userId: json["UserId"] == null ? undefined : json["UserId"],
17497
- permissions: json["Permissions"] == null ? undefined : json["Permissions"]
17498
- };
17499
- }
17500
- // ../orchestrator-sdk/generated/src/models/UserPrivileges.ts
17501
- function UserPrivilegesFromJSON(json) {
17502
- return UserPrivilegesFromJSONTyped(json, false);
17503
- }
17504
- function UserPrivilegesFromJSONTyped(json, ignoreDiscriminator) {
17505
- if (json == null) {
17506
- return json;
17507
- }
17508
- return {
17509
- userId: json["userId"] == null ? undefined : json["userId"],
17510
- roles: json["roles"] == null ? undefined : RolePrivilegesFromJSON(json["roles"]),
17511
- access: json["access"] == null ? undefined : AccessPrivilegeFromJSON(json["access"]),
17512
- attendedSession: json["attendedSession"] == null ? undefined : BooleanPrivilegeFromJSON(json["attendedSession"]),
17513
- personalWorkspace: json["personalWorkspace"] == null ? undefined : BooleanPrivilegeFromJSON(json["personalWorkspace"]),
17514
- updatePolicy: json["updatePolicy"] == null ? undefined : UpdatePolicyPrivilegeFromJSON(json["updatePolicy"])
17515
- };
17516
- }
17517
- // ../orchestrator-sdk/generated/src/models/UsersToggleRoleRequest.ts
17518
- function UsersToggleRoleRequestToJSON(json) {
17519
- return UsersToggleRoleRequestToJSONTyped(json, false);
17520
- }
17521
- function UsersToggleRoleRequestToJSONTyped(value, ignoreDiscriminator = false) {
17522
- if (value == null) {
17523
- return value;
17524
- }
17525
- return {
17526
- role: value["role"],
17527
- toggle: value["toggle"]
17528
- };
17529
- }
17530
- // ../orchestrator-sdk/generated/src/apis/UsersApi.ts
17531
- class UsersApi extends BaseAPI {
17532
- async usersAcquireLicenseRaw(initOverrides) {
17533
- const queryParameters = {};
17534
- const headerParameters = {};
17535
- if (this.configuration && this.configuration.accessToken) {
17536
- headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", []);
17537
- }
17538
- let urlPath = `/api/Users/AcquireLicense`;
17539
- const response = await this.request({
17540
- path: urlPath,
17541
- method: "POST",
17542
- headers: headerParameters,
17543
- query: queryParameters
17544
- }, initOverrides);
17545
- return new VoidApiResponse(response);
17546
- }
17547
- async usersAcquireLicense(initOverrides) {
17548
- await this.usersAcquireLicenseRaw(initOverrides);
17549
- }
17550
- async usersAssignRolesByIdRaw(requestParameters, initOverrides) {
17551
- if (requestParameters["key"] == null) {
17552
- throw new RequiredError("key", 'Required parameter "key" was null or undefined when calling usersAssignRolesById().');
17553
- }
17554
- const queryParameters = {};
17555
- const headerParameters = {};
17556
- headerParameters["Content-Type"] = "application/json;odata.metadata=minimal;odata.streaming=true";
17557
- if (this.configuration && this.configuration.accessToken) {
17558
- headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", []);
17559
- }
17560
- let urlPath = `/odata/Users({key})/UiPath.Server.Configuration.OData.AssignRoles`;
17561
- urlPath = urlPath.replace(`{${"key"}}`, encodeURIComponent(String(requestParameters["key"])));
17562
- const response = await this.request({
17563
- path: urlPath,
17564
- method: "POST",
17565
- headers: headerParameters,
17566
- query: queryParameters,
17567
- body: UserAssignRolesRequestToJSON(requestParameters["body"])
17568
- }, initOverrides);
17569
- return new VoidApiResponse(response);
17570
- }
17571
- async usersAssignRolesById(requestParameters, initOverrides) {
17572
- await this.usersAssignRolesByIdRaw(requestParameters, initOverrides);
17573
- }
17574
- async usersChangeCultureRaw(requestParameters, initOverrides) {
17575
- const queryParameters = {};
17576
- const headerParameters = {};
17577
- headerParameters["Content-Type"] = "application/json;odata.metadata=minimal;odata.streaming=true";
17578
- if (this.configuration && this.configuration.accessToken) {
17579
- headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", []);
17580
- }
17581
- let urlPath = `/odata/Users/UiPath.Server.Configuration.OData.ChangeCulture`;
17582
- const response = await this.request({
17583
- path: urlPath,
17584
- method: "POST",
17585
- headers: headerParameters,
17586
- query: queryParameters,
17587
- body: UserChangeCultureRequestToJSON(requestParameters["body"])
17588
- }, initOverrides);
17589
- return new VoidApiResponse(response);
17590
- }
17591
- async usersChangeCulture(requestParameters = {}, initOverrides) {
17592
- await this.usersChangeCultureRaw(requestParameters, initOverrides);
17593
- }
17594
- async usersChangeUserCultureByIdRaw(requestParameters, initOverrides) {
17595
- if (requestParameters["key"] == null) {
17596
- throw new RequiredError("key", 'Required parameter "key" was null or undefined when calling usersChangeUserCultureById().');
17597
- }
17598
- const queryParameters = {};
17599
- const headerParameters = {};
17600
- headerParameters["Content-Type"] = "application/json;odata.metadata=minimal;odata.streaming=true";
17601
- if (this.configuration && this.configuration.accessToken) {
17602
- headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", []);
17603
- }
17604
- let urlPath = `/odata/Users({key})/UiPath.Server.Configuration.OData.ChangeUserCulture`;
17605
- urlPath = urlPath.replace(`{${"key"}}`, encodeURIComponent(String(requestParameters["key"])));
17606
- const response = await this.request({
17607
- path: urlPath,
17608
- method: "POST",
17609
- headers: headerParameters,
17610
- query: queryParameters,
17611
- body: UserChangeCultureRequestToJSON(requestParameters["body"])
17612
- }, initOverrides);
17613
- return new VoidApiResponse(response);
17614
- }
17615
- async usersChangeUserCultureById(requestParameters, initOverrides) {
17616
- await this.usersChangeUserCultureByIdRaw(requestParameters, initOverrides);
17617
- }
17618
- async usersDeleteByIdRaw(requestParameters, initOverrides) {
17619
- if (requestParameters["key"] == null) {
17620
- throw new RequiredError("key", 'Required parameter "key" was null or undefined when calling usersDeleteById().');
17621
- }
17622
- const queryParameters = {};
17623
- const headerParameters = {};
17624
- if (this.configuration && this.configuration.accessToken) {
17625
- headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", []);
17626
- }
17627
- let urlPath = `/odata/Users({key})`;
17628
- urlPath = urlPath.replace(`{${"key"}}`, encodeURIComponent(String(requestParameters["key"])));
17629
- const response = await this.request({
17630
- path: urlPath,
17631
- method: "DELETE",
17632
- headers: headerParameters,
17633
- query: queryParameters
17634
- }, initOverrides);
17635
- return new VoidApiResponse(response);
17636
- }
17637
- async usersDeleteById(requestParameters, initOverrides) {
17638
- await this.usersDeleteByIdRaw(requestParameters, initOverrides);
17517
+ async usersAssignRolesById(requestParameters, initOverrides) {
17518
+ await this.usersAssignRolesByIdRaw(requestParameters, initOverrides);
17639
17519
  }
17640
17520
  async usersGetRaw(requestParameters, initOverrides) {
17641
17521
  const queryParameters = {};
@@ -17677,69 +17557,6 @@ class UsersApi extends BaseAPI {
17677
17557
  const response = await this.usersGetRaw(requestParameters, initOverrides);
17678
17558
  return await response.value();
17679
17559
  }
17680
- async usersGetAllPermissionsExtendedRaw(requestParameters, initOverrides) {
17681
- const queryParameters = {};
17682
- if (requestParameters["$select"] != null) {
17683
- queryParameters["$select"] = requestParameters["$select"];
17684
- }
17685
- if (requestParameters["$expand"] != null) {
17686
- queryParameters["$expand"] = requestParameters["$expand"];
17687
- }
17688
- if (requestParameters["$filter"] != null) {
17689
- queryParameters["$filter"] = requestParameters["$filter"];
17690
- }
17691
- if (requestParameters["$orderby"] != null) {
17692
- queryParameters["$orderby"] = requestParameters["$orderby"];
17693
- }
17694
- if (requestParameters["$count"] != null) {
17695
- queryParameters["$count"] = requestParameters["$count"];
17696
- }
17697
- const headerParameters = {};
17698
- if (this.configuration && this.configuration.accessToken) {
17699
- headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", []);
17700
- }
17701
- let urlPath = `/odata/Users/UiPath.Server.Configuration.OData.GetAllPermissionsExtended`;
17702
- const response = await this.request({
17703
- path: urlPath,
17704
- method: "GET",
17705
- headers: headerParameters,
17706
- query: queryParameters
17707
- }, initOverrides);
17708
- return new JSONApiResponse(response, (jsonValue) => ODataValueOfIEnumerableOfUserPermissionsExtendedFromJSON(jsonValue));
17709
- }
17710
- async usersGetAllPermissionsExtended(requestParameters = {}, initOverrides) {
17711
- const response = await this.usersGetAllPermissionsExtendedRaw(requestParameters, initOverrides);
17712
- return await response.value();
17713
- }
17714
- async usersGetByIdRaw(requestParameters, initOverrides) {
17715
- if (requestParameters["key"] == null) {
17716
- throw new RequiredError("key", 'Required parameter "key" was null or undefined when calling usersGetById().');
17717
- }
17718
- const queryParameters = {};
17719
- if (requestParameters["$select"] != null) {
17720
- queryParameters["$select"] = requestParameters["$select"];
17721
- }
17722
- if (requestParameters["$expand"] != null) {
17723
- queryParameters["$expand"] = requestParameters["$expand"];
17724
- }
17725
- const headerParameters = {};
17726
- if (this.configuration && this.configuration.accessToken) {
17727
- headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", []);
17728
- }
17729
- let urlPath = `/odata/Users({key})`;
17730
- urlPath = urlPath.replace(`{${"key"}}`, encodeURIComponent(String(requestParameters["key"])));
17731
- const response = await this.request({
17732
- path: urlPath,
17733
- method: "GET",
17734
- headers: headerParameters,
17735
- query: queryParameters
17736
- }, initOverrides);
17737
- return new JSONApiResponse(response, (jsonValue) => UserDtoFromJSON(jsonValue));
17738
- }
17739
- async usersGetById(requestParameters, initOverrides) {
17740
- const response = await this.usersGetByIdRaw(requestParameters, initOverrides);
17741
- return await response.value();
17742
- }
17743
17560
  async usersGetByKeyByIdentifierRaw(requestParameters, initOverrides) {
17744
17561
  if (requestParameters["identifier"] == null) {
17745
17562
  throw new RequiredError("identifier", 'Required parameter "identifier" was null or undefined when calling usersGetByKeyByIdentifier().');
@@ -17784,56 +17601,6 @@ class UsersApi extends BaseAPI {
17784
17601
  const response = await this.usersGetByKeyByIdentifierRaw(requestParameters, initOverrides);
17785
17602
  return await response.value();
17786
17603
  }
17787
- async usersGetCurrentPermissionsRaw(requestParameters, initOverrides) {
17788
- const queryParameters = {};
17789
- if (requestParameters["$select"] != null) {
17790
- queryParameters["$select"] = requestParameters["$select"];
17791
- }
17792
- if (requestParameters["$expand"] != null) {
17793
- queryParameters["$expand"] = requestParameters["$expand"];
17794
- }
17795
- const headerParameters = {};
17796
- if (this.configuration && this.configuration.accessToken) {
17797
- headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", []);
17798
- }
17799
- let urlPath = `/odata/Users/UiPath.Server.Configuration.OData.GetCurrentPermissions`;
17800
- const response = await this.request({
17801
- path: urlPath,
17802
- method: "GET",
17803
- headers: headerParameters,
17804
- query: queryParameters
17805
- }, initOverrides);
17806
- return new JSONApiResponse(response, (jsonValue) => UserPermissionsCollectionFromJSON(jsonValue));
17807
- }
17808
- async usersGetCurrentPermissions(requestParameters = {}, initOverrides) {
17809
- const response = await this.usersGetCurrentPermissionsRaw(requestParameters, initOverrides);
17810
- return await response.value();
17811
- }
17812
- async usersGetCurrentPermissionsExtendedRaw(requestParameters, initOverrides) {
17813
- const queryParameters = {};
17814
- if (requestParameters["$select"] != null) {
17815
- queryParameters["$select"] = requestParameters["$select"];
17816
- }
17817
- if (requestParameters["$expand"] != null) {
17818
- queryParameters["$expand"] = requestParameters["$expand"];
17819
- }
17820
- const headerParameters = {};
17821
- if (this.configuration && this.configuration.accessToken) {
17822
- headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", []);
17823
- }
17824
- let urlPath = `/odata/Users/UiPath.Server.Configuration.OData.GetCurrentPermissionsExtended`;
17825
- const response = await this.request({
17826
- path: urlPath,
17827
- method: "GET",
17828
- headers: headerParameters,
17829
- query: queryParameters
17830
- }, initOverrides);
17831
- return new JSONApiResponse(response, (jsonValue) => UserPermissionsExtendedFromJSON(jsonValue));
17832
- }
17833
- async usersGetCurrentPermissionsExtended(requestParameters = {}, initOverrides) {
17834
- const response = await this.usersGetCurrentPermissionsExtendedRaw(requestParameters, initOverrides);
17835
- return await response.value();
17836
- }
17837
17604
  async usersGetCurrentUserRaw(requestParameters, initOverrides) {
17838
17605
  const queryParameters = {};
17839
17606
  if (requestParameters["$select"] != null) {
@@ -17861,163 +17628,39 @@ class UsersApi extends BaseAPI {
17861
17628
  case 200:
17862
17629
  return await response.value();
17863
17630
  case 204:
17864
- return null;
17865
- default:
17866
- return await response.value();
17867
- }
17868
- }
17869
- async usersGetCurrentUserExtendedRaw(requestParameters, initOverrides) {
17870
- const queryParameters = {};
17871
- if (requestParameters["$select"] != null) {
17872
- queryParameters["$select"] = requestParameters["$select"];
17873
- }
17874
- if (requestParameters["$expand"] != null) {
17875
- queryParameters["$expand"] = requestParameters["$expand"];
17876
- }
17877
- const headerParameters = {};
17878
- if (this.configuration && this.configuration.accessToken) {
17879
- headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", []);
17880
- }
17881
- let urlPath = `/odata/Users/UiPath.Server.Configuration.OData.GetCurrentUserExtended`;
17882
- const response = await this.request({
17883
- path: urlPath,
17884
- method: "GET",
17885
- headers: headerParameters,
17886
- query: queryParameters
17887
- }, initOverrides);
17888
- return new JSONApiResponse(response, (jsonValue) => ExtendedUserDtoFromJSON(jsonValue));
17889
- }
17890
- async usersGetCurrentUserExtended(requestParameters = {}, initOverrides) {
17891
- const response = await this.usersGetCurrentUserExtendedRaw(requestParameters, initOverrides);
17892
- switch (response.raw.status) {
17893
- case 200:
17894
- return await response.value();
17895
- case 204:
17896
- return null;
17897
- default:
17898
- return await response.value();
17899
- }
17900
- }
17901
- async usersGetDirectoryPrivilegesRaw(requestParameters, initOverrides) {
17902
- const queryParameters = {};
17903
- if (requestParameters["identifier"] != null) {
17904
- queryParameters["identifier"] = requestParameters["identifier"];
17905
- }
17906
- if (requestParameters["type"] != null) {
17907
- queryParameters["type"] = requestParameters["type"];
17908
- }
17909
- const headerParameters = {};
17910
- if (this.configuration && this.configuration.accessToken) {
17911
- headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", []);
17912
- }
17913
- let urlPath = `/api/Users/GetDirectoryPrivileges`;
17914
- const response = await this.request({
17915
- path: urlPath,
17916
- method: "GET",
17917
- headers: headerParameters,
17918
- query: queryParameters
17919
- }, initOverrides);
17920
- return new JSONApiResponse(response, (jsonValue) => UserPrivilegesFromJSON(jsonValue));
17921
- }
17922
- async usersGetDirectoryPrivileges(requestParameters = {}, initOverrides) {
17923
- const response = await this.usersGetDirectoryPrivilegesRaw(requestParameters, initOverrides);
17924
- return await response.value();
17925
- }
17926
- async usersGetPrivilegesRaw(requestParameters, initOverrides) {
17927
- const queryParameters = {};
17928
- if (requestParameters["userId"] != null) {
17929
- queryParameters["userId"] = requestParameters["userId"];
17930
- }
17931
- const headerParameters = {};
17932
- if (this.configuration && this.configuration.accessToken) {
17933
- headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", []);
17934
- }
17935
- let urlPath = `/api/Users/GetPrivileges`;
17936
- const response = await this.request({
17937
- path: urlPath,
17938
- method: "GET",
17939
- headers: headerParameters,
17940
- query: queryParameters
17941
- }, initOverrides);
17942
- return new JSONApiResponse(response, (jsonValue) => UserPrivilegesFromJSON(jsonValue));
17943
- }
17944
- async usersGetPrivileges(requestParameters = {}, initOverrides) {
17945
- const response = await this.usersGetPrivilegesRaw(requestParameters, initOverrides);
17946
- return await response.value();
17947
- }
17948
- async usersGetUserIdByUserkeyRaw(requestParameters, initOverrides) {
17949
- if (requestParameters["userKey"] == null) {
17950
- throw new RequiredError("userKey", 'Required parameter "userKey" was null or undefined when calling usersGetUserIdByUserkey().');
17951
- }
17952
- const queryParameters = {};
17953
- if (requestParameters["$select"] != null) {
17954
- queryParameters["$select"] = requestParameters["$select"];
17955
- }
17956
- if (requestParameters["$expand"] != null) {
17957
- queryParameters["$expand"] = requestParameters["$expand"];
17958
- }
17959
- const headerParameters = {};
17960
- if (this.configuration && this.configuration.accessToken) {
17961
- headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", []);
17962
- }
17963
- let urlPath = `/odata/Users/UiPath.Server.Configuration.OData.GetUserId(userKey='{userKey}')`;
17964
- urlPath = urlPath.replace(`{${"userKey"}}`, encodeURIComponent(String(requestParameters["userKey"])));
17965
- const response = await this.request({
17966
- path: urlPath,
17967
- method: "GET",
17968
- headers: headerParameters,
17969
- query: queryParameters
17970
- }, initOverrides);
17971
- return new JSONApiResponse(response, (jsonValue) => ODataValueOfInt64FromJSON(jsonValue));
17972
- }
17973
- async usersGetUserIdByUserkey(requestParameters, initOverrides) {
17974
- const response = await this.usersGetUserIdByUserkeyRaw(requestParameters, initOverrides);
17975
- return await response.value();
17976
- }
17977
- async usersGetUsersWithPermissionsRaw(requestParameters, initOverrides) {
17978
- const queryParameters = {};
17979
- const headerParameters = {};
17980
- headerParameters["Content-Type"] = "application/json";
17981
- if (this.configuration && this.configuration.accessToken) {
17982
- headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", []);
17983
- }
17984
- let urlPath = `/api/Users/GetUsersWithPermissions`;
17985
- const response = await this.request({
17986
- path: urlPath,
17987
- method: "POST",
17988
- headers: headerParameters,
17989
- query: queryParameters,
17990
- body: GetUsersModelToJSON(requestParameters["body"])
17991
- }, initOverrides);
17992
- return new JSONApiResponse(response, (jsonValue) => UserIdTypeCollectionDtoFromJSON(jsonValue));
17993
- }
17994
- async usersGetUsersWithPermissions(requestParameters = {}, initOverrides) {
17995
- const response = await this.usersGetUsersWithPermissionsRaw(requestParameters, initOverrides);
17996
- return await response.value();
17631
+ return null;
17632
+ default:
17633
+ return await response.value();
17634
+ }
17997
17635
  }
17998
- async usersPatchByIdRaw(requestParameters, initOverrides) {
17999
- if (requestParameters["key"] == null) {
18000
- throw new RequiredError("key", 'Required parameter "key" was null or undefined when calling usersPatchById().');
17636
+ async usersGetUserIdByUserkeyRaw(requestParameters, initOverrides) {
17637
+ if (requestParameters["userKey"] == null) {
17638
+ throw new RequiredError("userKey", 'Required parameter "userKey" was null or undefined when calling usersGetUserIdByUserkey().');
18001
17639
  }
18002
17640
  const queryParameters = {};
17641
+ if (requestParameters["$select"] != null) {
17642
+ queryParameters["$select"] = requestParameters["$select"];
17643
+ }
17644
+ if (requestParameters["$expand"] != null) {
17645
+ queryParameters["$expand"] = requestParameters["$expand"];
17646
+ }
18003
17647
  const headerParameters = {};
18004
- headerParameters["Content-Type"] = "application/json;odata.metadata=minimal;odata.streaming=true";
18005
17648
  if (this.configuration && this.configuration.accessToken) {
18006
17649
  headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", []);
18007
17650
  }
18008
- let urlPath = `/odata/Users({key})`;
18009
- urlPath = urlPath.replace(`{${"key"}}`, encodeURIComponent(String(requestParameters["key"])));
17651
+ let urlPath = `/odata/Users/UiPath.Server.Configuration.OData.GetUserId(userKey='{userKey}')`;
17652
+ urlPath = urlPath.replace(`{${"userKey"}}`, encodeURIComponent(String(requestParameters["userKey"])));
18010
17653
  const response = await this.request({
18011
17654
  path: urlPath,
18012
- method: "PATCH",
17655
+ method: "GET",
18013
17656
  headers: headerParameters,
18014
- query: queryParameters,
18015
- body: UserDtoToJSON(requestParameters["body"])
17657
+ query: queryParameters
18016
17658
  }, initOverrides);
18017
- return new VoidApiResponse(response);
17659
+ return new JSONApiResponse(response, (jsonValue) => ODataValueOfInt64FromJSON(jsonValue));
18018
17660
  }
18019
- async usersPatchById(requestParameters, initOverrides) {
18020
- await this.usersPatchByIdRaw(requestParameters, initOverrides);
17661
+ async usersGetUserIdByUserkey(requestParameters, initOverrides) {
17662
+ const response = await this.usersGetUserIdByUserkeyRaw(requestParameters, initOverrides);
17663
+ return await response.value();
18021
17664
  }
18022
17665
  async usersPostRaw(requestParameters, initOverrides) {
18023
17666
  const queryParameters = {};
@@ -18064,89 +17707,37 @@ class UsersApi extends BaseAPI {
18064
17707
  async usersPutById(requestParameters, initOverrides) {
18065
17708
  await this.usersPutByIdRaw(requestParameters, initOverrides);
18066
17709
  }
18067
- async usersRevokeExplicitPrivilegesRaw(requestParameters, initOverrides) {
18068
- const queryParameters = {};
18069
- const headerParameters = {};
18070
- headerParameters["Content-Type"] = "application/json";
18071
- if (this.configuration && this.configuration.accessToken) {
18072
- headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", []);
18073
- }
18074
- let urlPath = `/api/Users/RevokeExplicitPrivileges`;
18075
- const response = await this.request({
18076
- path: urlPath,
18077
- method: "POST",
18078
- headers: headerParameters,
18079
- query: queryParameters,
18080
- body: RevokeExplicitPrivilegesRequestToJSON(requestParameters["body"])
18081
- }, initOverrides);
18082
- return new VoidApiResponse(response);
18083
- }
18084
- async usersRevokeExplicitPrivileges(requestParameters = {}, initOverrides) {
18085
- await this.usersRevokeExplicitPrivilegesRaw(requestParameters, initOverrides);
18086
- }
18087
- async usersToggleRoleByIdRaw(requestParameters, initOverrides) {
18088
- if (requestParameters["key"] == null) {
18089
- throw new RequiredError("key", 'Required parameter "key" was null or undefined when calling usersToggleRoleById().');
18090
- }
18091
- const queryParameters = {};
18092
- const headerParameters = {};
18093
- headerParameters["Content-Type"] = "application/json;odata.metadata=minimal;odata.streaming=true";
18094
- if (this.configuration && this.configuration.accessToken) {
18095
- headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", []);
18096
- }
18097
- let urlPath = `/odata/Users({key})/UiPath.Server.Configuration.OData.ToggleRole`;
18098
- urlPath = urlPath.replace(`{${"key"}}`, encodeURIComponent(String(requestParameters["key"])));
18099
- const response = await this.request({
18100
- path: urlPath,
18101
- method: "POST",
18102
- headers: headerParameters,
18103
- query: queryParameters,
18104
- body: UsersToggleRoleRequestToJSON(requestParameters["body"])
18105
- }, initOverrides);
18106
- return new VoidApiResponse(response);
18107
- }
18108
- async usersToggleRoleById(requestParameters, initOverrides) {
18109
- await this.usersToggleRoleByIdRaw(requestParameters, initOverrides);
18110
- }
18111
- async usersValidateByUseridsRaw(requestParameters, initOverrides) {
18112
- if (requestParameters["userIds"] == null) {
18113
- throw new RequiredError("userIds", 'Required parameter "userIds" was null or undefined when calling usersValidateByUserids().');
18114
- }
18115
- const queryParameters = {};
18116
- if (requestParameters["$select"] != null) {
18117
- queryParameters["$select"] = requestParameters["$select"];
18118
- }
18119
- if (requestParameters["$expand"] != null) {
18120
- queryParameters["$expand"] = requestParameters["$expand"];
18121
- }
18122
- if (requestParameters["$filter"] != null) {
18123
- queryParameters["$filter"] = requestParameters["$filter"];
18124
- }
18125
- if (requestParameters["$orderby"] != null) {
18126
- queryParameters["$orderby"] = requestParameters["$orderby"];
18127
- }
18128
- if (requestParameters["$count"] != null) {
18129
- queryParameters["$count"] = requestParameters["$count"];
18130
- }
18131
- const headerParameters = {};
18132
- if (this.configuration && this.configuration.accessToken) {
18133
- headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", []);
18134
- }
18135
- let urlPath = `/odata/Users/UiPath.Server.Configuration.OData.Validate(userIds=[{userIds}])`;
18136
- urlPath = urlPath.replace(`{${"userIds"}}`, encodeURIComponent(String(requestParameters["userIds"])));
18137
- const response = await this.request({
18138
- path: urlPath,
18139
- method: "GET",
18140
- headers: headerParameters,
18141
- query: queryParameters
18142
- }, initOverrides);
18143
- return new JSONApiResponse(response, (jsonValue) => ODataValueOfIDictionaryOfInt64BooleanFromJSON(jsonValue));
18144
- }
18145
- async usersValidateByUserids(requestParameters, initOverrides) {
18146
- const response = await this.usersValidateByUseridsRaw(requestParameters, initOverrides);
18147
- return await response.value();
17710
+ }
17711
+ // ../common/src/session-kind.ts
17712
+ var SESSION_KIND_KEY = Symbol.for("@uipath/common/SessionKind");
17713
+ function attachSessionKind(carrier, kind) {
17714
+ if (!kind)
17715
+ return carrier;
17716
+ Object.defineProperty(carrier, SESSION_KIND_KEY, {
17717
+ value: {
17718
+ __brand: "SessionKind",
17719
+ type: kind.type,
17720
+ ...kind.clientId ? { clientId: kind.clientId } : {},
17721
+ ...kind.applicationSubtype ? { applicationSubtype: kind.applicationSubtype } : {}
17722
+ },
17723
+ enumerable: false,
17724
+ configurable: true
17725
+ });
17726
+ const clone = carrier.clone;
17727
+ if (typeof clone === "function") {
17728
+ Object.defineProperty(carrier, "clone", {
17729
+ value: function stampedClone(...args) {
17730
+ const copy = clone.apply(this, args);
17731
+ return typeof copy === "object" && copy !== null ? attachSessionKind(copy, kind) : copy;
17732
+ },
17733
+ enumerable: false,
17734
+ configurable: true,
17735
+ writable: true
17736
+ });
18148
17737
  }
17738
+ return carrier;
18149
17739
  }
17740
+
18150
17741
  // ../orchestrator-sdk/src/client-factory.ts
18151
17742
  async function createOrchestratorConfig(options) {
18152
17743
  const ctx = await getAuthContext({
@@ -18169,9 +17760,15 @@ async function createOrchestratorConfig(options) {
18169
17760
  }
18170
17761
  return new Configuration({
18171
17762
  basePath: orchestratorBasePath,
18172
- headers
17763
+ headers,
17764
+ fetchApi: sessionKindStampingFetch(ctx.identity ?? resolveSessionIdentity(ctx.accessToken))
18173
17765
  });
18174
17766
  }
17767
+ function sessionKindStampingFetch(kind) {
17768
+ if (!kind)
17769
+ return;
17770
+ return async (...args) => attachSessionKind(await fetch(...args), kind);
17771
+ }
18175
17772
  async function createApiClient(ApiClass, options) {
18176
17773
  const config = await createOrchestratorConfig(options);
18177
17774
  return new ApiClass(config);
@@ -18414,6 +18011,108 @@ async function createProjectInSolutionBuilder(solutionDir, projectId, projectNam
18414
18011
  await catchError(solutionBuilder.disposeAsync());
18415
18012
  return createError;
18416
18013
  }
18014
+ // src/resources/services/catalog-lookup-failure.ts
18015
+ var NO_CLIENT_MESSAGE = "Unable to create Resource Catalog client";
18016
+ function classifyCatalogFailure(error) {
18017
+ const message = error instanceof Error ? error.message : String(error);
18018
+ if (message.includes(NO_CLIENT_MESSAGE)) {
18019
+ return { message, kind: "no_session" };
18020
+ }
18021
+ const match = /\bHTTP (\d{3})\b/.exec(message);
18022
+ const status = match ? Number(match[1]) : undefined;
18023
+ if (status === 401 || status === 403) {
18024
+ return { message, kind: "refused", status };
18025
+ }
18026
+ return { message, kind: "failed", ...status ? { status } : {} };
18027
+ }
18028
+ function stopsCatalogLookups(failure) {
18029
+ return failure.kind !== "failed";
18030
+ }
18031
+ function describeBindings(bindings) {
18032
+ return bindings.map((b) => `${b.kind} "${b.name}"`).join(", ");
18033
+ }
18034
+ function describeCause(failure) {
18035
+ switch (failure.kind) {
18036
+ case "no_session":
18037
+ return "There is no login, so the Resource Catalog could not be searched";
18038
+ case "refused":
18039
+ return `The Resource Catalog refused this login (${failure.message})`;
18040
+ default:
18041
+ return `A Resource Catalog call failed (${failure.message})`;
18042
+ }
18043
+ }
18044
+ function classify(failure) {
18045
+ const refreshAndCommit = "or run 'uip solution resources refresh' under a login the Resource Catalog accepts and commit the solution's resources. The resources already in the solution are used as they are.";
18046
+ if (failure.kind === "no_session") {
18047
+ return {
18048
+ errorCode: "authentication_required",
18049
+ retry: "RetryWillNotFix",
18050
+ instructions: `Run 'uip login', then re-run; ${refreshAndCommit}`
18051
+ };
18052
+ }
18053
+ if (failure.kind === "refused") {
18054
+ return {
18055
+ errorCode: "permission_denied",
18056
+ retry: "RetryWillNotFix",
18057
+ instructions: `Use a login the Resource Catalog accepts (a user login: 'uip login'), ${refreshAndCommit}`
18058
+ };
18059
+ }
18060
+ const status = failure.status;
18061
+ if (status === 429) {
18062
+ return {
18063
+ errorCode: "rate_limited",
18064
+ retry: "RetryLater",
18065
+ instructions: `Wait, then re-run; ${refreshAndCommit}`
18066
+ };
18067
+ }
18068
+ if (status !== undefined && status >= 500) {
18069
+ return {
18070
+ errorCode: "server_error",
18071
+ retry: "RetryLater",
18072
+ instructions: `Retry once the Resource Catalog is back; ${refreshAndCommit}`
18073
+ };
18074
+ }
18075
+ if (status !== undefined && status >= 400) {
18076
+ return {
18077
+ errorCode: "unknown_error",
18078
+ retry: "RetryWillNotFix",
18079
+ instructions: `The Resource Catalog rejected the lookup for these bindings, so a retry gets the same answer. Check them in the project's bindings, ${refreshAndCommit}`
18080
+ };
18081
+ }
18082
+ return {
18083
+ errorCode: "unknown_error",
18084
+ retry: "RetryLater",
18085
+ instructions: `Retry; if it keeps failing, ${refreshAndCommit}`
18086
+ };
18087
+ }
18088
+ function catalogLookupWarning(failure, kept, unresolved) {
18089
+ const parts = [
18090
+ `${describeCause(failure)}, so ${kept + unresolved.length} binding(s) were not checked against the cloud.`
18091
+ ];
18092
+ if (kept > 0) {
18093
+ parts.push(`${kept} already in the solution were kept as they are.`);
18094
+ }
18095
+ if (unresolved.length > 0) {
18096
+ parts.push(`Not added to the solution: ${describeBindings(unresolved)}.`);
18097
+ }
18098
+ return parts.join(" ");
18099
+ }
18100
+
18101
+ class CatalogLookupError extends Error {
18102
+ errorCode;
18103
+ retry;
18104
+ instructions;
18105
+ unresolved;
18106
+ constructor(failure, unresolved) {
18107
+ super(`${describeCause(failure)}, so these bindings could not be resolved and are not in the solution: ${describeBindings(unresolved)}.`);
18108
+ this.name = "CatalogLookupError";
18109
+ const { errorCode, retry, instructions } = classify(failure);
18110
+ this.errorCode = errorCode;
18111
+ this.retry = retry;
18112
+ this.instructions = instructions;
18113
+ this.unresolved = unresolved;
18114
+ }
18115
+ }
18417
18116
  // src/resources/services/local-resource-matcher.ts
18418
18117
  function normalizeFolderPath(path) {
18419
18118
  if (!path)
@@ -18519,6 +18218,20 @@ async function findCatalogEntityAsync(catalog, query, match) {
18519
18218
  } while (pageCursor);
18520
18219
  return;
18521
18220
  }
18221
+ async function findCatalogEntitiesAsync(catalog, query, match) {
18222
+ const found = [];
18223
+ let pageCursor;
18224
+ do {
18225
+ const page = await catalog.searchFolderEntities({
18226
+ ...query,
18227
+ pageSize: 100,
18228
+ pageCursor
18229
+ });
18230
+ found.push(...(page.items ?? []).filter(match));
18231
+ pageCursor = page.nextPage ?? undefined;
18232
+ } while (pageCursor);
18233
+ return found;
18234
+ }
18522
18235
  function toResourceReference(entity) {
18523
18236
  return toCatalogReference({
18524
18237
  kind: entity.entityType ?? "",
@@ -18572,7 +18285,7 @@ function parseJsonString(raw) {
18572
18285
  return error ? undefined : parsed;
18573
18286
  }
18574
18287
  // src/resources/services/resource-casing.ts
18575
- var RESOURCE_FILES_FOLDER_NAME = "resources";
18288
+ var RESOURCE_FILES_FOLDER_NAME2 = "resources";
18576
18289
  function lowerFirstChar(value) {
18577
18290
  return value ? value.charAt(0).toLowerCase() + value.slice(1) : value;
18578
18291
  }
@@ -18601,7 +18314,7 @@ async function saveCasingNormalized(builder) {
18601
18314
  }
18602
18315
  async function normalizeResourceFileCasing(solutionDir) {
18603
18316
  const fs = getFileSystem();
18604
- const root = fs.path.join(solutionDir, RESOURCE_FILES_FOLDER_NAME);
18317
+ const root = fs.path.join(solutionDir, RESOURCE_FILES_FOLDER_NAME2);
18605
18318
  if (!await fs.exists(root))
18606
18319
  return [];
18607
18320
  const byTarget = new Map;
@@ -18649,13 +18362,17 @@ function targetSegments(segments, kind, type) {
18649
18362
  const kindIndex = type ? target.length - 3 : target.length - 2;
18650
18363
  if (kindIndex < 0)
18651
18364
  return target;
18652
- if (target[kindIndex] === kind)
18365
+ if (sameIgnoringCase(target[kindIndex], kind)) {
18653
18366
  target[kindIndex] = lowerFirstChar(kind);
18654
- if (type && target[kindIndex + 1] === type) {
18367
+ }
18368
+ if (type && sameIgnoringCase(target[kindIndex + 1], type)) {
18655
18369
  target[kindIndex + 1] = lowerFirstChar(type);
18656
18370
  }
18657
18371
  return target;
18658
18372
  }
18373
+ function sameIgnoringCase(a, b) {
18374
+ return a.toLowerCase() === b.toLowerCase();
18375
+ }
18659
18376
  async function collectResourceFiles(root, segments) {
18660
18377
  const fs = getFileSystem();
18661
18378
  const [readError, names] = await catchError(fs.readdir(fs.path.join(root, ...segments)));
@@ -18728,6 +18445,118 @@ function parseResourceHeader(content) {
18728
18445
  return null;
18729
18446
  }
18730
18447
  }
18448
+ // src/resources/services/resource-configurations.ts
18449
+ var ROOT_RESOURCE_TYPES = new Set(["resource", "solutionresource"]);
18450
+ var KEY_NOT_FOUND = /^(?:Solution)?Resource with key '([^']+)' was not found$/i;
18451
+ function isResourceKeyNotFound(error, resourceKey) {
18452
+ if (!(error instanceof Error))
18453
+ return false;
18454
+ const typed = error;
18455
+ const sameKey = (key) => key !== undefined && key.toLowerCase() === resourceKey.toLowerCase();
18456
+ if (typeof typed.resourceType === "string" && typeof typed.resourceKey === "string") {
18457
+ return ROOT_RESOURCE_TYPES.has(typed.resourceType.toLowerCase()) && sameKey(typed.resourceKey);
18458
+ }
18459
+ return sameKey(KEY_NOT_FOUND.exec(error.message.trim())?.[1]);
18460
+ }
18461
+ async function refreshArtefactSpecsAsync(builder, configurations) {
18462
+ const resources = new Map;
18463
+ const [loadError, solution] = await catchError(builder.context.loadAsync());
18464
+ if (loadError || !solution)
18465
+ return resources;
18466
+ for (const configuration of configurations) {
18467
+ const resource = solution.resources.find((r) => r.key === configuration?.key);
18468
+ if (!resource)
18469
+ continue;
18470
+ resources.set(resource.key, resource);
18471
+ if (!resource.projectKey)
18472
+ continue;
18473
+ configuration.spec = await applyEntryPointEnhancementAsync(builder.context, resource, configuration.spec ?? {});
18474
+ }
18475
+ return resources;
18476
+ }
18477
+ async function exportResourceConfigurationsAsync(services2, resourceKey, hint = {}) {
18478
+ const { catalog, importer } = getRemoteResourceClients(services2);
18479
+ const byKey = (item) => item.entityKey === resourceKey;
18480
+ const entity = (hint.name ? await findCatalogEntityAsync(catalog, { name: hint.name }, byKey) : undefined) ?? await findCatalogEntityAsync(catalog, {}, byKey);
18481
+ if (!entity) {
18482
+ throw new Error(`Resource '${resourceKey}' was not found in the solution or in the resource catalog`);
18483
+ }
18484
+ const payload = await importer.exportResourceAsync(toResourceReference(entity));
18485
+ const definitions = payload.resourceDefinitions ?? [];
18486
+ if (definitions.length === 0) {
18487
+ throw new Error(`FPS export for '${resourceKey}' returned no resource definitions`);
18488
+ }
18489
+ return {
18490
+ resources: definitions.map((d) => ({
18491
+ key: d.key ?? "",
18492
+ spec: d.spec ?? {},
18493
+ locks: d.locks ?? [],
18494
+ apiVersion: d.apiVersion,
18495
+ isOverridable: d.isOverridable,
18496
+ name: d.name ?? "",
18497
+ kind: d.kind ?? "",
18498
+ dependencies: (d.dependencies ?? []).map((dep) => ({
18499
+ kind: dep.kind ?? "",
18500
+ name: dep.name ?? ""
18501
+ }))
18502
+ }))
18503
+ };
18504
+ }
18505
+ async function readLocalAsync(builder, resourceKey, read) {
18506
+ if (!builder)
18507
+ return;
18508
+ const [error, value] = await catchError(read(builder));
18509
+ if (!error)
18510
+ return { builder, value };
18511
+ if (isResourceKeyNotFound(error, resourceKey))
18512
+ return;
18513
+ throw error;
18514
+ }
18515
+ async function readResourceConfigurationsAsync(services2, builder, resourceKey, hint = {}) {
18516
+ const local = await readLocalAsync(builder, resourceKey, (b) => b.getAllConfigurationsAsync(resourceKey));
18517
+ if (!local) {
18518
+ return exportResourceConfigurationsAsync(services2, resourceKey, hint);
18519
+ }
18520
+ await refreshArtefactSpecsAsync(local.builder, local.value?.resources ?? []);
18521
+ return local.value;
18522
+ }
18523
+ async function readResourceConfigurationAsync(services2, builder, resourceKey) {
18524
+ const local = await readLocalAsync(builder, resourceKey, (b) => b.getConfigurationAsync(resourceKey));
18525
+ if (local) {
18526
+ const configuration = local.value;
18527
+ const resources2 = await refreshArtefactSpecsAsync(local.builder, [
18528
+ configuration
18529
+ ]);
18530
+ return { configuration, resource: resources2.get(configuration.key) };
18531
+ }
18532
+ const { resources } = await exportResourceConfigurationsAsync(services2, resourceKey);
18533
+ const primary = resources.find((r) => r.key === resourceKey) ?? resources[0];
18534
+ const { key, spec, locks, apiVersion, isOverridable } = primary;
18535
+ return { configuration: { key, spec, locks, apiVersion, isOverridable } };
18536
+ }
18537
+ // src/resources/services/resource-lookup.ts
18538
+ async function findResourcesByNameAsync(services2, builder, { kind, name, subTypes, folderKey }) {
18539
+ const same = (a, b) => (a ?? "").toLowerCase() === b.toLowerCase();
18540
+ const ofSubType = (type) => subTypes === undefined || subTypes.some((t) => same(type, t));
18541
+ if (builder) {
18542
+ const solution = await builder.context.loadAsync();
18543
+ const local = solution.resources.filter((r) => same(r.kind, kind) && same(r.name, name) && ofSubType(r.type)).map((r) => ({
18544
+ key: r.key,
18545
+ local: true,
18546
+ folderPath: r.folders?.[0]?.fullyQualifiedName
18547
+ }));
18548
+ if (local.length > 0)
18549
+ return local;
18550
+ }
18551
+ const { catalog } = getRemoteResourceClients(services2);
18552
+ const rows = await findCatalogEntitiesAsync(catalog, { name, entityTypes: [kind] }, (row) => same(row.entityType, kind) && same(row.entityName, name) && ofSubType(row.entitySubType) && (folderKey === undefined || same(row.folderKey, folderKey)));
18553
+ return rows.map((row) => ({
18554
+ key: row.entityKey ?? "",
18555
+ local: false,
18556
+ folderPath: row.fullyQualifiedName ?? undefined,
18557
+ folderKey: row.folderKey ?? undefined
18558
+ }));
18559
+ }
18731
18560
  // src/resources/services/resource-name.ts
18732
18561
  var MAX_RESOURCE_NAME_LENGTH = 256;
18733
18562
  var UNSAFE_NAME_CHARS = /[\\/:*?"<>|]/;
@@ -18775,6 +18604,9 @@ var TYPE_IS_IDENTITY_REPLACE_OPTIONS = new Set([
18775
18604
  "SameNameAndType"
18776
18605
  ]);
18777
18606
  var BINDINGS_JSON_FALLBACK_TYPES = new Set(["agent", "function"]);
18607
+
18608
+ class OverwriteRefreshError extends Error {
18609
+ }
18778
18610
  function placeholderForType(type) {
18779
18611
  switch ((type ?? "string").toLowerCase()) {
18780
18612
  case "boolean":
@@ -18875,13 +18707,15 @@ function resolveBindingResourceIdentity(binding) {
18875
18707
  };
18876
18708
  }
18877
18709
  }
18878
- async function syncResourcesFromBindings(solutionDir, projectPaths, projectSubTypes) {
18710
+ async function syncResourcesFromBindings(solutionDir, projectPaths, projectSubTypes, projectBindings) {
18879
18711
  const result = {
18880
18712
  created: 0,
18881
18713
  imported: 0,
18882
18714
  skipped: 0,
18883
18715
  pruned: 0,
18884
- warnings: []
18716
+ projectResourcesCreated: 0,
18717
+ warnings: [],
18718
+ unresolved: []
18885
18719
  };
18886
18720
  const uipxProjects = await readUipxProjects(solutionDir);
18887
18721
  const paths = projectPaths ?? uipxProjects.map((p) => p.path);
@@ -18895,7 +18729,7 @@ async function syncResourcesFromBindings(solutionDir, projectPaths, projectSubTy
18895
18729
  return result;
18896
18730
  }
18897
18731
  const serializer = services2.container.resolve(Tokens.IBindingsMetadataSerializer);
18898
- const { bindings: allBindings, parseErrors } = await collectBindings(solutionDir, paths, bindingsJsonFallbackDirs, serializer);
18732
+ const { bindings: allBindings, parseErrors } = await collectBindings(bindingsJsonFallbackDirs, serializer, bindingSources(solutionDir, paths, uipxProjects, projectBindings));
18899
18733
  if (parseErrors.length > 0) {
18900
18734
  const detail = parseErrors.map((e) => `${e.path}: ${e.reason}`).join("; ");
18901
18735
  throw new Error(`Invalid bindings file — ${detail}`);
@@ -18909,7 +18743,8 @@ async function syncResourcesFromBindings(solutionDir, projectPaths, projectSubTy
18909
18743
  logger.warn(`Failed to get solution builder: ${builderError.message}`);
18910
18744
  return result;
18911
18745
  }
18912
- await reconcileSolutionProjects(builder, solutionDir, projectSubTypes);
18746
+ const reconcileOutcome = await reconcileSolutionProjects(builder, solutionDir, projectSubTypes);
18747
+ result.projectResourcesCreated = reconcileOutcome.resourcesAdded;
18913
18748
  const memberProjectKeys = new Set(uipxProjects.map((project) => project.id.toLowerCase()));
18914
18749
  await pruneMemberClones(builder, memberProjectKeys, result);
18915
18750
  if (allBindings.length === 0) {
@@ -18924,6 +18759,28 @@ async function syncResourcesFromBindings(solutionDir, projectPaths, projectSubTy
18924
18759
  const resolveKindMetadata = await buildKindResolver(metadataReader);
18925
18760
  const solution = await builder.context.loadAsync();
18926
18761
  const knownResourceKeys = new Set((solution.resources ?? []).map((r) => r.key?.toLowerCase()).filter((k) => !!k));
18762
+ let keptUnchecked = 0;
18763
+ const resolvedKeys = new Set;
18764
+ const overwrittenKeys = new Set;
18765
+ const bindingKey = (kind, name) => `${kind}:${name ?? ""}`.toLowerCase();
18766
+ const recordUnchecked = async (error, kind, name, directCloudKey) => {
18767
+ if (error) {
18768
+ const failure = classifyCatalogFailure(error);
18769
+ if (!result.catalogLookupFailure || stopsCatalogLookups(failure) && !stopsCatalogLookups(result.catalogLookupFailure)) {
18770
+ result.catalogLookupFailure = failure;
18771
+ }
18772
+ }
18773
+ const covered = await isUncheckedBindingCovered(builder, knownResourceKeys, kind, name, directCloudKey);
18774
+ if (covered) {
18775
+ keptUnchecked++;
18776
+ result.skipped++;
18777
+ return;
18778
+ }
18779
+ result.unresolved.push({
18780
+ kind,
18781
+ name: directCloudKey ?? name
18782
+ });
18783
+ };
18927
18784
  const virtualCandidates = [];
18928
18785
  for (const binding of allBindings) {
18929
18786
  const identity = resolveBindingResourceIdentity(binding);
@@ -18953,7 +18810,12 @@ async function syncResourcesFromBindings(solutionDir, projectPaths, projectSubTy
18953
18810
  logger.info(`Skipping ${kind} "${name}" — the solution provisions this project itself; its member declaration covers the binding`);
18954
18811
  continue;
18955
18812
  }
18956
- const rcsMatch = directCloudKey ? await findResourceByKeyInRcs(builder, kind, directCloudKey, folderPath) : await findResourceInRcs(builder, kind, name, folderPath);
18813
+ const lookupsStopped = !!result.catalogLookupFailure && stopsCatalogLookups(result.catalogLookupFailure);
18814
+ const [lookupError, rcsMatch] = lookupsStopped ? [undefined, undefined] : await catchError(directCloudKey ? findResourceByKeyInRcs(builder, kind, directCloudKey, folderPath, true) : findResourceInRcs(builder, kind, name, folderPath, true));
18815
+ if (lookupsStopped || lookupError) {
18816
+ await recordUnchecked(lookupError, kind, name, directCloudKey);
18817
+ continue;
18818
+ }
18957
18819
  const resolvedType = identity.type ?? rcsMatch?.type ?? metadata?.type;
18958
18820
  if (!rcsMatch) {
18959
18821
  if (isConnection) {
@@ -18972,30 +18834,48 @@ async function syncResourcesFromBindings(solutionDir, projectPaths, projectSubTy
18972
18834
  }
18973
18835
  if (!isConnection && rcsMatch.key && knownResourceKeys.has(rcsMatch.key.toLowerCase())) {
18974
18836
  result.skipped++;
18837
+ resolvedKeys.add(bindingKey(kind, name));
18975
18838
  continue;
18976
18839
  }
18977
18840
  const callType = isConnection ? binding.metadata?.connector : resolvedType;
18978
- const [importError] = await catchError(builder.addOrUpdateResourceToSolutionAsync({
18841
+ const wasKnown = !!rcsMatch.key && knownResourceKeys.has(rcsMatch.key.toLowerCase());
18842
+ const reference = {
18979
18843
  kind,
18980
18844
  type: callType,
18981
18845
  key: rcsMatch.key,
18982
18846
  name: rcsMatch.name,
18983
18847
  folder: rcsMatch.folder
18984
- }, true));
18848
+ };
18849
+ const [importError] = await catchError(wasKnown ? refreshKnownResource(services2, builder, reference, overwrittenKeys) : builder.addOrUpdateResourceToSolutionAsync(reference, true));
18985
18850
  if (!importError) {
18851
+ resolvedKeys.add(bindingKey(kind, directCloudKey ?? name));
18852
+ if (wasKnown) {
18853
+ result.skipped++;
18854
+ logger.info(`Refreshed ${kind} "${rcsMatch.name}" (key: ${rcsMatch.key}), already in solution`);
18855
+ continue;
18856
+ }
18986
18857
  if (rcsMatch.key) {
18987
18858
  knownResourceKeys.add(rcsMatch.key.toLowerCase());
18859
+ overwrittenKeys.add(rcsMatch.key.toLowerCase());
18988
18860
  }
18989
18861
  result.imported++;
18990
18862
  logger.info(`Imported ${kind} "${rcsMatch.name}" (key: ${rcsMatch.key}) into solution`);
18991
18863
  continue;
18992
18864
  }
18865
+ if (stopsCatalogLookups(classifyCatalogFailure(importError))) {
18866
+ await recordUnchecked(importError, kind, name, directCloudKey);
18867
+ continue;
18868
+ }
18993
18869
  if (isConnection) {
18994
- result.warnings.push(`Failed to import connection ${directCloudKey}: ${importError.message}`);
18995
- logger.warn(`Failed to import connection ${directCloudKey}: ${importError.message}`);
18870
+ const failedStep = importError instanceof OverwriteRefreshError ? "refresh the debug overwrite for" : "import";
18871
+ const warning = `Failed to ${failedStep} connection ${directCloudKey}: ${importError.message}`;
18872
+ result.warnings.push(warning);
18873
+ logger.warn(warning);
18996
18874
  continue;
18997
18875
  }
18998
- logger.warn(`Failed to import ${kind} "${name}" from Orchestrator: ${importError.message}. Will create locally instead.`);
18876
+ const importWarning = `Failed to import ${kind} "${name}" from Orchestrator: ${importError.message}. Created it locally instead; link it before deploy if it must point at the cloud resource.`;
18877
+ result.warnings.push(importWarning);
18878
+ logger.warn(importWarning);
18999
18879
  virtualCandidates.push({
19000
18880
  binding,
19001
18881
  kind,
@@ -19014,11 +18894,29 @@ async function syncResourcesFromBindings(solutionDir, projectPaths, projectSubTy
19014
18894
  return true;
19015
18895
  });
19016
18896
  for (const candidate of dedupedVirtuals) {
19017
- const [syncError] = await catchError(createVirtualForBinding(builder, candidate.binding, candidate.kind, candidate.type, candidate.metadata, candidate.name, candidate.folderPath, result));
18897
+ const [syncError, created] = await catchError(createVirtualForBinding(builder, candidate.binding, candidate.kind, candidate.type, candidate.metadata, candidate.name, candidate.folderPath, result));
19018
18898
  if (syncError) {
19019
18899
  logger.warn(`Failed to create virtual ${candidate.kind}/${candidate.name}: ${syncError.message}`);
18900
+ } else if (created) {
18901
+ resolvedKeys.add(bindingKey(candidate.kind, candidate.name));
19020
18902
  }
19021
18903
  }
18904
+ if (result.catalogLookupFailure) {
18905
+ const seen = new Set;
18906
+ result.unresolved = result.unresolved.filter((b) => {
18907
+ const key = bindingKey(b.kind, b.name);
18908
+ if (resolvedKeys.has(key)) {
18909
+ keptUnchecked++;
18910
+ result.skipped++;
18911
+ return false;
18912
+ }
18913
+ if (seen.has(key))
18914
+ return false;
18915
+ seen.add(key);
18916
+ return true;
18917
+ });
18918
+ result.warnings.push(catalogLookupWarning(result.catalogLookupFailure, keptUnchecked, result.unresolved));
18919
+ }
19022
18920
  const saveError = await saveAndDisposeBuilder(builder, solutionDir);
19023
18921
  if (saveError) {
19024
18922
  throw new Error(`Failed to save solution changes: ${saveError.message}`);
@@ -19046,6 +18944,43 @@ async function pruneMemberClones(builder, memberProjectKeys, result) {
19046
18944
  logger.info(`Removed duplicate ${clone.kind} "${clone.name}" (key: ${clone.key}) — the solution provisions this project itself`);
19047
18945
  }
19048
18946
  }
18947
+ async function isUncheckedBindingCovered(builder, knownResourceKeys, kind, name, directCloudKey) {
18948
+ if (directCloudKey) {
18949
+ return knownResourceKeys.has(directCloudKey.toLowerCase());
18950
+ }
18951
+ const solution = await builder.context.loadAsync();
18952
+ return !!findMatchingLocalResource(solution.resources ?? [], kind, name, undefined);
18953
+ }
18954
+ async function refreshKnownResource(services2, builder, reference, overwrittenKeys) {
18955
+ const solution = await builder.context.loadAsync();
18956
+ const referenceKey = reference.key.toLowerCase();
18957
+ const existing = (solution.resources ?? []).find((resource) => resource.key?.toLowerCase() === referenceKey);
18958
+ const mediator = services2.container.resolve(Tokens.IMediator);
18959
+ const response = await mediator.sendCommandAsync(new AddOrUpdateResourceToSolutionCommand(builder.context, reference, true, existing?.key));
18960
+ const sdkWroteOverwrite = response.saved && existing?.key === reference.key;
18961
+ if (!existing || sdkWroteOverwrite || overwrittenKeys.has(referenceKey)) {
18962
+ overwrittenKeys.add(referenceKey);
18963
+ return response;
18964
+ }
18965
+ const [overwriteError] = await catchError(refreshOverwrite(services2, builder, reference, existing.key));
18966
+ if (overwriteError)
18967
+ throw new OverwriteRefreshError(overwriteError.message);
18968
+ overwrittenKeys.add(referenceKey);
18969
+ return response;
18970
+ }
18971
+ async function refreshOverwrite(services2, builder, reference, solutionResourceKey) {
18972
+ const importer = services2.container.resolve(Tokens.IImportResourceHelper);
18973
+ const payload = await importer.exportResourceAsync(reference);
18974
+ const referenceKey = reference.key.toLowerCase();
18975
+ const overwrite = [...payload.overwrites].find(([key]) => key.toLowerCase() === referenceKey)?.[1];
18976
+ if (!overwrite) {
18977
+ throw new Error(`Overwrite not found for resource key '${reference.key}' in exported payload`);
18978
+ }
18979
+ const overwrites = services2.container.resolve(Tokens.IResourceOverwritesService);
18980
+ await overwrites.manageSolutionOverwritesAsync(builder.context, [
18981
+ { solutionResourceKey, overwrite }
18982
+ ]);
18983
+ }
19049
18984
  async function saveAndDisposeBuilder(builder, solutionDir) {
19050
18985
  const context = builder.context;
19051
18986
  if (!context?.forceSaveChangesAsync) {
@@ -19115,11 +19050,11 @@ async function createVirtualForBinding(builder, _binding, kind, type, metadata,
19115
19050
  if (alreadyVirtualized) {
19116
19051
  result.skipped++;
19117
19052
  logger.info(`Skipping virtual ${kind} "${name}" — existing resource "${alreadyVirtualized.name}" in solution_folder already covers this binding (requested folder "${folderPath}")`);
19118
- return;
19053
+ return true;
19119
19054
  }
19120
19055
  const minted = await mintVirtualResource(builder, kind, type, name, metadata);
19121
19056
  if (!minted)
19122
- return;
19057
+ return false;
19123
19058
  result.created++;
19124
19059
  logger.info(`Created ${kind} "${name}" in solution`);
19125
19060
  if (!virtualizable) {
@@ -19127,6 +19062,7 @@ async function createVirtualForBinding(builder, _binding, kind, type, metadata,
19127
19062
  result.warnings.push(warning);
19128
19063
  logger.warn(warning);
19129
19064
  }
19065
+ return true;
19130
19066
  }
19131
19067
  async function findResourceByKeyInRcs(builder, kind, expectedKey, folderPath, propagateErrors = false) {
19132
19068
  const expectedLower = expectedKey.toLowerCase();
@@ -19204,8 +19140,8 @@ async function searchRcsResourcesStrict(builder, kind, name) {
19204
19140
  } while (pageCursor);
19205
19141
  return allMatches;
19206
19142
  }
19207
- async function findResourceInRcs(builder, kind, name, folderPath) {
19208
- const allMatches = await searchRcsResources(builder, kind, name);
19143
+ async function findResourceInRcs(builder, kind, name, folderPath, propagateErrors = false) {
19144
+ const allMatches = propagateErrors ? await searchRcsResourcesStrict(builder, kind, name) : await searchRcsResources(builder, kind, name);
19209
19145
  if (allMatches.length === 0) {
19210
19146
  return;
19211
19147
  }
@@ -19303,9 +19239,15 @@ async function readUiprojName(uiprojPath) {
19303
19239
  return;
19304
19240
  }
19305
19241
  }
19242
+ async function snapshotResourceIdentities(builder) {
19243
+ const [loadError, solution] = await catchError(builder.context.loadAsync());
19244
+ if (loadError || !solution)
19245
+ return;
19246
+ return new Set((solution.resources ?? []).map((resource) => resource.key ? resource.key.toLowerCase() : `${resource.kind}:${resource.name}`.toLowerCase()));
19247
+ }
19306
19248
  async function reconcileSolutionProjects(builder, solutionDir, projectSubTypes) {
19307
19249
  const fs = getFileSystem();
19308
- const outcome = { projectsCount: 0 };
19250
+ const outcome = { projectsCount: 0, resourcesAdded: 0 };
19309
19251
  const uipxProjects = await readUipxProjects(solutionDir);
19310
19252
  const projectDetails = uipxProjects.flatMap((project) => {
19311
19253
  const reconcileType = mapUipxTypeToReconcileType(project.type);
@@ -19323,6 +19265,7 @@ async function reconcileSolutionProjects(builder, solutionDir, projectSubTypes)
19323
19265
  if (projectDetails.length === 0)
19324
19266
  return outcome;
19325
19267
  const solutionName = fs.path.basename(solutionDir);
19268
+ const before = await snapshotResourceIdentities(builder);
19326
19269
  const [reconcileError] = await catchError(builder.reconcileProjectsAsync({
19327
19270
  solutionName,
19328
19271
  projects: projectDetails
@@ -19332,6 +19275,10 @@ async function reconcileSolutionProjects(builder, solutionDir, projectSubTypes)
19332
19275
  return outcome;
19333
19276
  }
19334
19277
  outcome.projectsCount = projectDetails.length;
19278
+ const after = before && await snapshotResourceIdentities(builder);
19279
+ if (before && after) {
19280
+ outcome.resourcesAdded = [...after].filter((identity) => !before.has(identity)).length;
19281
+ }
19335
19282
  logger.info(`Reconciled ${projectDetails.length} .uipx project(s) in solution ${solutionName}`);
19336
19283
  return outcome;
19337
19284
  }
@@ -19373,12 +19320,48 @@ function findBindingsSchemaError(content) {
19373
19320
  }
19374
19321
  return null;
19375
19322
  }
19376
- async function collectBindings(solutionDir, projectPaths, bindingsJsonFallbackDirs, serializer) {
19323
+ function bindingSources(solutionDir, projectPaths, projects, projectBindings) {
19324
+ const sources = [{ directory: solutionDir }];
19325
+ const fileDirectories = new Set([solutionDir]);
19326
+ const contributedIds = new Set;
19327
+ for (const directory of new Set(projectPaths)) {
19328
+ const owners = projects.filter((project) => project.path === directory);
19329
+ for (const project of owners) {
19330
+ const bindings = projectBindings?.get(project.id);
19331
+ if (bindings === undefined || contributedIds.has(project.id))
19332
+ continue;
19333
+ contributedIds.add(project.id);
19334
+ sources.push({
19335
+ directory,
19336
+ contribution: { projectId: project.id, bindings }
19337
+ });
19338
+ }
19339
+ const needsFile = owners.length === 0 || owners.some((project) => !projectBindings?.has(project.id));
19340
+ if (needsFile && !fileDirectories.has(directory)) {
19341
+ fileDirectories.add(directory);
19342
+ sources.push({ directory });
19343
+ }
19344
+ }
19345
+ return sources;
19346
+ }
19347
+ async function collectBindings(bindingsJsonFallbackDirs, serializer, sources) {
19377
19348
  const fs = getFileSystem();
19378
19349
  const allBindings = [];
19379
19350
  const parseErrors = [];
19380
- const candidateDirs = [solutionDir, ...projectPaths];
19381
- for (const dir of candidateDirs) {
19351
+ for (const { directory: dir, contribution } of sources) {
19352
+ if (contribution) {
19353
+ if (contribution.bindings.length === 0)
19354
+ continue;
19355
+ const parsed2 = deserializeBindings(JSON.stringify({
19356
+ version: "2.0",
19357
+ resources: contribution.bindings
19358
+ }), `${dir} (bindings contributed by the project's tool; project ${contribution.projectId})`, serializer);
19359
+ if ("error" in parsed2)
19360
+ parseErrors.push(parsed2.error);
19361
+ else
19362
+ allBindings.push(...parsed2.resources);
19363
+ continue;
19364
+ }
19382
19365
  const v2Path = fs.path.join(dir, "bindings_v2.json");
19383
19366
  let bindingsPath = v2Path;
19384
19367
  let exists = await fs.exists(v2Path);
@@ -19397,37 +19380,44 @@ async function collectBindings(solutionDir, projectPaths, bindingsJsonFallbackDi
19397
19380
  });
19398
19381
  continue;
19399
19382
  }
19400
- const decoded = new TextDecoder().decode(content);
19401
- let success;
19402
- let metadata;
19403
- try {
19404
- const result = serializer.tryDeserialize(decoded);
19405
- success = result.success;
19406
- metadata = result.metadata;
19407
- } catch (err) {
19408
- parseErrors.push({
19409
- path: bindingsPath,
19383
+ const parsed = deserializeBindings(new TextDecoder().decode(content), bindingsPath, serializer);
19384
+ if ("error" in parsed)
19385
+ parseErrors.push(parsed.error);
19386
+ else
19387
+ allBindings.push(...parsed.resources);
19388
+ }
19389
+ return { bindings: allBindings, parseErrors };
19390
+ }
19391
+ function deserializeBindings(decoded, source, serializer) {
19392
+ let success;
19393
+ let metadata;
19394
+ try {
19395
+ const result = serializer.tryDeserialize(decoded);
19396
+ success = result.success;
19397
+ metadata = result.metadata;
19398
+ } catch (err) {
19399
+ return {
19400
+ error: {
19401
+ path: source,
19410
19402
  reason: findBindingsSchemaError(decoded) ?? `does not match the expected v2 bindings schema — check each resource's 'kind' and required fields${err instanceof Error ? ` (${err.message})` : ""}`
19411
- });
19412
- continue;
19413
- }
19414
- if (!success) {
19415
- parseErrors.push({
19416
- path: bindingsPath,
19403
+ }
19404
+ };
19405
+ }
19406
+ if (!success) {
19407
+ return {
19408
+ error: {
19409
+ path: source,
19417
19410
  reason: findBindingsSchemaError(decoded) ?? "does not match the expected v2 bindings schema (the serializer rejected it)"
19418
- });
19419
- continue;
19420
- }
19421
- if (!metadata?.resources?.length) {
19422
- continue;
19423
- }
19424
- allBindings.push(...metadata.resources);
19411
+ }
19412
+ };
19425
19413
  }
19426
- return { bindings: allBindings, parseErrors };
19414
+ return { resources: metadata?.resources ?? [] };
19427
19415
  }
19428
- async function syncAndLog(solutionDir, projectSubTypes) {
19429
- const [syncError, syncResult] = await catchError(syncResourcesFromBindings(solutionDir, undefined, projectSubTypes));
19416
+ async function syncAndLog(solutionDir, projectSubTypes, options) {
19417
+ const [syncError, syncResult] = await catchError(syncResourcesFromBindings(solutionDir, undefined, projectSubTypes, options?.projectBindings));
19430
19418
  if (syncError) {
19419
+ if (options?.failOnUnresolved)
19420
+ throw syncError;
19431
19421
  logger.warn(`Resource sync failed: ${syncError.message}. Continuing.`);
19432
19422
  return;
19433
19423
  }
@@ -19437,6 +19427,9 @@ async function syncAndLog(solutionDir, projectSubTypes) {
19437
19427
  for (const warning of syncResult.warnings) {
19438
19428
  logger.warn(warning);
19439
19429
  }
19430
+ if (options?.failOnUnresolved && syncResult.catalogLookupFailure && syncResult.unresolved.length > 0) {
19431
+ throw new CatalogLookupError(syncResult.catalogLookupFailure, syncResult.unresolved);
19432
+ }
19440
19433
  }
19441
19434
 
19442
19435
  // src/resources/services/resource-refresh-service.ts
@@ -19473,7 +19466,11 @@ async function resourceRefreshAsync(solutionPath = ".", options = {}) {
19473
19466
  const resolverWarnings = subTypesError ? [
19474
19467
  `Could not resolve project subTypes: ${subTypesError.message}. Project artefacts for types that need a variant were left as they are; fix the tool install and re-run 'uip solution resources refresh'.`
19475
19468
  ] : [];
19476
- const [syncError, result] = await catchError(syncResourcesFromBindings(resolvedPath, undefined, projectSubTypes ?? new Map));
19469
+ const [bindingsError, projectBindings] = await catchError(options.resolveProjectBindingsAsync?.() ?? Promise.resolve(new Map));
19470
+ if (bindingsError) {
19471
+ resolverWarnings.push(`Could not read the bindings projects contribute: ${bindingsError.message}. Those projects were synced from any bindings_v2.json on disk instead; fix the tool install and re-run 'uip solution resources refresh'.`);
19472
+ }
19473
+ const [syncError, result] = await catchError(syncResourcesFromBindings(resolvedPath, undefined, projectSubTypes ?? new Map, projectBindings ?? new Map));
19477
19474
  if (syncError) {
19478
19475
  return {
19479
19476
  ok: false,
@@ -19487,6 +19484,7 @@ async function resourceRefreshAsync(solutionPath = ".", options = {}) {
19487
19484
  imported: result.imported,
19488
19485
  skipped: result.skipped,
19489
19486
  pruned: result.pruned,
19487
+ projectResourcesCreated: result.projectResourcesCreated,
19490
19488
  warnings: [...resolverWarnings, ...result.warnings]
19491
19489
  };
19492
19490
  }
@@ -19668,6 +19666,7 @@ function sortKeysDeep(value) {
19668
19666
  return sorted;
19669
19667
  }
19670
19668
  export {
19669
+ CatalogLookupError,
19671
19670
  EntryPointSpecEnhancer,
19672
19671
  MAX_RESOURCE_NAME_LENGTH,
19673
19672
  ProjectManifestError,
@@ -19680,7 +19679,9 @@ export {
19680
19679
  createProjectInSolutionBuilder,
19681
19680
  createResourceBuilderServices,
19682
19681
  createResourceKindMetadataResolver,
19682
+ exportResourceConfigurationsAsync,
19683
19683
  exportResourceDefinitionAsync,
19684
+ findCatalogEntitiesAsync,
19684
19685
  findCatalogEntityAsync,
19685
19686
  findMatchingLocalResource,
19686
19687
  findMatchingMemberResource,
@@ -19688,21 +19689,26 @@ export {
19688
19689
  findProjectFile,
19689
19690
  findResourceByKeyInRcs,
19690
19691
  findResourceInRcs,
19692
+ findResourcesByNameAsync,
19691
19693
  formatResourceSubtypes,
19692
19694
  getRemoteResourceClients,
19693
19695
  hasAnyTemplateRow,
19694
19696
  hasBareTemplateRow,
19695
19697
  isMissingProjectTypeError,
19696
19698
  isProjectManifestError,
19699
+ isResourceKeyNotFound,
19697
19700
  normalizeFolderPath,
19698
19701
  normalizeResourceCasing,
19699
19702
  normalizeResourceFileCasing,
19700
19703
  readProjectFile,
19704
+ readResourceConfigurationAsync,
19705
+ readResourceConfigurationsAsync,
19701
19706
  readSolutionFile,
19702
19707
  readSolutionManifest,
19703
19708
  readSpecEntryPoints,
19704
19709
  readSpecProperty,
19705
19710
  readUipxProjects,
19711
+ refreshArtefactSpecsAsync,
19706
19712
  resolveProjectDirFromManifest,
19707
19713
  resolveResourceKindMetadata,
19708
19714
  resolveSolutionFilePath,
@@ -19722,4 +19728,4 @@ export {
19722
19728
  writeSolutionFile
19723
19729
  };
19724
19730
 
19725
- //# debugId=177609A48706C50164756E2164756E21
19731
+ //# debugId=6996E99F6A38BCF964756E2164756E21