@uipath/packager-tool-workflowcompiler 1.197.0-preview.63 → 1.197.0-preview.65
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/index.js
CHANGED
|
@@ -653,9 +653,307 @@ I18nManager.registerTranslations("zu", zu_default);
|
|
|
653
653
|
import { execSync } from "node:child_process";
|
|
654
654
|
import {
|
|
655
655
|
ProjectTypes,
|
|
656
|
-
translate as
|
|
656
|
+
translate as translate6
|
|
657
657
|
} from "@uipath/solutionpackager-tool-core";
|
|
658
658
|
|
|
659
|
+
// ../packager-orchestrator-client/dist/index.js
|
|
660
|
+
import { I18nManager as I18nManager2 } from "@uipath/solutionpackager-tool-core";
|
|
661
|
+
import {
|
|
662
|
+
Path,
|
|
663
|
+
TemporaryStorageService,
|
|
664
|
+
translate as translate2
|
|
665
|
+
} from "@uipath/solutionpackager-tool-core";
|
|
666
|
+
import {
|
|
667
|
+
translate
|
|
668
|
+
} from "@uipath/solutionpackager-tool-core";
|
|
669
|
+
var en2 = {
|
|
670
|
+
packagerOrchestratorClient: {
|
|
671
|
+
feeds: {
|
|
672
|
+
errors: {
|
|
673
|
+
orchestratorUrlRequired: "Orchestrator URL is required.",
|
|
674
|
+
getAccessibleFeedsFailed: "GetAccessibleFeeds failed: {status} {statusText}{body}"
|
|
675
|
+
},
|
|
676
|
+
warnings: {
|
|
677
|
+
tenantFeedsUnavailable: "Could not retrieve Orchestrator tenant feeds. Packaging will continue, but it may fail if a project references a library published to a tenant feed."
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
};
|
|
682
|
+
I18nManager2.registerTranslations("en", en2);
|
|
683
|
+
function isPromiseLike(value) {
|
|
684
|
+
return value !== null && typeof value === "object" && typeof value.then === "function";
|
|
685
|
+
}
|
|
686
|
+
function catchError(fnOrPromise) {
|
|
687
|
+
if (isPromiseLike(fnOrPromise)) {
|
|
688
|
+
return settlePromiseLike(fnOrPromise);
|
|
689
|
+
}
|
|
690
|
+
try {
|
|
691
|
+
const result = fnOrPromise();
|
|
692
|
+
if (isPromiseLike(result)) {
|
|
693
|
+
return settlePromiseLike(result);
|
|
694
|
+
}
|
|
695
|
+
return [undefined, result];
|
|
696
|
+
} catch (error) {
|
|
697
|
+
return [
|
|
698
|
+
error instanceof Error ? error : new Error(String(error)),
|
|
699
|
+
undefined
|
|
700
|
+
];
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
function settlePromiseLike(thenable) {
|
|
704
|
+
return Promise.resolve(thenable).then((data) => [undefined, data]).catch((error) => [
|
|
705
|
+
error instanceof Error ? error : new Error(String(error)),
|
|
706
|
+
undefined
|
|
707
|
+
]);
|
|
708
|
+
}
|
|
709
|
+
var PREFIX = "@uipath/common/";
|
|
710
|
+
var _g = globalThis;
|
|
711
|
+
function singleton(ctorOrName) {
|
|
712
|
+
const name = typeof ctorOrName === "string" ? ctorOrName : ctorOrName.name;
|
|
713
|
+
const key = Symbol.for(PREFIX + name);
|
|
714
|
+
return {
|
|
715
|
+
get(fallback) {
|
|
716
|
+
return _g[key] ?? fallback;
|
|
717
|
+
},
|
|
718
|
+
set(value) {
|
|
719
|
+
_g[key] = value;
|
|
720
|
+
},
|
|
721
|
+
clear() {
|
|
722
|
+
delete _g[key];
|
|
723
|
+
},
|
|
724
|
+
getOrInit(factory, guard) {
|
|
725
|
+
const existing = _g[key];
|
|
726
|
+
if (existing != null && typeof existing === "object") {
|
|
727
|
+
if (!guard || guard(existing)) {
|
|
728
|
+
return existing;
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
const instance = factory();
|
|
732
|
+
_g[key] = instance;
|
|
733
|
+
return instance;
|
|
734
|
+
}
|
|
735
|
+
};
|
|
736
|
+
}
|
|
737
|
+
var telemetryPropsSlot = singleton("TelemetryDefaultProps");
|
|
738
|
+
var USER_AGENT_HEADER = "User-Agent";
|
|
739
|
+
var sdkUserAgentHostToken = singleton("SdkUserAgentHostToken");
|
|
740
|
+
function splitUserAgentTokens(value) {
|
|
741
|
+
return value?.trim().split(/\s+/).filter(Boolean) ?? [];
|
|
742
|
+
}
|
|
743
|
+
function appendUserAgentToken(value, userAgent) {
|
|
744
|
+
const tokens = splitUserAgentTokens(value);
|
|
745
|
+
const seen = new Set(tokens);
|
|
746
|
+
for (const token of splitUserAgentTokens(userAgent)) {
|
|
747
|
+
if (!seen.has(token)) {
|
|
748
|
+
tokens.push(token);
|
|
749
|
+
seen.add(token);
|
|
750
|
+
}
|
|
751
|
+
}
|
|
752
|
+
return tokens.join(" ");
|
|
753
|
+
}
|
|
754
|
+
function getEffectiveUserAgent(userAgent) {
|
|
755
|
+
return appendUserAgentToken(sdkUserAgentHostToken.get(), userAgent);
|
|
756
|
+
}
|
|
757
|
+
function getHeaderName(headers, headerName) {
|
|
758
|
+
return Object.keys(headers).find((key) => key.toLowerCase() === headerName.toLowerCase());
|
|
759
|
+
}
|
|
760
|
+
function addSdkUserAgentHeader(headers, userAgent) {
|
|
761
|
+
const result = { ...headers ?? {} };
|
|
762
|
+
const headerName = getHeaderName(result, USER_AGENT_HEADER);
|
|
763
|
+
result[headerName ?? USER_AGENT_HEADER] = appendUserAgentToken(headerName ? result[headerName] : undefined, getEffectiveUserAgent(userAgent));
|
|
764
|
+
return result;
|
|
765
|
+
}
|
|
766
|
+
var package_default = {
|
|
767
|
+
name: "@uipath/packager-orchestrator-client",
|
|
768
|
+
version: "1.198.0",
|
|
769
|
+
description: "UiPath packager client for Orchestrator package-feed interaction (feed discovery + NuGet source composition)",
|
|
770
|
+
type: "module",
|
|
771
|
+
private: true,
|
|
772
|
+
exports: {
|
|
773
|
+
".": {
|
|
774
|
+
source: "./src/index.ts",
|
|
775
|
+
default: "./dist/index.js"
|
|
776
|
+
}
|
|
777
|
+
},
|
|
778
|
+
types: "./dist/index.d.ts",
|
|
779
|
+
scripts: {
|
|
780
|
+
build: "bun build ./src/index.ts --outdir dist --format esm --target node --external @uipath/solutionpackager-tool-core --sourcemap=linked && tsc --emitDeclarationOnly --outDir dist",
|
|
781
|
+
dev: "bun build ./src/index.ts --outdir dist --format esm --target node --external @uipath/solutionpackager-tool-core --watch",
|
|
782
|
+
test: "vitest run",
|
|
783
|
+
"test:coverage": "vitest run --coverage",
|
|
784
|
+
"test:all": "bun run test",
|
|
785
|
+
"test:all:coverage": "bun run test:coverage",
|
|
786
|
+
lint: "biome check ."
|
|
787
|
+
},
|
|
788
|
+
files: [
|
|
789
|
+
"dist",
|
|
790
|
+
"src"
|
|
791
|
+
],
|
|
792
|
+
author: "",
|
|
793
|
+
license: "ISC",
|
|
794
|
+
repository: {
|
|
795
|
+
type: "git",
|
|
796
|
+
url: "https://github.com/UiPath/cli.git",
|
|
797
|
+
directory: "packages/packager/packager-orchestrator-client"
|
|
798
|
+
},
|
|
799
|
+
peerDependencies: {
|
|
800
|
+
"@uipath/solutionpackager-tool-core": "workspace:*"
|
|
801
|
+
},
|
|
802
|
+
devDependencies: {
|
|
803
|
+
"@types/node": "^25.5.2",
|
|
804
|
+
"@uipath/common": "workspace:*",
|
|
805
|
+
"@uipath/solutionpackager-tool-core": "workspace:*",
|
|
806
|
+
"@vitest/coverage-v8": "^4.1.6",
|
|
807
|
+
typescript: "^6.0.2",
|
|
808
|
+
vitest: "^4.1.6"
|
|
809
|
+
}
|
|
810
|
+
};
|
|
811
|
+
var FEEDS_PATH = "/api/PackageFeeds/GetFeeds?onlyPublishable=false";
|
|
812
|
+
var HEADER_TENANT_ID = "X-UIPATH-TenantId";
|
|
813
|
+
var FEEDS_TIMEOUT_MS = 30000;
|
|
814
|
+
var SDK_USER_AGENT = `${package_default.name.replace(/^@uipath\//, "")}/${package_default.version}`;
|
|
815
|
+
|
|
816
|
+
class OrchestratorFeedsService {
|
|
817
|
+
logger;
|
|
818
|
+
constructor(logger) {
|
|
819
|
+
this.logger = logger;
|
|
820
|
+
}
|
|
821
|
+
async getAccessibleFeedsAsync(connection) {
|
|
822
|
+
const { orchestratorUrl, accessToken, tenantId } = connection;
|
|
823
|
+
if (!orchestratorUrl) {
|
|
824
|
+
throw new Error(translate.t("packagerOrchestratorClient.feeds.errors.orchestratorUrlRequired"));
|
|
825
|
+
}
|
|
826
|
+
this.logger.info(`Fetching accessible feeds from ${orchestratorUrl}`);
|
|
827
|
+
const headers = {};
|
|
828
|
+
if (accessToken) {
|
|
829
|
+
headers.Authorization = `Bearer ${accessToken}`;
|
|
830
|
+
}
|
|
831
|
+
if (tenantId) {
|
|
832
|
+
headers[HEADER_TENANT_ID] = tenantId;
|
|
833
|
+
}
|
|
834
|
+
const response = await fetch(feedsEndpoint(orchestratorUrl), {
|
|
835
|
+
method: "GET",
|
|
836
|
+
headers: addSdkUserAgentHeader(headers, SDK_USER_AGENT),
|
|
837
|
+
signal: AbortSignal.timeout(FEEDS_TIMEOUT_MS)
|
|
838
|
+
});
|
|
839
|
+
if (!response.ok) {
|
|
840
|
+
throw new Error(translate.t("packagerOrchestratorClient.feeds.errors.getAccessibleFeedsFailed", await describeFailure(response)));
|
|
841
|
+
}
|
|
842
|
+
const text = await response.text();
|
|
843
|
+
const feeds = text === "" || text === "null" ? null : JSON.parse(text);
|
|
844
|
+
return Array.isArray(feeds) ? feeds : [];
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
function feedsEndpoint(orchestratorUrl) {
|
|
848
|
+
let end = orchestratorUrl.length;
|
|
849
|
+
while (end > 0 && orchestratorUrl.charAt(end - 1) === "/") {
|
|
850
|
+
end--;
|
|
851
|
+
}
|
|
852
|
+
const trimmed = orchestratorUrl.slice(0, end);
|
|
853
|
+
if (/\/orchestrator_$/i.test(trimmed)) {
|
|
854
|
+
return `${trimmed}${FEEDS_PATH}`;
|
|
855
|
+
}
|
|
856
|
+
return hasPathSegments(trimmed) ? `${trimmed}/orchestrator_${FEEDS_PATH}` : `${trimmed}${FEEDS_PATH}`;
|
|
857
|
+
}
|
|
858
|
+
function hasPathSegments(url) {
|
|
859
|
+
const [error, parsed] = catchError(() => new URL(url));
|
|
860
|
+
if (error) {
|
|
861
|
+
return true;
|
|
862
|
+
}
|
|
863
|
+
return parsed.pathname !== "/" && parsed.pathname !== "";
|
|
864
|
+
}
|
|
865
|
+
async function describeFailure(response) {
|
|
866
|
+
const text = await response.text().catch(() => "");
|
|
867
|
+
return {
|
|
868
|
+
status: response.status,
|
|
869
|
+
statusText: response.statusText,
|
|
870
|
+
body: text ? ` - ${text.slice(0, 500)}` : ""
|
|
871
|
+
};
|
|
872
|
+
}
|
|
873
|
+
var feedsByTenant = new Map;
|
|
874
|
+
function tenantKey(connection) {
|
|
875
|
+
return JSON.stringify([
|
|
876
|
+
connection.orchestratorUrl,
|
|
877
|
+
connection.tenantId ?? ""
|
|
878
|
+
]);
|
|
879
|
+
}
|
|
880
|
+
function getAccessibleFeedsOnce(connection, fetchFeeds) {
|
|
881
|
+
const key = tenantKey(connection);
|
|
882
|
+
const inFlight = feedsByTenant.get(key);
|
|
883
|
+
if (inFlight) {
|
|
884
|
+
return inFlight;
|
|
885
|
+
}
|
|
886
|
+
const request = fetchFeeds();
|
|
887
|
+
feedsByTenant.set(key, request);
|
|
888
|
+
request.catch(() => {
|
|
889
|
+
if (feedsByTenant.get(key) === request) {
|
|
890
|
+
feedsByTenant.delete(key);
|
|
891
|
+
}
|
|
892
|
+
});
|
|
893
|
+
return request;
|
|
894
|
+
}
|
|
895
|
+
var FEEDS_FILE_NAME = "nuget-feeds.json";
|
|
896
|
+
var LIBRARIES_PURPOSE = "Libraries";
|
|
897
|
+
var NO_FEEDS = { dispose: async () => {} };
|
|
898
|
+
|
|
899
|
+
class OrchestratorFeedComposer {
|
|
900
|
+
fileSystem;
|
|
901
|
+
logger;
|
|
902
|
+
feedsService;
|
|
903
|
+
constructor(fileSystem, logger, feedsService) {
|
|
904
|
+
this.fileSystem = fileSystem;
|
|
905
|
+
this.logger = logger;
|
|
906
|
+
this.feedsService = feedsService ?? new OrchestratorFeedsService(logger);
|
|
907
|
+
}
|
|
908
|
+
async composeAsync({
|
|
909
|
+
connection
|
|
910
|
+
}) {
|
|
911
|
+
const feeds = await this.resolveTenantFeeds(connection);
|
|
912
|
+
if (feeds.length === 0) {
|
|
913
|
+
return NO_FEEDS;
|
|
914
|
+
}
|
|
915
|
+
const [error, composed] = await catchError(this.writeFeedsFile(feeds));
|
|
916
|
+
if (error || !composed) {
|
|
917
|
+
this.warnFeedsUnavailable();
|
|
918
|
+
return NO_FEEDS;
|
|
919
|
+
}
|
|
920
|
+
return composed;
|
|
921
|
+
}
|
|
922
|
+
async resolveTenantFeeds(connection) {
|
|
923
|
+
if (!connection?.accessToken || !connection.cloudUrl) {
|
|
924
|
+
return [];
|
|
925
|
+
}
|
|
926
|
+
const { accessToken, cloudUrl, tenantId } = connection;
|
|
927
|
+
const orchestratorConnection = {
|
|
928
|
+
orchestratorUrl: cloudUrl,
|
|
929
|
+
accessToken,
|
|
930
|
+
tenantId
|
|
931
|
+
};
|
|
932
|
+
const [error, feeds] = await catchError(getAccessibleFeedsOnce(orchestratorConnection, () => this.feedsService.getAccessibleFeedsAsync(orchestratorConnection)));
|
|
933
|
+
if (error || !feeds) {
|
|
934
|
+
this.warnFeedsUnavailable();
|
|
935
|
+
return [];
|
|
936
|
+
}
|
|
937
|
+
return feeds.map((feed) => toTenantFeedSource(feed, accessToken)).filter((feed) => feed !== undefined);
|
|
938
|
+
}
|
|
939
|
+
async writeFeedsFile(feeds) {
|
|
940
|
+
const storage = new TemporaryStorageService(this.fileSystem);
|
|
941
|
+
const directory = await storage.getTempFolderPath();
|
|
942
|
+
const configPath = Path.join(directory, FEEDS_FILE_NAME);
|
|
943
|
+
await this.fileSystem.writeFile(configPath, JSON.stringify(feeds));
|
|
944
|
+
return { configPath, dispose: () => storage.cleanup() };
|
|
945
|
+
}
|
|
946
|
+
warnFeedsUnavailable() {
|
|
947
|
+
this.logger.warn(translate2.t("packagerOrchestratorClient.feeds.warnings.tenantFeedsUnavailable"));
|
|
948
|
+
}
|
|
949
|
+
}
|
|
950
|
+
function toTenantFeedSource(feed, accessToken) {
|
|
951
|
+
if (feed.purpose !== LIBRARIES_PURPOSE || !feed.feedUrl) {
|
|
952
|
+
return;
|
|
953
|
+
}
|
|
954
|
+
return { Url: feed.feedUrl, AccessToken: accessToken };
|
|
955
|
+
}
|
|
956
|
+
|
|
659
957
|
// src/workflow-compiler-tool.ts
|
|
660
958
|
import {
|
|
661
959
|
LogLevel,
|
|
@@ -667,16 +965,16 @@ import { spawn } from "node:child_process";
|
|
|
667
965
|
import {
|
|
668
966
|
ToolErrorCodes,
|
|
669
967
|
ToolResult,
|
|
670
|
-
translate as
|
|
968
|
+
translate as translate5
|
|
671
969
|
} from "@uipath/solutionpackager-tool-core";
|
|
672
970
|
|
|
673
971
|
// src/workflow-compiler-path-resolver.ts
|
|
674
972
|
import { execFileSync } from "node:child_process";
|
|
675
973
|
import { homedir, platform } from "node:os";
|
|
676
974
|
import {
|
|
677
|
-
Path,
|
|
678
|
-
TemporaryStorageService,
|
|
679
|
-
translate
|
|
975
|
+
Path as Path2,
|
|
976
|
+
TemporaryStorageService as TemporaryStorageService2,
|
|
977
|
+
translate as translate3
|
|
680
978
|
} from "@uipath/solutionpackager-tool-core";
|
|
681
979
|
|
|
682
980
|
// src/workflow-compiler-config.ts
|
|
@@ -724,7 +1022,7 @@ class WorkflowCompilerPathResolver {
|
|
|
724
1022
|
constructor(logger, fileSystem) {
|
|
725
1023
|
this.logger = logger;
|
|
726
1024
|
this.fileSystem = fileSystem;
|
|
727
|
-
this.tempStorage = new
|
|
1025
|
+
this.tempStorage = new TemporaryStorageService2(fileSystem);
|
|
728
1026
|
}
|
|
729
1027
|
static getInstance(logger, fileSystem) {
|
|
730
1028
|
if (!WorkflowCompilerPathResolver.instance) {
|
|
@@ -734,7 +1032,7 @@ class WorkflowCompilerPathResolver {
|
|
|
734
1032
|
}
|
|
735
1033
|
async getCompilerPathAsync() {
|
|
736
1034
|
if (this.cachedPath) {
|
|
737
|
-
this.logger.info(
|
|
1035
|
+
this.logger.info(translate3.t("toolWorkflowcompiler.pathResolver.info.usingCached", { path: this.cachedPath }));
|
|
738
1036
|
return this.cachedPath;
|
|
739
1037
|
}
|
|
740
1038
|
if (this.pendingResolution) {
|
|
@@ -742,7 +1040,7 @@ class WorkflowCompilerPathResolver {
|
|
|
742
1040
|
}
|
|
743
1041
|
this.pendingResolution = this.resolveCompilerPath();
|
|
744
1042
|
this.cachedPath = await this.pendingResolution;
|
|
745
|
-
this.logger.info(
|
|
1043
|
+
this.logger.info(translate3.t("toolWorkflowcompiler.pathResolver.info.resolved", {
|
|
746
1044
|
path: this.cachedPath
|
|
747
1045
|
}));
|
|
748
1046
|
return this.cachedPath;
|
|
@@ -750,30 +1048,30 @@ class WorkflowCompilerPathResolver {
|
|
|
750
1048
|
async resolveCompilerPath() {
|
|
751
1049
|
this.logger.info("[PathResolver] resolveCompilerPath started");
|
|
752
1050
|
if (workflowCompilerConfig.workflowCompilerPath) {
|
|
753
|
-
this.logger.info(
|
|
1051
|
+
this.logger.info(translate3.t("toolWorkflowcompiler.pathResolver.info.usingExplicitPath", { path: workflowCompilerConfig.workflowCompilerPath }));
|
|
754
1052
|
return workflowCompilerConfig.workflowCompilerPath;
|
|
755
1053
|
}
|
|
756
|
-
this.logger.info(
|
|
1054
|
+
this.logger.info(translate3.t("toolWorkflowcompiler.pathResolver.info.resolving"));
|
|
757
1055
|
const envPath = await this.findInEnvLocation();
|
|
758
1056
|
if (envPath)
|
|
759
1057
|
return envPath;
|
|
760
1058
|
const version = workflowCompilerConfig.workflowCompilerVersion;
|
|
761
1059
|
const compilerPath = this.getNuGetCompilerPath(version);
|
|
762
|
-
this.logger.info(
|
|
1060
|
+
this.logger.info(translate3.t("toolWorkflowcompiler.pathResolver.info.checkingNuGetCache", { path: compilerPath }));
|
|
763
1061
|
if (await this.fileSystem.exists(compilerPath)) {
|
|
764
|
-
this.logger.info(
|
|
1062
|
+
this.logger.info(translate3.t("toolWorkflowcompiler.pathResolver.info.foundInNuGetCache"));
|
|
765
1063
|
return compilerPath;
|
|
766
1064
|
}
|
|
767
|
-
this.logger.info(
|
|
1065
|
+
this.logger.info(translate3.t("toolWorkflowcompiler.pathResolver.info.notFoundStartingInstall"));
|
|
768
1066
|
return this.restoreAndResolve(compilerPath, version);
|
|
769
1067
|
}
|
|
770
1068
|
async findInEnvLocation() {
|
|
771
1069
|
const location = process.env.UIPATH_WORKFLOWCOMPILER_LOCATION;
|
|
772
1070
|
if (!location)
|
|
773
1071
|
return null;
|
|
774
|
-
this.logger.info(
|
|
1072
|
+
this.logger.info(translate3.t("toolWorkflowcompiler.pathResolver.info.checkingEnvVar", { path: location }));
|
|
775
1073
|
if (location.endsWith(".dll") && await this.fileSystem.exists(location)) {
|
|
776
|
-
this.logger.info(
|
|
1074
|
+
this.logger.info(translate3.t("toolWorkflowcompiler.pathResolver.info.foundViaEnv"));
|
|
777
1075
|
return location;
|
|
778
1076
|
}
|
|
779
1077
|
return null;
|
|
@@ -782,11 +1080,11 @@ class WorkflowCompilerPathResolver {
|
|
|
782
1080
|
const packageId = this.getPackageId();
|
|
783
1081
|
const tempDir = await this.tempStorage.getTempFolderPath();
|
|
784
1082
|
try {
|
|
785
|
-
this.logger.info(
|
|
1083
|
+
this.logger.info(translate3.t("toolWorkflowcompiler.pathResolver.info.restoringPackage", { packageName: packageId, version, platform: platform() }));
|
|
786
1084
|
const csproj = RESTORE_CSPROJ_TEMPLATE.replace("{packageId}", packageId).replace("{version}", version);
|
|
787
|
-
await this.fileSystem.writeFile(
|
|
788
|
-
await this.fileSystem.writeFile(
|
|
789
|
-
this.logger.info(
|
|
1085
|
+
await this.fileSystem.writeFile(Path2.join(tempDir, "restore.csproj"), csproj);
|
|
1086
|
+
await this.fileSystem.writeFile(Path2.join(tempDir, "nuget.config"), EMPTY_NUGET_CONFIG);
|
|
1087
|
+
this.logger.info(translate3.t("toolWorkflowcompiler.pathResolver.info.runningDotnetRestore"));
|
|
790
1088
|
try {
|
|
791
1089
|
execFileSync("dotnet", [
|
|
792
1090
|
"restore",
|
|
@@ -803,29 +1101,29 @@ class WorkflowCompilerPathResolver {
|
|
|
803
1101
|
const stderr = err?.stderr ? String(err.stderr).trim() : "";
|
|
804
1102
|
const stdout = err?.stdout ? String(err.stdout).trim() : "";
|
|
805
1103
|
const details = stderr || stdout || (error instanceof Error ? error.message : String(error));
|
|
806
|
-
throw new Error(
|
|
1104
|
+
throw new Error(translate3.t("toolWorkflowcompiler.pathResolver.errors.dotnetRestoreFailed", { details }));
|
|
807
1105
|
}
|
|
808
|
-
this.logger.info(
|
|
1106
|
+
this.logger.info(translate3.t("toolWorkflowcompiler.pathResolver.info.restoreCompleted"));
|
|
809
1107
|
if (!await this.fileSystem.exists(compilerPath)) {
|
|
810
|
-
throw new Error(
|
|
1108
|
+
throw new Error(translate3.t("toolWorkflowcompiler.pathResolver.errors.compilerNotFoundAfterRestore"));
|
|
811
1109
|
}
|
|
812
|
-
this.logger.info(
|
|
1110
|
+
this.logger.info(translate3.t("toolWorkflowcompiler.pathResolver.info.installCompleted"));
|
|
813
1111
|
return compilerPath;
|
|
814
1112
|
} finally {
|
|
815
|
-
this.logger.info(
|
|
1113
|
+
this.logger.info(translate3.t("toolWorkflowcompiler.pathResolver.info.cleaningUp"));
|
|
816
1114
|
await this.tempStorage.cleanup();
|
|
817
1115
|
}
|
|
818
1116
|
}
|
|
819
1117
|
getPackageId() {
|
|
820
1118
|
const packageId = PLATFORM_PACKAGE_IDS[platform()];
|
|
821
1119
|
if (!packageId) {
|
|
822
|
-
throw new Error(
|
|
1120
|
+
throw new Error(translate3.t("toolWorkflowcompiler.pathResolver.errors.unsupportedPlatform", { platform: platform() }));
|
|
823
1121
|
}
|
|
824
1122
|
return packageId;
|
|
825
1123
|
}
|
|
826
1124
|
getNuGetCompilerPath(version) {
|
|
827
|
-
const cacheRoot = process.env.NUGET_PACKAGES ??
|
|
828
|
-
return
|
|
1125
|
+
const cacheRoot = process.env.NUGET_PACKAGES ?? Path2.join(homedir(), ".nuget", "packages");
|
|
1126
|
+
return Path2.join(cacheRoot, this.getPackageId().toLowerCase(), version.toLowerCase(), "WorkflowCompiler", WORKFLOW_COMPILER_DLL_NAME);
|
|
829
1127
|
}
|
|
830
1128
|
}
|
|
831
1129
|
|
|
@@ -870,7 +1168,7 @@ class WorkflowCompilerExecutor {
|
|
|
870
1168
|
const elapsed = Date.now() - startTime;
|
|
871
1169
|
if (result) {
|
|
872
1170
|
result.elapsed = elapsed;
|
|
873
|
-
this.logger.info(
|
|
1171
|
+
this.logger.info(translate5.t("toolWorkflowcompiler.lifecycle.completed", {
|
|
874
1172
|
operation,
|
|
875
1173
|
elapsed: elapsed.toString(),
|
|
876
1174
|
errorCode: result.errorCode
|
|
@@ -881,10 +1179,10 @@ class WorkflowCompilerExecutor {
|
|
|
881
1179
|
} else {
|
|
882
1180
|
const exitCode = childProcess.exitCode ?? -1;
|
|
883
1181
|
const errorMessage = fallbackErrors.join(`
|
|
884
|
-
`) ||
|
|
1182
|
+
`) || translate5.t("toolWorkflowcompiler.errors.processExited", {
|
|
885
1183
|
exitCode: exitCode.toString()
|
|
886
1184
|
});
|
|
887
|
-
this.logger.error(
|
|
1185
|
+
this.logger.error(translate5.t("toolWorkflowcompiler.errors.failed", {
|
|
888
1186
|
operation,
|
|
889
1187
|
errorMessage
|
|
890
1188
|
}));
|
|
@@ -921,10 +1219,10 @@ class WorkflowCompilerExecutor {
|
|
|
921
1219
|
}
|
|
922
1220
|
logCommandStart(operation, executable, commandArgs) {
|
|
923
1221
|
const fullCommand = [executable, ...commandArgs];
|
|
924
|
-
this.logger.info(
|
|
1222
|
+
this.logger.info(translate5.t("toolWorkflowcompiler.lifecycle.started", {
|
|
925
1223
|
operation
|
|
926
1224
|
}));
|
|
927
|
-
this.logger.info(
|
|
1225
|
+
this.logger.info(translate5.t("toolWorkflowcompiler.lifecycle.command", {
|
|
928
1226
|
command: fullCommand.join(" ")
|
|
929
1227
|
}));
|
|
930
1228
|
}
|
|
@@ -1018,10 +1316,10 @@ class WorkflowCompilerExecutor {
|
|
|
1018
1316
|
setupProcessEventHandlers(childProcess, streamCompletion, resolve) {
|
|
1019
1317
|
childProcess.on("exit", () => streamCompletion.markProcessExited());
|
|
1020
1318
|
childProcess.on("error", (error) => {
|
|
1021
|
-
this.logger.error(
|
|
1319
|
+
this.logger.error(translate5.t("toolWorkflowcompiler.errors.processError", {
|
|
1022
1320
|
message: error.message
|
|
1023
1321
|
}));
|
|
1024
|
-
resolve(new ToolResult(ToolErrorCodes.InternalError,
|
|
1322
|
+
resolve(new ToolResult(ToolErrorCodes.InternalError, translate5.t("toolWorkflowcompiler.errors.startFailed", {
|
|
1025
1323
|
message: error.message
|
|
1026
1324
|
}), []));
|
|
1027
1325
|
});
|
|
@@ -1030,9 +1328,9 @@ class WorkflowCompilerExecutor {
|
|
|
1030
1328
|
if (!cancellationToken)
|
|
1031
1329
|
return;
|
|
1032
1330
|
cancellationToken.addEventListener("abort", () => {
|
|
1033
|
-
this.logger.warn(
|
|
1331
|
+
this.logger.warn(translate5.t("toolWorkflowcompiler.lifecycle.cancelled"));
|
|
1034
1332
|
childProcess.kill("SIGTERM");
|
|
1035
|
-
resolve(new ToolResult(ToolErrorCodes.Canceled,
|
|
1333
|
+
resolve(new ToolResult(ToolErrorCodes.Canceled, translate5.t("toolWorkflowcompiler.errors.operationCancelled"), []));
|
|
1036
1334
|
});
|
|
1037
1335
|
}
|
|
1038
1336
|
parseOutputEntry(line) {
|
|
@@ -1076,143 +1374,165 @@ function getAdditionalResultDetails(result) {
|
|
|
1076
1374
|
|
|
1077
1375
|
// src/workflow-compiler-tool.ts
|
|
1078
1376
|
class WorkflowCompilerTool extends ProjectTool {
|
|
1377
|
+
context;
|
|
1079
1378
|
executor;
|
|
1080
|
-
constructor(fileSystem, logger) {
|
|
1379
|
+
constructor(fileSystem, logger, context) {
|
|
1081
1380
|
super(fileSystem, logger);
|
|
1381
|
+
this.context = context;
|
|
1082
1382
|
this.executor = new WorkflowCompilerExecutor(logger, fileSystem);
|
|
1083
1383
|
}
|
|
1084
|
-
async
|
|
1085
|
-
const
|
|
1086
|
-
|
|
1087
|
-
options.
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
`--exclude-configured-sources`,
|
|
1095
|
-
`${options.excludeConfiguredSources}`
|
|
1096
|
-
];
|
|
1097
|
-
if (options.nuGetSourcesConfigPath) {
|
|
1098
|
-
args.push(`--nuget-config-file`, options.nuGetSourcesConfigPath);
|
|
1384
|
+
async withNuGetConfig(options, run) {
|
|
1385
|
+
const connection = this.context?.connection;
|
|
1386
|
+
if (options.nuGetSourcesConfigPath || !connection) {
|
|
1387
|
+
return run(options.nuGetSourcesConfigPath);
|
|
1388
|
+
}
|
|
1389
|
+
const composed = await new OrchestratorFeedComposer(this.fileSystem, this.logger).composeAsync({ connection });
|
|
1390
|
+
try {
|
|
1391
|
+
return await run(composed.configPath);
|
|
1392
|
+
} finally {
|
|
1393
|
+
await composed.dispose();
|
|
1099
1394
|
}
|
|
1100
|
-
|
|
1395
|
+
}
|
|
1396
|
+
async restoreAsync(options, cancellationToken) {
|
|
1397
|
+
return this.withNuGetConfig(options, (nuGetConfigPath) => {
|
|
1398
|
+
const args = [
|
|
1399
|
+
`-p`,
|
|
1400
|
+
options.projectPath,
|
|
1401
|
+
`--log-level`,
|
|
1402
|
+
String(options.logLevel ?? LogLevel.Info),
|
|
1403
|
+
`--destination`,
|
|
1404
|
+
options.outputPath ?? "",
|
|
1405
|
+
`--format-logs`,
|
|
1406
|
+
`true`,
|
|
1407
|
+
`--exclude-configured-sources`,
|
|
1408
|
+
`${options.excludeConfiguredSources}`
|
|
1409
|
+
];
|
|
1410
|
+
if (nuGetConfigPath) {
|
|
1411
|
+
args.push(`--nuget-config-file`, nuGetConfigPath);
|
|
1412
|
+
}
|
|
1413
|
+
return this.executor.executeAsync("restore", args, cancellationToken);
|
|
1414
|
+
});
|
|
1101
1415
|
}
|
|
1102
1416
|
async validateAsync(options, cancellationToken) {
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1417
|
+
return this.withNuGetConfig(options, (nuGetConfigPath) => {
|
|
1418
|
+
const args = [
|
|
1419
|
+
`-p`,
|
|
1420
|
+
options.projectPath,
|
|
1421
|
+
`--log-level`,
|
|
1422
|
+
String(options.logLevel ?? LogLevel.Info),
|
|
1423
|
+
`--format-logs`,
|
|
1424
|
+
`true`,
|
|
1425
|
+
`--skip-analyze`,
|
|
1426
|
+
`${options.skipAnalyze}`,
|
|
1427
|
+
`--skip-validate`,
|
|
1428
|
+
`${options.skipValidate}`,
|
|
1429
|
+
`--exclude-configured-sources`,
|
|
1430
|
+
`${options.excludeConfiguredSources}`
|
|
1431
|
+
];
|
|
1432
|
+
if (options.detailedLogPath) {
|
|
1433
|
+
args.push(`--detailed`, options.detailedLogPath);
|
|
1434
|
+
}
|
|
1435
|
+
if (options.defaultSeverity) {
|
|
1436
|
+
args.push(`--default-severity`, options.defaultSeverity);
|
|
1437
|
+
}
|
|
1438
|
+
if (options.policyFilePath) {
|
|
1439
|
+
args.push(`--policy-file`, options.policyFilePath);
|
|
1440
|
+
}
|
|
1441
|
+
if (options.policyFileType) {
|
|
1442
|
+
args.push(`--policy-file-type`, `${options.policyFileType}`);
|
|
1443
|
+
}
|
|
1444
|
+
if (nuGetConfigPath) {
|
|
1445
|
+
args.push(`--nuget-config-file`, nuGetConfigPath);
|
|
1446
|
+
}
|
|
1447
|
+
return this.executor.executeAsync("validate", args, cancellationToken);
|
|
1448
|
+
});
|
|
1133
1449
|
}
|
|
1134
1450
|
async buildAsync(options, cancellationToken) {
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1451
|
+
return this.withNuGetConfig(options, (nuGetConfigPath) => {
|
|
1452
|
+
const args = [
|
|
1453
|
+
`-p`,
|
|
1454
|
+
options.projectPath,
|
|
1455
|
+
`-o`,
|
|
1456
|
+
options.outputPath,
|
|
1457
|
+
`--log-level`,
|
|
1458
|
+
String(options.logLevel ?? LogLevel.Info),
|
|
1459
|
+
`--format-logs`,
|
|
1460
|
+
`true`,
|
|
1461
|
+
`--skip-analyze`,
|
|
1462
|
+
`${options.skipAnalyze}`,
|
|
1463
|
+
`--skip-validate`,
|
|
1464
|
+
`${options.skipValidate}`,
|
|
1465
|
+
`--exclude-configured-sources`,
|
|
1466
|
+
`${options.excludeConfiguredSources}`
|
|
1467
|
+
];
|
|
1468
|
+
if (options.detailedLogPath) {
|
|
1469
|
+
args.push(`--detailed`, options.detailedLogPath);
|
|
1470
|
+
}
|
|
1471
|
+
if (options.policyFilePath) {
|
|
1472
|
+
args.push(`--policy-file`, options.policyFilePath);
|
|
1473
|
+
}
|
|
1474
|
+
if (options.policyFileType) {
|
|
1475
|
+
args.push(`--policy-file-type`, `${options.policyFileType}`);
|
|
1476
|
+
}
|
|
1477
|
+
if (options.outputType) {
|
|
1478
|
+
const outputType = this.mapOutputType(options.outputType);
|
|
1479
|
+
args.push(`--output-type`, outputType);
|
|
1480
|
+
}
|
|
1481
|
+
if (nuGetConfigPath) {
|
|
1482
|
+
args.push(`--nuget-config-file`, nuGetConfigPath);
|
|
1483
|
+
}
|
|
1484
|
+
return this.executor.executeAsync("build", args, cancellationToken);
|
|
1485
|
+
});
|
|
1168
1486
|
}
|
|
1169
1487
|
async packAsync(options, cancellationToken) {
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1488
|
+
return this.withNuGetConfig(options, async (nuGetConfigPath) => {
|
|
1489
|
+
const args = [
|
|
1490
|
+
`-p`,
|
|
1491
|
+
options.projectPath,
|
|
1492
|
+
`-o`,
|
|
1493
|
+
options.outputPath,
|
|
1494
|
+
`--build-version`,
|
|
1495
|
+
options.package.version,
|
|
1496
|
+
`--log-level`,
|
|
1497
|
+
String(options.logLevel ?? LogLevel.Info),
|
|
1498
|
+
`--format-logs`,
|
|
1499
|
+
`true`,
|
|
1500
|
+
`--skip-analyze`,
|
|
1501
|
+
`${options.skipAnalyze}`,
|
|
1502
|
+
`--skip-validate`,
|
|
1503
|
+
`${options.skipValidate}`,
|
|
1504
|
+
`--no-optimize-deps`,
|
|
1505
|
+
`${options.skipDependencyOptimization}`,
|
|
1506
|
+
`--include-sources`,
|
|
1507
|
+
`${options.includeSources}`,
|
|
1508
|
+
`--split-packages`,
|
|
1509
|
+
`${options.splitPackages}`,
|
|
1510
|
+
`--exclude-configured-sources`,
|
|
1511
|
+
`${options.excludeConfiguredSources}`,
|
|
1512
|
+
`--pack-options`,
|
|
1513
|
+
JSON.stringify(options.package)
|
|
1514
|
+
];
|
|
1515
|
+
if (options.package.id) {
|
|
1516
|
+
args.push(`--package-name`, options.package.id);
|
|
1517
|
+
}
|
|
1518
|
+
if (options.detailedLogPath) {
|
|
1519
|
+
args.push(`--detailed`, options.detailedLogPath);
|
|
1520
|
+
}
|
|
1521
|
+
if (options.policyFilePath) {
|
|
1522
|
+
args.push(`--policy-file`, options.policyFilePath);
|
|
1523
|
+
}
|
|
1524
|
+
if (options.policyFileType) {
|
|
1525
|
+
args.push(`--policy-file-type`, options.policyFileType);
|
|
1526
|
+
}
|
|
1527
|
+
if (options.outputType) {
|
|
1528
|
+
const outputType = this.mapOutputType(options.outputType);
|
|
1529
|
+
args.push(`--output-type`, outputType);
|
|
1530
|
+
}
|
|
1531
|
+
if (nuGetConfigPath) {
|
|
1532
|
+
args.push(`--nuget-config-file`, nuGetConfigPath);
|
|
1533
|
+
}
|
|
1534
|
+
return this.executor.executeAsync("build", args, cancellationToken);
|
|
1535
|
+
});
|
|
1216
1536
|
}
|
|
1217
1537
|
mapOutputType(outputType) {
|
|
1218
1538
|
return outputType === "WebApp" ? "Process" : outputType;
|
|
@@ -1228,11 +1548,11 @@ class WorkflowCompilerToolFactory {
|
|
|
1228
1548
|
ProjectTypes.Tests,
|
|
1229
1549
|
ProjectTypes.WebApp
|
|
1230
1550
|
];
|
|
1231
|
-
async createAsync(logger, fileSystem) {
|
|
1551
|
+
async createAsync(logger, fileSystem, context) {
|
|
1232
1552
|
if (!this.isDotnetAvailable()) {
|
|
1233
|
-
throw new Error(
|
|
1553
|
+
throw new Error(translate6.t("toolWorkflowcompiler.errors.dotnetNotAvailable"));
|
|
1234
1554
|
}
|
|
1235
|
-
return new WorkflowCompilerTool(fileSystem, logger);
|
|
1555
|
+
return new WorkflowCompilerTool(fileSystem, logger, context);
|
|
1236
1556
|
}
|
|
1237
1557
|
isDotnetAvailable() {
|
|
1238
1558
|
if (WorkflowCompilerToolFactory.cachedDotnetAvailable !== undefined) {
|
|
@@ -1254,4 +1574,4 @@ export {
|
|
|
1254
1574
|
WorkflowCompilerToolFactory
|
|
1255
1575
|
};
|
|
1256
1576
|
|
|
1257
|
-
//# debugId=
|
|
1577
|
+
//# debugId=3093E6E2D5D9AED664756E2164756E21
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type IFileSystem, type IProjectToolFactory, type IToolLogger, type ProjectTool, type ProjectType } from "@uipath/solutionpackager-tool-core";
|
|
1
|
+
import { type IFileSystem, type IProjectToolFactory, type IToolLogger, type ProjectOperationContext, type ProjectTool, type ProjectType } from "@uipath/solutionpackager-tool-core";
|
|
2
2
|
/**
|
|
3
3
|
* Factory for creating a workflow compiler tool.
|
|
4
4
|
* Handles Process, Library, WebApp, and Tests project types.
|
|
@@ -11,6 +11,6 @@ export declare class WorkflowCompilerToolFactory implements IProjectToolFactory
|
|
|
11
11
|
*/
|
|
12
12
|
private static cachedDotnetAvailable;
|
|
13
13
|
readonly supportedTypes: readonly ProjectType[];
|
|
14
|
-
createAsync(logger: IToolLogger, fileSystem: IFileSystem): Promise<ProjectTool>;
|
|
14
|
+
createAsync(logger: IToolLogger, fileSystem: IFileSystem, context?: ProjectOperationContext): Promise<ProjectTool>;
|
|
15
15
|
private isDotnetAvailable;
|
|
16
16
|
}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import { type IFileSystem, type IProjectBuildOptions, type IProjectPackOptions, type IProjectRestoreOptions, type IProjectValidateOptions, type IToolLogger, ProjectTool, type ToolResult } from "@uipath/solutionpackager-tool-core";
|
|
1
|
+
import { type IFileSystem, type IProjectBuildOptions, type IProjectPackOptions, type IProjectRestoreOptions, type IProjectValidateOptions, type IToolLogger, type ProjectOperationContext, ProjectTool, type ToolResult } from "@uipath/solutionpackager-tool-core";
|
|
2
2
|
/**
|
|
3
3
|
* Workflow compiler tool implementation.
|
|
4
4
|
* Builds commands and delegates execution to WorkflowCompilerExecutor.
|
|
5
5
|
*/
|
|
6
6
|
export declare class WorkflowCompilerTool extends ProjectTool {
|
|
7
|
+
private readonly context?;
|
|
7
8
|
private readonly executor;
|
|
8
|
-
constructor(fileSystem: IFileSystem, logger: IToolLogger);
|
|
9
|
+
constructor(fileSystem: IFileSystem, logger: IToolLogger, context?: ProjectOperationContext | undefined);
|
|
10
|
+
private withNuGetConfig;
|
|
9
11
|
restoreAsync(options: IProjectRestoreOptions, cancellationToken?: AbortSignal): Promise<ToolResult>;
|
|
10
12
|
validateAsync(options: IProjectValidateOptions, cancellationToken?: AbortSignal): Promise<ToolResult>;
|
|
11
13
|
buildAsync(options: IProjectBuildOptions, cancellationToken?: AbortSignal): Promise<ToolResult>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uipath/packager-tool-workflowcompiler",
|
|
3
|
-
"version": "1.197.0-preview.
|
|
3
|
+
"version": "1.197.0-preview.65",
|
|
4
4
|
"description": "UiPath Workflow Compiler tool implementation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -28,5 +28,5 @@
|
|
|
28
28
|
"@uipath/solutionpackager-tool-core": "1.197.0"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {},
|
|
31
|
-
"gitHead": "
|
|
31
|
+
"gitHead": "9388ccbe5e739c9578bfd9b5395980fb63e11d9c"
|
|
32
32
|
}
|
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
type IFileSystem,
|
|
4
4
|
type IProjectToolFactory,
|
|
5
5
|
type IToolLogger,
|
|
6
|
+
type ProjectOperationContext,
|
|
6
7
|
type ProjectTool,
|
|
7
8
|
type ProjectType,
|
|
8
9
|
ProjectTypes,
|
|
@@ -32,13 +33,14 @@ export class WorkflowCompilerToolFactory implements IProjectToolFactory {
|
|
|
32
33
|
async createAsync(
|
|
33
34
|
logger: IToolLogger,
|
|
34
35
|
fileSystem: IFileSystem,
|
|
36
|
+
context?: ProjectOperationContext,
|
|
35
37
|
): Promise<ProjectTool> {
|
|
36
38
|
if (!this.isDotnetAvailable()) {
|
|
37
39
|
throw new Error(
|
|
38
40
|
translate.t("toolWorkflowcompiler.errors.dotnetNotAvailable"),
|
|
39
41
|
);
|
|
40
42
|
}
|
|
41
|
-
return new WorkflowCompilerTool(fileSystem, logger);
|
|
43
|
+
return new WorkflowCompilerTool(fileSystem, logger, context);
|
|
42
44
|
}
|
|
43
45
|
|
|
44
46
|
private isDotnetAvailable(): boolean {
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
+
import { OrchestratorFeedComposer } from "@uipath/packager-orchestrator-client";
|
|
1
2
|
import {
|
|
2
3
|
type IFileSystem,
|
|
3
4
|
type IProjectBuildOptions,
|
|
5
|
+
type IProjectOptions,
|
|
4
6
|
type IProjectPackOptions,
|
|
5
7
|
type IProjectRestoreOptions,
|
|
6
8
|
type IProjectValidateOptions,
|
|
7
9
|
type IToolLogger,
|
|
8
10
|
LogLevel,
|
|
11
|
+
type ProjectOperationContext,
|
|
9
12
|
ProjectTool,
|
|
10
13
|
type ToolResult,
|
|
11
14
|
} from "@uipath/solutionpackager-tool-core";
|
|
@@ -18,166 +21,205 @@ import { WorkflowCompilerExecutor } from "./workflow-compiler-executor.js";
|
|
|
18
21
|
export class WorkflowCompilerTool extends ProjectTool {
|
|
19
22
|
private readonly executor: WorkflowCompilerExecutor;
|
|
20
23
|
|
|
21
|
-
constructor(
|
|
24
|
+
constructor(
|
|
25
|
+
fileSystem: IFileSystem,
|
|
26
|
+
logger: IToolLogger,
|
|
27
|
+
private readonly context?: ProjectOperationContext,
|
|
28
|
+
) {
|
|
22
29
|
super(fileSystem, logger);
|
|
23
30
|
this.executor = new WorkflowCompilerExecutor(logger, fileSystem);
|
|
24
31
|
}
|
|
25
32
|
|
|
33
|
+
private async withNuGetConfig(
|
|
34
|
+
options: IProjectOptions,
|
|
35
|
+
run: (nuGetConfigPath?: string) => Promise<ToolResult>,
|
|
36
|
+
): Promise<ToolResult> {
|
|
37
|
+
const connection = this.context?.connection;
|
|
38
|
+
if (options.nuGetSourcesConfigPath || !connection) {
|
|
39
|
+
return run(options.nuGetSourcesConfigPath);
|
|
40
|
+
}
|
|
41
|
+
const composed = await new OrchestratorFeedComposer(
|
|
42
|
+
this.fileSystem,
|
|
43
|
+
this.logger,
|
|
44
|
+
).composeAsync({ connection });
|
|
45
|
+
try {
|
|
46
|
+
return await run(composed.configPath);
|
|
47
|
+
} finally {
|
|
48
|
+
await composed.dispose();
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
26
52
|
async restoreAsync(
|
|
27
53
|
options: IProjectRestoreOptions,
|
|
28
54
|
cancellationToken?: AbortSignal,
|
|
29
55
|
): Promise<ToolResult> {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
56
|
+
return this.withNuGetConfig(options, (nuGetConfigPath) => {
|
|
57
|
+
const args = [
|
|
58
|
+
`-p`,
|
|
59
|
+
options.projectPath,
|
|
60
|
+
`--log-level`,
|
|
61
|
+
String(options.logLevel ?? LogLevel.Info),
|
|
62
|
+
`--destination`,
|
|
63
|
+
options.outputPath ?? "",
|
|
64
|
+
`--format-logs`,
|
|
65
|
+
`true`,
|
|
66
|
+
`--exclude-configured-sources`,
|
|
67
|
+
`${options.excludeConfiguredSources}`,
|
|
68
|
+
];
|
|
69
|
+
|
|
70
|
+
if (nuGetConfigPath) {
|
|
71
|
+
args.push(`--nuget-config-file`, nuGetConfigPath);
|
|
72
|
+
}
|
|
46
73
|
|
|
47
|
-
|
|
74
|
+
return this.executor.executeAsync(
|
|
75
|
+
"restore",
|
|
76
|
+
args,
|
|
77
|
+
cancellationToken,
|
|
78
|
+
);
|
|
79
|
+
});
|
|
48
80
|
}
|
|
49
81
|
|
|
50
82
|
async validateAsync(
|
|
51
83
|
options: IProjectValidateOptions,
|
|
52
84
|
cancellationToken?: AbortSignal,
|
|
53
85
|
): Promise<ToolResult> {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
86
|
+
return this.withNuGetConfig(options, (nuGetConfigPath) => {
|
|
87
|
+
const args = [
|
|
88
|
+
`-p`,
|
|
89
|
+
options.projectPath,
|
|
90
|
+
`--log-level`,
|
|
91
|
+
String(options.logLevel ?? LogLevel.Info),
|
|
92
|
+
`--format-logs`,
|
|
93
|
+
`true`,
|
|
94
|
+
`--skip-analyze`,
|
|
95
|
+
`${options.skipAnalyze}`,
|
|
96
|
+
`--skip-validate`,
|
|
97
|
+
`${options.skipValidate}`,
|
|
98
|
+
`--exclude-configured-sources`,
|
|
99
|
+
`${options.excludeConfiguredSources}`,
|
|
100
|
+
];
|
|
101
|
+
|
|
102
|
+
if (options.detailedLogPath) {
|
|
103
|
+
args.push(`--detailed`, options.detailedLogPath);
|
|
104
|
+
}
|
|
105
|
+
if (options.defaultSeverity) {
|
|
106
|
+
args.push(`--default-severity`, options.defaultSeverity);
|
|
107
|
+
}
|
|
108
|
+
if (options.policyFilePath) {
|
|
109
|
+
args.push(`--policy-file`, options.policyFilePath);
|
|
110
|
+
}
|
|
111
|
+
if (options.policyFileType) {
|
|
112
|
+
args.push(`--policy-file-type`, `${options.policyFileType}`);
|
|
113
|
+
}
|
|
114
|
+
if (nuGetConfigPath) {
|
|
115
|
+
args.push(`--nuget-config-file`, nuGetConfigPath);
|
|
116
|
+
}
|
|
84
117
|
|
|
85
|
-
|
|
118
|
+
return this.executor.executeAsync(
|
|
119
|
+
"validate",
|
|
120
|
+
args,
|
|
121
|
+
cancellationToken,
|
|
122
|
+
);
|
|
123
|
+
});
|
|
86
124
|
}
|
|
87
125
|
|
|
88
126
|
async buildAsync(
|
|
89
127
|
options: IProjectBuildOptions,
|
|
90
128
|
cancellationToken?: AbortSignal,
|
|
91
129
|
): Promise<ToolResult> {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
130
|
+
return this.withNuGetConfig(options, (nuGetConfigPath) => {
|
|
131
|
+
const args = [
|
|
132
|
+
`-p`,
|
|
133
|
+
options.projectPath,
|
|
134
|
+
`-o`,
|
|
135
|
+
options.outputPath,
|
|
136
|
+
`--log-level`,
|
|
137
|
+
String(options.logLevel ?? LogLevel.Info),
|
|
138
|
+
`--format-logs`,
|
|
139
|
+
`true`,
|
|
140
|
+
`--skip-analyze`,
|
|
141
|
+
`${options.skipAnalyze}`,
|
|
142
|
+
`--skip-validate`,
|
|
143
|
+
`${options.skipValidate}`,
|
|
144
|
+
`--exclude-configured-sources`,
|
|
145
|
+
`${options.excludeConfiguredSources}`,
|
|
146
|
+
];
|
|
147
|
+
|
|
148
|
+
if (options.detailedLogPath) {
|
|
149
|
+
args.push(`--detailed`, options.detailedLogPath);
|
|
150
|
+
}
|
|
151
|
+
if (options.policyFilePath) {
|
|
152
|
+
args.push(`--policy-file`, options.policyFilePath);
|
|
153
|
+
}
|
|
154
|
+
if (options.policyFileType) {
|
|
155
|
+
args.push(`--policy-file-type`, `${options.policyFileType}`);
|
|
156
|
+
}
|
|
157
|
+
if (options.outputType) {
|
|
158
|
+
const outputType = this.mapOutputType(options.outputType);
|
|
159
|
+
args.push(`--output-type`, outputType);
|
|
160
|
+
}
|
|
161
|
+
if (nuGetConfigPath) {
|
|
162
|
+
args.push(`--nuget-config-file`, nuGetConfigPath);
|
|
163
|
+
}
|
|
125
164
|
|
|
126
|
-
|
|
165
|
+
return this.executor.executeAsync("build", args, cancellationToken);
|
|
166
|
+
});
|
|
127
167
|
}
|
|
128
168
|
|
|
129
169
|
async packAsync(
|
|
130
170
|
options: IProjectPackOptions,
|
|
131
171
|
cancellationToken?: AbortSignal,
|
|
132
172
|
): Promise<ToolResult> {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
173
|
+
return this.withNuGetConfig(options, async (nuGetConfigPath) => {
|
|
174
|
+
const args: string[] = [
|
|
175
|
+
`-p`,
|
|
176
|
+
options.projectPath,
|
|
177
|
+
`-o`,
|
|
178
|
+
options.outputPath,
|
|
179
|
+
`--build-version`,
|
|
180
|
+
options.package.version,
|
|
181
|
+
`--log-level`,
|
|
182
|
+
String(options.logLevel ?? LogLevel.Info),
|
|
183
|
+
`--format-logs`,
|
|
184
|
+
`true`,
|
|
185
|
+
`--skip-analyze`,
|
|
186
|
+
`${options.skipAnalyze}`,
|
|
187
|
+
`--skip-validate`,
|
|
188
|
+
`${options.skipValidate}`,
|
|
189
|
+
`--no-optimize-deps`,
|
|
190
|
+
`${options.skipDependencyOptimization}`,
|
|
191
|
+
`--include-sources`,
|
|
192
|
+
`${options.includeSources}`,
|
|
193
|
+
`--split-packages`,
|
|
194
|
+
`${options.splitPackages}`,
|
|
195
|
+
`--exclude-configured-sources`,
|
|
196
|
+
`${options.excludeConfiguredSources}`,
|
|
197
|
+
`--pack-options`,
|
|
198
|
+
JSON.stringify(options.package),
|
|
199
|
+
];
|
|
200
|
+
|
|
201
|
+
if (options.package.id) {
|
|
202
|
+
args.push(`--package-name`, options.package.id);
|
|
203
|
+
}
|
|
204
|
+
if (options.detailedLogPath) {
|
|
205
|
+
args.push(`--detailed`, options.detailedLogPath);
|
|
206
|
+
}
|
|
207
|
+
if (options.policyFilePath) {
|
|
208
|
+
args.push(`--policy-file`, options.policyFilePath);
|
|
209
|
+
}
|
|
210
|
+
if (options.policyFileType) {
|
|
211
|
+
args.push(`--policy-file-type`, options.policyFileType);
|
|
212
|
+
}
|
|
213
|
+
if (options.outputType) {
|
|
214
|
+
const outputType = this.mapOutputType(options.outputType);
|
|
215
|
+
args.push(`--output-type`, outputType);
|
|
216
|
+
}
|
|
217
|
+
if (nuGetConfigPath) {
|
|
218
|
+
args.push(`--nuget-config-file`, nuGetConfigPath);
|
|
219
|
+
}
|
|
179
220
|
|
|
180
|
-
|
|
221
|
+
return this.executor.executeAsync("build", args, cancellationToken);
|
|
222
|
+
});
|
|
181
223
|
}
|
|
182
224
|
|
|
183
225
|
/**
|