@uipath/function-tool 1.204.0-preview.255 → 1.205.0-preview.256
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-yw3vsdrc.js → index-7gz8y4st.js} +3 -3
- package/dist/{index-7z0xbffa.js → index-9zg970m9.js} +19 -8
- package/dist/{index-hkrczw69.js → index-d5j82d97.js} +2 -2
- package/dist/{node-strategy-e5xy4ztb.js → node-strategy-nmepnk2k.js} +1 -1
- package/dist/{packager-tool-p94n5277.js → packager-tool-f7enb48c.js} +17 -6
- package/dist/packager-tool-h7ke7taj.js +59 -0
- package/dist/{packager-tool-4r3qztwy.js → packager-tool-n4sgccez.js} +124 -58
- package/dist/{packager-tool-g0hcxnae.js → packager-tool-y4vgqz1w.js} +11 -1
- package/dist/packager-tool.js +62 -54
- package/dist/tool.js +14 -58
- package/package.json +2 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getAuthEnv
|
|
3
|
-
} from "./packager-tool-
|
|
3
|
+
} from "./packager-tool-n4sgccez.js";
|
|
4
4
|
import {
|
|
5
5
|
OutputFormatter,
|
|
6
6
|
RESULTS,
|
|
@@ -11,12 +11,12 @@ import {
|
|
|
11
11
|
getOutputSink,
|
|
12
12
|
logger,
|
|
13
13
|
processContext
|
|
14
|
-
} from "./packager-tool-
|
|
14
|
+
} from "./packager-tool-f7enb48c.js";
|
|
15
15
|
import"./packager-tool-0gctz400.js";
|
|
16
16
|
import"./packager-tool-qa9gftnj.js";
|
|
17
17
|
import {
|
|
18
18
|
getFileSystem
|
|
19
|
-
} from "./packager-tool-
|
|
19
|
+
} from "./packager-tool-y4vgqz1w.js";
|
|
20
20
|
import"./packager-tool-yc4kw997.js";
|
|
21
21
|
import"./packager-tool-1de529jm.js";
|
|
22
22
|
|
|
@@ -8,10 +8,11 @@ import {
|
|
|
8
8
|
getSdkUserAgentToken,
|
|
9
9
|
installSdkUserAgentHeader,
|
|
10
10
|
logger,
|
|
11
|
+
quoteForShell,
|
|
11
12
|
summarizePlatformBody,
|
|
12
13
|
unsupportedSolutionProjectType
|
|
13
|
-
} from "./packager-tool-
|
|
14
|
-
import"./packager-tool-
|
|
14
|
+
} from "./packager-tool-f7enb48c.js";
|
|
15
|
+
import"./packager-tool-y4vgqz1w.js";
|
|
15
16
|
import {
|
|
16
17
|
__commonJS,
|
|
17
18
|
__toESM
|
|
@@ -577,7 +578,7 @@ var package_default = {
|
|
|
577
578
|
name: "@uipath/solution-sdk",
|
|
578
579
|
author: "UiPath",
|
|
579
580
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
580
|
-
version: "1.
|
|
581
|
+
version: "1.205.0-preview.256",
|
|
581
582
|
repository: {
|
|
582
583
|
type: "git",
|
|
583
584
|
url: "https://github.com/UiPath/cli.git",
|
|
@@ -606,6 +607,14 @@ var package_default = {
|
|
|
606
607
|
"./auth": {
|
|
607
608
|
types: "./dist/src/solution-auth.d.ts",
|
|
608
609
|
default: "./dist/solution-auth.js"
|
|
610
|
+
},
|
|
611
|
+
"./deployments": {
|
|
612
|
+
types: "./dist/src/deployment-search.d.ts",
|
|
613
|
+
default: "./dist/deployment-search.js"
|
|
614
|
+
},
|
|
615
|
+
"./packages": {
|
|
616
|
+
types: "./dist/src/package-search.d.ts",
|
|
617
|
+
default: "./dist/package-search.js"
|
|
609
618
|
}
|
|
610
619
|
},
|
|
611
620
|
bin: {
|
|
@@ -616,7 +625,7 @@ var package_default = {
|
|
|
616
625
|
],
|
|
617
626
|
private: false,
|
|
618
627
|
scripts: {
|
|
619
|
-
build: "bun build ./src/index.ts ./src/resources/index.ts ./src/solution-auth.ts --outdir dist --format esm --target node --splitting --sourcemap=linked && bun build ./src/scripts/generate-sdk.ts --outdir dist/scripts --format esm --target node --sourcemap=linked && tsc -p tsconfig.build.json --noCheck",
|
|
628
|
+
build: "bun build ./src/index.ts ./src/resources/index.ts ./src/solution-auth.ts ./src/deployment-search.ts ./src/package-search.ts --outdir dist --format esm --target node --splitting --sourcemap=linked && bun build ./src/scripts/generate-sdk.ts --outdir dist/scripts --format esm --target node --sourcemap=linked && tsc -p tsconfig.build.json --noCheck",
|
|
620
629
|
generate: "bun run src/scripts/generate-sdk.ts",
|
|
621
630
|
lint: "biome check .",
|
|
622
631
|
test: "vitest run",
|
|
@@ -628,7 +637,8 @@ var package_default = {
|
|
|
628
637
|
"@uipath/common": "workspace:*",
|
|
629
638
|
"@uipath/filesystem": "workspace:*",
|
|
630
639
|
"@uipath/orchestrator-sdk": "workspace:*",
|
|
631
|
-
"@uipath/
|
|
640
|
+
"@uipath/pipelines-sdk": "workspace:*",
|
|
641
|
+
"@uipath/resource-builder-sdk": "2025.11.0-alpha6584-4367",
|
|
632
642
|
"@uipath/solutionpackager-tool-core": "workspace:*",
|
|
633
643
|
"@uipath/studioweb-sdk": "workspace:*",
|
|
634
644
|
"@types/node": "^25.5.2",
|
|
@@ -5032,7 +5042,7 @@ function buildRegistrationSuccessInstructions(solutionDir) {
|
|
|
5032
5042
|
return [
|
|
5033
5043
|
"The project is listed in the parent solution manifest.",
|
|
5034
5044
|
"Packing or uploading the solution will sync solution resources automatically.",
|
|
5035
|
-
`To sync resources before packaging, run
|
|
5045
|
+
`To sync resources before packaging, run: uip solution resources refresh --solution-folder ${quoteForShell(solutionDir)}`
|
|
5036
5046
|
].join(`
|
|
5037
5047
|
`);
|
|
5038
5048
|
}
|
|
@@ -5127,7 +5137,8 @@ var DEFAULT_EXCLUDED_DIR_NAMES = new Set([
|
|
|
5127
5137
|
"__pycache__",
|
|
5128
5138
|
".git",
|
|
5129
5139
|
".local",
|
|
5130
|
-
".flow-sdk"
|
|
5140
|
+
".flow-sdk",
|
|
5141
|
+
".flow-debug"
|
|
5131
5142
|
]);
|
|
5132
5143
|
var DEFAULT_EXCLUDED_FILE_PATTERNS = [
|
|
5133
5144
|
/^\.env($|\..+)/
|
|
@@ -6210,4 +6221,4 @@ export {
|
|
|
6210
6221
|
uploadOrOverwriteSolution
|
|
6211
6222
|
};
|
|
6212
6223
|
|
|
6213
|
-
//# debugId=
|
|
6224
|
+
//# debugId=9A23899C187AE81264756E2164756E21
|
|
@@ -65,13 +65,13 @@ import {
|
|
|
65
65
|
selectTenantWithDeps,
|
|
66
66
|
setActiveAuthProfile,
|
|
67
67
|
setAuthFileConfig
|
|
68
|
-
} from "./packager-tool-
|
|
68
|
+
} from "./packager-tool-n4sgccez.js";
|
|
69
69
|
import {
|
|
70
70
|
isBrowser,
|
|
71
71
|
isNode
|
|
72
72
|
} from "./packager-tool-0gctz400.js";
|
|
73
73
|
import"./packager-tool-qa9gftnj.js";
|
|
74
|
-
import"./packager-tool-
|
|
74
|
+
import"./packager-tool-y4vgqz1w.js";
|
|
75
75
|
import {
|
|
76
76
|
AUTH_CANCELLED_ERROR_CODE,
|
|
77
77
|
AUTH_RECLAIMED_ERROR_CODE,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getFileSystem
|
|
3
|
-
} from "./packager-tool-
|
|
3
|
+
} from "./packager-tool-y4vgqz1w.js";
|
|
4
4
|
import {
|
|
5
5
|
__commonJS,
|
|
6
6
|
__require,
|
|
@@ -2676,7 +2676,7 @@ function setGlobalLogFilePath(path) {
|
|
|
2676
2676
|
function getGlobalLogFilePath() {
|
|
2677
2677
|
return logFilePathSlot.get("");
|
|
2678
2678
|
}
|
|
2679
|
-
var DEFAULT_LOG_LEVEL =
|
|
2679
|
+
var DEFAULT_LOG_LEVEL = 2 /* WARN */;
|
|
2680
2680
|
|
|
2681
2681
|
class SimpleLogger {
|
|
2682
2682
|
__brand = "SimpleLogger";
|
|
@@ -3002,7 +3002,9 @@ var ErrorDimensions = {
|
|
|
3002
3002
|
Result: "Result",
|
|
3003
3003
|
ErrorCode: "ErrorCode",
|
|
3004
3004
|
Retry: "Retry",
|
|
3005
|
-
ErrorMessage: "ErrorMessage"
|
|
3005
|
+
ErrorMessage: "ErrorMessage",
|
|
3006
|
+
HttpStatus: "HttpStatus",
|
|
3007
|
+
UpstreamErrorCode: "UpstreamErrorCode"
|
|
3006
3008
|
};
|
|
3007
3009
|
var AuthDimensions = {
|
|
3008
3010
|
AuthenticationMethod: "AuthenticationMethod",
|
|
@@ -3990,7 +3992,9 @@ var CLI_ERROR_CODES = [
|
|
|
3990
3992
|
"timeout",
|
|
3991
3993
|
"server_error",
|
|
3992
3994
|
"method_not_allowed",
|
|
3995
|
+
"not_supported",
|
|
3993
3996
|
"configuration_error",
|
|
3997
|
+
"execution_failed",
|
|
3994
3998
|
"unknown_error"
|
|
3995
3999
|
];
|
|
3996
4000
|
var RETRY_HINTS = [
|
|
@@ -4947,7 +4951,9 @@ var OutputFormatter;
|
|
|
4947
4951
|
[ErrorDimensions.Result]: data.Result,
|
|
4948
4952
|
[ErrorDimensions.ErrorCode]: data.ErrorCode,
|
|
4949
4953
|
[ErrorDimensions.Retry]: data.Retry,
|
|
4950
|
-
[ErrorDimensions.ErrorMessage]: data.Message
|
|
4954
|
+
[ErrorDimensions.ErrorMessage]: data.Message,
|
|
4955
|
+
[ErrorDimensions.HttpStatus]: data.Context?.httpStatus?.toString(),
|
|
4956
|
+
[ErrorDimensions.UpstreamErrorCode]: data.Context?.errorCode
|
|
4951
4957
|
});
|
|
4952
4958
|
}
|
|
4953
4959
|
logOutput(normalizeOutputKeys(envelope), getOutputFormat());
|
|
@@ -5599,6 +5605,11 @@ function installSdkUserAgentHeader(BaseApiClass, userAgent) {
|
|
|
5599
5605
|
installRequestHeaderForwarding(BaseApiClass, userAgentPatchKey(userAgent), (headers) => addSdkUserAgentHeader(headers, userAgent));
|
|
5600
5606
|
}
|
|
5601
5607
|
|
|
5608
|
+
// ../common/src/shell-quote.ts
|
|
5609
|
+
function quoteForShell(value) {
|
|
5610
|
+
return `'${value.replace(/'/g, "'\\''")}'`;
|
|
5611
|
+
}
|
|
5612
|
+
|
|
5602
5613
|
// ../common/src/solution-project-types.ts
|
|
5603
5614
|
var LIBRARY_NOT_A_PROJECT = "A library cannot be a project inside a solution — it is a reusable .nupkg that other projects consume as a NuGet dependency, not a deployable unit. Build and publish it on its own ('uip rpa pack <project-dir> <output-path>', then 'uip or libraries upload --file <nupkg-path>'), and reference it from a project's dependencies. To make the published library part of this solution, add it as a resource instead: 'uip solution resources add --source remote --kind Library --name <library-name>'.";
|
|
5604
5615
|
function unsupportedSolutionProjectType(projectType) {
|
|
@@ -5984,6 +5995,6 @@ function trackShipSucceeded(payload) {
|
|
|
5984
5995
|
}
|
|
5985
5996
|
// ../common/src/tool-provider.ts
|
|
5986
5997
|
var factorySlot = singleton("PackagerFactoryProvider");
|
|
5987
|
-
export { catchError, getOutputSink, logger, getOutputFormat, getOutputFormatExplicit, CommandDimensions, ShipDimensions, RESULTS, OutputFormatter, summarizePlatformBody, Option, processContext, UIPATH_HOME_DIR, stripHostGlobalOptions, createHiddenDeprecatedTenantOption, ScreenLogger, getSdkUserAgentToken, addSdkUserAgentHeader, installSdkUserAgentHeader, unsupportedSolutionProjectType, trackShipSucceeded };
|
|
5998
|
+
export { catchError, getOutputSink, logger, getOutputFormat, getOutputFormatExplicit, CommandDimensions, ShipDimensions, RESULTS, OutputFormatter, summarizePlatformBody, Option, processContext, UIPATH_HOME_DIR, stripHostGlobalOptions, createHiddenDeprecatedTenantOption, ScreenLogger, getSdkUserAgentToken, addSdkUserAgentHeader, installSdkUserAgentHeader, quoteForShell, unsupportedSolutionProjectType, trackShipSucceeded };
|
|
5988
5999
|
|
|
5989
|
-
//# debugId=
|
|
6000
|
+
//# debugId=56A31FF974DBA38964756E2164756E21
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// ../packager/packager-tool-functions/src/types.ts
|
|
2
|
+
var Languages = {
|
|
3
|
+
JavaScript: "javascript",
|
|
4
|
+
Python: "python"
|
|
5
|
+
};
|
|
6
|
+
var LanguageLabels = {
|
|
7
|
+
[Languages.JavaScript]: "JS/TS",
|
|
8
|
+
[Languages.Python]: "Python"
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
// ../packager/packager-tool-functions/src/language-detection.ts
|
|
12
|
+
var EXTENSION_TO_LANGUAGE = {
|
|
13
|
+
".ts": Languages.JavaScript,
|
|
14
|
+
".js": Languages.JavaScript,
|
|
15
|
+
".mjs": Languages.JavaScript,
|
|
16
|
+
".py": Languages.Python
|
|
17
|
+
};
|
|
18
|
+
function languageFromFunctionsMap(functions) {
|
|
19
|
+
const firstEntry = Object.values(functions ?? {})[0];
|
|
20
|
+
if (!firstEntry) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
const filePath = firstEntry.split(":")[0] ?? "";
|
|
24
|
+
const dot = filePath.lastIndexOf(".");
|
|
25
|
+
return dot >= 0 ? EXTENSION_TO_LANGUAGE[filePath.slice(dot)] : undefined;
|
|
26
|
+
}
|
|
27
|
+
async function detectProjectLanguage(fileSystem, projectPath) {
|
|
28
|
+
const fromManifest = await languageFromUipathJson(fileSystem, projectPath);
|
|
29
|
+
if (fromManifest) {
|
|
30
|
+
return fromManifest;
|
|
31
|
+
}
|
|
32
|
+
if (await fileSystem.exists(fileSystem.path.join(projectPath, "package.json"))) {
|
|
33
|
+
return Languages.JavaScript;
|
|
34
|
+
}
|
|
35
|
+
if (await fileSystem.exists(fileSystem.path.join(projectPath, "pyproject.toml"))) {
|
|
36
|
+
return Languages.Python;
|
|
37
|
+
}
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
async function languageFromUipathJson(fileSystem, projectPath) {
|
|
41
|
+
const uipathJsonPath = fileSystem.path.join(projectPath, "uipath.json");
|
|
42
|
+
if (!await fileSystem.exists(uipathJsonPath)) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
const content = await fileSystem.readFile(uipathJsonPath, "utf-8");
|
|
46
|
+
if (!content) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
try {
|
|
50
|
+
const uipathJson = JSON.parse(content);
|
|
51
|
+
return languageFromFunctionsMap(uipathJson.functions);
|
|
52
|
+
} catch {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export { Languages, LanguageLabels, detectProjectLanguage };
|
|
58
|
+
|
|
59
|
+
//# debugId=C47535DD6320BC8D64756E2164756E21
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
} from "./packager-tool-qa9gftnj.js";
|
|
8
8
|
import {
|
|
9
9
|
getFileSystem
|
|
10
|
-
} from "./packager-tool-
|
|
10
|
+
} from "./packager-tool-y4vgqz1w.js";
|
|
11
11
|
import {
|
|
12
12
|
AUTH_FILENAME,
|
|
13
13
|
DEFAULT_BASE_URL,
|
|
@@ -96,22 +96,12 @@ var resolveConfigAsync = async ({
|
|
|
96
96
|
baseUrl = DEFAULT_BASE_URL;
|
|
97
97
|
}
|
|
98
98
|
baseUrl = normalizeAndValidateBaseUrl(baseUrl);
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
clientId = fileAuth.clientId;
|
|
102
|
-
}
|
|
103
|
-
if (!clientId) {
|
|
104
|
-
clientId = DEFAULT_CLIENT_ID;
|
|
105
|
-
}
|
|
106
|
-
let clientSecret = customClientSecret;
|
|
107
|
-
if (!clientSecret && fileAuth.clientSecret) {
|
|
108
|
-
clientSecret = fileAuth.clientSecret;
|
|
109
|
-
}
|
|
110
|
-
const isExternalAppAuth = clientId !== DEFAULT_CLIENT_ID && (Boolean(clientSecret) || Boolean(customClientAssertion));
|
|
99
|
+
const clientId = customClientId || DEFAULT_CLIENT_ID;
|
|
100
|
+
const isExternalAppAuth = clientId !== DEFAULT_CLIENT_ID && (Boolean(customClientSecret) || Boolean(customClientAssertion));
|
|
111
101
|
const scopes = resolveScopes(isExternalAppAuth, customScopes, fileAuth.scopes);
|
|
112
102
|
return {
|
|
113
103
|
clientId,
|
|
114
|
-
clientSecret,
|
|
104
|
+
clientSecret: customClientSecret,
|
|
115
105
|
scopes,
|
|
116
106
|
baseUrl,
|
|
117
107
|
authorizationEndpoint: `${baseUrl}/identity_/connect/authorize`,
|
|
@@ -719,6 +709,16 @@ var resolveIdentityType = (claims, authFlow, email) => {
|
|
|
719
709
|
}
|
|
720
710
|
return;
|
|
721
711
|
};
|
|
712
|
+
var resolveApplicationSubtype = (claims, authFlow) => {
|
|
713
|
+
switch (asString(claims?.sub_type)) {
|
|
714
|
+
case "service.external":
|
|
715
|
+
return "External";
|
|
716
|
+
case "service.internal":
|
|
717
|
+
return "Internal";
|
|
718
|
+
default:
|
|
719
|
+
return authFlow === "client_credentials" || authFlow === "federated_credentials" ? "External" : undefined;
|
|
720
|
+
}
|
|
721
|
+
};
|
|
722
722
|
var looksLikeEmail = (value) => value?.includes("@") ?? false;
|
|
723
723
|
var pickEmail = (claims) => {
|
|
724
724
|
for (const candidate of [claims?.email, claims?.preferred_username]) {
|
|
@@ -760,6 +760,12 @@ var resolveSessionIdentity = (accessToken, authFlow) => {
|
|
|
760
760
|
const clientId = asString(claims?.client_id);
|
|
761
761
|
if (clientId)
|
|
762
762
|
identity.clientId = clientId;
|
|
763
|
+
const subType = asString(claims?.sub_type);
|
|
764
|
+
if (subType)
|
|
765
|
+
identity.subType = subType;
|
|
766
|
+
const applicationSubtype = resolveApplicationSubtype(claims, authFlow);
|
|
767
|
+
if (applicationSubtype)
|
|
768
|
+
identity.applicationSubtype = applicationSubtype;
|
|
763
769
|
return identity;
|
|
764
770
|
};
|
|
765
771
|
var readTokenScopes = (accessToken) => accessToken ? pickScopes(decodeClaims(accessToken)) : undefined;
|
|
@@ -1055,6 +1061,40 @@ var tryRobotClientFallback = async (options = {}) => {
|
|
|
1055
1061
|
}
|
|
1056
1062
|
};
|
|
1057
1063
|
|
|
1064
|
+
// ../auth/src/tenantSelection.ts
|
|
1065
|
+
var LOGIN_STATUS_HINT = "Run 'uip login status' to see the organization the CLI is signed in to.";
|
|
1066
|
+
var organizationHint = (organizationId) => `The request used '${organizationId}' as the organization. ${LOGIN_STATUS_HINT}`;
|
|
1067
|
+
var IDENTIFIER_STATUSES = new Set([400, 403, 404]);
|
|
1068
|
+
var describeNonJsonResponse = (organizationId, response, parseError) => {
|
|
1069
|
+
if (response.redirected) {
|
|
1070
|
+
return `Could not find organization '${organizationId}': the request was ` + `redirected to a sign-in page instead of the organization's tenant ` + `list. ${LOGIN_STATUS_HINT}`;
|
|
1071
|
+
}
|
|
1072
|
+
const contentType = response.headers.get("content-type") ?? "unknown";
|
|
1073
|
+
return `The organization service returned a '${contentType}' response instead ` + `of JSON: ${parseError.message}. ${organizationHint(organizationId)}`;
|
|
1074
|
+
};
|
|
1075
|
+
var fetchTenantsAndOrganizations = async (baseUrl, accessToken, organizationId, signal) => {
|
|
1076
|
+
const url = `${baseUrl}/${organizationId}/portal_/api/filtering/leftnav/tenantsAndOrganizationInfo`;
|
|
1077
|
+
const response = await fetch(url, {
|
|
1078
|
+
headers: {
|
|
1079
|
+
Authorization: `Bearer ${accessToken}`
|
|
1080
|
+
},
|
|
1081
|
+
...signal ? { signal } : {}
|
|
1082
|
+
});
|
|
1083
|
+
if (!response.ok) {
|
|
1084
|
+
if (response.status === 401) {
|
|
1085
|
+
throw new Error(`Unauthorized: the access token was rejected, it was not ` + `issued for organization '${organizationId}', or ` + `'${organizationId}' was not accepted as an organization ` + `URL segment in this environment. ` + LOGIN_STATUS_HINT);
|
|
1086
|
+
}
|
|
1087
|
+
const errorText = await response.text();
|
|
1088
|
+
const message = `Failed to get tenants and organizations: ${response.status} ${errorText}`;
|
|
1089
|
+
throw new Error(IDENTIFIER_STATUSES.has(response.status) ? `${message}. ${organizationHint(organizationId)}` : message);
|
|
1090
|
+
}
|
|
1091
|
+
const [parseError, data] = await catchError(response.json());
|
|
1092
|
+
if (parseError) {
|
|
1093
|
+
throw new Error(describeNonJsonResponse(organizationId, response, parseError));
|
|
1094
|
+
}
|
|
1095
|
+
return data;
|
|
1096
|
+
};
|
|
1097
|
+
|
|
1058
1098
|
// ../auth/src/tokenRefresh.ts
|
|
1059
1099
|
var TOKEN_REFRESH_REAUTHENTICATE_MESSAGE = "Token refresh failed. Run 'uip login' to re-authenticate.";
|
|
1060
1100
|
|
|
@@ -1274,6 +1314,8 @@ var CredentialSource;
|
|
|
1274
1314
|
CredentialSource2["Robot"] = "robot";
|
|
1275
1315
|
CredentialSource2["EnvironmentVariables"] = "env-vars";
|
|
1276
1316
|
})(CredentialSource ||= {});
|
|
1317
|
+
var defaultRobotTenantIdCache = new Map;
|
|
1318
|
+
var ROBOT_TENANT_LOOKUP_TIMEOUT_MS = 5000;
|
|
1277
1319
|
var getLoginStatusAsync = async (options = {}) => {
|
|
1278
1320
|
return getLoginStatusWithDeps(options);
|
|
1279
1321
|
};
|
|
@@ -1286,12 +1328,20 @@ var getLoginStatusWithDeps = async (options = {}, deps = {}) => {
|
|
|
1286
1328
|
refreshToken: refreshTokenFn = refreshAccessToken,
|
|
1287
1329
|
resolveConfig = resolveConfigAsync,
|
|
1288
1330
|
robotFallback = tryRobotClientFallback,
|
|
1331
|
+
fetchTenantsAndOrgs = fetchTenantsAndOrganizations,
|
|
1332
|
+
robotTenantIdCache = defaultRobotTenantIdCache,
|
|
1333
|
+
robotTenantLookupTimeoutMs = ROBOT_TENANT_LOOKUP_TIMEOUT_MS,
|
|
1289
1334
|
loadBreaker = loadRefreshBreaker,
|
|
1290
1335
|
saveBreaker = saveRefreshBreaker,
|
|
1291
1336
|
clearBreaker = clearRefreshBreaker
|
|
1292
1337
|
} = deps;
|
|
1338
|
+
const robotDeps = {
|
|
1339
|
+
fetchTenantsAndOrgs,
|
|
1340
|
+
cache: robotTenantIdCache,
|
|
1341
|
+
lookupTimeoutMs: robotTenantLookupTimeoutMs
|
|
1342
|
+
};
|
|
1293
1343
|
if (isRobotAuthEnforced()) {
|
|
1294
|
-
return resolveRobotEnforcedStatus(robotFallback);
|
|
1344
|
+
return resolveRobotEnforcedStatus(robotFallback, robotDeps);
|
|
1295
1345
|
}
|
|
1296
1346
|
if (isEnvAuthEnabled()) {
|
|
1297
1347
|
return readAuthFromEnv();
|
|
@@ -1309,7 +1359,7 @@ var getLoginStatusWithDeps = async (options = {}, deps = {}) => {
|
|
|
1309
1359
|
hint: `No credentials found for profile "${activeProfile}". Run 'uip login --profile ${activeProfile}' to authenticate this profile.`
|
|
1310
1360
|
};
|
|
1311
1361
|
}
|
|
1312
|
-
return resolveBorrowedRobotStatus(robotFallback);
|
|
1362
|
+
return resolveBorrowedRobotStatus(robotFallback, robotDeps);
|
|
1313
1363
|
}
|
|
1314
1364
|
const loaded = await loadFileCredentials(loadEnvFile, absolutePath);
|
|
1315
1365
|
if ("status" in loaded) {
|
|
@@ -1351,7 +1401,7 @@ var getLoginStatusWithDeps = async (options = {}, deps = {}) => {
|
|
|
1351
1401
|
}
|
|
1352
1402
|
return buildFileStatus(tokens, credentials, globalHint);
|
|
1353
1403
|
};
|
|
1354
|
-
async function resolveRobotEnforcedStatus(robotFallback) {
|
|
1404
|
+
async function resolveRobotEnforcedStatus(robotFallback, deps) {
|
|
1355
1405
|
if (isEnvAuthEnabled()) {
|
|
1356
1406
|
throw new EnvAuthConfigError(`${ENV_AUTH_ENABLE_VAR}=true and ${ENFORCE_ROBOT_AUTH_VAR}=true ` + `are mutually exclusive. Unset one of them and re-run.`);
|
|
1357
1407
|
}
|
|
@@ -1362,11 +1412,11 @@ async function resolveRobotEnforcedStatus(robotFallback) {
|
|
|
1362
1412
|
hint: `${ENFORCE_ROBOT_AUTH_VAR}=true but the UiPath Robot ` + `session is unavailable. Start and sign in to the Assistant, ` + `or unset ${ENFORCE_ROBOT_AUTH_VAR} to fall back to file or ` + `env-var authentication.`
|
|
1363
1413
|
};
|
|
1364
1414
|
}
|
|
1365
|
-
return buildRobotStatus(robotCreds);
|
|
1415
|
+
return buildRobotStatus(robotCreds, deps);
|
|
1366
1416
|
}
|
|
1367
|
-
async function resolveBorrowedRobotStatus(robotFallback) {
|
|
1417
|
+
async function resolveBorrowedRobotStatus(robotFallback, deps) {
|
|
1368
1418
|
const robotCreds = await robotFallback();
|
|
1369
|
-
return robotCreds ? buildRobotStatus(robotCreds) : { loginStatus: "Not logged in" };
|
|
1419
|
+
return robotCreds ? buildRobotStatus(robotCreds, deps) : { loginStatus: "Not logged in" };
|
|
1370
1420
|
}
|
|
1371
1421
|
async function loadFileCredentials(loadEnvFile, absolutePath) {
|
|
1372
1422
|
let credentials;
|
|
@@ -1501,9 +1551,10 @@ function identityFields(accessToken, credentials) {
|
|
|
1501
1551
|
...scopes ? { scopes } : {}
|
|
1502
1552
|
};
|
|
1503
1553
|
}
|
|
1504
|
-
function buildRobotStatus(robotCreds) {
|
|
1554
|
+
async function buildRobotStatus(robotCreds, deps) {
|
|
1505
1555
|
const identity = resolveSessionIdentity(robotCreds.accessToken);
|
|
1506
1556
|
const scopes = readTokenScopes(robotCreds.accessToken);
|
|
1557
|
+
const tenant = robotCreds.tenantId ? { tenantId: robotCreds.tenantId } : await resolveRobotTenantId(robotCreds, deps);
|
|
1507
1558
|
return {
|
|
1508
1559
|
loginStatus: "Logged in",
|
|
1509
1560
|
accessToken: robotCreds.accessToken,
|
|
@@ -1511,14 +1562,62 @@ function buildRobotStatus(robotCreds) {
|
|
|
1511
1562
|
organizationName: robotCreds.organizationName,
|
|
1512
1563
|
organizationId: robotCreds.organizationId,
|
|
1513
1564
|
tenantName: robotCreds.tenantName,
|
|
1514
|
-
tenantId:
|
|
1565
|
+
tenantId: tenant.tenantId,
|
|
1515
1566
|
issuer: robotCreds.issuer,
|
|
1516
1567
|
expiration: getTokenExpiration(robotCreds.accessToken),
|
|
1517
1568
|
source: "robot" /* Robot */,
|
|
1569
|
+
...tenant.hint ? { hint: tenant.hint } : {},
|
|
1518
1570
|
...identity ? { identity } : {},
|
|
1519
1571
|
...scopes ? { scopes } : {}
|
|
1520
1572
|
};
|
|
1521
1573
|
}
|
|
1574
|
+
async function resolveRobotTenantId(robotCreds, deps) {
|
|
1575
|
+
const { baseUrl, accessToken, tenantName } = robotCreds;
|
|
1576
|
+
const organization = robotCreds.organizationName ?? robotCreds.organizationId;
|
|
1577
|
+
if (!tenantName || !organization) {
|
|
1578
|
+
return {};
|
|
1579
|
+
}
|
|
1580
|
+
const key = `${baseUrl}|${organization}|${tenantName}|${accessToken}`;
|
|
1581
|
+
let pending = deps.cache.get(key);
|
|
1582
|
+
if (!pending) {
|
|
1583
|
+
pending = catchError(lookupRobotTenantId({ baseUrl, accessToken, organization, tenantName }, deps)).then(([error, resolution]) => {
|
|
1584
|
+
const settled = error ? { hint: tenantLookupFailureHint(tenantName, error.message) } : resolution;
|
|
1585
|
+
if (!settled.tenantId) {
|
|
1586
|
+
deps.cache.delete(key);
|
|
1587
|
+
}
|
|
1588
|
+
return settled;
|
|
1589
|
+
});
|
|
1590
|
+
deps.cache.set(key, pending);
|
|
1591
|
+
}
|
|
1592
|
+
return pending;
|
|
1593
|
+
}
|
|
1594
|
+
async function lookupRobotTenantId(target, deps) {
|
|
1595
|
+
const { baseUrl, accessToken, organization, tenantName } = target;
|
|
1596
|
+
const [error, data] = await catchError(deps.fetchTenantsAndOrgs(baseUrl, accessToken, organization, AbortSignal.timeout(deps.lookupTimeoutMs)));
|
|
1597
|
+
if (error) {
|
|
1598
|
+
const reason = error.name === "TimeoutError" ? `the tenant list did not answer within ${deps.lookupTimeoutMs} ms.` : error.message;
|
|
1599
|
+
return { hint: tenantLookupFailureHint(tenantName, reason) };
|
|
1600
|
+
}
|
|
1601
|
+
const rows = data?.tenants;
|
|
1602
|
+
const tenants = Array.isArray(rows) ? rows.filter((tenant) => typeof tenant?.id === "string" && typeof tenant?.name === "string") : [];
|
|
1603
|
+
const wantedName = decodePathSegment(tenantName);
|
|
1604
|
+
const wanted = wantedName.toLowerCase();
|
|
1605
|
+
const match = tenants.find((tenant) => tenant.name === wantedName) ?? tenants.find((tenant) => tenant.name.toLowerCase() === wanted);
|
|
1606
|
+
if (!match) {
|
|
1607
|
+
const names = tenants.map((tenant) => tenant.name).join(", ");
|
|
1608
|
+
return {
|
|
1609
|
+
hint: `The Robot session targets tenant '${tenantName}', but ` + `organization '${organization}' lists no tenant of that name` + `${names ? ` (available: ${names})` : ""}. Commands that need ` + `the tenant id will fail until it can be resolved.`
|
|
1610
|
+
};
|
|
1611
|
+
}
|
|
1612
|
+
return { tenantId: match.id };
|
|
1613
|
+
}
|
|
1614
|
+
function tenantLookupFailureHint(tenantName, reason) {
|
|
1615
|
+
return `Could not resolve the id of tenant '${tenantName}' from the ` + `Robot session: ${reason} Commands that need the tenant id will ` + `fail until it can be resolved.`;
|
|
1616
|
+
}
|
|
1617
|
+
function decodePathSegment(segment) {
|
|
1618
|
+
const [error, decoded] = catchError(() => decodeURIComponent(segment));
|
|
1619
|
+
return error ? segment : decoded;
|
|
1620
|
+
}
|
|
1522
1621
|
var isFileNotFoundError = (error) => {
|
|
1523
1622
|
if (!(error instanceof Object))
|
|
1524
1623
|
return false;
|
|
@@ -2040,39 +2139,6 @@ var federatedCredentialsLogin = async ({
|
|
|
2040
2139
|
buildError: buildFederatedError
|
|
2041
2140
|
});
|
|
2042
2141
|
};
|
|
2043
|
-
// ../auth/src/tenantSelection.ts
|
|
2044
|
-
var LOGIN_STATUS_HINT = "Run 'uip login status' to see the organization the CLI is signed in to.";
|
|
2045
|
-
var organizationHint = (organizationId) => `The request used '${organizationId}' as the organization. ${LOGIN_STATUS_HINT}`;
|
|
2046
|
-
var IDENTIFIER_STATUSES = new Set([400, 403, 404]);
|
|
2047
|
-
var describeNonJsonResponse = (organizationId, response, parseError) => {
|
|
2048
|
-
if (response.redirected) {
|
|
2049
|
-
return `Could not find organization '${organizationId}': the request was ` + `redirected to a sign-in page instead of the organization's tenant ` + `list. ${LOGIN_STATUS_HINT}`;
|
|
2050
|
-
}
|
|
2051
|
-
const contentType = response.headers.get("content-type") ?? "unknown";
|
|
2052
|
-
return `The organization service returned a '${contentType}' response instead ` + `of JSON: ${parseError.message}. ${organizationHint(organizationId)}`;
|
|
2053
|
-
};
|
|
2054
|
-
var fetchTenantsAndOrganizations = async (baseUrl, accessToken, organizationId) => {
|
|
2055
|
-
const url = `${baseUrl}/${organizationId}/portal_/api/filtering/leftnav/tenantsAndOrganizationInfo`;
|
|
2056
|
-
const response = await fetch(url, {
|
|
2057
|
-
headers: {
|
|
2058
|
-
Authorization: `Bearer ${accessToken}`
|
|
2059
|
-
}
|
|
2060
|
-
});
|
|
2061
|
-
if (!response.ok) {
|
|
2062
|
-
if (response.status === 401) {
|
|
2063
|
-
throw new Error(`Unauthorized: the access token was rejected, it was not ` + `issued for organization '${organizationId}', or ` + `'${organizationId}' was not accepted as an organization ` + `URL segment in this environment. ` + LOGIN_STATUS_HINT);
|
|
2064
|
-
}
|
|
2065
|
-
const errorText = await response.text();
|
|
2066
|
-
const message = `Failed to get tenants and organizations: ${response.status} ${errorText}`;
|
|
2067
|
-
throw new Error(IDENTIFIER_STATUSES.has(response.status) ? `${message}. ${organizationHint(organizationId)}` : message);
|
|
2068
|
-
}
|
|
2069
|
-
const [parseError, data] = await catchError(response.json());
|
|
2070
|
-
if (parseError) {
|
|
2071
|
-
throw new Error(describeNonJsonResponse(organizationId, response, parseError));
|
|
2072
|
-
}
|
|
2073
|
-
return data;
|
|
2074
|
-
};
|
|
2075
|
-
|
|
2076
2142
|
// ../auth/src/selectTenant.ts
|
|
2077
2143
|
var TENANT_SELECTION_REQUIRED_CODE = "TENANT_SELECTION_REQUIRED";
|
|
2078
2144
|
var INVALID_TENANT_CODE = "INVALID_TENANT";
|
|
@@ -2432,7 +2498,7 @@ var authenticate = async ({
|
|
|
2432
2498
|
const { BrowserAuthStrategy } = await import("./browser-strategy-tyy1nbjg.js");
|
|
2433
2499
|
strategy = new BrowserAuthStrategy;
|
|
2434
2500
|
} else {
|
|
2435
|
-
const { NodeAuthStrategy } = await import("./node-strategy-
|
|
2501
|
+
const { NodeAuthStrategy } = await import("./node-strategy-nmepnk2k.js");
|
|
2436
2502
|
strategy = new NodeAuthStrategy;
|
|
2437
2503
|
}
|
|
2438
2504
|
const code = await strategy.execute(authUrl, effectiveRedirectUriUrl, state, {
|
|
@@ -2452,6 +2518,6 @@ var authenticate = async ({
|
|
|
2452
2518
|
});
|
|
2453
2519
|
};
|
|
2454
2520
|
|
|
2455
|
-
export { setAuthFileConfig, InvalidBaseUrlError, DEFAULT_AUTH_PROFILE, AuthProfileValidationError, normalizeAuthProfileName, setActiveAuthProfile, clearActiveAuthProfile, getActiveAuthProfile, runWithAuthProfile, resolveAuthProfileFilePath, getActiveAuthProfileFilePath, getAuthProfilesRootPath, resolveAuthProfileDirPath, listAuthProfileNamesAsync, authProfileExistsAsync, deleteAuthProfileAsync, parseJWT, parseAuthFlow, resolveSessionIdentity, readTokenScopes, ENV_AUTH_ENABLE_VAR, ENFORCE_ROBOT_AUTH_VAR, ENV_AUTH_VARS, EnvAuthConfigError, isEnvAuthEnabled, isRobotAuthEnforced, readAuthFromEnv, refreshTokenFingerprint, loadRefreshBreaker, saveRefreshBreaker, clearRefreshBreaker, registerRobotClientLoader, TokenRefreshOAuthError, isTokenRefreshOAuthFailure, refreshAccessToken, AUTH_FLOW_ENV_VAR, DEFAULT_AUTH_FILENAME, DEFAULT_ENV_FILENAME, resolveEnvFileLocationAsync, resolveEnvFilePathAsync, loadEnvFileAsync, saveEnvFileAsync, CredentialSource, getLoginStatusAsync, getLoginStatusWithDeps, getAuthContext, getAuthEnv, describeAuthProfilesAsync, ClientCredentialsAuthenticationError, clientCredentialsLogin, JWT_BEARER_ASSERTION_TYPE, FederatedCredentialsAuthenticationError, federatedCredentialsLogin,
|
|
2521
|
+
export { setAuthFileConfig, InvalidBaseUrlError, DEFAULT_AUTH_PROFILE, AuthProfileValidationError, normalizeAuthProfileName, setActiveAuthProfile, clearActiveAuthProfile, getActiveAuthProfile, runWithAuthProfile, resolveAuthProfileFilePath, getActiveAuthProfileFilePath, getAuthProfilesRootPath, resolveAuthProfileDirPath, listAuthProfileNamesAsync, authProfileExistsAsync, deleteAuthProfileAsync, parseJWT, parseAuthFlow, resolveSessionIdentity, readTokenScopes, ENV_AUTH_ENABLE_VAR, ENFORCE_ROBOT_AUTH_VAR, ENV_AUTH_VARS, EnvAuthConfigError, isEnvAuthEnabled, isRobotAuthEnforced, readAuthFromEnv, refreshTokenFingerprint, loadRefreshBreaker, saveRefreshBreaker, clearRefreshBreaker, registerRobotClientLoader, fetchTenantsAndOrganizations, TokenRefreshOAuthError, isTokenRefreshOAuthFailure, refreshAccessToken, AUTH_FLOW_ENV_VAR, DEFAULT_AUTH_FILENAME, DEFAULT_ENV_FILENAME, resolveEnvFileLocationAsync, resolveEnvFilePathAsync, loadEnvFileAsync, saveEnvFileAsync, CredentialSource, getLoginStatusAsync, getLoginStatusWithDeps, getAuthContext, getAuthEnv, describeAuthProfilesAsync, ClientCredentialsAuthenticationError, clientCredentialsLogin, JWT_BEARER_ASSERTION_TYPE, FederatedCredentialsAuthenticationError, federatedCredentialsLogin, TENANT_SELECTION_REQUIRED_CODE, INVALID_TENANT_CODE, TenantSelectionError, TenantSelectionRequiredError, InvalidTenantError, isTenantSelectionError, selectTenantWithDeps, interactiveLoginWithDeps, interactiveLogin, logoutWithDeps, logout, authenticate };
|
|
2456
2522
|
|
|
2457
|
-
//# debugId=
|
|
2523
|
+
//# debugId=40192C240CF134F264756E2164756E21
|
|
@@ -182,6 +182,16 @@ class NodeFileSystem {
|
|
|
182
182
|
async rename(oldPath, newPath) {
|
|
183
183
|
await fs.rename(oldPath, newPath);
|
|
184
184
|
}
|
|
185
|
+
async isSymbolicLink(filePath) {
|
|
186
|
+
try {
|
|
187
|
+
return (await fs.lstat(filePath)).isSymbolicLink();
|
|
188
|
+
} catch (error) {
|
|
189
|
+
if (this.isEnoent(error) || this.hasErrnoCode(error, "ENOTDIR")) {
|
|
190
|
+
return false;
|
|
191
|
+
}
|
|
192
|
+
throw error;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
185
195
|
async realpath(filePath) {
|
|
186
196
|
try {
|
|
187
197
|
return await fs.realpath(filePath);
|
|
@@ -234,4 +244,4 @@ var getFileSystem = () => fsInstance;
|
|
|
234
244
|
|
|
235
245
|
export { getFileSystem };
|
|
236
246
|
|
|
237
|
-
//# debugId=
|
|
247
|
+
//# debugId=82E3494FD83B7EB464756E2164756E21
|
package/dist/packager-tool.js
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
zipSync
|
|
3
3
|
} from "./packager-tool-b098y4a2.js";
|
|
4
|
+
import {
|
|
5
|
+
LanguageLabels,
|
|
6
|
+
Languages,
|
|
7
|
+
detectProjectLanguage
|
|
8
|
+
} from "./packager-tool-h7ke7taj.js";
|
|
4
9
|
import {
|
|
5
10
|
__require
|
|
6
11
|
} from "./packager-tool-1de529jm.js";
|
|
@@ -1649,16 +1654,6 @@ function addFileToDescriptor(packageDescriptor, key, fileName) {
|
|
|
1649
1654
|
const relativePath = Path.join(NugetConstants.ContentFolderName, fileName);
|
|
1650
1655
|
packageDescriptor.files[key] = relativePath;
|
|
1651
1656
|
}
|
|
1652
|
-
// ../packager/packager-tool-functions/src/types.ts
|
|
1653
|
-
var Languages = {
|
|
1654
|
-
JavaScript: "javascript",
|
|
1655
|
-
Python: "python"
|
|
1656
|
-
};
|
|
1657
|
-
var LanguageLabels = {
|
|
1658
|
-
[Languages.JavaScript]: "JS/TS",
|
|
1659
|
-
[Languages.Python]: "Python"
|
|
1660
|
-
};
|
|
1661
|
-
|
|
1662
1657
|
// ../packager/packager-tool-functions/src/functions-tool.ts
|
|
1663
1658
|
class FunctionsTool extends ProjectTool {
|
|
1664
1659
|
_temporaryStorage;
|
|
@@ -1674,14 +1669,20 @@ class FunctionsTool extends ProjectTool {
|
|
|
1674
1669
|
this.logger.info("Validate not required for Functions projects.");
|
|
1675
1670
|
return ToolResult.success();
|
|
1676
1671
|
}
|
|
1677
|
-
async buildAsync(options,
|
|
1678
|
-
const
|
|
1672
|
+
async buildAsync(options, cancellationToken) {
|
|
1673
|
+
const probe = await this.probeProject(options.projectPath);
|
|
1674
|
+
if (probe.language === undefined) {
|
|
1675
|
+
return this.uninitializedProjectResult(probe, options.projectPath);
|
|
1676
|
+
}
|
|
1677
|
+
const prepared = await this.prepareBuildAsync(probe, options, cancellationToken);
|
|
1678
|
+
if (!prepared.isSuccess) {
|
|
1679
|
+
return prepared;
|
|
1680
|
+
}
|
|
1679
1681
|
const tempFolder = await this._temporaryStorage.getTempFolderPath();
|
|
1680
1682
|
const localBuildFolder = Path.join(tempFolder, NugetConstants.OutputFolderName);
|
|
1681
|
-
const build = language === Languages.Python ? buildPyFunctionsPackage : buildJsFunctionsPackage;
|
|
1682
|
-
const languageLabel = LanguageLabels[language];
|
|
1683
|
+
const build = probe.language === Languages.Python ? buildPyFunctionsPackage : buildJsFunctionsPackage;
|
|
1683
1684
|
try {
|
|
1684
|
-
this.logger.progress(`Building ${
|
|
1685
|
+
this.logger.progress(`Building ${LanguageLabels[probe.language]} Functions package...`);
|
|
1685
1686
|
const projectStorageId = options.projectStorageId ?? await ensureProjectId(options.projectPath, this.fileSystem);
|
|
1686
1687
|
await build(this.fileSystem, {
|
|
1687
1688
|
projectPath: options.projectPath,
|
|
@@ -1690,9 +1691,7 @@ class FunctionsTool extends ProjectTool {
|
|
|
1690
1691
|
});
|
|
1691
1692
|
return new ToolResult("SUCCESS" /* Success */, "Build completed successfully.", [localBuildFolder]);
|
|
1692
1693
|
} catch (error) {
|
|
1693
|
-
|
|
1694
|
-
this.logger.error(errorMessage);
|
|
1695
|
-
return ToolResult.error("INTERNAL_ERROR" /* InternalError */, `Build failed for ${languageLabel} Functions project.`);
|
|
1694
|
+
return this.failureResult(probe, "Build", error);
|
|
1696
1695
|
}
|
|
1697
1696
|
}
|
|
1698
1697
|
async packAsync(options, cancellationToken) {
|
|
@@ -1710,9 +1709,8 @@ class FunctionsTool extends ProjectTool {
|
|
|
1710
1709
|
this.logger.progress("Package created successfully.");
|
|
1711
1710
|
return new ToolResult("SUCCESS" /* Success */, "Pack completed successfully.", [result.outputPath]);
|
|
1712
1711
|
} catch (error) {
|
|
1713
|
-
const
|
|
1714
|
-
this.
|
|
1715
|
-
return ToolResult.error("INTERNAL_ERROR" /* InternalError */, "Pack failed for Functions project.");
|
|
1712
|
+
const probe = await this.probeProject(options.projectPath);
|
|
1713
|
+
return this.failureResult(probe, "Pack", error);
|
|
1716
1714
|
}
|
|
1717
1715
|
}
|
|
1718
1716
|
async dispose() {
|
|
@@ -1721,28 +1719,40 @@ class FunctionsTool extends ProjectTool {
|
|
|
1721
1719
|
await this._temporaryStorage.cleanup();
|
|
1722
1720
|
} catch {}
|
|
1723
1721
|
}
|
|
1724
|
-
async
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1722
|
+
async prepareBuildAsync(_probe, _options, _cancellationToken) {
|
|
1723
|
+
return ToolResult.success();
|
|
1724
|
+
}
|
|
1725
|
+
async probeProject(projectPath) {
|
|
1726
|
+
const [name, language] = await Promise.all([
|
|
1727
|
+
this.resolveProjectName(projectPath),
|
|
1728
|
+
detectProjectLanguage(this.fileSystem, projectPath)
|
|
1729
|
+
]);
|
|
1730
|
+
return { name, language };
|
|
1731
|
+
}
|
|
1732
|
+
uninitializedProjectResult(probe, projectPath) {
|
|
1733
|
+
const message = `${describeProject(probe)} is not initialized: ${projectPath} has no uipath.json functions map, no package.json and no pyproject.toml.`;
|
|
1734
|
+
this.logger.error(message);
|
|
1735
|
+
return ToolResult.error("INTERNAL_ERROR" /* InternalError */, message, "Initialize the project, then pack again.");
|
|
1736
|
+
}
|
|
1737
|
+
failureResult(probe, stage, error) {
|
|
1738
|
+
const inner = error instanceof Error ? error.message : String(error);
|
|
1739
|
+
const languageLabel = probe.language === undefined ? "" : ` (${LanguageLabels[probe.language]})`;
|
|
1740
|
+
const message = `${stage} failed for ${describeProject(probe)}${languageLabel}: ${inner}`;
|
|
1741
|
+
this.logger.error(error instanceof Error ? error.toString() : String(error));
|
|
1742
|
+
return ToolResult.error("INTERNAL_ERROR" /* InternalError */, message);
|
|
1743
|
+
}
|
|
1744
|
+
async resolveProjectName(projectPath) {
|
|
1745
|
+
try {
|
|
1746
|
+
const uiProject = await this.getUiProjectAsync(projectPath);
|
|
1747
|
+
return uiProject?.Name?.trim() ?? "";
|
|
1748
|
+
} catch {
|
|
1749
|
+
return "";
|
|
1739
1750
|
}
|
|
1740
|
-
const pyprojectStat = await this.fileSystem.stat(Path.join(projectPath, "pyproject.toml"));
|
|
1741
|
-
if (pyprojectStat?.isFile())
|
|
1742
|
-
return Languages.Python;
|
|
1743
|
-
return Languages.JavaScript;
|
|
1744
1751
|
}
|
|
1745
1752
|
}
|
|
1753
|
+
function describeProject(probe) {
|
|
1754
|
+
return probe.name ? `Function project '${probe.name}'` : "Function project";
|
|
1755
|
+
}
|
|
1746
1756
|
// ../packager/packager-tool-functions/src/functions-tool-factory.ts
|
|
1747
1757
|
class FunctionsToolFactory {
|
|
1748
1758
|
supportedTypes = ["Function" /* Function */];
|
|
@@ -1753,20 +1763,18 @@ class FunctionsToolFactory {
|
|
|
1753
1763
|
// src/services/manifest-generating-functions-tool.ts
|
|
1754
1764
|
function createManifestGeneratingFunctionsToolFactory() {
|
|
1755
1765
|
class ManifestGeneratingFunctionsTool extends FunctionsTool {
|
|
1756
|
-
async
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
return ToolResult.error("INTERNAL_ERROR" /* InternalError */, "Manifest generation failed for JS/TS Functions project.");
|
|
1767
|
-
}
|
|
1766
|
+
async prepareBuildAsync(probe, options) {
|
|
1767
|
+
if (probe.language !== Languages.JavaScript) {
|
|
1768
|
+
return ToolResult.success();
|
|
1769
|
+
}
|
|
1770
|
+
this.logger.progress("Generating Functions manifests...");
|
|
1771
|
+
try {
|
|
1772
|
+
const { generateManifests } = await import("./cliRunner-23vh097s.js");
|
|
1773
|
+
await generateManifests(options.projectPath);
|
|
1774
|
+
} catch (error) {
|
|
1775
|
+
return this.failureResult(probe, "Manifest generation", error);
|
|
1768
1776
|
}
|
|
1769
|
-
return
|
|
1777
|
+
return ToolResult.success();
|
|
1770
1778
|
}
|
|
1771
1779
|
}
|
|
1772
1780
|
|
|
@@ -1786,4 +1794,4 @@ export {
|
|
|
1786
1794
|
registerPackagerFactories
|
|
1787
1795
|
};
|
|
1788
1796
|
|
|
1789
|
-
//# debugId=
|
|
1797
|
+
//# debugId=5FCF6883C0AABB2364756E2164756E21
|
package/dist/tool.js
CHANGED
|
@@ -14,10 +14,13 @@ import {
|
|
|
14
14
|
processContext,
|
|
15
15
|
stripHostGlobalOptions,
|
|
16
16
|
trackShipSucceeded
|
|
17
|
-
} from "./packager-tool-
|
|
17
|
+
} from "./packager-tool-f7enb48c.js";
|
|
18
|
+
import {
|
|
19
|
+
detectProjectLanguage
|
|
20
|
+
} from "./packager-tool-h7ke7taj.js";
|
|
18
21
|
import {
|
|
19
22
|
getFileSystem
|
|
20
|
-
} from "./packager-tool-
|
|
23
|
+
} from "./packager-tool-y4vgqz1w.js";
|
|
21
24
|
import {
|
|
22
25
|
__require
|
|
23
26
|
} from "./packager-tool-1de529jm.js";
|
|
@@ -26,7 +29,7 @@ var package_default = {
|
|
|
26
29
|
name: "@uipath/function-tool",
|
|
27
30
|
author: "UiPath",
|
|
28
31
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
29
|
-
version: "1.
|
|
32
|
+
version: "1.205.0-preview.256",
|
|
30
33
|
description: "UiPath CLI tool for JS/TS and Python Functions — thin passthrough to uipath-functions / uipath",
|
|
31
34
|
keywords: [
|
|
32
35
|
"uipcli-tool",
|
|
@@ -97,7 +100,7 @@ function registerSetupCommand(program) {
|
|
|
97
100
|
});
|
|
98
101
|
}
|
|
99
102
|
async function reportPythonSetup(force) {
|
|
100
|
-
const { getAllowedPythonVersions, getPackageName, PythonService } = await import("./index-
|
|
103
|
+
const { getAllowedPythonVersions, getPackageName, PythonService } = await import("./index-7gz8y4st.js");
|
|
101
104
|
const packageName = getPackageName();
|
|
102
105
|
const service = new PythonService({
|
|
103
106
|
allowedVersions: getAllowedPythonVersions(),
|
|
@@ -217,7 +220,7 @@ function namesRunTarget(arg) {
|
|
|
217
220
|
// src/services/utils.ts
|
|
218
221
|
async function loadGlobalAuthEnv() {
|
|
219
222
|
try {
|
|
220
|
-
const { loadEnvFileAsync, resolveEnvFilePathAsync } = await import("./index-
|
|
223
|
+
const { loadEnvFileAsync, resolveEnvFilePathAsync } = await import("./index-d5j82d97.js");
|
|
221
224
|
const { absolutePath } = await resolveEnvFilePathAsync();
|
|
222
225
|
if (!absolutePath) {
|
|
223
226
|
return {};
|
|
@@ -254,14 +257,8 @@ var FLAG_ALIASES = {
|
|
|
254
257
|
python: ["py", "python"],
|
|
255
258
|
unknown: []
|
|
256
259
|
};
|
|
257
|
-
var EXTENSION_TO_LANGUAGE = {
|
|
258
|
-
".ts": "javascript",
|
|
259
|
-
".js": "javascript",
|
|
260
|
-
".mjs": "javascript",
|
|
261
|
-
".py": "python"
|
|
262
|
-
};
|
|
263
260
|
async function resolveLanguage(cwd, args) {
|
|
264
|
-
return fromFlag(args) ?? await
|
|
261
|
+
return fromFlag(args) ?? await detectProjectLanguage(fs3, cwd) ?? "unknown";
|
|
265
262
|
}
|
|
266
263
|
function fromFlag(args) {
|
|
267
264
|
const i = args.findIndex((a) => a === "--language" || a === "-l");
|
|
@@ -276,47 +273,6 @@ function fromFlag(args) {
|
|
|
276
273
|
}
|
|
277
274
|
return null;
|
|
278
275
|
}
|
|
279
|
-
async function fromUipathJson(cwd) {
|
|
280
|
-
const path = fs3.path.join(cwd, "uipath.json");
|
|
281
|
-
if (!await fs3.exists(path)) {
|
|
282
|
-
return null;
|
|
283
|
-
}
|
|
284
|
-
try {
|
|
285
|
-
const content = await fs3.readFile(path, "utf-8");
|
|
286
|
-
if (!content) {
|
|
287
|
-
return null;
|
|
288
|
-
}
|
|
289
|
-
const { functions } = JSON.parse(content);
|
|
290
|
-
const lang = inferFromFunctionsMap(functions);
|
|
291
|
-
return lang === "unknown" ? null : lang;
|
|
292
|
-
} catch {
|
|
293
|
-
return null;
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
async function fromMarkerFiles(cwd) {
|
|
297
|
-
if (await fs3.exists(fs3.path.join(cwd, "package.json"))) {
|
|
298
|
-
return "javascript";
|
|
299
|
-
}
|
|
300
|
-
if (await fs3.exists(fs3.path.join(cwd, "pyproject.toml"))) {
|
|
301
|
-
return "python";
|
|
302
|
-
}
|
|
303
|
-
return null;
|
|
304
|
-
}
|
|
305
|
-
function inferFromFunctionsMap(functions) {
|
|
306
|
-
if (!functions) {
|
|
307
|
-
return "unknown";
|
|
308
|
-
}
|
|
309
|
-
const entries = Object.values(functions);
|
|
310
|
-
if (entries.length === 0) {
|
|
311
|
-
return "unknown";
|
|
312
|
-
}
|
|
313
|
-
const ext = extname(entries[0]?.split(":")[0] ?? "");
|
|
314
|
-
return EXTENSION_TO_LANGUAGE[ext] ?? "unknown";
|
|
315
|
-
}
|
|
316
|
-
function extname(filePath) {
|
|
317
|
-
const dot = filePath.lastIndexOf(".");
|
|
318
|
-
return dot >= 0 ? filePath.slice(dot) : "";
|
|
319
|
-
}
|
|
320
276
|
|
|
321
277
|
// src/services/python-args.ts
|
|
322
278
|
function buildPythonArgs(args) {
|
|
@@ -369,7 +325,7 @@ function flagsToDrop(verb) {
|
|
|
369
325
|
|
|
370
326
|
// src/services/python-cli-runner.ts
|
|
371
327
|
async function runPythonCli(args, cwd, options = {}) {
|
|
372
|
-
const { runUipathPythonCommand } = await import("./index-
|
|
328
|
+
const { runUipathPythonCommand } = await import("./index-7gz8y4st.js");
|
|
373
329
|
return runUipathPythonCommand(buildPythonArgs(args), {
|
|
374
330
|
cwd,
|
|
375
331
|
toolName: "function",
|
|
@@ -378,7 +334,7 @@ async function runPythonCli(args, cwd, options = {}) {
|
|
|
378
334
|
});
|
|
379
335
|
}
|
|
380
336
|
async function spawnPythonCli(args, cwd, options = {}) {
|
|
381
|
-
const { reportUipathPythonFailure } = await import("./index-
|
|
337
|
+
const { reportUipathPythonFailure } = await import("./index-7gz8y4st.js");
|
|
382
338
|
return reportUipathPythonFailure(await runPythonCli(args, cwd, options));
|
|
383
339
|
}
|
|
384
340
|
|
|
@@ -422,7 +378,7 @@ async function runAndEmit(runArgs, cwd, outputFile) {
|
|
|
422
378
|
}
|
|
423
379
|
async function reportRunFailure(result) {
|
|
424
380
|
if (result.reason !== "command_failed") {
|
|
425
|
-
const { reportUipathPythonFailure } = await import("./index-
|
|
381
|
+
const { reportUipathPythonFailure } = await import("./index-7gz8y4st.js");
|
|
426
382
|
return reportUipathPythonFailure(result);
|
|
427
383
|
}
|
|
428
384
|
OutputFormatter.error({
|
|
@@ -592,7 +548,7 @@ async function dispatch(rawArgs) {
|
|
|
592
548
|
}
|
|
593
549
|
}
|
|
594
550
|
async function reportSolutionRegistration(projectDir, skipSolutionRegistration) {
|
|
595
|
-
const { tryRegisterProjectInParentSolution } = await import("./index-
|
|
551
|
+
const { tryRegisterProjectInParentSolution } = await import("./index-9zg970m9.js");
|
|
596
552
|
const registration = await tryRegisterProjectInParentSolution(fs5, projectDir, {
|
|
597
553
|
skipRegistration: skipSolutionRegistration
|
|
598
554
|
});
|
|
@@ -775,4 +731,4 @@ export {
|
|
|
775
731
|
registerCommands
|
|
776
732
|
};
|
|
777
733
|
|
|
778
|
-
//# debugId=
|
|
734
|
+
//# debugId=98017E48D54FB48264756E2164756E21
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@uipath/function-tool",
|
|
3
3
|
"author": "UiPath",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
|
-
"version": "1.
|
|
5
|
+
"version": "1.205.0-preview.256",
|
|
6
6
|
"description": "UiPath CLI tool for JS/TS and Python Functions — thin passthrough to uipath-functions / uipath",
|
|
7
7
|
"keywords": [
|
|
8
8
|
"uipcli-tool",
|
|
@@ -35,5 +35,5 @@
|
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"typescript": "^5.7.0"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "63740c6cbb7ff282fa9118cc16a148eb030b245f"
|
|
39
39
|
}
|