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