@uipath/automation-hub-tool 1.204.0 → 1.205.0-preview.258
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/dist/{tool-hqqd16nk.js → tool-94d7zfj1.js} +193 -37
- package/dist/tool.js +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -2111,7 +2111,7 @@ var package_default = {
|
|
|
2111
2111
|
name: "@uipath/automation-hub-tool",
|
|
2112
2112
|
author: "UiPath",
|
|
2113
2113
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
2114
|
-
version: "1.
|
|
2114
|
+
version: "1.205.0-preview.258",
|
|
2115
2115
|
description: "Automation Hub — automation ideas, pipeline, taxonomy and users.",
|
|
2116
2116
|
private: false,
|
|
2117
2117
|
repository: {
|
|
@@ -2334,6 +2334,16 @@ class NodeFileSystem {
|
|
|
2334
2334
|
async rename(oldPath, newPath) {
|
|
2335
2335
|
await fs.rename(oldPath, newPath);
|
|
2336
2336
|
}
|
|
2337
|
+
async isSymbolicLink(filePath) {
|
|
2338
|
+
try {
|
|
2339
|
+
return (await fs.lstat(filePath)).isSymbolicLink();
|
|
2340
|
+
} catch (error) {
|
|
2341
|
+
if (this.isEnoent(error) || this.hasErrnoCode(error, "ENOTDIR")) {
|
|
2342
|
+
return false;
|
|
2343
|
+
}
|
|
2344
|
+
throw error;
|
|
2345
|
+
}
|
|
2346
|
+
}
|
|
2337
2347
|
async realpath(filePath) {
|
|
2338
2348
|
try {
|
|
2339
2349
|
return await fs.realpath(filePath);
|
|
@@ -2504,7 +2514,7 @@ function setGlobalLogFilePath(path2) {
|
|
|
2504
2514
|
function getGlobalLogFilePath() {
|
|
2505
2515
|
return logFilePathSlot.get("");
|
|
2506
2516
|
}
|
|
2507
|
-
var DEFAULT_LOG_LEVEL =
|
|
2517
|
+
var DEFAULT_LOG_LEVEL = 2 /* WARN */;
|
|
2508
2518
|
|
|
2509
2519
|
class SimpleLogger {
|
|
2510
2520
|
__brand = "SimpleLogger";
|
|
@@ -2771,7 +2781,9 @@ var ErrorDimensions = {
|
|
|
2771
2781
|
Result: "Result",
|
|
2772
2782
|
ErrorCode: "ErrorCode",
|
|
2773
2783
|
Retry: "Retry",
|
|
2774
|
-
ErrorMessage: "ErrorMessage"
|
|
2784
|
+
ErrorMessage: "ErrorMessage",
|
|
2785
|
+
HttpStatus: "HttpStatus",
|
|
2786
|
+
UpstreamErrorCode: "UpstreamErrorCode"
|
|
2775
2787
|
};
|
|
2776
2788
|
var AuthDimensions = {
|
|
2777
2789
|
AuthenticationMethod: "AuthenticationMethod",
|
|
@@ -3765,7 +3777,9 @@ var CLI_ERROR_CODES = [
|
|
|
3765
3777
|
"timeout",
|
|
3766
3778
|
"server_error",
|
|
3767
3779
|
"method_not_allowed",
|
|
3780
|
+
"not_supported",
|
|
3768
3781
|
"configuration_error",
|
|
3782
|
+
"execution_failed",
|
|
3769
3783
|
"unknown_error"
|
|
3770
3784
|
];
|
|
3771
3785
|
var RETRY_HINTS = [
|
|
@@ -4755,7 +4769,9 @@ var OutputFormatter;
|
|
|
4755
4769
|
[ErrorDimensions.Result]: data.Result,
|
|
4756
4770
|
[ErrorDimensions.ErrorCode]: data.ErrorCode,
|
|
4757
4771
|
[ErrorDimensions.Retry]: data.Retry,
|
|
4758
|
-
[ErrorDimensions.ErrorMessage]: data.Message
|
|
4772
|
+
[ErrorDimensions.ErrorMessage]: data.Message,
|
|
4773
|
+
[ErrorDimensions.HttpStatus]: data.Context?.httpStatus?.toString(),
|
|
4774
|
+
[ErrorDimensions.UpstreamErrorCode]: data.Context?.errorCode
|
|
4759
4775
|
});
|
|
4760
4776
|
}
|
|
4761
4777
|
logOutput(normalizeOutputKeys(envelope), getOutputFormat());
|
|
@@ -5793,22 +5809,12 @@ var resolveConfigAsync = async ({
|
|
|
5793
5809
|
baseUrl = DEFAULT_BASE_URL;
|
|
5794
5810
|
}
|
|
5795
5811
|
baseUrl = normalizeAndValidateBaseUrl(baseUrl);
|
|
5796
|
-
|
|
5797
|
-
|
|
5798
|
-
clientId = fileAuth.clientId;
|
|
5799
|
-
}
|
|
5800
|
-
if (!clientId) {
|
|
5801
|
-
clientId = DEFAULT_CLIENT_ID;
|
|
5802
|
-
}
|
|
5803
|
-
let clientSecret = customClientSecret;
|
|
5804
|
-
if (!clientSecret && fileAuth.clientSecret) {
|
|
5805
|
-
clientSecret = fileAuth.clientSecret;
|
|
5806
|
-
}
|
|
5807
|
-
const isExternalAppAuth = clientId !== DEFAULT_CLIENT_ID && (Boolean(clientSecret) || Boolean(customClientAssertion));
|
|
5812
|
+
const clientId = customClientId || DEFAULT_CLIENT_ID;
|
|
5813
|
+
const isExternalAppAuth = clientId !== DEFAULT_CLIENT_ID && (Boolean(customClientSecret) || Boolean(customClientAssertion));
|
|
5808
5814
|
const scopes = resolveScopes(isExternalAppAuth, customScopes, fileAuth.scopes);
|
|
5809
5815
|
return {
|
|
5810
5816
|
clientId,
|
|
5811
|
-
clientSecret,
|
|
5817
|
+
clientSecret: customClientSecret,
|
|
5812
5818
|
scopes,
|
|
5813
5819
|
baseUrl,
|
|
5814
5820
|
authorizationEndpoint: `${baseUrl}/identity_/connect/authorize`,
|
|
@@ -5982,6 +5988,16 @@ var resolveIdentityType = (claims, authFlow, email) => {
|
|
|
5982
5988
|
}
|
|
5983
5989
|
return;
|
|
5984
5990
|
};
|
|
5991
|
+
var resolveApplicationSubtype = (claims, authFlow) => {
|
|
5992
|
+
switch (asString(claims?.sub_type)) {
|
|
5993
|
+
case "service.external":
|
|
5994
|
+
return "External";
|
|
5995
|
+
case "service.internal":
|
|
5996
|
+
return "Internal";
|
|
5997
|
+
default:
|
|
5998
|
+
return authFlow === "client_credentials" || authFlow === "federated_credentials" ? "External" : undefined;
|
|
5999
|
+
}
|
|
6000
|
+
};
|
|
5985
6001
|
var looksLikeEmail = (value) => value?.includes("@") ?? false;
|
|
5986
6002
|
var pickEmail = (claims) => {
|
|
5987
6003
|
for (const candidate of [claims?.email, claims?.preferred_username]) {
|
|
@@ -6023,6 +6039,12 @@ var resolveSessionIdentity = (accessToken, authFlow) => {
|
|
|
6023
6039
|
const clientId = asString(claims?.client_id);
|
|
6024
6040
|
if (clientId)
|
|
6025
6041
|
identity.clientId = clientId;
|
|
6042
|
+
const subType = asString(claims?.sub_type);
|
|
6043
|
+
if (subType)
|
|
6044
|
+
identity.subType = subType;
|
|
6045
|
+
const applicationSubtype = resolveApplicationSubtype(claims, authFlow);
|
|
6046
|
+
if (applicationSubtype)
|
|
6047
|
+
identity.applicationSubtype = applicationSubtype;
|
|
6026
6048
|
return identity;
|
|
6027
6049
|
};
|
|
6028
6050
|
var readTokenScopes = (accessToken) => accessToken ? pickScopes(decodeClaims(accessToken)) : undefined;
|
|
@@ -6315,6 +6337,40 @@ var tryRobotClientFallback = async (options = {}) => {
|
|
|
6315
6337
|
}
|
|
6316
6338
|
};
|
|
6317
6339
|
|
|
6340
|
+
// ../auth/src/tenantSelection.ts
|
|
6341
|
+
var LOGIN_STATUS_HINT = "Run 'uip login status' to see the organization the CLI is signed in to.";
|
|
6342
|
+
var organizationHint = (organizationId) => `The request used '${organizationId}' as the organization. ${LOGIN_STATUS_HINT}`;
|
|
6343
|
+
var IDENTIFIER_STATUSES = new Set([400, 403, 404]);
|
|
6344
|
+
var describeNonJsonResponse = (organizationId, response, parseError) => {
|
|
6345
|
+
if (response.redirected) {
|
|
6346
|
+
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}`;
|
|
6347
|
+
}
|
|
6348
|
+
const contentType = response.headers.get("content-type") ?? "unknown";
|
|
6349
|
+
return `The organization service returned a '${contentType}' response instead ` + `of JSON: ${parseError.message}. ${organizationHint(organizationId)}`;
|
|
6350
|
+
};
|
|
6351
|
+
var fetchTenantsAndOrganizations = async (baseUrl, accessToken, organizationId, signal) => {
|
|
6352
|
+
const url = `${baseUrl}/${organizationId}/portal_/api/filtering/leftnav/tenantsAndOrganizationInfo`;
|
|
6353
|
+
const response = await fetch(url, {
|
|
6354
|
+
headers: {
|
|
6355
|
+
Authorization: `Bearer ${accessToken}`
|
|
6356
|
+
},
|
|
6357
|
+
...signal ? { signal } : {}
|
|
6358
|
+
});
|
|
6359
|
+
if (!response.ok) {
|
|
6360
|
+
if (response.status === 401) {
|
|
6361
|
+
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);
|
|
6362
|
+
}
|
|
6363
|
+
const errorText = await response.text();
|
|
6364
|
+
const message = `Failed to get tenants and organizations: ${response.status} ${errorText}`;
|
|
6365
|
+
throw new Error(IDENTIFIER_STATUSES.has(response.status) ? `${message}. ${organizationHint(organizationId)}` : message);
|
|
6366
|
+
}
|
|
6367
|
+
const [parseError, data] = await catchError2(response.json());
|
|
6368
|
+
if (parseError) {
|
|
6369
|
+
throw new Error(describeNonJsonResponse(organizationId, response, parseError));
|
|
6370
|
+
}
|
|
6371
|
+
return data;
|
|
6372
|
+
};
|
|
6373
|
+
|
|
6318
6374
|
// ../auth/src/tokenRefresh.ts
|
|
6319
6375
|
var TOKEN_REFRESH_REAUTHENTICATE_MESSAGE = "Token refresh failed. Run 'uip login' to re-authenticate.";
|
|
6320
6376
|
|
|
@@ -6527,6 +6583,8 @@ var saveEnvFileAsync = async ({
|
|
|
6527
6583
|
};
|
|
6528
6584
|
|
|
6529
6585
|
// ../auth/src/loginStatus.ts
|
|
6586
|
+
var defaultRobotTenantIdCache = new Map;
|
|
6587
|
+
var ROBOT_TENANT_LOOKUP_TIMEOUT_MS = 5000;
|
|
6530
6588
|
var getLoginStatusAsync = async (options = {}) => {
|
|
6531
6589
|
return getLoginStatusWithDeps(options);
|
|
6532
6590
|
};
|
|
@@ -6539,12 +6597,20 @@ var getLoginStatusWithDeps = async (options = {}, deps = {}) => {
|
|
|
6539
6597
|
refreshToken: refreshTokenFn = refreshAccessToken,
|
|
6540
6598
|
resolveConfig = resolveConfigAsync,
|
|
6541
6599
|
robotFallback = tryRobotClientFallback,
|
|
6600
|
+
fetchTenantsAndOrgs = fetchTenantsAndOrganizations,
|
|
6601
|
+
robotTenantIdCache = defaultRobotTenantIdCache,
|
|
6602
|
+
robotTenantLookupTimeoutMs = ROBOT_TENANT_LOOKUP_TIMEOUT_MS,
|
|
6542
6603
|
loadBreaker = loadRefreshBreaker,
|
|
6543
6604
|
saveBreaker = saveRefreshBreaker,
|
|
6544
6605
|
clearBreaker = clearRefreshBreaker
|
|
6545
6606
|
} = deps;
|
|
6607
|
+
const robotDeps = {
|
|
6608
|
+
fetchTenantsAndOrgs,
|
|
6609
|
+
cache: robotTenantIdCache,
|
|
6610
|
+
lookupTimeoutMs: robotTenantLookupTimeoutMs
|
|
6611
|
+
};
|
|
6546
6612
|
if (isRobotAuthEnforced()) {
|
|
6547
|
-
return resolveRobotEnforcedStatus(robotFallback);
|
|
6613
|
+
return resolveRobotEnforcedStatus(robotFallback, robotDeps);
|
|
6548
6614
|
}
|
|
6549
6615
|
if (isEnvAuthEnabled()) {
|
|
6550
6616
|
return readAuthFromEnv();
|
|
@@ -6562,7 +6628,7 @@ var getLoginStatusWithDeps = async (options = {}, deps = {}) => {
|
|
|
6562
6628
|
hint: `No credentials found for profile "${activeProfile}". Run 'uip login --profile ${activeProfile}' to authenticate this profile.`
|
|
6563
6629
|
};
|
|
6564
6630
|
}
|
|
6565
|
-
return resolveBorrowedRobotStatus(robotFallback);
|
|
6631
|
+
return resolveBorrowedRobotStatus(robotFallback, robotDeps);
|
|
6566
6632
|
}
|
|
6567
6633
|
const loaded = await loadFileCredentials(loadEnvFile, absolutePath);
|
|
6568
6634
|
if ("status" in loaded) {
|
|
@@ -6604,7 +6670,7 @@ var getLoginStatusWithDeps = async (options = {}, deps = {}) => {
|
|
|
6604
6670
|
}
|
|
6605
6671
|
return buildFileStatus(tokens, credentials, globalHint);
|
|
6606
6672
|
};
|
|
6607
|
-
async function resolveRobotEnforcedStatus(robotFallback) {
|
|
6673
|
+
async function resolveRobotEnforcedStatus(robotFallback, deps) {
|
|
6608
6674
|
if (isEnvAuthEnabled()) {
|
|
6609
6675
|
throw new EnvAuthConfigError(`${ENV_AUTH_ENABLE_VAR}=true and ${ENFORCE_ROBOT_AUTH_VAR}=true ` + `are mutually exclusive. Unset one of them and re-run.`);
|
|
6610
6676
|
}
|
|
@@ -6615,11 +6681,11 @@ async function resolveRobotEnforcedStatus(robotFallback) {
|
|
|
6615
6681
|
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.`
|
|
6616
6682
|
};
|
|
6617
6683
|
}
|
|
6618
|
-
return buildRobotStatus(robotCreds);
|
|
6684
|
+
return buildRobotStatus(robotCreds, deps);
|
|
6619
6685
|
}
|
|
6620
|
-
async function resolveBorrowedRobotStatus(robotFallback) {
|
|
6686
|
+
async function resolveBorrowedRobotStatus(robotFallback, deps) {
|
|
6621
6687
|
const robotCreds = await robotFallback();
|
|
6622
|
-
return robotCreds ? buildRobotStatus(robotCreds) : { loginStatus: "Not logged in" };
|
|
6688
|
+
return robotCreds ? buildRobotStatus(robotCreds, deps) : { loginStatus: "Not logged in" };
|
|
6623
6689
|
}
|
|
6624
6690
|
async function loadFileCredentials(loadEnvFile, absolutePath) {
|
|
6625
6691
|
let credentials;
|
|
@@ -6754,9 +6820,10 @@ function identityFields(accessToken, credentials) {
|
|
|
6754
6820
|
...scopes ? { scopes } : {}
|
|
6755
6821
|
};
|
|
6756
6822
|
}
|
|
6757
|
-
function buildRobotStatus(robotCreds) {
|
|
6823
|
+
async function buildRobotStatus(robotCreds, deps) {
|
|
6758
6824
|
const identity = resolveSessionIdentity(robotCreds.accessToken);
|
|
6759
6825
|
const scopes = readTokenScopes(robotCreds.accessToken);
|
|
6826
|
+
const tenant = robotCreds.tenantId ? { tenantId: robotCreds.tenantId } : await resolveRobotTenantId(robotCreds, deps);
|
|
6760
6827
|
return {
|
|
6761
6828
|
loginStatus: "Logged in",
|
|
6762
6829
|
accessToken: robotCreds.accessToken,
|
|
@@ -6764,14 +6831,62 @@ function buildRobotStatus(robotCreds) {
|
|
|
6764
6831
|
organizationName: robotCreds.organizationName,
|
|
6765
6832
|
organizationId: robotCreds.organizationId,
|
|
6766
6833
|
tenantName: robotCreds.tenantName,
|
|
6767
|
-
tenantId:
|
|
6834
|
+
tenantId: tenant.tenantId,
|
|
6768
6835
|
issuer: robotCreds.issuer,
|
|
6769
6836
|
expiration: getTokenExpiration(robotCreds.accessToken),
|
|
6770
6837
|
source: "robot" /* Robot */,
|
|
6838
|
+
...tenant.hint ? { hint: tenant.hint } : {},
|
|
6771
6839
|
...identity ? { identity } : {},
|
|
6772
6840
|
...scopes ? { scopes } : {}
|
|
6773
6841
|
};
|
|
6774
6842
|
}
|
|
6843
|
+
async function resolveRobotTenantId(robotCreds, deps) {
|
|
6844
|
+
const { baseUrl, accessToken, tenantName } = robotCreds;
|
|
6845
|
+
const organization = robotCreds.organizationName ?? robotCreds.organizationId;
|
|
6846
|
+
if (!tenantName || !organization) {
|
|
6847
|
+
return {};
|
|
6848
|
+
}
|
|
6849
|
+
const key = `${baseUrl}|${organization}|${tenantName}|${accessToken}`;
|
|
6850
|
+
let pending = deps.cache.get(key);
|
|
6851
|
+
if (!pending) {
|
|
6852
|
+
pending = catchError2(lookupRobotTenantId({ baseUrl, accessToken, organization, tenantName }, deps)).then(([error, resolution]) => {
|
|
6853
|
+
const settled = error ? { hint: tenantLookupFailureHint(tenantName, error.message) } : resolution;
|
|
6854
|
+
if (!settled.tenantId) {
|
|
6855
|
+
deps.cache.delete(key);
|
|
6856
|
+
}
|
|
6857
|
+
return settled;
|
|
6858
|
+
});
|
|
6859
|
+
deps.cache.set(key, pending);
|
|
6860
|
+
}
|
|
6861
|
+
return pending;
|
|
6862
|
+
}
|
|
6863
|
+
async function lookupRobotTenantId(target, deps) {
|
|
6864
|
+
const { baseUrl, accessToken, organization, tenantName } = target;
|
|
6865
|
+
const [error, data] = await catchError2(deps.fetchTenantsAndOrgs(baseUrl, accessToken, organization, AbortSignal.timeout(deps.lookupTimeoutMs)));
|
|
6866
|
+
if (error) {
|
|
6867
|
+
const reason = error.name === "TimeoutError" ? `the tenant list did not answer within ${deps.lookupTimeoutMs} ms.` : error.message;
|
|
6868
|
+
return { hint: tenantLookupFailureHint(tenantName, reason) };
|
|
6869
|
+
}
|
|
6870
|
+
const rows = data?.tenants;
|
|
6871
|
+
const tenants = Array.isArray(rows) ? rows.filter((tenant) => typeof tenant?.id === "string" && typeof tenant?.name === "string") : [];
|
|
6872
|
+
const wantedName = decodePathSegment(tenantName);
|
|
6873
|
+
const wanted = wantedName.toLowerCase();
|
|
6874
|
+
const match = tenants.find((tenant) => tenant.name === wantedName) ?? tenants.find((tenant) => tenant.name.toLowerCase() === wanted);
|
|
6875
|
+
if (!match) {
|
|
6876
|
+
const names = tenants.map((tenant) => tenant.name).join(", ");
|
|
6877
|
+
return {
|
|
6878
|
+
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.`
|
|
6879
|
+
};
|
|
6880
|
+
}
|
|
6881
|
+
return { tenantId: match.id };
|
|
6882
|
+
}
|
|
6883
|
+
function tenantLookupFailureHint(tenantName, reason) {
|
|
6884
|
+
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.`;
|
|
6885
|
+
}
|
|
6886
|
+
function decodePathSegment(segment) {
|
|
6887
|
+
const [error, decoded] = catchError2(() => decodeURIComponent(segment));
|
|
6888
|
+
return error ? segment : decoded;
|
|
6889
|
+
}
|
|
6775
6890
|
var isFileNotFoundError = (error) => {
|
|
6776
6891
|
if (!(error instanceof Object))
|
|
6777
6892
|
return false;
|
|
@@ -7040,9 +7155,6 @@ var getAuthContext = async (options = {}) => {
|
|
|
7040
7155
|
identity: status.identity
|
|
7041
7156
|
};
|
|
7042
7157
|
};
|
|
7043
|
-
// ../auth/src/tenantSelection.ts
|
|
7044
|
-
var IDENTIFIER_STATUSES = new Set([400, 403, 404]);
|
|
7045
|
-
|
|
7046
7158
|
// ../auth/src/selectTenant.ts
|
|
7047
7159
|
var TENANT_SELECTION_REQUIRED_CODE = "TENANT_SELECTION_REQUIRED";
|
|
7048
7160
|
var INVALID_TENANT_CODE = "INVALID_TENANT";
|
|
@@ -8399,16 +8511,24 @@ function buildPath(options, page, window) {
|
|
|
8399
8511
|
|
|
8400
8512
|
// src/bpmn-upload.ts
|
|
8401
8513
|
var BPMN_EXTENSION = ".bpmn";
|
|
8402
|
-
var
|
|
8514
|
+
var PROCESS_MAP_DOCUMENT_TYPE_ID = 6;
|
|
8515
|
+
var isBpmnFileName = (fileName) => fileName.toLowerCase().endsWith(BPMN_EXTENSION);
|
|
8516
|
+
var DIAGRAM_ELEMENT = /<(?:[^\s<>/:!?]+:)?BPMNDiagram(?=[\s/>])/;
|
|
8517
|
+
var POOL_OR_LANES_ELEMENT = /<(?:[^\s<>/:!?]+:)?(?:participant|laneSet)(?=[\s/>])/;
|
|
8403
8518
|
var XML_COMMENT = /<!--[\s\S]*?-->/g;
|
|
8404
|
-
var
|
|
8519
|
+
var hasElement = (xml, element) => element.test(xml) && element.test(xml.replace(XML_COMMENT, ""));
|
|
8405
8520
|
async function ensureBpmnLayout(upload) {
|
|
8406
|
-
if (!upload.file_name
|
|
8521
|
+
if (!isBpmnFileName(upload.file_name))
|
|
8407
8522
|
return { upload };
|
|
8408
|
-
}
|
|
8409
8523
|
const xml = Buffer.from(upload.file_content, "base64").toString("utf-8");
|
|
8410
|
-
if (
|
|
8524
|
+
if (hasElement(xml, DIAGRAM_ELEMENT))
|
|
8411
8525
|
return { upload };
|
|
8526
|
+
if (hasElement(xml, POOL_OR_LANES_ELEMENT)) {
|
|
8527
|
+
return {
|
|
8528
|
+
upload,
|
|
8529
|
+
skipped: "The map has a pool or lanes, which the generated layout would " + "drop, so it was uploaded without a layout."
|
|
8530
|
+
};
|
|
8531
|
+
}
|
|
8412
8532
|
const { applyBpmnLayout } = await import("./index-wsq7vfwv.js");
|
|
8413
8533
|
const result = await applyBpmnLayout(xml);
|
|
8414
8534
|
if (!result.success) {
|
|
@@ -8461,6 +8581,19 @@ var CREATE_EXAMPLES3 = [
|
|
|
8461
8581
|
Data: { AutomationId: 20, Id: 11, Title: "Process definition" }
|
|
8462
8582
|
}
|
|
8463
8583
|
},
|
|
8584
|
+
{
|
|
8585
|
+
Description: "Upload a process map — a .bpmn file defaults to type 6 (Process Map), the only type Automation Hub opens in its process map editor",
|
|
8586
|
+
Command: 'uip ah documents create 20 --title "Order to cash" ' + '--description "TO-BE" --file ./order-to-cash.bpmn',
|
|
8587
|
+
Output: {
|
|
8588
|
+
Code: "AhDocumentsCreate",
|
|
8589
|
+
Data: {
|
|
8590
|
+
AutomationId: 20,
|
|
8591
|
+
Id: 12,
|
|
8592
|
+
Title: "Order to cash",
|
|
8593
|
+
TypeId: 6
|
|
8594
|
+
}
|
|
8595
|
+
}
|
|
8596
|
+
},
|
|
8464
8597
|
{
|
|
8465
8598
|
Description: "Attach a document by link instead of uploading bytes",
|
|
8466
8599
|
Command: 'uip ah documents create 20 --title "Process definition" ' + '--description "PDD v2" --document-type-id 1 --embed-link https://acme.sharepoint.com/pdd.docx',
|
|
@@ -8480,6 +8613,16 @@ var DOWNLOAD_EXAMPLES2 = [
|
|
|
8480
8613
|
}
|
|
8481
8614
|
}
|
|
8482
8615
|
];
|
|
8616
|
+
var DOCUMENT_TYPE_HELP = "Document type id: 1 PDD, 2 SDD, 3 DSD, 4 SOP, 5 DWI, 6 Process Map, " + "7 Input file, 8 Output file, 9 Misc, 10 Task Capture, 11 Source code. " + "Defaults to 6 for a .bpmn --file; required otherwise";
|
|
8617
|
+
function resolveDocumentTypeId(options) {
|
|
8618
|
+
if (options.documentTypeId !== undefined) {
|
|
8619
|
+
return Number(options.documentTypeId);
|
|
8620
|
+
}
|
|
8621
|
+
if (options.file !== undefined && isBpmnFileName(options.file)) {
|
|
8622
|
+
return PROCESS_MAP_DOCUMENT_TYPE_ID;
|
|
8623
|
+
}
|
|
8624
|
+
return;
|
|
8625
|
+
}
|
|
8483
8626
|
function registerDocumentsCommand(program2) {
|
|
8484
8627
|
const documentsCmd = program2.command("documents").description("Manage the documents attached to an automation");
|
|
8485
8628
|
withAllFields(withPaging(documentsCmd.command("list <automation-id>").description("List the documents attached to an automation"))).examples(LIST_EXAMPLES4).trackedAction(processContext, async (automationId, options) => {
|
|
@@ -8488,11 +8631,16 @@ function registerDocumentsCommand(program2) {
|
|
|
8488
8631
|
return;
|
|
8489
8632
|
await runPagedList(config, (page) => `/automations/${encodeURIComponent(automationId)}/documents${query({ page })}`, "documents", "AhDocumentsList", DOCUMENT_FIELDS, options, "Check the automation id ('uip ah automations list').");
|
|
8490
8633
|
});
|
|
8491
|
-
documentsCmd.command("create <automation-id>").description("Attach a document to an automation — upload the file's bytes with " + "--file, or link to it with --embed-link (exactly one of the two).").option("--submitter <email>", "Email of the submitting Automation Hub user (defaults to the caller)").requiredOption("--title <text>", "Document title").requiredOption("--description <text>", "Document description").
|
|
8634
|
+
documentsCmd.command("create <automation-id>").description("Attach a document to an automation — upload the file's bytes with " + "--file, or link to it with --embed-link (exactly one of the two).").option("--submitter <email>", "Email of the submitting Automation Hub user (defaults to the caller)").requiredOption("--title <text>", "Document title").requiredOption("--description <text>", "Document description").option("--document-type-id <id>", DOCUMENT_TYPE_HELP).option("--file <path>", "Local document file to upload").option("--embed-link <url>", "Link to an already-hosted document").examples(CREATE_EXAMPLES3).trackedAction(processContext, async (automationId, options) => {
|
|
8492
8635
|
if (options.file === undefined === (options.embedLink === undefined)) {
|
|
8493
8636
|
failValidation("Pass exactly one of --file or --embed-link.", "--file uploads the document's bytes; --embed-link records a URL.");
|
|
8494
8637
|
return;
|
|
8495
8638
|
}
|
|
8639
|
+
const documentTypeId = resolveDocumentTypeId(options);
|
|
8640
|
+
if (documentTypeId === undefined) {
|
|
8641
|
+
failValidation("--document-type-id is required unless --file is a .bpmn process map.", "Pass --document-type-id — 1 PDD, 2 SDD, 6 Process Map, 9 Misc; " + "see 'uip ah documents create --help' for the full list.");
|
|
8642
|
+
return;
|
|
8643
|
+
}
|
|
8496
8644
|
const config = await loadConfigOrExit();
|
|
8497
8645
|
if (!config)
|
|
8498
8646
|
return;
|
|
@@ -8511,7 +8659,7 @@ function registerDocumentsCommand(program2) {
|
|
|
8511
8659
|
...options.submitter === undefined ? {} : { submitter: options.submitter },
|
|
8512
8660
|
document_title: options.title,
|
|
8513
8661
|
document_description: options.description,
|
|
8514
|
-
document_type_id:
|
|
8662
|
+
document_type_id: documentTypeId,
|
|
8515
8663
|
...upload !== undefined ? { file: upload } : { embed_link: options.embedLink }
|
|
8516
8664
|
}));
|
|
8517
8665
|
if (err) {
|
|
@@ -8519,17 +8667,25 @@ function registerDocumentsCommand(program2) {
|
|
|
8519
8667
|
return;
|
|
8520
8668
|
}
|
|
8521
8669
|
const data = unwrapData(body) ?? {};
|
|
8670
|
+
const isMisfiledMap = upload !== undefined && isBpmnFileName(upload.file_name) && documentTypeId !== PROCESS_MAP_DOCUMENT_TYPE_ID;
|
|
8522
8671
|
emit("AhDocumentsCreate", {
|
|
8523
8672
|
AutomationId: Number(automationId),
|
|
8524
8673
|
Id: data.document_id,
|
|
8525
8674
|
Title: options.title,
|
|
8675
|
+
TypeId: documentTypeId,
|
|
8526
8676
|
...options.embedLink === undefined ? { FileId: data.file_id, File: upload?.file_name } : { EmbedLink: options.embedLink },
|
|
8527
8677
|
...layout?.generated === undefined ? {} : {
|
|
8528
8678
|
LayoutGenerated: true,
|
|
8529
8679
|
ShapeCount: layout.generated.shapeCount,
|
|
8530
8680
|
EdgeCount: layout.generated.edgeCount
|
|
8531
8681
|
},
|
|
8532
|
-
...layout?.warning === undefined ? {} : { LayoutWarning: layout.warning }
|
|
8682
|
+
...layout?.warning === undefined ? {} : { LayoutWarning: layout.warning },
|
|
8683
|
+
...layout?.skipped === undefined ? {} : {
|
|
8684
|
+
LayoutSkipped: isMisfiledMap ? layout.skipped : `${layout.skipped} The Automation Hub process map ` + "editor lays it out, lanes included, when it opens the map."
|
|
8685
|
+
},
|
|
8686
|
+
...isMisfiledMap ? {
|
|
8687
|
+
DocumentTypeWarning: `A .bpmn file stored as type ${documentTypeId} is download-only in ` + "Automation Hub. Upload it as type 6 (Process Map) to open it " + "in the process map editor."
|
|
8688
|
+
} : {}
|
|
8533
8689
|
});
|
|
8534
8690
|
});
|
|
8535
8691
|
documentsCmd.command("download <file-id>").description("Download a stored document by its file id").requiredOption("--destination <path>", "Local path to write the file to").examples(DOWNLOAD_EXAMPLES2).trackedAction(processContext, async (fileId, options) => {
|
|
@@ -9229,4 +9385,4 @@ var registerCommands = async (program2) => {
|
|
|
9229
9385
|
|
|
9230
9386
|
export { Command, metadata, registerCommands };
|
|
9231
9387
|
|
|
9232
|
-
//# debugId=
|
|
9388
|
+
//# debugId=0FBA8D028A1CD8D964756E2164756E21
|
package/dist/tool.js
CHANGED
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@uipath/automation-hub-tool",
|
|
3
3
|
"author": "UiPath",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
|
-
"version": "1.
|
|
5
|
+
"version": "1.205.0-preview.258",
|
|
6
6
|
"description": "Automation Hub — automation ideas, pipeline, taxonomy and users.",
|
|
7
7
|
"private": false,
|
|
8
8
|
"repository": {
|
|
@@ -27,5 +27,5 @@
|
|
|
27
27
|
"files": [
|
|
28
28
|
"dist"
|
|
29
29
|
],
|
|
30
|
-
"gitHead": "
|
|
30
|
+
"gitHead": "8f629ee9fa89abf94f197436a60cb3b9620f8b27"
|
|
31
31
|
}
|