@uipath/case-tool 1.201.0-preview.115 → 1.201.0-preview.121
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/README.md +1 -1
- package/dist/{authoring-k4xzp7fh.js → authoring-aaaqwck3.js} +64 -20
- package/dist/case-pack-service-96tjknaz.js +119 -0
- package/dist/{de-3RMZHIP6-1na18a74.js → de-K6MLR24N-00fjz82b.js} +474 -51
- package/dist/{de-LVBY3VVG-tc58p3x6.js → de-WMKOGI7B-r1821wpe.js} +16 -7
- package/dist/{en-JGJNQYMG-xq29xvhk.js → en-ILA4HPE5-fhwvq92r.js} +264 -4
- package/dist/{en-4UFXRW7N-mqabr9tf.js → en-X4DLPKLJ-dt1wtdm7.js} +17 -5
- package/dist/{es-CI4AE5B5-55sgqk64.js → es-BVPGJUWA-9gk2g9yb.js} +16 -7
- package/dist/{es-EYHYM5C4-3bajghda.js → es-HTQSD352-m9rr3f0g.js} +468 -45
- package/dist/{es-MX-QSQP2KWV-qvgkwvz2.js → es-MX-FOX525CG-87g500gr.js} +474 -51
- package/dist/{es-MX-OLZNAYY5-30cmv1dx.js → es-MX-U6YL5KQX-ynwxdjr8.js} +16 -7
- package/dist/{fr-FXFJQRD3-rfztd3e5.js → fr-54THJ4QH-d6ezjbhw.js} +473 -50
- package/dist/{fr-CCN6ZO5E-x2akzsjt.js → fr-EKTTDR7Z-bmpwp31r.js} +16 -7
- package/dist/{index-mrht9sxd.js → index-8bsngk9y.js} +101787 -90880
- package/dist/index-cncq089f.js +16491 -0
- package/dist/{index-w23k88b5.js → index-p50kx6jv.js} +202 -64
- package/dist/index.js +10 -6
- package/dist/{ja-G7NJYQ42-ve4gadd7.js → ja-MHUPLSWO-3qwy4jc0.js} +470 -47
- package/dist/{ja-O2NEV5D6-nt9rhd8c.js → ja-Y2YBTXNN-96cvy5av.js} +16 -7
- package/dist/{ko-7XWV2SEQ-chk3y7aj.js → ko-S33XAV26-cxf4dn2t.js} +16 -7
- package/dist/{ko-QDHECDTM-zmbqs9pr.js → ko-XPJTXIKK-w1hs4px7.js} +467 -44
- package/dist/{packager-tool-973f0r2g.js → packager-tool-1yy9x4vk.js} +17 -5
- package/dist/{packager-tool-pj8j9a59.js → packager-tool-8f28ypk9.js} +72533 -91227
- package/dist/packager-tool-b098y4a2.js +646 -0
- package/dist/{packager-tool-kvgt1s4z.js → packager-tool-cqrsre00.js} +282 -22
- package/dist/packager-tool-nhnf1ap2.js +13607 -0
- package/dist/packager-tool-w3h8xrnv.js +472 -0
- package/dist/packager-tool-we1phz71.js +41 -0
- package/dist/{packager-tool-8eennarq.js → packager-tool-wvqz81mx.js} +52 -690
- package/dist/packager-tool-zqa5k9f7.js +8774 -0
- package/dist/{packager-tool-pcd0vhvd.js → packager-tool-zx48pq4v.js} +646 -565
- package/dist/packager-tool.js +5 -3
- package/dist/{pt-VXJT4WUJ-nwkc9k2p.js → pt-4JEPEAST-40npwxyw.js} +471 -48
- package/dist/{pt-BR-Z4J3LEEO-cf33d2zv.js → pt-BR-JO45SCNI-4kbfnzc4.js} +16 -7
- package/dist/{pt-BR-SADBLGXA-yd89fdy2.js → pt-BR-TV7NR3ID-vgd26pj1.js} +470 -47
- package/dist/{pt-CRSN3TCU-txxbbcxm.js → pt-W3NA4LIZ-f02gapvs.js} +16 -7
- package/dist/{ro-7JHKFGCH-hbtkeqdr.js → ro-RKJ74FV3-qn0ey39v.js} +473 -50
- package/dist/{ro-WMQEVD7D-6mtq0e6b.js → ro-WLKX6HF5-fcbe2zz8.js} +16 -7
- package/dist/tool.js +10 -6
- package/dist/{tr-UCMB7W3T-xmxp2naq.js → tr-3U2W2XCA-zg3zcmq3.js} +15 -6
- package/dist/{tr-Q6IHBFK7-zs9rsm1b.js → tr-X7R6GQNB-shwv16dz.js} +482 -59
- package/dist/{zh-CN-3BPA3WIX-c5ts2m5v.js → zh-CN-FEZ24J4A-q5b5x20w.js} +470 -47
- package/dist/{zh-CN-2QOHEFC5-ryjb2byk.js → zh-CN-IPZYQR3P-1h76csc4.js} +16 -7
- package/dist/{zh-TW-QCJEQC5S-b1v637hd.js → zh-TW-GKSCT6NW-4n1yfre0.js} +464 -41
- package/dist/{zh-TW-Q5QSSTS6-6y7yjbbn.js → zh-TW-YPVSQVGT-wbybwpwt.js} +16 -7
- package/package.json +2 -2
|
@@ -2100,6 +2100,34 @@ var require_commander = __commonJS((exports) => {
|
|
|
2100
2100
|
exports.InvalidOptionArgumentError = InvalidArgumentError;
|
|
2101
2101
|
});
|
|
2102
2102
|
|
|
2103
|
+
// ../common/src/catch-error.ts
|
|
2104
|
+
function isPromiseLike(value) {
|
|
2105
|
+
return value !== null && typeof value === "object" && typeof value.then === "function";
|
|
2106
|
+
}
|
|
2107
|
+
function catchError(fnOrPromise) {
|
|
2108
|
+
if (isPromiseLike(fnOrPromise)) {
|
|
2109
|
+
return settlePromiseLike(fnOrPromise);
|
|
2110
|
+
}
|
|
2111
|
+
try {
|
|
2112
|
+
const result = fnOrPromise();
|
|
2113
|
+
if (isPromiseLike(result)) {
|
|
2114
|
+
return settlePromiseLike(result);
|
|
2115
|
+
}
|
|
2116
|
+
return [undefined, result];
|
|
2117
|
+
} catch (error) {
|
|
2118
|
+
return [
|
|
2119
|
+
error instanceof Error ? error : new Error(String(error)),
|
|
2120
|
+
undefined
|
|
2121
|
+
];
|
|
2122
|
+
}
|
|
2123
|
+
}
|
|
2124
|
+
function settlePromiseLike(thenable) {
|
|
2125
|
+
return Promise.resolve(thenable).then((data) => [undefined, data]).catch((error) => [
|
|
2126
|
+
error instanceof Error ? error : new Error(String(error)),
|
|
2127
|
+
undefined
|
|
2128
|
+
]);
|
|
2129
|
+
}
|
|
2130
|
+
|
|
2103
2131
|
// ../../node_modules/commander/esm.mjs
|
|
2104
2132
|
var import__ = __toESM(require_commander(), 1);
|
|
2105
2133
|
var {
|
|
@@ -2158,577 +2186,640 @@ Command.prototype.previewCommand = function(nameAndArgs, opts) {
|
|
|
2158
2186
|
return new Command(nameAndArgs.split(/\s+/)[0] ?? nameAndArgs);
|
|
2159
2187
|
};
|
|
2160
2188
|
|
|
2161
|
-
// ../common/src/
|
|
2162
|
-
function
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
if (isPromiseLike(result)) {
|
|
2172
|
-
return settlePromiseLike(result);
|
|
2173
|
-
}
|
|
2174
|
-
return [undefined, result];
|
|
2175
|
-
} catch (error) {
|
|
2176
|
-
return [
|
|
2177
|
-
error instanceof Error ? error : new Error(String(error)),
|
|
2178
|
-
undefined
|
|
2179
|
-
];
|
|
2189
|
+
// ../common/src/output-context.ts
|
|
2190
|
+
function createStorage() {
|
|
2191
|
+
const [error, mod] = catchError(() => __require("node:async_hooks"));
|
|
2192
|
+
if (error || typeof mod?.AsyncLocalStorage !== "function") {
|
|
2193
|
+
return {
|
|
2194
|
+
getStore: () => {
|
|
2195
|
+
return;
|
|
2196
|
+
},
|
|
2197
|
+
run: (_store, fn) => fn()
|
|
2198
|
+
};
|
|
2180
2199
|
}
|
|
2200
|
+
return new mod.AsyncLocalStorage;
|
|
2181
2201
|
}
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
var HTML_RESPONSE_MESSAGE = "Received HTML instead of the expected JSON response.";
|
|
2195
|
-
var NETWORK_ERROR_CODES = new Set([
|
|
2196
|
-
"ECONNREFUSED",
|
|
2197
|
-
"ECONNRESET",
|
|
2198
|
-
"ENOTFOUND",
|
|
2199
|
-
"EAI_AGAIN",
|
|
2200
|
-
"ETIMEDOUT",
|
|
2201
|
-
"EPIPE",
|
|
2202
|
-
"EHOSTUNREACH",
|
|
2203
|
-
"ENETUNREACH",
|
|
2204
|
-
"EAI_FAIL"
|
|
2205
|
-
]);
|
|
2206
|
-
var TLS_ERROR_CODES = new Set([
|
|
2207
|
-
"SELF_SIGNED_CERT_IN_CHAIN",
|
|
2208
|
-
"DEPTH_ZERO_SELF_SIGNED_CERT",
|
|
2209
|
-
"UNABLE_TO_VERIFY_LEAF_SIGNATURE",
|
|
2210
|
-
"UNABLE_TO_GET_ISSUER_CERT_LOCALLY",
|
|
2211
|
-
"UNABLE_TO_GET_ISSUER_CERT",
|
|
2212
|
-
"CERT_HAS_EXPIRED",
|
|
2213
|
-
"CERT_UNTRUSTED",
|
|
2214
|
-
"ERR_TLS_CERT_ALTNAME_INVALID"
|
|
2215
|
-
]);
|
|
2216
|
-
var TLS_INSTRUCTIONS = "The server's TLS certificate could not be verified. Most often a " + "corporate proxy/firewall re-signs HTTPS with a root CA that Node does " + "not trust — set NODE_EXTRA_CA_CERTS to that CA's PEM file (and HTTPS_PROXY " + "if you connect through a proxy). If the certificate is instead expired or " + "its hostname does not match, fix the endpoint URL or the system clock. " + "Then retry.";
|
|
2217
|
-
var NETWORK_INSTRUCTIONS = "Could not reach the UiPath service. Check your network connection and " + "VPN, confirm any HTTP_PROXY/HTTPS_PROXY/NO_PROXY settings are correct, " + "then retry.";
|
|
2218
|
-
function describeConnectivityError(error) {
|
|
2219
|
-
const queue = [error];
|
|
2220
|
-
const seen = new Set;
|
|
2221
|
-
for (let steps = 0;queue.length > 0 && steps < 32; steps++) {
|
|
2222
|
-
const current = queue.shift();
|
|
2223
|
-
if (current === null || typeof current !== "object")
|
|
2224
|
-
continue;
|
|
2225
|
-
if (seen.has(current))
|
|
2226
|
-
continue;
|
|
2227
|
-
seen.add(current);
|
|
2228
|
-
const cur = current;
|
|
2229
|
-
const code = typeof cur.code === "string" ? cur.code : undefined;
|
|
2230
|
-
const message = typeof cur.message === "string" ? cur.message : undefined;
|
|
2231
|
-
if (code && TLS_ERROR_CODES.has(code)) {
|
|
2232
|
-
return {
|
|
2233
|
-
code,
|
|
2234
|
-
kind: "tls",
|
|
2235
|
-
message: message ?? code,
|
|
2236
|
-
instructions: TLS_INSTRUCTIONS
|
|
2237
|
-
};
|
|
2238
|
-
}
|
|
2239
|
-
if (code && NETWORK_ERROR_CODES.has(code)) {
|
|
2240
|
-
return {
|
|
2241
|
-
code,
|
|
2242
|
-
kind: "network",
|
|
2243
|
-
message: message ?? code,
|
|
2244
|
-
instructions: NETWORK_INSTRUCTIONS
|
|
2245
|
-
};
|
|
2246
|
-
}
|
|
2247
|
-
if (cur.cause !== undefined)
|
|
2248
|
-
queue.push(cur.cause);
|
|
2249
|
-
if (Array.isArray(cur.errors))
|
|
2250
|
-
queue.push(...cur.errors);
|
|
2202
|
+
var storageSingleton = singleton("OutputStorage");
|
|
2203
|
+
var sinkSlot = singleton("OutputSink");
|
|
2204
|
+
var outputStorage = storageSingleton.getOrInit(createStorage, (v) => ("getStore" in v));
|
|
2205
|
+
var CONSOLE_FALLBACK = {
|
|
2206
|
+
writeOut: (str) => process.stdout.write(str),
|
|
2207
|
+
writeErr: (str) => process.stderr.write(str),
|
|
2208
|
+
writeLog: (str) => process.stdout.write(str),
|
|
2209
|
+
capabilities: {
|
|
2210
|
+
isInteractive: false,
|
|
2211
|
+
canReadInput: false,
|
|
2212
|
+
supportsColor: false,
|
|
2213
|
+
outputWidth: 80
|
|
2251
2214
|
}
|
|
2252
|
-
|
|
2215
|
+
};
|
|
2216
|
+
function getOutputSink() {
|
|
2217
|
+
return outputStorage.getStore() ?? sinkSlot.get() ?? CONSOLE_FALLBACK;
|
|
2253
2218
|
}
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
return Number.isInteger(status) && status >= 100 && status <= 599 ? status : undefined;
|
|
2219
|
+
|
|
2220
|
+
// ../common/src/logger.ts
|
|
2221
|
+
var logFilePathSlot = singleton("logFilePath");
|
|
2222
|
+
function setGlobalLogFilePath(path) {
|
|
2223
|
+
logFilePathSlot.set(path);
|
|
2260
2224
|
}
|
|
2261
|
-
function
|
|
2262
|
-
return
|
|
2225
|
+
function getGlobalLogFilePath() {
|
|
2226
|
+
return logFilePathSlot.get("");
|
|
2263
2227
|
}
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2228
|
+
var DEFAULT_LOG_LEVEL = 3 /* ERROR */;
|
|
2229
|
+
|
|
2230
|
+
class SimpleLogger {
|
|
2231
|
+
__brand = "SimpleLogger";
|
|
2232
|
+
level;
|
|
2233
|
+
logFilePath;
|
|
2234
|
+
fileLoggingEnabled;
|
|
2235
|
+
pendingWrites = Promise.resolve();
|
|
2236
|
+
pendingInit = Promise.resolve();
|
|
2237
|
+
constructor() {
|
|
2238
|
+
this.level = SimpleLogger.resolveLevel();
|
|
2239
|
+
this.logFilePath = "";
|
|
2240
|
+
this.fileLoggingEnabled = false;
|
|
2267
2241
|
}
|
|
2268
|
-
|
|
2269
|
-
return "
|
|
2242
|
+
static getInstance() {
|
|
2243
|
+
return loggerSingleton.getOrInit(() => new SimpleLogger, (v) => ("__brand" in v) && v.__brand === "SimpleLogger");
|
|
2270
2244
|
}
|
|
2271
|
-
|
|
2272
|
-
|
|
2245
|
+
static resetInstance() {
|
|
2246
|
+
loggerSingleton.clear();
|
|
2273
2247
|
}
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2248
|
+
static isNode = typeof process !== "undefined" && !!process.versions?.node;
|
|
2249
|
+
static resolveLevel() {
|
|
2250
|
+
if (SimpleLogger.isNode) {
|
|
2251
|
+
const explicitLevel = SimpleLogger.parseLevel(process.env?.UIP_LOG_LEVEL ?? "");
|
|
2252
|
+
if (explicitLevel !== undefined)
|
|
2253
|
+
return explicitLevel;
|
|
2254
|
+
const debugVal = process.env?.DEBUG;
|
|
2255
|
+
if (debugVal === "true" || debugVal === "1") {
|
|
2256
|
+
return 0 /* DEBUG */;
|
|
2257
|
+
}
|
|
2258
|
+
return DEFAULT_LOG_LEVEL;
|
|
2259
|
+
}
|
|
2260
|
+
const [localStorageError, hasDebug] = catchError(() => typeof localStorage !== "undefined" && !!localStorage.getItem("debug"));
|
|
2261
|
+
if (!localStorageError && hasDebug) {
|
|
2262
|
+
return 0 /* DEBUG */;
|
|
2263
|
+
}
|
|
2264
|
+
return DEFAULT_LOG_LEVEL;
|
|
2279
2265
|
}
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2266
|
+
static parseLevel(value) {
|
|
2267
|
+
switch (value.toLowerCase()) {
|
|
2268
|
+
case "debug":
|
|
2269
|
+
return 0 /* DEBUG */;
|
|
2270
|
+
case "info":
|
|
2271
|
+
return 1 /* INFO */;
|
|
2272
|
+
case "warn":
|
|
2273
|
+
return 2 /* WARN */;
|
|
2274
|
+
case "error":
|
|
2275
|
+
return 3 /* ERROR */;
|
|
2276
|
+
default:
|
|
2277
|
+
return;
|
|
2278
|
+
}
|
|
2285
2279
|
}
|
|
2286
|
-
|
|
2287
|
-
|
|
2280
|
+
format(message, args) {
|
|
2281
|
+
if (args.length === 0)
|
|
2282
|
+
return `${message}
|
|
2283
|
+
`;
|
|
2284
|
+
return `${message} ${args.map(String).join(" ")}
|
|
2285
|
+
`;
|
|
2288
2286
|
}
|
|
2289
|
-
|
|
2290
|
-
return
|
|
2287
|
+
isFileLoggingActive() {
|
|
2288
|
+
return this.fileLoggingEnabled || !!getGlobalLogFilePath();
|
|
2291
2289
|
}
|
|
2292
|
-
|
|
2293
|
-
|
|
2290
|
+
writeToFile(formatted) {
|
|
2291
|
+
const path = this.logFilePath || getGlobalLogFilePath();
|
|
2292
|
+
if (!path)
|
|
2293
|
+
return;
|
|
2294
|
+
const timestamp = new Date().toISOString();
|
|
2295
|
+
this.pendingWrites = Promise.all([
|
|
2296
|
+
this.pendingWrites,
|
|
2297
|
+
this.pendingInit
|
|
2298
|
+
]).then(() => getFileSystem().appendFile(path, `${timestamp} ${formatted}`).catch(() => {}));
|
|
2294
2299
|
}
|
|
2295
|
-
|
|
2296
|
-
|
|
2300
|
+
debug(message, ...args) {
|
|
2301
|
+
if (this.level > 0 /* DEBUG */)
|
|
2302
|
+
return;
|
|
2303
|
+
const formatted = this.format(`[DEBUG] ${message}`, args);
|
|
2304
|
+
if (this.isFileLoggingActive()) {
|
|
2305
|
+
this.writeToFile(formatted);
|
|
2306
|
+
} else {
|
|
2307
|
+
getOutputSink().writeErr(formatted);
|
|
2308
|
+
}
|
|
2297
2309
|
}
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
}
|
|
2307
|
-
const connectivity = describeConnectivityError(error);
|
|
2308
|
-
if (connectivity) {
|
|
2309
|
-
return {
|
|
2310
|
-
errorCode: "network_error",
|
|
2311
|
-
retry: connectivity.kind === "tls" ? "RetryWillNotFix" : "RetryLater"
|
|
2312
|
-
};
|
|
2313
|
-
}
|
|
2314
|
-
return { errorCode: "unknown_error", retry: "RetryWillNotFix" };
|
|
2315
|
-
}
|
|
2316
|
-
function formatHttpStatusMessage(status, rawMessage, extractedMessage, inferredStatus) {
|
|
2317
|
-
if (extractedMessage) {
|
|
2318
|
-
return `HTTP ${status}: ${extractedMessage}`;
|
|
2319
|
-
}
|
|
2320
|
-
return inferredStatus !== undefined ? rawMessage : `HTTP ${status}: ${rawMessage}`;
|
|
2321
|
-
}
|
|
2322
|
-
async function extractErrorDetails(error, options) {
|
|
2323
|
-
const err = error !== null && error !== undefined && typeof error === "object" ? error : {};
|
|
2324
|
-
const response = err.response;
|
|
2325
|
-
const rawMessage = typeof err.message === "string" ? err.message : "Unknown error";
|
|
2326
|
-
const explicitStatus = err.status ?? response?.status;
|
|
2327
|
-
const inferredStatus = explicitStatus === undefined ? parseHttpStatusFromMessage(rawMessage) : undefined;
|
|
2328
|
-
const status = explicitStatus ?? inferredStatus;
|
|
2329
|
-
const isSuccessfulResponse = status !== undefined && status >= 200 && status < 300;
|
|
2330
|
-
let rawBody;
|
|
2331
|
-
let extractedMessage;
|
|
2332
|
-
let parsedBody;
|
|
2333
|
-
const textFn = response?.text?.bind(response);
|
|
2334
|
-
if (textFn) {
|
|
2335
|
-
const [bodyError, body] = await catchError((async () => textFn())());
|
|
2336
|
-
if (!bodyError && body) {
|
|
2337
|
-
rawBody = body;
|
|
2338
|
-
const [parseError, parsed] = catchError(() => JSON.parse(body));
|
|
2339
|
-
if (!parseError && parsed && typeof parsed === "object") {
|
|
2340
|
-
parsedBody = parsed;
|
|
2341
|
-
if (parsedBody.errors && typeof parsedBody.errors === "object") {
|
|
2342
|
-
for (const field of Object.values(parsedBody.errors)) {
|
|
2343
|
-
if (Array.isArray(field) && field.length > 0) {
|
|
2344
|
-
const first = field[0];
|
|
2345
|
-
if (first && typeof first.message === "string") {
|
|
2346
|
-
extractedMessage = first.message;
|
|
2347
|
-
break;
|
|
2348
|
-
}
|
|
2349
|
-
}
|
|
2350
|
-
}
|
|
2351
|
-
}
|
|
2352
|
-
if (!extractedMessage) {
|
|
2353
|
-
extractedMessage = typeof parsedBody.message === "string" ? parsedBody.message : typeof parsedBody.errorMessage === "string" ? parsedBody.errorMessage : typeof parsedBody.title === "string" ? parsedBody.title : undefined;
|
|
2354
|
-
}
|
|
2355
|
-
if (!extractedMessage) {
|
|
2356
|
-
extractedMessage = body;
|
|
2357
|
-
}
|
|
2358
|
-
if (extractedMessage && typeof parsedBody.detail === "string" && parsedBody.detail.length > 0 && !extractedMessage.includes(parsedBody.detail)) {
|
|
2359
|
-
extractedMessage = `${extractedMessage}: ${parsedBody.detail}`;
|
|
2360
|
-
}
|
|
2361
|
-
} else {
|
|
2362
|
-
extractedMessage = isHtmlDocument(body) ? HTML_RESPONSE_MESSAGE : body;
|
|
2363
|
-
}
|
|
2310
|
+
info(message, ...args) {
|
|
2311
|
+
if (this.level > 1 /* INFO */)
|
|
2312
|
+
return;
|
|
2313
|
+
const formatted = this.format(message, args);
|
|
2314
|
+
if (this.isFileLoggingActive()) {
|
|
2315
|
+
this.writeToFile(formatted);
|
|
2316
|
+
} else {
|
|
2317
|
+
getOutputSink().writeErr(formatted);
|
|
2364
2318
|
}
|
|
2365
2319
|
}
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
result = "AuthenticationError";
|
|
2373
|
-
} else if (status === 403) {
|
|
2374
|
-
message = options?.forbiddenMessage ?? DEFAULT_403;
|
|
2375
|
-
result = "AuthenticationError";
|
|
2376
|
-
} else if (status === 405) {
|
|
2377
|
-
message = DEFAULT_405;
|
|
2378
|
-
} else if (status === 413) {
|
|
2379
|
-
message = DEFAULT_413;
|
|
2380
|
-
} else if (status === 400 || status === 422) {
|
|
2381
|
-
message = formatHttpStatusMessage(status, rawMessage, extractedMessage, inferredStatus);
|
|
2382
|
-
result = "ValidationError";
|
|
2383
|
-
} else if (status === 429) {
|
|
2384
|
-
message = formatHttpStatusMessage(status, rawMessage, extractedMessage, inferredStatus);
|
|
2385
|
-
} else if (extractedMessage) {
|
|
2386
|
-
if (isSuccessfulResponse && rawMessage !== "Unknown error") {
|
|
2387
|
-
message = rawMessage;
|
|
2320
|
+
warn(message, ...args) {
|
|
2321
|
+
if (this.level > 2 /* WARN */)
|
|
2322
|
+
return;
|
|
2323
|
+
const formatted = this.format(`[WARN] ${message}`, args);
|
|
2324
|
+
if (this.isFileLoggingActive()) {
|
|
2325
|
+
this.writeToFile(formatted);
|
|
2388
2326
|
} else {
|
|
2389
|
-
|
|
2327
|
+
getOutputSink().writeErr(formatted);
|
|
2390
2328
|
}
|
|
2391
|
-
}
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2329
|
+
}
|
|
2330
|
+
error(message, ...args) {
|
|
2331
|
+
if (this.level > 3 /* ERROR */)
|
|
2332
|
+
return;
|
|
2333
|
+
const formatted = this.format(`[ERROR] ${message}`, args);
|
|
2334
|
+
if (this.isFileLoggingActive()) {
|
|
2335
|
+
this.writeToFile(formatted);
|
|
2397
2336
|
} else {
|
|
2398
|
-
|
|
2337
|
+
getOutputSink().writeErr(formatted);
|
|
2399
2338
|
}
|
|
2400
|
-
} else {
|
|
2401
|
-
message = rawMessage;
|
|
2402
2339
|
}
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
if (connectivity && connectivity.message !== message && !message.includes(connectivity.message)) {
|
|
2406
|
-
message = `${message}: ${connectivity.message}`;
|
|
2407
|
-
}
|
|
2340
|
+
getLevel() {
|
|
2341
|
+
return this.level;
|
|
2408
2342
|
}
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
if (parsedBody) {
|
|
2412
|
-
const extra = {};
|
|
2413
|
-
if (parsedBody.errorCode)
|
|
2414
|
-
extra.errorCode = parsedBody.errorCode;
|
|
2415
|
-
if (parsedBody.detail)
|
|
2416
|
-
extra.detail = parsedBody.detail;
|
|
2417
|
-
if (parsedBody.details)
|
|
2418
|
-
extra.details = parsedBody.details;
|
|
2419
|
-
if (parsedBody.errors != null)
|
|
2420
|
-
extra.errors = parsedBody.errors;
|
|
2421
|
-
if (parsedBody.data && typeof parsedBody.data === "object" && Object.keys(parsedBody.data).length > 0) {
|
|
2422
|
-
extra.data = parsedBody.data;
|
|
2423
|
-
}
|
|
2424
|
-
details = Object.keys(extra).length > 0 ? JSON.stringify(extra) : rawBody;
|
|
2425
|
-
} else {
|
|
2426
|
-
details = rawBody;
|
|
2427
|
-
}
|
|
2428
|
-
} else if (typeof err.message === "string") {
|
|
2429
|
-
details = err.message;
|
|
2430
|
-
} else {
|
|
2431
|
-
details = String(error);
|
|
2343
|
+
setLevel(level) {
|
|
2344
|
+
this.level = level;
|
|
2432
2345
|
}
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2346
|
+
setFileLogging(enabled) {
|
|
2347
|
+
this.fileLoggingEnabled = enabled;
|
|
2348
|
+
if (!enabled) {
|
|
2349
|
+
this.logFilePath = "";
|
|
2350
|
+
setGlobalLogFilePath("");
|
|
2351
|
+
}
|
|
2436
2352
|
}
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2353
|
+
setLogFile(path) {
|
|
2354
|
+
this.logFilePath = path;
|
|
2355
|
+
setGlobalLogFilePath(path);
|
|
2356
|
+
if (!path)
|
|
2357
|
+
return;
|
|
2358
|
+
this.fileLoggingEnabled = true;
|
|
2359
|
+
const fs = getFileSystem();
|
|
2360
|
+
this.pendingInit = (async () => {
|
|
2361
|
+
const [error] = await catchError((async () => {
|
|
2362
|
+
await fs.mkdir(fs.path.dirname(path));
|
|
2363
|
+
await fs.writeFile(path, "");
|
|
2364
|
+
})());
|
|
2365
|
+
if (error)
|
|
2366
|
+
this.fileLoggingEnabled = false;
|
|
2367
|
+
})();
|
|
2441
2368
|
}
|
|
2442
|
-
|
|
2443
|
-
|
|
2369
|
+
async flushFile() {
|
|
2370
|
+
await this.pendingInit;
|
|
2371
|
+
await this.pendingWrites;
|
|
2444
2372
|
}
|
|
2445
|
-
|
|
2446
|
-
|
|
2373
|
+
getLogFilePath() {
|
|
2374
|
+
return this.logFilePath || getGlobalLogFilePath();
|
|
2447
2375
|
}
|
|
2448
|
-
|
|
2449
|
-
const
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
if (headersObj && typeof headersObj === "object" && typeof headersObj.get === "function") {
|
|
2453
|
-
retryAfterValue = headersObj.get("retry-after") ?? undefined;
|
|
2376
|
+
handleLog = (logMessage) => {
|
|
2377
|
+
const parts = [];
|
|
2378
|
+
if (logMessage.source) {
|
|
2379
|
+
parts.push(`[${logMessage.source}]`);
|
|
2454
2380
|
}
|
|
2455
|
-
if (
|
|
2456
|
-
|
|
2457
|
-
retryAfterValue = headers["retry-after"] ?? headers["Retry-After"];
|
|
2381
|
+
if (logMessage.sourceTarget) {
|
|
2382
|
+
parts.push(`[${logMessage.sourceTarget}]`);
|
|
2458
2383
|
}
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2384
|
+
parts.push(logMessage.message);
|
|
2385
|
+
const msg = parts.join(" ");
|
|
2386
|
+
switch (logMessage.logLevel) {
|
|
2387
|
+
case "Debug":
|
|
2388
|
+
this.debug(msg);
|
|
2389
|
+
break;
|
|
2390
|
+
case "Information":
|
|
2391
|
+
this.info(msg);
|
|
2392
|
+
break;
|
|
2393
|
+
case "Warning":
|
|
2394
|
+
this.warn(msg);
|
|
2395
|
+
break;
|
|
2396
|
+
case "Error":
|
|
2397
|
+
this.error(msg);
|
|
2398
|
+
break;
|
|
2399
|
+
default:
|
|
2400
|
+
this.info(msg);
|
|
2401
|
+
break;
|
|
2465
2402
|
}
|
|
2403
|
+
};
|
|
2404
|
+
}
|
|
2405
|
+
var loggerSingleton = singleton(SimpleLogger);
|
|
2406
|
+
var logger = SimpleLogger.getInstance();
|
|
2407
|
+
function getLogFilePath() {
|
|
2408
|
+
return logger.getLogFilePath();
|
|
2409
|
+
}
|
|
2410
|
+
|
|
2411
|
+
// ../common/src/package-metadata-options.ts
|
|
2412
|
+
function registerPackageMetadataOptions(command) {
|
|
2413
|
+
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");
|
|
2414
|
+
}
|
|
2415
|
+
function mapPackageMetadataOptions(opts) {
|
|
2416
|
+
const fields = {};
|
|
2417
|
+
if (opts.author !== undefined)
|
|
2418
|
+
fields.author = opts.author;
|
|
2419
|
+
if (opts.description !== undefined)
|
|
2420
|
+
fields.description = opts.description;
|
|
2421
|
+
if (opts.releaseNotes !== undefined)
|
|
2422
|
+
fields.releaseNotes = opts.releaseNotes;
|
|
2423
|
+
if (opts.projectUrl !== undefined)
|
|
2424
|
+
fields.projectUrl = opts.projectUrl;
|
|
2425
|
+
if (opts.repositoryUrl !== undefined)
|
|
2426
|
+
fields.repositoryUrl = opts.repositoryUrl;
|
|
2427
|
+
if (opts.repositoryCommit !== undefined)
|
|
2428
|
+
fields.repositoryCommit = opts.repositoryCommit;
|
|
2429
|
+
if (opts.repositoryBranch !== undefined)
|
|
2430
|
+
fields.repositoryBranch = opts.repositoryBranch;
|
|
2431
|
+
if (opts.repositoryType !== undefined)
|
|
2432
|
+
fields.repositoryType = opts.repositoryType;
|
|
2433
|
+
if (fields.repositoryUrl !== undefined && fields.repositoryType === undefined) {
|
|
2434
|
+
fields.repositoryType = "git";
|
|
2466
2435
|
}
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2436
|
+
return fields;
|
|
2437
|
+
}
|
|
2438
|
+
|
|
2439
|
+
// ../common/src/error-handler.ts
|
|
2440
|
+
var DEFAULT_401 = "Unauthorized (401). Run `uip login` to authenticate.";
|
|
2441
|
+
var DEFAULT_403 = "Forbidden (403). Ensure the account has the required permissions.";
|
|
2442
|
+
var DEFAULT_405 = "Method Not Allowed (405). The endpoint may not exist or the base URL may be incorrect.";
|
|
2443
|
+
var DEFAULT_413 = "Payload too large (413). The upload exceeded the server or CDN size limit. Reduce the package size — for example, exclude unused dependencies or remove large files from the project — and try again.";
|
|
2444
|
+
var HTML_RESPONSE_MESSAGE = "Received HTML instead of the expected JSON response.";
|
|
2445
|
+
var NETWORK_ERROR_CODES = new Set([
|
|
2446
|
+
"ECONNREFUSED",
|
|
2447
|
+
"ECONNRESET",
|
|
2448
|
+
"ENOTFOUND",
|
|
2449
|
+
"EAI_AGAIN",
|
|
2450
|
+
"ETIMEDOUT",
|
|
2451
|
+
"EPIPE",
|
|
2452
|
+
"EHOSTUNREACH",
|
|
2453
|
+
"ENETUNREACH",
|
|
2454
|
+
"EAI_FAIL"
|
|
2455
|
+
]);
|
|
2456
|
+
var TLS_ERROR_CODES = new Set([
|
|
2457
|
+
"SELF_SIGNED_CERT_IN_CHAIN",
|
|
2458
|
+
"DEPTH_ZERO_SELF_SIGNED_CERT",
|
|
2459
|
+
"UNABLE_TO_VERIFY_LEAF_SIGNATURE",
|
|
2460
|
+
"UNABLE_TO_GET_ISSUER_CERT_LOCALLY",
|
|
2461
|
+
"UNABLE_TO_GET_ISSUER_CERT",
|
|
2462
|
+
"CERT_HAS_EXPIRED",
|
|
2463
|
+
"CERT_UNTRUSTED",
|
|
2464
|
+
"ERR_TLS_CERT_ALTNAME_INVALID"
|
|
2465
|
+
]);
|
|
2466
|
+
var TLS_INSTRUCTIONS = "The server's TLS certificate could not be verified. Most often a " + "corporate proxy/firewall re-signs HTTPS with a root CA that Node does " + "not trust — set NODE_EXTRA_CA_CERTS to that CA's PEM file (and HTTPS_PROXY " + "if you connect through a proxy). If the certificate is instead expired or " + "its hostname does not match, fix the endpoint URL or the system clock. " + "Then retry.";
|
|
2467
|
+
var NETWORK_INSTRUCTIONS = "Could not reach the UiPath service. Check your network connection and " + "VPN, confirm any HTTP_PROXY/HTTPS_PROXY/NO_PROXY settings are correct, " + "then retry.";
|
|
2468
|
+
var LOCAL_PERMISSION_ERROR_CODES = new Set(["EACCES", "EPERM", "EROFS"]);
|
|
2469
|
+
var LOCAL_PERMISSION_MESSAGE_PATTERN = /\b(EACCES|EPERM|EROFS)\b/;
|
|
2470
|
+
function localPermissionInstructions(code, path) {
|
|
2471
|
+
const target = path !== undefined ? `'${path}'` : "a local file or resource";
|
|
2472
|
+
if (code === "EROFS") {
|
|
2473
|
+
return `The filesystem containing ${target} is read-only (EROFS), so the ` + "CLI could not write to it. This is a local environment problem, " + "not a UiPath service error — retrying will not help. Use a " + "writable location, or give this environment write access to the " + "path.";
|
|
2474
|
+
}
|
|
2475
|
+
const remedy = process.platform === "win32" ? "Re-run from an elevated terminal, close any program holding " + "the file open, or grant your user access to the path." : "Grant this user (or the sandbox the command runs in) access " + "to the path, or run the command outside the sandbox.";
|
|
2476
|
+
return `The operating system denied access to ${target} (${code}). This is ` + "a local permission problem, not a UiPath service error — retrying " + `without a permission change will not help. ${remedy}`;
|
|
2477
|
+
}
|
|
2478
|
+
function describeConnectivityError(error) {
|
|
2479
|
+
for (const cur of walkErrorGraph(error)) {
|
|
2480
|
+
const code = typeof cur.code === "string" ? cur.code : undefined;
|
|
2481
|
+
const message = typeof cur.message === "string" ? cur.message : undefined;
|
|
2482
|
+
if (code && TLS_ERROR_CODES.has(code)) {
|
|
2483
|
+
return {
|
|
2484
|
+
code,
|
|
2485
|
+
kind: "tls",
|
|
2486
|
+
message: message ?? code,
|
|
2487
|
+
instructions: TLS_INSTRUCTIONS
|
|
2488
|
+
};
|
|
2489
|
+
}
|
|
2490
|
+
if (code && NETWORK_ERROR_CODES.has(code)) {
|
|
2491
|
+
return {
|
|
2492
|
+
code,
|
|
2493
|
+
kind: "network",
|
|
2494
|
+
message: message ?? code,
|
|
2495
|
+
instructions: NETWORK_INSTRUCTIONS
|
|
2496
|
+
};
|
|
2486
2497
|
}
|
|
2487
|
-
if (Object.keys(errors).length > 0)
|
|
2488
|
-
parsedErrors = errors;
|
|
2489
2498
|
}
|
|
2490
|
-
return
|
|
2491
|
-
result,
|
|
2492
|
-
errorCode: classification.errorCode,
|
|
2493
|
-
message,
|
|
2494
|
-
retry,
|
|
2495
|
-
details,
|
|
2496
|
-
...hasContext ? { context } : {},
|
|
2497
|
-
...parsedErrors ? { parsedErrors } : {}
|
|
2498
|
-
};
|
|
2499
|
-
}
|
|
2500
|
-
async function extractErrorMessage(error, options) {
|
|
2501
|
-
const { message } = await extractErrorDetails(error, options);
|
|
2502
|
-
return message;
|
|
2499
|
+
return;
|
|
2503
2500
|
}
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
function createStorage() {
|
|
2512
|
-
const [error, mod] = catchError(() => __require("node:async_hooks"));
|
|
2513
|
-
if (error || typeof mod?.AsyncLocalStorage !== "function") {
|
|
2501
|
+
function describePermissionError(error) {
|
|
2502
|
+
for (const cur of walkErrorGraph(error)) {
|
|
2503
|
+
const message = typeof cur.message === "string" ? cur.message : undefined;
|
|
2504
|
+
const code = matchLocalPermissionCode(cur.code, message);
|
|
2505
|
+
if (!code)
|
|
2506
|
+
continue;
|
|
2507
|
+
const path = localPermissionPath(cur.path, message);
|
|
2514
2508
|
return {
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
},
|
|
2518
|
-
|
|
2509
|
+
code,
|
|
2510
|
+
message: message ?? code,
|
|
2511
|
+
...path !== undefined ? { path } : {},
|
|
2512
|
+
instructions: localPermissionInstructions(code, path)
|
|
2519
2513
|
};
|
|
2520
2514
|
}
|
|
2521
|
-
return
|
|
2515
|
+
return;
|
|
2522
2516
|
}
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
var CONSOLE_FALLBACK = {
|
|
2527
|
-
writeOut: (str) => process.stdout.write(str),
|
|
2528
|
-
writeErr: (str) => process.stderr.write(str),
|
|
2529
|
-
writeLog: (str) => process.stdout.write(str),
|
|
2530
|
-
capabilities: {
|
|
2531
|
-
isInteractive: false,
|
|
2532
|
-
canReadInput: false,
|
|
2533
|
-
supportsColor: false,
|
|
2534
|
-
outputWidth: 80
|
|
2517
|
+
function matchLocalPermissionCode(code, message) {
|
|
2518
|
+
if (typeof code === "string" && LOCAL_PERMISSION_ERROR_CODES.has(code)) {
|
|
2519
|
+
return code;
|
|
2535
2520
|
}
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
return outputStorage.getStore() ?? sinkSlot.get() ?? CONSOLE_FALLBACK;
|
|
2521
|
+
const match = message ? LOCAL_PERMISSION_MESSAGE_PATTERN.exec(message) : null;
|
|
2522
|
+
return match ? match[1] : undefined;
|
|
2539
2523
|
}
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
logFilePathSlot.set(path);
|
|
2524
|
+
function localPermissionPath(path, message) {
|
|
2525
|
+
if (typeof path === "string")
|
|
2526
|
+
return path;
|
|
2527
|
+
return message ? /'([^']+)'/.exec(message)?.[1] : undefined;
|
|
2545
2528
|
}
|
|
2546
|
-
function
|
|
2547
|
-
|
|
2529
|
+
function* walkErrorGraph(error) {
|
|
2530
|
+
const queue = [error];
|
|
2531
|
+
const seen = new Set;
|
|
2532
|
+
for (let steps = 0;queue.length > 0 && steps < 32; steps++) {
|
|
2533
|
+
const current = queue.shift();
|
|
2534
|
+
if (current === null || typeof current !== "object")
|
|
2535
|
+
continue;
|
|
2536
|
+
if (seen.has(current))
|
|
2537
|
+
continue;
|
|
2538
|
+
seen.add(current);
|
|
2539
|
+
const cur = current;
|
|
2540
|
+
yield cur;
|
|
2541
|
+
if (cur.cause !== undefined)
|
|
2542
|
+
queue.push(cur.cause);
|
|
2543
|
+
if (Array.isArray(cur.errors))
|
|
2544
|
+
queue.push(...cur.errors);
|
|
2545
|
+
}
|
|
2546
|
+
return;
|
|
2548
2547
|
}
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2548
|
+
function parseHttpStatusFromMessage(message) {
|
|
2549
|
+
const match = /^HTTP\s+(\d{3})(?::|\s|-|$)/i.exec(message.trim());
|
|
2550
|
+
if (!match)
|
|
2551
|
+
return;
|
|
2552
|
+
const status = Number(match[1]);
|
|
2553
|
+
return Number.isInteger(status) && status >= 100 && status <= 599 ? status : undefined;
|
|
2554
|
+
}
|
|
2555
|
+
function isHtmlDocument(body) {
|
|
2556
|
+
return /^\s*(<!doctype html|<html\b)/i.test(body);
|
|
2557
|
+
}
|
|
2558
|
+
function retryHintForRetryAfter(seconds) {
|
|
2559
|
+
if (seconds <= 1) {
|
|
2560
|
+
return "RetryAfter1Second";
|
|
2562
2561
|
}
|
|
2563
|
-
|
|
2564
|
-
return
|
|
2562
|
+
if (seconds <= 10) {
|
|
2563
|
+
return "RetryAfter10Seconds";
|
|
2565
2564
|
}
|
|
2566
|
-
|
|
2567
|
-
|
|
2565
|
+
if (seconds <= 30) {
|
|
2566
|
+
return "RetryAfter30Seconds";
|
|
2568
2567
|
}
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
return explicitLevel;
|
|
2575
|
-
const debugVal = process.env?.DEBUG;
|
|
2576
|
-
if (debugVal === "true" || debugVal === "1") {
|
|
2577
|
-
return 0 /* DEBUG */;
|
|
2578
|
-
}
|
|
2579
|
-
return DEFAULT_LOG_LEVEL;
|
|
2580
|
-
}
|
|
2581
|
-
const [localStorageError, hasDebug] = catchError(() => typeof localStorage !== "undefined" && !!localStorage.getItem("debug"));
|
|
2582
|
-
if (!localStorageError && hasDebug) {
|
|
2583
|
-
return 0 /* DEBUG */;
|
|
2584
|
-
}
|
|
2585
|
-
return DEFAULT_LOG_LEVEL;
|
|
2568
|
+
return "RetryAfter60Seconds";
|
|
2569
|
+
}
|
|
2570
|
+
function classifyError(status, error) {
|
|
2571
|
+
if (status === 400 || status === 409 || status === 422) {
|
|
2572
|
+
return { errorCode: "invalid_argument", retry: "RetryWillNotFix" };
|
|
2586
2573
|
}
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
return 1 /* INFO */;
|
|
2593
|
-
case "warn":
|
|
2594
|
-
return 2 /* WARN */;
|
|
2595
|
-
case "error":
|
|
2596
|
-
return 3 /* ERROR */;
|
|
2597
|
-
default:
|
|
2598
|
-
return;
|
|
2599
|
-
}
|
|
2574
|
+
if (status === 401) {
|
|
2575
|
+
return {
|
|
2576
|
+
errorCode: "authentication_required",
|
|
2577
|
+
retry: "RetryWillNotFix"
|
|
2578
|
+
};
|
|
2600
2579
|
}
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
return `${message}
|
|
2604
|
-
`;
|
|
2605
|
-
return `${message} ${args.map(String).join(" ")}
|
|
2606
|
-
`;
|
|
2580
|
+
if (status === 403) {
|
|
2581
|
+
return { errorCode: "permission_denied", retry: "RetryWillNotFix" };
|
|
2607
2582
|
}
|
|
2608
|
-
|
|
2609
|
-
return
|
|
2583
|
+
if (status === 404) {
|
|
2584
|
+
return { errorCode: "not_found", retry: "RetryWillNotFix" };
|
|
2610
2585
|
}
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
if (!path)
|
|
2614
|
-
return;
|
|
2615
|
-
const timestamp = new Date().toISOString();
|
|
2616
|
-
this.pendingWrites = Promise.all([
|
|
2617
|
-
this.pendingWrites,
|
|
2618
|
-
this.pendingInit
|
|
2619
|
-
]).then(() => getFileSystem().appendFile(path, `${timestamp} ${formatted}`).catch(() => {}));
|
|
2586
|
+
if (status === 405) {
|
|
2587
|
+
return { errorCode: "method_not_allowed", retry: "RetryWillNotFix" };
|
|
2620
2588
|
}
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
2589
|
+
if (status === 413) {
|
|
2590
|
+
return { errorCode: "invalid_argument", retry: "RetryWillNotFix" };
|
|
2591
|
+
}
|
|
2592
|
+
if (status === 408) {
|
|
2593
|
+
return { errorCode: "timeout", retry: "RetryLater" };
|
|
2594
|
+
}
|
|
2595
|
+
if (status === 429) {
|
|
2596
|
+
return { errorCode: "rate_limited", retry: "RetryLater" };
|
|
2597
|
+
}
|
|
2598
|
+
if (status !== undefined && status >= 500 && status < 600) {
|
|
2599
|
+
return { errorCode: "server_error", retry: "RetryLater" };
|
|
2600
|
+
}
|
|
2601
|
+
if (status === undefined && describePermissionError(error)) {
|
|
2602
|
+
return {
|
|
2603
|
+
errorCode: "local_permission_denied",
|
|
2604
|
+
retry: "RetryWillNotFix"
|
|
2605
|
+
};
|
|
2606
|
+
}
|
|
2607
|
+
const connectivity = describeConnectivityError(error);
|
|
2608
|
+
if (connectivity) {
|
|
2609
|
+
return {
|
|
2610
|
+
errorCode: "network_error",
|
|
2611
|
+
retry: connectivity.kind === "tls" ? "RetryWillNotFix" : "RetryLater"
|
|
2612
|
+
};
|
|
2613
|
+
}
|
|
2614
|
+
return { errorCode: "unknown_error", retry: "RetryWillNotFix" };
|
|
2615
|
+
}
|
|
2616
|
+
function formatHttpStatusMessage(status, rawMessage, extractedMessage, inferredStatus) {
|
|
2617
|
+
if (extractedMessage) {
|
|
2618
|
+
return `HTTP ${status}: ${extractedMessage}`;
|
|
2619
|
+
}
|
|
2620
|
+
return inferredStatus !== undefined ? rawMessage : `HTTP ${status}: ${rawMessage}`;
|
|
2621
|
+
}
|
|
2622
|
+
async function extractErrorDetails(error, options) {
|
|
2623
|
+
const err = error !== null && error !== undefined && typeof error === "object" ? error : {};
|
|
2624
|
+
const response = err.response;
|
|
2625
|
+
const rawMessage = typeof err.message === "string" ? err.message : "Unknown error";
|
|
2626
|
+
const explicitStatus = err.status ?? response?.status;
|
|
2627
|
+
const inferredStatus = explicitStatus === undefined ? parseHttpStatusFromMessage(rawMessage) : undefined;
|
|
2628
|
+
const status = explicitStatus ?? inferredStatus;
|
|
2629
|
+
const isSuccessfulResponse = status !== undefined && status >= 200 && status < 300;
|
|
2630
|
+
let rawBody;
|
|
2631
|
+
let extractedMessage;
|
|
2632
|
+
let parsedBody;
|
|
2633
|
+
const textFn = response?.text?.bind(response);
|
|
2634
|
+
if (textFn) {
|
|
2635
|
+
const [bodyError, body] = await catchError((async () => textFn())());
|
|
2636
|
+
if (!bodyError && body) {
|
|
2637
|
+
rawBody = body;
|
|
2638
|
+
const [parseError, parsed] = catchError(() => JSON.parse(body));
|
|
2639
|
+
if (!parseError && parsed && typeof parsed === "object") {
|
|
2640
|
+
parsedBody = parsed;
|
|
2641
|
+
if (parsedBody.errors && typeof parsedBody.errors === "object") {
|
|
2642
|
+
for (const field of Object.values(parsedBody.errors)) {
|
|
2643
|
+
if (Array.isArray(field) && field.length > 0) {
|
|
2644
|
+
const first = field[0];
|
|
2645
|
+
if (first && typeof first.message === "string") {
|
|
2646
|
+
extractedMessage = first.message;
|
|
2647
|
+
break;
|
|
2648
|
+
}
|
|
2649
|
+
}
|
|
2650
|
+
}
|
|
2651
|
+
}
|
|
2652
|
+
if (!extractedMessage) {
|
|
2653
|
+
extractedMessage = typeof parsedBody.message === "string" ? parsedBody.message : typeof parsedBody.errorMessage === "string" ? parsedBody.errorMessage : typeof parsedBody.title === "string" ? parsedBody.title : undefined;
|
|
2654
|
+
}
|
|
2655
|
+
if (!extractedMessage) {
|
|
2656
|
+
extractedMessage = body;
|
|
2657
|
+
}
|
|
2658
|
+
if (extractedMessage && typeof parsedBody.detail === "string" && parsedBody.detail.length > 0 && !extractedMessage.includes(parsedBody.detail)) {
|
|
2659
|
+
extractedMessage = `${extractedMessage}: ${parsedBody.detail}`;
|
|
2660
|
+
}
|
|
2661
|
+
} else {
|
|
2662
|
+
extractedMessage = isHtmlDocument(body) ? HTML_RESPONSE_MESSAGE : body;
|
|
2663
|
+
}
|
|
2664
|
+
}
|
|
2665
|
+
}
|
|
2666
|
+
let message;
|
|
2667
|
+
let result = "Failure";
|
|
2668
|
+
const classification = classifyError(status, error);
|
|
2669
|
+
let retry = classification.retry;
|
|
2670
|
+
if (status === 401) {
|
|
2671
|
+
message = DEFAULT_401;
|
|
2672
|
+
result = "AuthenticationError";
|
|
2673
|
+
} else if (status === 403) {
|
|
2674
|
+
message = options?.forbiddenMessage ?? DEFAULT_403;
|
|
2675
|
+
result = "AuthenticationError";
|
|
2676
|
+
} else if (status === 405) {
|
|
2677
|
+
message = DEFAULT_405;
|
|
2678
|
+
} else if (status === 413) {
|
|
2679
|
+
message = DEFAULT_413;
|
|
2680
|
+
} else if (status === 400 || status === 422) {
|
|
2681
|
+
message = formatHttpStatusMessage(status, rawMessage, extractedMessage, inferredStatus);
|
|
2682
|
+
result = "ValidationError";
|
|
2683
|
+
} else if (status === 429) {
|
|
2684
|
+
message = formatHttpStatusMessage(status, rawMessage, extractedMessage, inferredStatus);
|
|
2685
|
+
} else if (extractedMessage) {
|
|
2686
|
+
if (isSuccessfulResponse && rawMessage !== "Unknown error") {
|
|
2687
|
+
message = rawMessage;
|
|
2627
2688
|
} else {
|
|
2628
|
-
|
|
2689
|
+
message = status ? `HTTP ${status}: ${extractedMessage}` : extractedMessage;
|
|
2629
2690
|
}
|
|
2630
|
-
}
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
this.writeToFile(formatted);
|
|
2691
|
+
} else if (status) {
|
|
2692
|
+
if (inferredStatus !== undefined) {
|
|
2693
|
+
message = rawMessage;
|
|
2694
|
+
} else if (rawMessage === "Unknown error" && response) {
|
|
2695
|
+
const statusText = response.statusText;
|
|
2696
|
+
message = statusText ? `HTTP ${status} ${statusText}` : `HTTP ${status} - request failed`;
|
|
2637
2697
|
} else {
|
|
2638
|
-
|
|
2698
|
+
message = `HTTP ${status}: ${rawMessage}`;
|
|
2639
2699
|
}
|
|
2700
|
+
} else {
|
|
2701
|
+
message = rawMessage;
|
|
2640
2702
|
}
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
if (this.isFileLoggingActive()) {
|
|
2646
|
-
this.writeToFile(formatted);
|
|
2647
|
-
} else {
|
|
2648
|
-
getOutputSink().writeErr(formatted);
|
|
2703
|
+
if (status === undefined) {
|
|
2704
|
+
const connectivity = describeConnectivityError(error);
|
|
2705
|
+
if (connectivity && connectivity.message !== message && !message.includes(connectivity.message)) {
|
|
2706
|
+
message = `${message}: ${connectivity.message}`;
|
|
2649
2707
|
}
|
|
2650
2708
|
}
|
|
2651
|
-
error
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2709
|
+
const permission = status === undefined ? describePermissionError(error) : undefined;
|
|
2710
|
+
if (permission) {
|
|
2711
|
+
if (permission.message !== message && !message.includes(permission.message)) {
|
|
2712
|
+
message = `${message}: ${permission.message}`;
|
|
2713
|
+
}
|
|
2714
|
+
if (!message.includes(permission.instructions)) {
|
|
2715
|
+
const punctuated = message.endsWith(".") ? message : `${message}.`;
|
|
2716
|
+
message = `${punctuated} ${permission.instructions}`;
|
|
2659
2717
|
}
|
|
2660
2718
|
}
|
|
2661
|
-
|
|
2662
|
-
|
|
2719
|
+
let details = rawMessage;
|
|
2720
|
+
if (rawBody) {
|
|
2721
|
+
if (parsedBody) {
|
|
2722
|
+
const extra = {};
|
|
2723
|
+
if (parsedBody.errorCode)
|
|
2724
|
+
extra.errorCode = parsedBody.errorCode;
|
|
2725
|
+
if (parsedBody.detail)
|
|
2726
|
+
extra.detail = parsedBody.detail;
|
|
2727
|
+
if (parsedBody.details)
|
|
2728
|
+
extra.details = parsedBody.details;
|
|
2729
|
+
if (parsedBody.errors != null)
|
|
2730
|
+
extra.errors = parsedBody.errors;
|
|
2731
|
+
if (parsedBody.data && typeof parsedBody.data === "object" && Object.keys(parsedBody.data).length > 0) {
|
|
2732
|
+
extra.data = parsedBody.data;
|
|
2733
|
+
}
|
|
2734
|
+
details = Object.keys(extra).length > 0 ? JSON.stringify(extra) : rawBody;
|
|
2735
|
+
} else {
|
|
2736
|
+
details = rawBody;
|
|
2737
|
+
}
|
|
2738
|
+
} else if (typeof err.message === "string") {
|
|
2739
|
+
details = err.message;
|
|
2740
|
+
} else {
|
|
2741
|
+
details = String(error);
|
|
2663
2742
|
}
|
|
2664
|
-
|
|
2665
|
-
|
|
2743
|
+
const context = {};
|
|
2744
|
+
if (status) {
|
|
2745
|
+
context.httpStatus = status;
|
|
2666
2746
|
}
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
setGlobalLogFilePath("");
|
|
2672
|
-
}
|
|
2747
|
+
if (parsedBody?.errorCode && typeof parsedBody.errorCode === "string") {
|
|
2748
|
+
context.errorCode = parsedBody.errorCode;
|
|
2749
|
+
} else if (parsedBody?.code && typeof parsedBody.code === "string") {
|
|
2750
|
+
context.errorCode = parsedBody.code;
|
|
2673
2751
|
}
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
setGlobalLogFilePath(path);
|
|
2677
|
-
if (!path)
|
|
2678
|
-
return;
|
|
2679
|
-
this.fileLoggingEnabled = true;
|
|
2680
|
-
const fs = getFileSystem();
|
|
2681
|
-
this.pendingInit = (async () => {
|
|
2682
|
-
const [error] = await catchError((async () => {
|
|
2683
|
-
await fs.mkdir(fs.path.dirname(path));
|
|
2684
|
-
await fs.writeFile(path, "");
|
|
2685
|
-
})());
|
|
2686
|
-
if (error)
|
|
2687
|
-
this.fileLoggingEnabled = false;
|
|
2688
|
-
})();
|
|
2752
|
+
if (parsedBody?.requestId && typeof parsedBody.requestId === "string") {
|
|
2753
|
+
context.requestId = parsedBody.requestId;
|
|
2689
2754
|
}
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
await this.pendingWrites;
|
|
2755
|
+
if (parsedBody?.traceId && typeof parsedBody.traceId === "string") {
|
|
2756
|
+
context.traceId = parsedBody.traceId;
|
|
2693
2757
|
}
|
|
2694
|
-
|
|
2695
|
-
|
|
2758
|
+
if (permission?.path !== undefined) {
|
|
2759
|
+
context.path = permission.path;
|
|
2696
2760
|
}
|
|
2697
|
-
|
|
2698
|
-
const
|
|
2699
|
-
|
|
2700
|
-
|
|
2761
|
+
if (status === 429) {
|
|
2762
|
+
const resp = response;
|
|
2763
|
+
const headersObj = resp?.headers;
|
|
2764
|
+
let retryAfterValue;
|
|
2765
|
+
if (headersObj && typeof headersObj === "object" && typeof headersObj.get === "function") {
|
|
2766
|
+
retryAfterValue = headersObj.get("retry-after") ?? undefined;
|
|
2701
2767
|
}
|
|
2702
|
-
if (
|
|
2703
|
-
|
|
2768
|
+
if (!retryAfterValue && headersObj && typeof headersObj === "object") {
|
|
2769
|
+
const headers = headersObj;
|
|
2770
|
+
retryAfterValue = headers["retry-after"] ?? headers["Retry-After"];
|
|
2704
2771
|
}
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2772
|
+
if (retryAfterValue) {
|
|
2773
|
+
const seconds = Number(retryAfterValue);
|
|
2774
|
+
if (!Number.isNaN(seconds)) {
|
|
2775
|
+
context.retryAfter = seconds;
|
|
2776
|
+
retry = retryHintForRetryAfter(seconds);
|
|
2777
|
+
}
|
|
2778
|
+
}
|
|
2779
|
+
}
|
|
2780
|
+
const hasContext = Object.keys(context).length > 0;
|
|
2781
|
+
let parsedErrors;
|
|
2782
|
+
if (parsedBody?.errors && typeof parsedBody.errors === "object") {
|
|
2783
|
+
const errors = {};
|
|
2784
|
+
for (const [field, raw] of Object.entries(parsedBody.errors)) {
|
|
2785
|
+
if (Array.isArray(raw)) {
|
|
2786
|
+
const messages = raw.map((entry) => {
|
|
2787
|
+
if (typeof entry === "string")
|
|
2788
|
+
return entry;
|
|
2789
|
+
if (entry && typeof entry === "object" && typeof entry.message === "string") {
|
|
2790
|
+
return entry.message;
|
|
2791
|
+
}
|
|
2792
|
+
return String(entry);
|
|
2793
|
+
}).filter(Boolean);
|
|
2794
|
+
if (messages.length > 0)
|
|
2795
|
+
errors[field] = messages;
|
|
2796
|
+
} else if (typeof raw === "string") {
|
|
2797
|
+
errors[field] = [raw];
|
|
2798
|
+
}
|
|
2723
2799
|
}
|
|
2800
|
+
if (Object.keys(errors).length > 0)
|
|
2801
|
+
parsedErrors = errors;
|
|
2802
|
+
}
|
|
2803
|
+
return {
|
|
2804
|
+
result,
|
|
2805
|
+
errorCode: classification.errorCode,
|
|
2806
|
+
message,
|
|
2807
|
+
retry,
|
|
2808
|
+
details,
|
|
2809
|
+
...hasContext ? { context } : {},
|
|
2810
|
+
...parsedErrors ? { parsedErrors } : {}
|
|
2724
2811
|
};
|
|
2725
2812
|
}
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
return logger.getLogFilePath();
|
|
2813
|
+
async function extractErrorMessage(error, options) {
|
|
2814
|
+
const { message } = await extractErrorDetails(error, options);
|
|
2815
|
+
return message;
|
|
2730
2816
|
}
|
|
2731
|
-
|
|
2817
|
+
// ../common/src/command-examples.ts
|
|
2818
|
+
var examplesByCommand = new WeakMap;
|
|
2819
|
+
Command.prototype.examples = function(examples) {
|
|
2820
|
+
examplesByCommand.set(this, examples);
|
|
2821
|
+
return this;
|
|
2822
|
+
};
|
|
2732
2823
|
// ../common/src/output-codecs.ts
|
|
2733
2824
|
var yamlSlot = singleton("YamlCodec");
|
|
2734
2825
|
var jmespathSlot = singleton("JmespathCodec");
|
|
@@ -3623,6 +3714,7 @@ var CLI_ERROR_CODES = [
|
|
|
3623
3714
|
"invalid_argument",
|
|
3624
3715
|
"authentication_required",
|
|
3625
3716
|
"permission_denied",
|
|
3717
|
+
"local_permission_denied",
|
|
3626
3718
|
"not_found",
|
|
3627
3719
|
"rate_limited",
|
|
3628
3720
|
"network_error",
|
|
@@ -3656,6 +3748,40 @@ var EXIT_CODES = {
|
|
|
3656
3748
|
ValidationError: 3,
|
|
3657
3749
|
TimeoutError: 4
|
|
3658
3750
|
};
|
|
3751
|
+
|
|
3752
|
+
class Pagination {
|
|
3753
|
+
Returned;
|
|
3754
|
+
Limit;
|
|
3755
|
+
Offset;
|
|
3756
|
+
Total;
|
|
3757
|
+
HasMore;
|
|
3758
|
+
NextPage;
|
|
3759
|
+
constructor({
|
|
3760
|
+
returned,
|
|
3761
|
+
limit,
|
|
3762
|
+
offset,
|
|
3763
|
+
total,
|
|
3764
|
+
hasMore,
|
|
3765
|
+
nextPage
|
|
3766
|
+
}) {
|
|
3767
|
+
this.Returned = returned;
|
|
3768
|
+
this.Limit = limit;
|
|
3769
|
+
this.Offset = offset;
|
|
3770
|
+
this.Total = total;
|
|
3771
|
+
this.HasMore = hasMore ?? derivePaginationHasMore(returned, limit, offset, total, nextPage);
|
|
3772
|
+
this.NextPage = nextPage;
|
|
3773
|
+
}
|
|
3774
|
+
}
|
|
3775
|
+
function derivePaginationHasMore(returned, limit, offset, total, nextPage) {
|
|
3776
|
+
if (nextPage) {
|
|
3777
|
+
return true;
|
|
3778
|
+
}
|
|
3779
|
+
if (total === undefined) {
|
|
3780
|
+
return returned >= limit;
|
|
3781
|
+
}
|
|
3782
|
+
return (offset ?? 0) + returned < total;
|
|
3783
|
+
}
|
|
3784
|
+
|
|
3659
3785
|
class SuccessOutput {
|
|
3660
3786
|
Result = RESULTS.Success;
|
|
3661
3787
|
Code;
|
|
@@ -4058,12 +4184,16 @@ function defaultErrorCodeForHttpStatus(status) {
|
|
|
4058
4184
|
return "server_error";
|
|
4059
4185
|
return;
|
|
4060
4186
|
}
|
|
4187
|
+
var LOCAL_PERMISSION_TEXT_PATTERN = /(?:\b|\()(?:EACCES|EPERM|EROFS)(?::\s|\))/;
|
|
4061
4188
|
function defaultErrorCodeForFailure(data) {
|
|
4062
4189
|
if (data.Result === RESULTS.Failure) {
|
|
4063
4190
|
const status = data.Context?.httpStatus ?? parseHttpStatusFromMessage2(data.Message);
|
|
4064
4191
|
const errorCode = defaultErrorCodeForHttpStatus(status);
|
|
4065
4192
|
if (errorCode)
|
|
4066
4193
|
return errorCode;
|
|
4194
|
+
if (status === undefined && (LOCAL_PERMISSION_TEXT_PATTERN.test(data.Message) || LOCAL_PERMISSION_TEXT_PATTERN.test(data.Instructions))) {
|
|
4195
|
+
return "local_permission_denied";
|
|
4196
|
+
}
|
|
4067
4197
|
}
|
|
4068
4198
|
return defaultErrorCodeForResult(data.Result);
|
|
4069
4199
|
}
|
|
@@ -4513,7 +4643,10 @@ function extractHttpStatus(err) {
|
|
|
4513
4643
|
if (!err || typeof err !== "object")
|
|
4514
4644
|
return;
|
|
4515
4645
|
const e = err;
|
|
4516
|
-
|
|
4646
|
+
const structured = e.response?.status ?? e.status ?? e.statusCode;
|
|
4647
|
+
if (structured !== undefined)
|
|
4648
|
+
return structured;
|
|
4649
|
+
return typeof e.message === "string" ? parseHttpStatusFromMessage(e.message) : undefined;
|
|
4517
4650
|
}
|
|
4518
4651
|
var GENERIC = "Check authentication and parameters";
|
|
4519
4652
|
function instructionsFor(ctx, err) {
|
|
@@ -4547,6 +4680,10 @@ function instructionsFor(ctx, err) {
|
|
|
4547
4680
|
if (status !== undefined && status >= 500 && status < 600) {
|
|
4548
4681
|
return "Orchestrator returned a server error — retry; if it persists, check service status";
|
|
4549
4682
|
}
|
|
4683
|
+
const permission = describePermissionError(err);
|
|
4684
|
+
if (permission) {
|
|
4685
|
+
return permission.instructions;
|
|
4686
|
+
}
|
|
4550
4687
|
const connectivity = describeConnectivityError(err);
|
|
4551
4688
|
if (connectivity) {
|
|
4552
4689
|
return connectivity.instructions;
|
|
@@ -4555,6 +4692,11 @@ function instructionsFor(ctx, err) {
|
|
|
4555
4692
|
}
|
|
4556
4693
|
}
|
|
4557
4694
|
}
|
|
4695
|
+
// ../common/src/guid.ts
|
|
4696
|
+
var GUID_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
4697
|
+
function isGuid(value) {
|
|
4698
|
+
return GUID_REGEX.test(value);
|
|
4699
|
+
}
|
|
4558
4700
|
// ../common/src/host-global-options.ts
|
|
4559
4701
|
var HOST_GLOBAL_OPTIONS_WITH_VALUE = [
|
|
4560
4702
|
"--output",
|
|
@@ -4611,33 +4753,6 @@ function parseBoundedInt(raw, optionName, bounds) {
|
|
|
4611
4753
|
}
|
|
4612
4754
|
return n;
|
|
4613
4755
|
}
|
|
4614
|
-
// ../common/src/package-metadata-options.ts
|
|
4615
|
-
function registerPackageMetadataOptions(command) {
|
|
4616
|
-
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");
|
|
4617
|
-
}
|
|
4618
|
-
function mapPackageMetadataOptions(opts) {
|
|
4619
|
-
const fields = {};
|
|
4620
|
-
if (opts.author !== undefined)
|
|
4621
|
-
fields.author = opts.author;
|
|
4622
|
-
if (opts.description !== undefined)
|
|
4623
|
-
fields.description = opts.description;
|
|
4624
|
-
if (opts.releaseNotes !== undefined)
|
|
4625
|
-
fields.releaseNotes = opts.releaseNotes;
|
|
4626
|
-
if (opts.projectUrl !== undefined)
|
|
4627
|
-
fields.projectUrl = opts.projectUrl;
|
|
4628
|
-
if (opts.repositoryUrl !== undefined)
|
|
4629
|
-
fields.repositoryUrl = opts.repositoryUrl;
|
|
4630
|
-
if (opts.repositoryCommit !== undefined)
|
|
4631
|
-
fields.repositoryCommit = opts.repositoryCommit;
|
|
4632
|
-
if (opts.repositoryBranch !== undefined)
|
|
4633
|
-
fields.repositoryBranch = opts.repositoryBranch;
|
|
4634
|
-
if (opts.repositoryType !== undefined)
|
|
4635
|
-
fields.repositoryType = opts.repositoryType;
|
|
4636
|
-
if (fields.repositoryUrl !== undefined && fields.repositoryType === undefined) {
|
|
4637
|
-
fields.repositoryType = "git";
|
|
4638
|
-
}
|
|
4639
|
-
return fields;
|
|
4640
|
-
}
|
|
4641
4756
|
// ../common/src/polling/types.ts
|
|
4642
4757
|
var PollOutcome = {
|
|
4643
4758
|
Completed: "completed",
|
|
@@ -4755,42 +4870,6 @@ function installRequestHeaderForwarding(BaseApiClass, patchKey, forward) {
|
|
|
4755
4870
|
function installSdkUserAgentHeader(BaseApiClass, userAgent) {
|
|
4756
4871
|
installRequestHeaderForwarding(BaseApiClass, userAgentPatchKey(userAgent), (headers) => addSdkUserAgentHeader(headers, userAgent));
|
|
4757
4872
|
}
|
|
4758
|
-
// ../common/src/tool-module-import.ts
|
|
4759
|
-
async function importToolModule(specifier) {
|
|
4760
|
-
return await import(specifier);
|
|
4761
|
-
}
|
|
4762
|
-
|
|
4763
|
-
// ../common/src/tool-provider.ts
|
|
4764
|
-
var factorySlot = singleton("PackagerFactoryProvider");
|
|
4765
|
-
var moduleSlot = singleton("ToolModuleProvider");
|
|
4766
|
-
async function ensureToolModule(verb, packageName, moduleName) {
|
|
4767
|
-
if (!/^[a-z0-9-]+$/.test(moduleName)) {
|
|
4768
|
-
throw new Error(`Invalid tool module name '${moduleName}'.`);
|
|
4769
|
-
}
|
|
4770
|
-
const provider = moduleSlot.get();
|
|
4771
|
-
if (provider) {
|
|
4772
|
-
return provider(verb, moduleName);
|
|
4773
|
-
}
|
|
4774
|
-
const specifier = `${packageName}/${moduleName}`;
|
|
4775
|
-
const [importError, mod] = await catchError(importToolModule(specifier));
|
|
4776
|
-
if (importError) {
|
|
4777
|
-
logger.debug(`No tool-module provider registered; import of '${specifier}' failed: ${importError.message}`);
|
|
4778
|
-
throw new Error(`This command needs '${packageName}'. Install it.`, {
|
|
4779
|
-
cause: importError
|
|
4780
|
-
});
|
|
4781
|
-
}
|
|
4782
|
-
return mod;
|
|
4783
|
-
}
|
|
4784
|
-
|
|
4785
|
-
// ../common/src/solution-project-artifacts.ts
|
|
4786
|
-
async function ensureProjectArtifacts(args) {
|
|
4787
|
-
const [error, mod] = await catchError(ensureToolModule("solution", "@uipath/solution-tool", "init"));
|
|
4788
|
-
if (error) {
|
|
4789
|
-
logger.warn(`Solution artifact-resource generation skipped for project "${args.projectName}": ${error.message}. ` + "Run 'uip solution projects add' to finish setup.");
|
|
4790
|
-
return { Created: false, Error: error.message };
|
|
4791
|
-
}
|
|
4792
|
-
return mod.addProjectArtifactsToSolutionAsync(args);
|
|
4793
|
-
}
|
|
4794
4873
|
// ../common/src/solution-project-types.ts
|
|
4795
4874
|
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>'.";
|
|
4796
4875
|
function unsupportedSolutionProjectType(projectType) {
|
|
@@ -4816,6 +4895,8 @@ async function readStdin() {
|
|
|
4816
4895
|
}
|
|
4817
4896
|
// ../common/src/telemetry/ship-succeeded.ts
|
|
4818
4897
|
var shippedKeysSlot = singleton("ShipSucceededDedupeKeys");
|
|
4819
|
-
|
|
4898
|
+
// ../common/src/tool-provider.ts
|
|
4899
|
+
var factorySlot = singleton("PackagerFactoryProvider");
|
|
4900
|
+
export { catchError, extractErrorMessage, InvalidArgumentError, Command, Option, isPreviewBuild, logger, getOutputFormat, getOutputFormatExplicit, RESULTS, EXIT_CODES, Pagination, OutputFormatter, processContext, DEFAULT_PAGE_SIZE, hashContent, instructionsFor, isGuid, createHiddenDeprecatedTenantOption, parseLimit, parseOffset, parseBoundedInt, registerPackageMetadataOptions, mapPackageMetadataOptions, getSdkUserAgentToken, addSdkUserAgentHeader, installSdkUserAgentHeader, unsupportedSolutionProjectType, readStdin };
|
|
4820
4901
|
|
|
4821
|
-
//# debugId=
|
|
4902
|
+
//# debugId=0588CC9DE89155C064756E2164756E21
|