@uipath/codedapp-tool 1.202.0-preview.159 → 1.203.0-preview.160
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/THIRD-PARTY-NOTICES.md +47 -20
- package/dist/{index-m7gsq50b.js → embedded-file-reader-0sjt4nkj.js} +96 -18441
- package/dist/first-party-service-srxaftkn.js +27 -0
- package/dist/index-6zef5vcv.js +18543 -0
- package/dist/{index-7zbv11qn.js → index-8yrjtchg.js} +14 -2
- package/dist/index-kmp9fmhb.js +25 -0
- package/dist/index.js +5 -5
- package/dist/packager-tool-53w8skv5.js +262 -0
- package/dist/{packager-tool-x4ekz7mw.js → packager-tool-8zzy6ght.js} +6898 -21058
- package/dist/{packager-tool-pvtdkdk8.js → packager-tool-bvm4jqr1.js} +127 -12
- package/dist/{packager-tool-58asqeb7.js → packager-tool-f1ptyxe1.js} +298 -24
- package/dist/packager-tool-gdtpsdn7.js +342 -0
- package/dist/packager-tool-shwgy5p6.js +27197 -0
- package/dist/packager-tool.js +4 -4
- package/dist/tool.js +5 -5
- package/package.json +3 -2
- package/dist/packager-tool-05wez2xw.js +0 -1837
|
@@ -566,6 +566,63 @@ function getActiveAuthProfileFilePath() {
|
|
|
566
566
|
const profile = getActiveAuthProfile();
|
|
567
567
|
return profile ? resolveAuthProfileFilePath(profile) : undefined;
|
|
568
568
|
}
|
|
569
|
+
function getAuthProfilesRootPath() {
|
|
570
|
+
const fs = getFileSystem();
|
|
571
|
+
return fs.path.join(fs.env.homedir(), UIPATH_HOME_DIR, PROFILE_DIR);
|
|
572
|
+
}
|
|
573
|
+
function resolveAuthProfileDirPath(profile) {
|
|
574
|
+
const normalized = normalizeAuthProfileName(profile);
|
|
575
|
+
if (normalized === undefined) {
|
|
576
|
+
throw new AuthProfileValidationError(`"${DEFAULT_AUTH_PROFILE}" is the built-in profile and does not have a profile directory.`);
|
|
577
|
+
}
|
|
578
|
+
const fs = getFileSystem();
|
|
579
|
+
return fs.path.join(getAuthProfilesRootPath(), normalized);
|
|
580
|
+
}
|
|
581
|
+
async function listAuthProfileNamesAsync() {
|
|
582
|
+
const fs = getFileSystem();
|
|
583
|
+
const root = getAuthProfilesRootPath();
|
|
584
|
+
if (!await fs.exists(root)) {
|
|
585
|
+
return [];
|
|
586
|
+
}
|
|
587
|
+
const [readError, entries] = await catchError(fs.readdir(root));
|
|
588
|
+
if (readError || !entries) {
|
|
589
|
+
return [];
|
|
590
|
+
}
|
|
591
|
+
const names = [];
|
|
592
|
+
for (const entry of entries) {
|
|
593
|
+
if (!PROFILE_NAME_RE.test(entry) || entry === DEFAULT_AUTH_PROFILE) {
|
|
594
|
+
continue;
|
|
595
|
+
}
|
|
596
|
+
const stats = await fs.stat(fs.path.join(root, entry));
|
|
597
|
+
if (stats?.isDirectory()) {
|
|
598
|
+
names.push(entry);
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
return names.sort((a, b) => a.localeCompare(b));
|
|
602
|
+
}
|
|
603
|
+
async function authProfileExistsAsync(profile) {
|
|
604
|
+
const fs = getFileSystem();
|
|
605
|
+
const [pathError, dir] = catchError(() => resolveAuthProfileDirPath(profile));
|
|
606
|
+
if (pathError || dir === undefined) {
|
|
607
|
+
return false;
|
|
608
|
+
}
|
|
609
|
+
const stats = await fs.stat(dir);
|
|
610
|
+
return stats?.isDirectory() === true;
|
|
611
|
+
}
|
|
612
|
+
async function deleteAuthProfileAsync(profile) {
|
|
613
|
+
const dir = resolveAuthProfileDirPath(profile);
|
|
614
|
+
const fs = getFileSystem();
|
|
615
|
+
const relativeToRoot = fs.path.relative(getAuthProfilesRootPath(), dir);
|
|
616
|
+
if (relativeToRoot === "" || relativeToRoot.startsWith("..") || fs.path.isAbsolute(relativeToRoot)) {
|
|
617
|
+
throw new AuthProfileValidationError(`Refusing to delete "${profile}": resolved path escapes the profiles directory.`);
|
|
618
|
+
}
|
|
619
|
+
const stats = await fs.stat(dir);
|
|
620
|
+
if (stats?.isDirectory() !== true) {
|
|
621
|
+
return;
|
|
622
|
+
}
|
|
623
|
+
await fs.rm(dir);
|
|
624
|
+
return dir;
|
|
625
|
+
}
|
|
569
626
|
|
|
570
627
|
// ../auth/src/utils/jwt.ts
|
|
571
628
|
class InvalidIssuerError extends Error {
|
|
@@ -1134,16 +1191,7 @@ var resolveEnvFilePathAsync = async (envFilePath = DEFAULT_ENV_FILENAME, opts) =
|
|
|
1134
1191
|
errorMessage: location.source === "absolute" ? `Environment file not found: ${envFilePath}` : `Unable to locate environment file: ${envFilePath}. Run 'uip login' to authenticate.`
|
|
1135
1192
|
};
|
|
1136
1193
|
};
|
|
1137
|
-
var
|
|
1138
|
-
const fs = getFileSystem();
|
|
1139
|
-
const absolutePath = fs.path.isAbsolute(envPath) ? envPath : fs.path.join(fs.env.cwd(), envPath);
|
|
1140
|
-
if (!await fs.exists(absolutePath)) {
|
|
1141
|
-
throw new Error(`Environment file not found: ${envPath}`);
|
|
1142
|
-
}
|
|
1143
|
-
const content = await fs.readFile(absolutePath, "utf-8");
|
|
1144
|
-
if (content === null) {
|
|
1145
|
-
throw new Error(`Environment file not found: ${envPath}`);
|
|
1146
|
-
}
|
|
1194
|
+
var parseEnvContent = (content) => {
|
|
1147
1195
|
const env = {};
|
|
1148
1196
|
for (const line of content.split(`
|
|
1149
1197
|
`)) {
|
|
@@ -1164,6 +1212,18 @@ var loadEnvFileAsync = async ({ envPath }) => {
|
|
|
1164
1212
|
}
|
|
1165
1213
|
return env;
|
|
1166
1214
|
};
|
|
1215
|
+
var loadEnvFileAsync = async ({ envPath }) => {
|
|
1216
|
+
const fs = getFileSystem();
|
|
1217
|
+
const absolutePath = fs.path.isAbsolute(envPath) ? envPath : fs.path.join(fs.env.cwd(), envPath);
|
|
1218
|
+
if (!await fs.exists(absolutePath)) {
|
|
1219
|
+
throw new Error(`Environment file not found: ${envPath}`);
|
|
1220
|
+
}
|
|
1221
|
+
const content = await fs.readFile(absolutePath, "utf-8");
|
|
1222
|
+
if (content === null) {
|
|
1223
|
+
throw new Error(`Environment file not found: ${envPath}`);
|
|
1224
|
+
}
|
|
1225
|
+
return parseEnvContent(content);
|
|
1226
|
+
};
|
|
1167
1227
|
var saveEnvFileAsync = async ({
|
|
1168
1228
|
envPath,
|
|
1169
1229
|
data,
|
|
@@ -1738,6 +1798,61 @@ var getAuthEnv = async (options = {}) => {
|
|
|
1738
1798
|
}
|
|
1739
1799
|
return { authEnv, loginStatus: status };
|
|
1740
1800
|
};
|
|
1801
|
+
// ../auth/src/authProfileDetails.ts
|
|
1802
|
+
var ORGANIZATION_NAME_KEY = "UIPATH_ORGANIZATION_NAME";
|
|
1803
|
+
var TENANT_NAME_KEY = "UIPATH_TENANT_NAME";
|
|
1804
|
+
var URL_KEY = "UIPATH_URL";
|
|
1805
|
+
var ACCESS_TOKEN_KEY = "UIPATH_ACCESS_TOKEN";
|
|
1806
|
+
function statusFromToken(accessToken) {
|
|
1807
|
+
if (!accessToken) {
|
|
1808
|
+
return { status: "Not logged in" };
|
|
1809
|
+
}
|
|
1810
|
+
const expiration = getTokenExpiration(accessToken);
|
|
1811
|
+
if (expiration === undefined) {
|
|
1812
|
+
return { status: "Logged in" };
|
|
1813
|
+
}
|
|
1814
|
+
return {
|
|
1815
|
+
status: expiration.getTime() <= Date.now() ? "Expired" : "Logged in",
|
|
1816
|
+
expiresAt: expiration.toISOString()
|
|
1817
|
+
};
|
|
1818
|
+
}
|
|
1819
|
+
async function describeAuthProfileAsync(name, filePath, active) {
|
|
1820
|
+
const base = {
|
|
1821
|
+
name,
|
|
1822
|
+
active,
|
|
1823
|
+
...filePath ? { path: filePath } : {}
|
|
1824
|
+
};
|
|
1825
|
+
if (!filePath) {
|
|
1826
|
+
return { ...base, status: "Not logged in" };
|
|
1827
|
+
}
|
|
1828
|
+
const fs = getFileSystem();
|
|
1829
|
+
const [readError, content] = await catchError(fs.readFile(filePath, "utf-8"));
|
|
1830
|
+
if (readError) {
|
|
1831
|
+
return { ...base, status: "Unreadable" };
|
|
1832
|
+
}
|
|
1833
|
+
if (content === null || content === undefined) {
|
|
1834
|
+
return { ...base, status: "Not logged in" };
|
|
1835
|
+
}
|
|
1836
|
+
const values = parseEnvContent(content);
|
|
1837
|
+
return {
|
|
1838
|
+
...base,
|
|
1839
|
+
...values[ORGANIZATION_NAME_KEY] ? { organizationName: values[ORGANIZATION_NAME_KEY] } : {},
|
|
1840
|
+
...values[TENANT_NAME_KEY] ? { tenantName: values[TENANT_NAME_KEY] } : {},
|
|
1841
|
+
...values[URL_KEY] ? { url: values[URL_KEY] } : {},
|
|
1842
|
+
...statusFromToken(values[ACCESS_TOKEN_KEY])
|
|
1843
|
+
};
|
|
1844
|
+
}
|
|
1845
|
+
async function describeAuthProfilesAsync() {
|
|
1846
|
+
const activeProfile = getActiveAuthProfile();
|
|
1847
|
+
const [defaultPathError, defaultLocation] = await catchError(resolveEnvFilePathAsync());
|
|
1848
|
+
const rows = [
|
|
1849
|
+
await describeAuthProfileAsync(DEFAULT_AUTH_PROFILE, defaultPathError ? undefined : defaultLocation?.absolutePath, activeProfile === undefined)
|
|
1850
|
+
];
|
|
1851
|
+
for (const name of await listAuthProfileNamesAsync()) {
|
|
1852
|
+
rows.push(await describeAuthProfileAsync(name, resolveAuthProfileFilePath(name), activeProfile === name));
|
|
1853
|
+
}
|
|
1854
|
+
return rows;
|
|
1855
|
+
}
|
|
1741
1856
|
// ../auth/src/tokenGrant.ts
|
|
1742
1857
|
var requestClientCredentialsToken = async ({
|
|
1743
1858
|
tokenEndpoint,
|
|
@@ -2320,6 +2435,6 @@ var authenticate = async ({
|
|
|
2320
2435
|
});
|
|
2321
2436
|
};
|
|
2322
2437
|
|
|
2323
|
-
export { setAuthFileConfig, InvalidBaseUrlError, DEFAULT_AUTH_PROFILE, AuthProfileValidationError, normalizeAuthProfileName, setActiveAuthProfile, clearActiveAuthProfile, getActiveAuthProfile, runWithAuthProfile, resolveAuthProfileFilePath, getActiveAuthProfileFilePath, parseJWT, parseAuthFlow, resolveSessionIdentity, 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, ClientCredentialsAuthenticationError, clientCredentialsLogin, JWT_BEARER_ASSERTION_TYPE, FederatedCredentialsAuthenticationError, federatedCredentialsLogin, fetchTenantsAndOrganizations, TENANT_SELECTION_REQUIRED_CODE, INVALID_TENANT_CODE, TenantSelectionError, TenantSelectionRequiredError, InvalidTenantError, isTenantSelectionError, selectTenantWithDeps, interactiveLoginWithDeps, interactiveLogin, logoutWithDeps, logout, authenticate };
|
|
2438
|
+
export { setAuthFileConfig, InvalidBaseUrlError, DEFAULT_AUTH_PROFILE, AuthProfileValidationError, normalizeAuthProfileName, setActiveAuthProfile, clearActiveAuthProfile, getActiveAuthProfile, runWithAuthProfile, resolveAuthProfileFilePath, getActiveAuthProfileFilePath, getAuthProfilesRootPath, resolveAuthProfileDirPath, listAuthProfileNamesAsync, authProfileExistsAsync, deleteAuthProfileAsync, parseJWT, parseAuthFlow, resolveSessionIdentity, 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, fetchTenantsAndOrganizations, TENANT_SELECTION_REQUIRED_CODE, INVALID_TENANT_CODE, TenantSelectionError, TenantSelectionRequiredError, InvalidTenantError, isTenantSelectionError, selectTenantWithDeps, interactiveLoginWithDeps, interactiveLogin, logoutWithDeps, logout, authenticate };
|
|
2324
2439
|
|
|
2325
|
-
//# debugId=
|
|
2440
|
+
//# debugId=E7AC7F320178FAB464756E2164756E21
|
|
@@ -2398,7 +2398,7 @@ var UUID_PATTERN = /\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{1
|
|
|
2398
2398
|
var EMAIL_PATTERN = /\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/g;
|
|
2399
2399
|
var JWT_PATTERN = /\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/g;
|
|
2400
2400
|
var LONG_TOKEN_PATTERN = /\b[A-Za-z0-9_-]{40,}\b/g;
|
|
2401
|
-
var PADDED_BASE64_PATTERN = /[A-Za-z0-9+/]{16,}={1,2}(?![A-Za-z0-9+/=])/g;
|
|
2401
|
+
var PADDED_BASE64_PATTERN = /(?<![A-Za-z0-9+/])[A-Za-z0-9+/]{16,}={1,2}(?![A-Za-z0-9+/=])/g;
|
|
2402
2402
|
var BASE64_WITH_PLUS_PATTERN = /[A-Za-z0-9+/]{40,}/g;
|
|
2403
2403
|
var USER_HOME_PATTERN = /(?<![A-Za-z0-9._-])([/\\])(Users|home|Profiles)([/\\])([^/\\]+)/gi;
|
|
2404
2404
|
var UNC_PATH_PATTERN = /(^|[\s"'<>|=,;([{])(\\\\[^\s"'<>|]+)/g;
|
|
@@ -2445,7 +2445,7 @@ var QUOTED_LITERAL_PATTERN = new RegExp([
|
|
|
2445
2445
|
`(?<![A-Za-z0-9])"(?:[^\\
|
|
2446
2446
|
]|\\.){2,${QUOTED_LITERAL_MAX_SPAN}}?"(?![A-Za-z0-9])`
|
|
2447
2447
|
].join("|"), "g");
|
|
2448
|
-
var JSON_BODY_PATTERN = /[{[][^{}[\]]*[:,][^{}[\]]*[\]}]/g;
|
|
2448
|
+
var JSON_BODY_PATTERN = /[{[][^{}[\]:,]*[:,][^{}[\]]*[\]}]/g;
|
|
2449
2449
|
var COLLAPSED_BODY = "{…}";
|
|
2450
2450
|
var COLLAPSED_BODY_MARKER = "\x01body\x01";
|
|
2451
2451
|
var MAX_BODY_NESTING = 8;
|
|
@@ -2460,10 +2460,13 @@ function collapseJsonBodies(text) {
|
|
|
2460
2460
|
}
|
|
2461
2461
|
return out.split(COLLAPSED_BODY_MARKER).join(COLLAPSED_BODY);
|
|
2462
2462
|
}
|
|
2463
|
-
var TRAILING_PROSE_PUNCT =
|
|
2463
|
+
var TRAILING_PROSE_PUNCT = `.,;:!?)]}>'"`;
|
|
2464
2464
|
function peelTrailingPunctuation(match) {
|
|
2465
|
-
|
|
2466
|
-
|
|
2465
|
+
let end = match.length;
|
|
2466
|
+
while (end > 0 && TRAILING_PROSE_PUNCT.includes(match[end - 1])) {
|
|
2467
|
+
end -= 1;
|
|
2468
|
+
}
|
|
2469
|
+
return [match.slice(0, end), match.slice(end)];
|
|
2467
2470
|
}
|
|
2468
2471
|
function redactUrl(raw) {
|
|
2469
2472
|
try {
|
|
@@ -2766,6 +2769,22 @@ function parseHttpStatusFromMessage(message) {
|
|
|
2766
2769
|
const status = Number(match[1]);
|
|
2767
2770
|
return Number.isInteger(status) && status >= 100 && status <= 599 ? status : undefined;
|
|
2768
2771
|
}
|
|
2772
|
+
function findHttpStatusInGraph(error) {
|
|
2773
|
+
for (const node of walkErrorGraph(error)) {
|
|
2774
|
+
const response = node.response;
|
|
2775
|
+
const explicit = typeof node.status === "number" ? node.status : response?.status;
|
|
2776
|
+
if (typeof explicit === "number" && explicit >= 400 && explicit <= 599) {
|
|
2777
|
+
return explicit;
|
|
2778
|
+
}
|
|
2779
|
+
if (typeof node.message === "string") {
|
|
2780
|
+
const parsed = parseHttpStatusFromMessage(node.message);
|
|
2781
|
+
if (parsed !== undefined && parsed >= 400) {
|
|
2782
|
+
return parsed;
|
|
2783
|
+
}
|
|
2784
|
+
}
|
|
2785
|
+
}
|
|
2786
|
+
return;
|
|
2787
|
+
}
|
|
2769
2788
|
function isHtmlDocument(body) {
|
|
2770
2789
|
return /^\s*(<!doctype html|<html\b)/i.test(body);
|
|
2771
2790
|
}
|
|
@@ -2879,7 +2898,8 @@ async function extractErrorDetails(error, options) {
|
|
|
2879
2898
|
}
|
|
2880
2899
|
let message;
|
|
2881
2900
|
let result = "Failure";
|
|
2882
|
-
const
|
|
2901
|
+
const classificationStatus = status ?? findHttpStatusInGraph(error);
|
|
2902
|
+
const classification = classifyError(classificationStatus, error);
|
|
2883
2903
|
let retry = classification.retry;
|
|
2884
2904
|
if (status === 401) {
|
|
2885
2905
|
message = DEFAULT_401;
|
|
@@ -2955,8 +2975,8 @@ async function extractErrorDetails(error, options) {
|
|
|
2955
2975
|
details = describeThrownValue(error);
|
|
2956
2976
|
}
|
|
2957
2977
|
const context = {};
|
|
2958
|
-
if (
|
|
2959
|
-
context.httpStatus =
|
|
2978
|
+
if (classificationStatus) {
|
|
2979
|
+
context.httpStatus = classificationStatus;
|
|
2960
2980
|
}
|
|
2961
2981
|
if (parsedBody?.errorCode && typeof parsedBody.errorCode === "string") {
|
|
2962
2982
|
context.errorCode = parsedBody.errorCode;
|
|
@@ -3519,7 +3539,8 @@ function readRegistryValue(keyPath, valueName) {
|
|
|
3519
3539
|
}
|
|
3520
3540
|
const [error, output] = catchError(() => execFileSync("reg", ["query", keyPath, "/v", valueName], {
|
|
3521
3541
|
encoding: "utf-8",
|
|
3522
|
-
stdio: ["pipe", "pipe", "pipe"]
|
|
3542
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
3543
|
+
windowsHide: true
|
|
3523
3544
|
}));
|
|
3524
3545
|
if (error) {
|
|
3525
3546
|
return "";
|
|
@@ -4201,28 +4222,32 @@ function isPlainRecord(value) {
|
|
|
4201
4222
|
const prototype = Object.getPrototypeOf(value);
|
|
4202
4223
|
return prototype === Object.prototype || prototype === null;
|
|
4203
4224
|
}
|
|
4204
|
-
function
|
|
4225
|
+
function splitPagedEnvelope(value) {
|
|
4205
4226
|
if (Array.isArray(value) || !isPlainRecord(value))
|
|
4206
4227
|
return null;
|
|
4207
|
-
const entries = Object.
|
|
4228
|
+
const entries = Object.entries(value);
|
|
4208
4229
|
if (entries.length === 0)
|
|
4209
4230
|
return null;
|
|
4210
|
-
let
|
|
4211
|
-
|
|
4212
|
-
for (const entry of entries) {
|
|
4231
|
+
let found = null;
|
|
4232
|
+
const meta = Object.create(null);
|
|
4233
|
+
for (const [key, entry] of entries) {
|
|
4213
4234
|
if (Array.isArray(entry)) {
|
|
4214
|
-
if (
|
|
4235
|
+
if (found !== null)
|
|
4215
4236
|
return null;
|
|
4216
|
-
|
|
4237
|
+
found = { key, rows: entry };
|
|
4217
4238
|
} else if (entry !== null && typeof entry === "object") {
|
|
4218
4239
|
return null;
|
|
4219
4240
|
} else {
|
|
4220
|
-
|
|
4241
|
+
meta[key] = entry;
|
|
4221
4242
|
}
|
|
4222
4243
|
}
|
|
4223
|
-
if (
|
|
4244
|
+
if (found === null || Object.keys(meta).length === 0)
|
|
4224
4245
|
return null;
|
|
4225
|
-
return
|
|
4246
|
+
return { ...found, meta };
|
|
4247
|
+
}
|
|
4248
|
+
function extractPagedRows(value) {
|
|
4249
|
+
const paged = splitPagedEnvelope(value);
|
|
4250
|
+
return paged === null ? null : paged.rows;
|
|
4226
4251
|
}
|
|
4227
4252
|
function toLowerCamelCaseKey(key) {
|
|
4228
4253
|
if (!key)
|
|
@@ -4326,6 +4351,9 @@ function printOutput(data, format = "json", logFn, asciiSafe = false, tableRowSt
|
|
|
4326
4351
|
}
|
|
4327
4352
|
break;
|
|
4328
4353
|
}
|
|
4354
|
+
case "markdown":
|
|
4355
|
+
logFn(renderMarkdown(data));
|
|
4356
|
+
break;
|
|
4329
4357
|
default: {
|
|
4330
4358
|
const hasData = "Data" in data && data.Data != null;
|
|
4331
4359
|
const pagedRows = hasData ? extractPagedRows(data.Data) : null;
|
|
@@ -4350,6 +4378,10 @@ function logOutput(data, format = "json", tableRowStyle) {
|
|
|
4350
4378
|
printOutput(data, format, (msg) => sink.writeOut(`${msg}
|
|
4351
4379
|
`), needsAsciiSafeJson(sink), styleFn);
|
|
4352
4380
|
}
|
|
4381
|
+
var PLUMBING_KEYS = new Set(["code", "log"]);
|
|
4382
|
+
function isPlumbingKey(key) {
|
|
4383
|
+
return PLUMBING_KEYS.has(key.toLowerCase());
|
|
4384
|
+
}
|
|
4353
4385
|
function cellToString(val) {
|
|
4354
4386
|
return val != null && typeof val === "object" ? JSON.stringify(val) : String(val ?? "");
|
|
4355
4387
|
}
|
|
@@ -4365,7 +4397,7 @@ function wrapText(text, width) {
|
|
|
4365
4397
|
function printTable(data, logFn, externalLogValue, tableRowStyle) {
|
|
4366
4398
|
if (data.length === 0)
|
|
4367
4399
|
return;
|
|
4368
|
-
const keys = Object.keys(data[0]).filter((key) => !
|
|
4400
|
+
const keys = Object.keys(data[0]).filter((key) => !isPlumbingKey(key));
|
|
4369
4401
|
const maxWidths = keys.map((key) => Math.max(key.length, ...data.map((item) => cellToString(item[key]).length)));
|
|
4370
4402
|
const header = keys.map((key, i) => key.padEnd(maxWidths[i])).join(" | ");
|
|
4371
4403
|
logFn(header);
|
|
@@ -4387,7 +4419,7 @@ function isNonEmptyPlainObject(value) {
|
|
|
4387
4419
|
}
|
|
4388
4420
|
var NESTED_INDENT = " ";
|
|
4389
4421
|
function printVerticalTable(data, logFn = console.log, externalLogValue) {
|
|
4390
|
-
const keys = Object.keys(data).filter((key) => !
|
|
4422
|
+
const keys = Object.keys(data).filter((key) => !isPlumbingKey(key));
|
|
4391
4423
|
if (keys.length === 0)
|
|
4392
4424
|
return;
|
|
4393
4425
|
const isBlockValue = (value) => isPlainObjectArray(value) || isNonEmptyPlainObject(value);
|
|
@@ -4418,7 +4450,7 @@ function printVerticalTable(data, logFn = console.log, externalLogValue) {
|
|
|
4418
4450
|
function printResizableTable(data, logFn = console.log, externalLogValue, availableWidth, tableRowStyle) {
|
|
4419
4451
|
if (data.length === 0)
|
|
4420
4452
|
return;
|
|
4421
|
-
const keys = Object.keys(data[0]).filter((key) => !
|
|
4453
|
+
const keys = Object.keys(data[0]).filter((key) => !isPlumbingKey(key));
|
|
4422
4454
|
if (keys.length === 0)
|
|
4423
4455
|
return;
|
|
4424
4456
|
if (!process.stdout.isTTY) {
|
|
@@ -4492,6 +4524,220 @@ function printResizableTable(data, logFn = console.log, externalLogValue, availa
|
|
|
4492
4524
|
logFn(`Log: ${externalLogValue}`);
|
|
4493
4525
|
}
|
|
4494
4526
|
}
|
|
4527
|
+
var MARKDOWN_MAX_CELL = 200;
|
|
4528
|
+
var MARKDOWN_MAX_DEPTH = 3;
|
|
4529
|
+
function markdownHeading(depth) {
|
|
4530
|
+
return "#".repeat(Math.min(3 + depth, 6));
|
|
4531
|
+
}
|
|
4532
|
+
var BACKTICK_RUN = /`+/g;
|
|
4533
|
+
function fencedBlock(text) {
|
|
4534
|
+
const first = text.trimStart()[0];
|
|
4535
|
+
const language = first === "<" ? "xml" : first === "{" || first === "[" ? "json" : "";
|
|
4536
|
+
const longestRun = Math.max(0, ...Array.from(text.matchAll(BACKTICK_RUN), (match) => match[0].length));
|
|
4537
|
+
const fence = "`".repeat(Math.max(3, longestRun + 1));
|
|
4538
|
+
return `${fence}${language}
|
|
4539
|
+
${text}
|
|
4540
|
+
${fence}`;
|
|
4541
|
+
}
|
|
4542
|
+
function collapseNewlineRuns(text) {
|
|
4543
|
+
return text.split(/(\s+)/).map((part, index) => index % 2 === 1 && part.includes(`
|
|
4544
|
+
`) ? " " : part).join("");
|
|
4545
|
+
}
|
|
4546
|
+
function markdownCell(value) {
|
|
4547
|
+
const text = value instanceof Date ? value.toISOString() : cellToString(value);
|
|
4548
|
+
return collapseNewlineRuns(text).replace(/\|/g, "\\|");
|
|
4549
|
+
}
|
|
4550
|
+
function markdownLabel(key) {
|
|
4551
|
+
return collapseNewlineRuns(key).replace(/[\\`*|]/g, "\\$&");
|
|
4552
|
+
}
|
|
4553
|
+
function withoutPlumbing(record) {
|
|
4554
|
+
const kept = Object.create(null);
|
|
4555
|
+
for (const [key, value] of Object.entries(record)) {
|
|
4556
|
+
if (!isPlumbingKey(key))
|
|
4557
|
+
kept[key] = value;
|
|
4558
|
+
}
|
|
4559
|
+
return kept;
|
|
4560
|
+
}
|
|
4561
|
+
function rowsWithoutPlumbing(rows) {
|
|
4562
|
+
return rows.map((row) => isPlainRecord(row) ? withoutPlumbing(row) : row);
|
|
4563
|
+
}
|
|
4564
|
+
function markdownTable(rows) {
|
|
4565
|
+
const columns = [];
|
|
4566
|
+
const seen = new Set;
|
|
4567
|
+
for (const row of rows) {
|
|
4568
|
+
for (const key of Object.keys(row)) {
|
|
4569
|
+
if (!seen.has(key)) {
|
|
4570
|
+
seen.add(key);
|
|
4571
|
+
columns.push(key);
|
|
4572
|
+
}
|
|
4573
|
+
}
|
|
4574
|
+
}
|
|
4575
|
+
if (columns.length === 0)
|
|
4576
|
+
return null;
|
|
4577
|
+
const cells = rows.map((row) => columns.map((key) => markdownCell(row[key])));
|
|
4578
|
+
if (cells.some((row) => row.some((c) => c.length > MARKDOWN_MAX_CELL))) {
|
|
4579
|
+
return null;
|
|
4580
|
+
}
|
|
4581
|
+
return [
|
|
4582
|
+
`| ${columns.map(markdownLabel).join(" | ")} |`,
|
|
4583
|
+
`| ${columns.map(() => "---").join(" | ")} |`,
|
|
4584
|
+
...cells.map((row) => `| ${row.join(" | ")} |`)
|
|
4585
|
+
].join(`
|
|
4586
|
+
`);
|
|
4587
|
+
}
|
|
4588
|
+
function extractMessageSequence(rows) {
|
|
4589
|
+
const messages = [];
|
|
4590
|
+
for (const row of rows) {
|
|
4591
|
+
const message = extractSingleMessage(row);
|
|
4592
|
+
if (message === null)
|
|
4593
|
+
return null;
|
|
4594
|
+
messages.push(message);
|
|
4595
|
+
}
|
|
4596
|
+
return messages.join(`
|
|
4597
|
+
|
|
4598
|
+
`);
|
|
4599
|
+
}
|
|
4600
|
+
function markdownRows(rows, depth) {
|
|
4601
|
+
if (rows.length === 0)
|
|
4602
|
+
return "(none)";
|
|
4603
|
+
if (!isPlainObjectArray(rows)) {
|
|
4604
|
+
return rows.map((item) => `- ${markdownCell(item)}`).join(`
|
|
4605
|
+
`);
|
|
4606
|
+
}
|
|
4607
|
+
const prose = extractMessageSequence(rows);
|
|
4608
|
+
if (prose !== null)
|
|
4609
|
+
return prose;
|
|
4610
|
+
const table = markdownTable(rows);
|
|
4611
|
+
if (table !== null)
|
|
4612
|
+
return table;
|
|
4613
|
+
if (depth >= MARKDOWN_MAX_DEPTH) {
|
|
4614
|
+
return fencedBlock(JSON.stringify(rows, null, 2));
|
|
4615
|
+
}
|
|
4616
|
+
return rows.map((row, index) => [
|
|
4617
|
+
`${markdownHeading(depth)} ${index + 1}`,
|
|
4618
|
+
markdownObject(row, depth + 1)
|
|
4619
|
+
].join(`
|
|
4620
|
+
|
|
4621
|
+
`)).join(`
|
|
4622
|
+
|
|
4623
|
+
`);
|
|
4624
|
+
}
|
|
4625
|
+
function markdownObject(obj, depth) {
|
|
4626
|
+
const scalars = [];
|
|
4627
|
+
const blocks = [];
|
|
4628
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
4629
|
+
if (value === undefined)
|
|
4630
|
+
continue;
|
|
4631
|
+
const label = markdownLabel(key);
|
|
4632
|
+
if (Array.isArray(value)) {
|
|
4633
|
+
blocks.push(`${markdownHeading(depth)} ${label}
|
|
4634
|
+
|
|
4635
|
+
${markdownRows(value, depth + 1)}`);
|
|
4636
|
+
} else if (isNonEmptyPlainObject(value)) {
|
|
4637
|
+
const nested = depth < MARKDOWN_MAX_DEPTH ? markdownObject(value, depth + 1) : fencedBlock(JSON.stringify(value, null, 2));
|
|
4638
|
+
if (nested !== "") {
|
|
4639
|
+
blocks.push(`${markdownHeading(depth)} ${label}
|
|
4640
|
+
|
|
4641
|
+
${nested}`);
|
|
4642
|
+
}
|
|
4643
|
+
} else if (typeof value === "string" && value.includes(`
|
|
4644
|
+
`)) {
|
|
4645
|
+
blocks.push(`**${label}:**
|
|
4646
|
+
|
|
4647
|
+
${fencedBlock(value)}`);
|
|
4648
|
+
} else {
|
|
4649
|
+
scalars.push(`**${label}:** ${markdownCell(value)}`);
|
|
4650
|
+
}
|
|
4651
|
+
}
|
|
4652
|
+
const sections = scalars.length > 0 ? [scalars.join(`
|
|
4653
|
+
`)] : [];
|
|
4654
|
+
sections.push(...blocks);
|
|
4655
|
+
return sections.join(`
|
|
4656
|
+
|
|
4657
|
+
`);
|
|
4658
|
+
}
|
|
4659
|
+
function extractSingleMessage(payload) {
|
|
4660
|
+
if (!isPlainRecord(payload))
|
|
4661
|
+
return null;
|
|
4662
|
+
const keys = Object.keys(payload);
|
|
4663
|
+
if (keys.length !== 1 || keys[0].toLowerCase() !== "message")
|
|
4664
|
+
return null;
|
|
4665
|
+
const value = payload[keys[0]];
|
|
4666
|
+
return typeof value === "string" ? value : null;
|
|
4667
|
+
}
|
|
4668
|
+
function markdownPayload(payload) {
|
|
4669
|
+
const message = extractSingleMessage(payload);
|
|
4670
|
+
if (message !== null)
|
|
4671
|
+
return message;
|
|
4672
|
+
if (Array.isArray(payload)) {
|
|
4673
|
+
return markdownRows(rowsWithoutPlumbing(payload), 0);
|
|
4674
|
+
}
|
|
4675
|
+
const visible = withoutPlumbing(payload);
|
|
4676
|
+
const paged = splitPagedEnvelope(visible);
|
|
4677
|
+
if (paged !== null) {
|
|
4678
|
+
const meta = markdownObject(paged.meta, 0);
|
|
4679
|
+
const rows = `${markdownHeading(0)} ${markdownLabel(paged.key)}
|
|
4680
|
+
|
|
4681
|
+
${markdownRows(rowsWithoutPlumbing(paged.rows), 1)}`;
|
|
4682
|
+
return meta === "" ? rows : `${meta}
|
|
4683
|
+
|
|
4684
|
+
${rows}`;
|
|
4685
|
+
}
|
|
4686
|
+
return markdownObject(visible, 0);
|
|
4687
|
+
}
|
|
4688
|
+
function isPaginationWorthShowing(value) {
|
|
4689
|
+
if (typeof value !== "object" || value === null)
|
|
4690
|
+
return false;
|
|
4691
|
+
const page = value;
|
|
4692
|
+
return page.HasMore === true || typeof page.Offset === "number" && page.Offset > 0;
|
|
4693
|
+
}
|
|
4694
|
+
function markdownEnvelopeNotes(data) {
|
|
4695
|
+
const envelope = data;
|
|
4696
|
+
const notes = [];
|
|
4697
|
+
const warning = envelope.Warning;
|
|
4698
|
+
if (typeof warning === "string" && warning !== "") {
|
|
4699
|
+
notes.push(`> **Warning:** ${warning}`);
|
|
4700
|
+
}
|
|
4701
|
+
const instructions = envelope.Instructions;
|
|
4702
|
+
if (typeof instructions === "string" && instructions !== "") {
|
|
4703
|
+
notes.push(`> ${instructions}`);
|
|
4704
|
+
}
|
|
4705
|
+
const pagination = envelope.Pagination;
|
|
4706
|
+
if (isPaginationWorthShowing(pagination)) {
|
|
4707
|
+
const body = markdownObject(pagination, 1);
|
|
4708
|
+
if (body !== "") {
|
|
4709
|
+
notes.push(`${markdownHeading(0)} Pagination
|
|
4710
|
+
|
|
4711
|
+
${body}`);
|
|
4712
|
+
}
|
|
4713
|
+
}
|
|
4714
|
+
const log = envelope.Log;
|
|
4715
|
+
if (typeof log === "string" && log !== "") {
|
|
4716
|
+
notes.push(`**Log:** ${log}`);
|
|
4717
|
+
}
|
|
4718
|
+
return notes;
|
|
4719
|
+
}
|
|
4720
|
+
function renderMarkdown(data) {
|
|
4721
|
+
if (data.Result !== RESULTS.Success) {
|
|
4722
|
+
const failure = data;
|
|
4723
|
+
const sections = [`**Failed:** ${failure.Message}`];
|
|
4724
|
+
if (failure.Data != null) {
|
|
4725
|
+
sections.push(markdownPayload(failure.Data));
|
|
4726
|
+
}
|
|
4727
|
+
if (failure.Instructions) {
|
|
4728
|
+
sections.push(`> ${failure.Instructions}`);
|
|
4729
|
+
}
|
|
4730
|
+
return sections.filter((section) => section !== "").join(`
|
|
4731
|
+
|
|
4732
|
+
`);
|
|
4733
|
+
}
|
|
4734
|
+
if (!("Data" in data) || data.Data == null) {
|
|
4735
|
+
return markdownObject(withoutPlumbing(data), 0);
|
|
4736
|
+
}
|
|
4737
|
+
return [markdownPayload(data.Data), ...markdownEnvelopeNotes(data)].filter((section) => section !== "").join(`
|
|
4738
|
+
|
|
4739
|
+
`);
|
|
4740
|
+
}
|
|
4495
4741
|
function toYaml(data) {
|
|
4496
4742
|
const codec = getYamlCodec();
|
|
4497
4743
|
if (!codec) {
|
|
@@ -4535,6 +4781,20 @@ class FilterImplicitLimitError extends Error {
|
|
|
4535
4781
|
this.instructions = "Pass --limit <n> to choose how many records the filter applies to. " + "To filter over all records, pass the command's maximum accepted --limit (see the option's description in --help).";
|
|
4536
4782
|
}
|
|
4537
4783
|
}
|
|
4784
|
+
|
|
4785
|
+
class ConfigurationError extends Error {
|
|
4786
|
+
__brand = "ConfigurationError";
|
|
4787
|
+
errorCode = "configuration_error";
|
|
4788
|
+
retry = "RetryWillNotFix";
|
|
4789
|
+
result = RESULTS.ConfigError;
|
|
4790
|
+
constructor(message) {
|
|
4791
|
+
super(message);
|
|
4792
|
+
this.name = "ConfigurationError";
|
|
4793
|
+
}
|
|
4794
|
+
}
|
|
4795
|
+
function isConfigurationError(error) {
|
|
4796
|
+
return typeof error === "object" && error !== null && "__brand" in error && error.__brand === "ConfigurationError";
|
|
4797
|
+
}
|
|
4538
4798
|
function applyFilter(data, filter) {
|
|
4539
4799
|
const codec = requireJmespath();
|
|
4540
4800
|
let result;
|
|
@@ -5133,6 +5393,20 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
5133
5393
|
});
|
|
5134
5394
|
};
|
|
5135
5395
|
|
|
5396
|
+
// ../common/src/confirmation.ts
|
|
5397
|
+
function requireConfirmation(flags, operation) {
|
|
5398
|
+
if (flags.yes === true || flags.force === true) {
|
|
5399
|
+
return true;
|
|
5400
|
+
}
|
|
5401
|
+
OutputFormatter.error({
|
|
5402
|
+
Result: RESULTS.Failure,
|
|
5403
|
+
Message: `Confirmation required: this will ${operation} and cannot be undone.`,
|
|
5404
|
+
Instructions: "Re-run with --yes to confirm."
|
|
5405
|
+
});
|
|
5406
|
+
processContext.exit(1);
|
|
5407
|
+
return false;
|
|
5408
|
+
}
|
|
5409
|
+
|
|
5136
5410
|
// ../common/src/package-metadata-options.ts
|
|
5137
5411
|
function registerPackageMetadataOptions(command) {
|
|
5138
5412
|
return command.option("--author <author>", "Package author").option("--description <text>", "Package description").option("--repository-url <url>", "Source repository URL (recorded in the package for traceability)").option("--repository-commit <sha>", "Source repository commit hash (recorded in the package for traceability)").option("--repository-branch <branch>", "Source repository branch").option("--repository-type <type>", "Source repository type (defaults to 'git' when --repository-url is set)").option("--release-notes <text>", "Release notes for the package").option("--project-url <url>", "Automation Hub idea URL");
|
|
@@ -5920,6 +6194,6 @@ async function findSolutionFileUpward(fs, startDir) {
|
|
|
5920
6194
|
}
|
|
5921
6195
|
}
|
|
5922
6196
|
|
|
5923
|
-
export { catchError, describeConnectivityError, extractErrorDetails, extractErrorMessage, getOutputSink, logger, RESULTS, OutputFormatter, InvalidArgumentError, Command, Option, processContext, isGuid, canPrompt, registerPackageMetadataOptions, mapPackageMetadataOptions, getSdkUserAgentToken, addSdkUserAgentHeader, installSdkUserAgentHeader, trackShipSucceeded, normalizeProjectType, tryRegisterProjectInParentSolution, findNearestParentUipxFile, findSolutionFileUpward };
|
|
6197
|
+
export { catchError, describeConnectivityError, extractErrorDetails, extractErrorMessage, getOutputSink, logger, RESULTS, EXIT_CODES, ConfigurationError, isConfigurationError, OutputFormatter, InvalidArgumentError, Command, Option, processContext, requireConfirmation, isGuid, canPrompt, registerPackageMetadataOptions, mapPackageMetadataOptions, getSdkUserAgentToken, addSdkUserAgentHeader, installSdkUserAgentHeader, trackShipSucceeded, normalizeProjectType, toPortableRelativePath, tryRegisterProjectInParentSolution, findNearestParentUipxFile, findSolutionFileUpward };
|
|
5924
6198
|
|
|
5925
|
-
//# debugId=
|
|
6199
|
+
//# debugId=401ACF1EEAAA614364756E2164756E21
|