@uipath/insights-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/dist/index.js +1 -1
- package/dist/{tool-vs72q3tv.js → tool-b9c68vwv.js} +510 -90
- package/dist/tool.js +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -2112,7 +2112,7 @@ var require_commander = __commonJS((exports) => {
|
|
|
2112
2112
|
var package_default = {
|
|
2113
2113
|
name: "@uipath/insights-tool",
|
|
2114
2114
|
license: "MIT",
|
|
2115
|
-
version: "1.201.0-preview.
|
|
2115
|
+
version: "1.201.0-preview.121",
|
|
2116
2116
|
description: "Query UiPath Insights data — jobs, failures, and performance metrics.",
|
|
2117
2117
|
private: false,
|
|
2118
2118
|
repository: {
|
|
@@ -2205,17 +2205,9 @@ var TLS_ERROR_CODES = new Set([
|
|
|
2205
2205
|
]);
|
|
2206
2206
|
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.";
|
|
2207
2207
|
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.";
|
|
2208
|
+
var LOCAL_PERMISSION_ERROR_CODES = new Set(["EACCES", "EPERM", "EROFS"]);
|
|
2208
2209
|
function describeConnectivityError(error) {
|
|
2209
|
-
const
|
|
2210
|
-
const seen = new Set;
|
|
2211
|
-
for (let steps = 0;queue.length > 0 && steps < 32; steps++) {
|
|
2212
|
-
const current = queue.shift();
|
|
2213
|
-
if (current === null || typeof current !== "object")
|
|
2214
|
-
continue;
|
|
2215
|
-
if (seen.has(current))
|
|
2216
|
-
continue;
|
|
2217
|
-
seen.add(current);
|
|
2218
|
-
const cur = current;
|
|
2210
|
+
for (const cur of walkErrorGraph(error)) {
|
|
2219
2211
|
const code = typeof cur.code === "string" ? cur.code : undefined;
|
|
2220
2212
|
const message = typeof cur.message === "string" ? cur.message : undefined;
|
|
2221
2213
|
if (code && TLS_ERROR_CODES.has(code)) {
|
|
@@ -2234,6 +2226,21 @@ function describeConnectivityError(error) {
|
|
|
2234
2226
|
instructions: NETWORK_INSTRUCTIONS
|
|
2235
2227
|
};
|
|
2236
2228
|
}
|
|
2229
|
+
}
|
|
2230
|
+
return;
|
|
2231
|
+
}
|
|
2232
|
+
function* walkErrorGraph(error) {
|
|
2233
|
+
const queue = [error];
|
|
2234
|
+
const seen = new Set;
|
|
2235
|
+
for (let steps = 0;queue.length > 0 && steps < 32; steps++) {
|
|
2236
|
+
const current = queue.shift();
|
|
2237
|
+
if (current === null || typeof current !== "object")
|
|
2238
|
+
continue;
|
|
2239
|
+
if (seen.has(current))
|
|
2240
|
+
continue;
|
|
2241
|
+
seen.add(current);
|
|
2242
|
+
const cur = current;
|
|
2243
|
+
yield cur;
|
|
2237
2244
|
if (cur.cause !== undefined)
|
|
2238
2245
|
queue.push(cur.cause);
|
|
2239
2246
|
if (Array.isArray(cur.errors))
|
|
@@ -3418,6 +3425,7 @@ var CLI_ERROR_CODES = [
|
|
|
3418
3425
|
"invalid_argument",
|
|
3419
3426
|
"authentication_required",
|
|
3420
3427
|
"permission_denied",
|
|
3428
|
+
"local_permission_denied",
|
|
3421
3429
|
"not_found",
|
|
3422
3430
|
"rate_limited",
|
|
3423
3431
|
"network_error",
|
|
@@ -3458,18 +3466,31 @@ class Pagination {
|
|
|
3458
3466
|
Offset;
|
|
3459
3467
|
Total;
|
|
3460
3468
|
HasMore;
|
|
3469
|
+
NextPage;
|
|
3461
3470
|
constructor({
|
|
3462
3471
|
returned,
|
|
3463
3472
|
limit,
|
|
3464
3473
|
offset,
|
|
3465
|
-
total
|
|
3474
|
+
total,
|
|
3475
|
+
hasMore,
|
|
3476
|
+
nextPage
|
|
3466
3477
|
}) {
|
|
3467
3478
|
this.Returned = returned;
|
|
3468
3479
|
this.Limit = limit;
|
|
3469
3480
|
this.Offset = offset;
|
|
3470
3481
|
this.Total = total;
|
|
3471
|
-
this.HasMore =
|
|
3482
|
+
this.HasMore = hasMore ?? derivePaginationHasMore(returned, limit, offset, total, nextPage);
|
|
3483
|
+
this.NextPage = nextPage;
|
|
3484
|
+
}
|
|
3485
|
+
}
|
|
3486
|
+
function derivePaginationHasMore(returned, limit, offset, total, nextPage) {
|
|
3487
|
+
if (nextPage) {
|
|
3488
|
+
return true;
|
|
3489
|
+
}
|
|
3490
|
+
if (total === undefined) {
|
|
3491
|
+
return returned >= limit;
|
|
3472
3492
|
}
|
|
3493
|
+
return (offset ?? 0) + returned < total;
|
|
3473
3494
|
}
|
|
3474
3495
|
|
|
3475
3496
|
class SuccessOutput {
|
|
@@ -3874,12 +3895,16 @@ function defaultErrorCodeForHttpStatus(status) {
|
|
|
3874
3895
|
return "server_error";
|
|
3875
3896
|
return;
|
|
3876
3897
|
}
|
|
3898
|
+
var LOCAL_PERMISSION_TEXT_PATTERN = /(?:\b|\()(?:EACCES|EPERM|EROFS)(?::\s|\))/;
|
|
3877
3899
|
function defaultErrorCodeForFailure(data) {
|
|
3878
3900
|
if (data.Result === RESULTS.Failure) {
|
|
3879
3901
|
const status = data.Context?.httpStatus ?? parseHttpStatusFromMessage(data.Message);
|
|
3880
3902
|
const errorCode = defaultErrorCodeForHttpStatus(status);
|
|
3881
3903
|
if (errorCode)
|
|
3882
3904
|
return errorCode;
|
|
3905
|
+
if (status === undefined && (LOCAL_PERMISSION_TEXT_PATTERN.test(data.Message) || LOCAL_PERMISSION_TEXT_PATTERN.test(data.Instructions))) {
|
|
3906
|
+
return "local_permission_denied";
|
|
3907
|
+
}
|
|
3883
3908
|
}
|
|
3884
3909
|
return defaultErrorCodeForResult(data.Result);
|
|
3885
3910
|
}
|
|
@@ -4427,11 +4452,10 @@ function getSdkUserAgentToken(pkg) {
|
|
|
4427
4452
|
const packageName = pkg.name.replace(/^@uipath\//, "");
|
|
4428
4453
|
return getEffectiveUserAgent(`${packageName}/${pkg.version}`);
|
|
4429
4454
|
}
|
|
4430
|
-
// ../common/src/tool-provider.ts
|
|
4431
|
-
var factorySlot = singleton("PackagerFactoryProvider");
|
|
4432
|
-
var moduleSlot = singleton("ToolModuleProvider");
|
|
4433
4455
|
// ../common/src/telemetry/ship-succeeded.ts
|
|
4434
4456
|
var shippedKeysSlot = singleton("ShipSucceededDedupeKeys");
|
|
4457
|
+
// ../common/src/tool-provider.ts
|
|
4458
|
+
var factorySlot = singleton("PackagerFactoryProvider");
|
|
4435
4459
|
// ../insights-sdk/src/errors.ts
|
|
4436
4460
|
class InsightsHttpError extends Error {
|
|
4437
4461
|
status;
|
|
@@ -4473,7 +4497,7 @@ class InsightsProtocolError extends Error {
|
|
|
4473
4497
|
var package_default2 = {
|
|
4474
4498
|
name: "@uipath/insights-sdk",
|
|
4475
4499
|
license: "MIT",
|
|
4476
|
-
version: "1.201.0-preview.
|
|
4500
|
+
version: "1.201.0-preview.121",
|
|
4477
4501
|
description: "SDK for the UiPath Insights API — jobs, failures, and performance metrics.",
|
|
4478
4502
|
repository: {
|
|
4479
4503
|
type: "git",
|
|
@@ -4754,6 +4778,26 @@ async function requestInsightsRoute(config, routeKey, request = {}) {
|
|
|
4754
4778
|
}
|
|
4755
4779
|
return parsed;
|
|
4756
4780
|
}
|
|
4781
|
+
|
|
4782
|
+
// ../insights-sdk/src/alerts.ts
|
|
4783
|
+
async function listAlertDefinitions(config, request) {
|
|
4784
|
+
return requestInsightsRoute(config, "alertDefinitionsList", {
|
|
4785
|
+
body: request ?? {}
|
|
4786
|
+
});
|
|
4787
|
+
}
|
|
4788
|
+
async function listAgenticAlertDefinitions(config, processKey) {
|
|
4789
|
+
return requestInsightsRoute(config, "alertDefinitionsListAgentic", {
|
|
4790
|
+
pathParams: { processKey }
|
|
4791
|
+
});
|
|
4792
|
+
}
|
|
4793
|
+
async function getAlertDefinition(config, alertDefinitionId) {
|
|
4794
|
+
return requestInsightsRoute(config, "alertDefinitionsGet", {
|
|
4795
|
+
pathParams: { alertDefinitionId }
|
|
4796
|
+
});
|
|
4797
|
+
}
|
|
4798
|
+
async function checkAlertEntitlement(config) {
|
|
4799
|
+
return requestInsightsRoute(config, "alertDefinitionsCheckEntitlement");
|
|
4800
|
+
}
|
|
4757
4801
|
// ../insights-sdk/src/client.ts
|
|
4758
4802
|
function buildInsightsUrl(config, path) {
|
|
4759
4803
|
return `${config.baseUrl}/${config.organizationId}/${config.tenantName}/insightsrtm_/api/v1.0/InsightsJobs${path}`;
|
|
@@ -6060,6 +6104,9 @@ var getAuthContext = async (options = {}) => {
|
|
|
6060
6104
|
tenantName
|
|
6061
6105
|
};
|
|
6062
6106
|
};
|
|
6107
|
+
// ../auth/src/tenantSelection.ts
|
|
6108
|
+
var IDENTIFIER_STATUSES = new Set([400, 403, 404]);
|
|
6109
|
+
|
|
6063
6110
|
// ../auth/src/selectTenant.ts
|
|
6064
6111
|
var TENANT_SELECTION_REQUIRED_CODE = "TENANT_SELECTION_REQUIRED";
|
|
6065
6112
|
var INVALID_TENANT_CODE = "INVALID_TENANT";
|
|
@@ -6162,58 +6209,15 @@ function fail(message, instructions) {
|
|
|
6162
6209
|
});
|
|
6163
6210
|
processContext.exit(1);
|
|
6164
6211
|
}
|
|
6165
|
-
|
|
6166
|
-
|
|
6167
|
-
|
|
6168
|
-
|
|
6169
|
-
|
|
6170
|
-
|
|
6171
|
-
function overPagedNote(total) {
|
|
6172
|
-
return `The requested --offset is past the last row: ${total} rows exist in the backend's fixed 30-day activity window. Lower --offset to see them.`;
|
|
6173
|
-
}
|
|
6174
|
-
function listInstructions(total, pageLength, hasMore) {
|
|
6175
|
-
if (total === 0) {
|
|
6176
|
-
return EMPTY_RESULT_NOTE;
|
|
6177
|
-
}
|
|
6178
|
-
if (pageLength === 0) {
|
|
6179
|
-
return overPagedNote(total);
|
|
6180
|
-
}
|
|
6181
|
-
return hasMore ? `${FIXED_WINDOW_NOTE} ${TRUNCATED_NOTE}` : FIXED_WINDOW_NOTE;
|
|
6212
|
+
function failValidation(message, instructions) {
|
|
6213
|
+
OutputFormatter.error({
|
|
6214
|
+
Result: RESULTS.ValidationError,
|
|
6215
|
+
Message: message,
|
|
6216
|
+
Instructions: instructions
|
|
6217
|
+
});
|
|
6182
6218
|
}
|
|
6183
6219
|
|
|
6184
|
-
|
|
6185
|
-
constructor(message) {
|
|
6186
|
-
super(message);
|
|
6187
|
-
this.name = "FilterContractError";
|
|
6188
|
-
}
|
|
6189
|
-
}
|
|
6190
|
-
function addFilterListOptions(cmd) {
|
|
6191
|
-
return cmd.option("-l, --limit <number>", "Maximum rows to return", parseLimit, DEFAULT_LIMIT).option("-o, --offset <number>", "Rows to skip before returning results", parseOffset);
|
|
6192
|
-
}
|
|
6193
|
-
function pairFilterRows(input, toRow) {
|
|
6194
|
-
const left = input.left ?? [];
|
|
6195
|
-
const right = input.right ?? [];
|
|
6196
|
-
if (left.length !== right.length) {
|
|
6197
|
-
throw new FilterContractError(`Insights returned misaligned filter arrays: ${input.leftField} has ${left.length} entries but ${input.rightField} has ${right.length}`);
|
|
6198
|
-
}
|
|
6199
|
-
return left.map((value, index) => toRow(value, right[index]));
|
|
6200
|
-
}
|
|
6201
|
-
function dedupeAndSortRows(rows) {
|
|
6202
|
-
const byKey = new Map;
|
|
6203
|
-
for (const row of rows) {
|
|
6204
|
-
const key = JSON.stringify(row);
|
|
6205
|
-
if (!byKey.has(key)) {
|
|
6206
|
-
byKey.set(key, row);
|
|
6207
|
-
}
|
|
6208
|
-
}
|
|
6209
|
-
return [...byKey.entries()].sort(([a], [b]) => compareRowKeys(a, b)).map(([, row]) => row);
|
|
6210
|
-
}
|
|
6211
|
-
function compareRowKeys(a, b) {
|
|
6212
|
-
if (a === b) {
|
|
6213
|
-
return 0;
|
|
6214
|
-
}
|
|
6215
|
-
return a < b ? -1 : 1;
|
|
6216
|
-
}
|
|
6220
|
+
// src/utils/errors.ts
|
|
6217
6221
|
function isEnvAuthConfigError(error) {
|
|
6218
6222
|
return error.name === "EnvAuthConfigError";
|
|
6219
6223
|
}
|
|
@@ -6241,25 +6245,56 @@ function writeConfigError(error) {
|
|
|
6241
6245
|
OutputFormatter.error({
|
|
6242
6246
|
Result: RESULTS.AuthenticationError,
|
|
6243
6247
|
Message: error.message,
|
|
6244
|
-
Instructions: "Run 'uip login' to authenticate first."
|
|
6248
|
+
Instructions: "Run 'uip login' to authenticate first. If the message says a tenant must be selected, run 'uip login tenant set' instead."
|
|
6245
6249
|
});
|
|
6246
6250
|
processContext.exit(EXIT_CODES.AuthenticationError);
|
|
6247
6251
|
}
|
|
6252
|
+
async function resolveInsightsConfig() {
|
|
6253
|
+
const [configError, config] = await catchError2(createInsightsConfig());
|
|
6254
|
+
if (configError) {
|
|
6255
|
+
writeConfigError(configError);
|
|
6256
|
+
return null;
|
|
6257
|
+
}
|
|
6258
|
+
return config;
|
|
6259
|
+
}
|
|
6260
|
+
function ensureFailureExit() {
|
|
6261
|
+
if (!process.exitCode) {
|
|
6262
|
+
processContext.exit(EXIT_CODES.Failure);
|
|
6263
|
+
}
|
|
6264
|
+
}
|
|
6248
6265
|
function httpErrorContext(error) {
|
|
6249
6266
|
return {
|
|
6250
6267
|
httpStatus: error.status,
|
|
6251
6268
|
endpoint: error.endpoint,
|
|
6252
|
-
...error.requestId ? { requestId: error.requestId } : {},
|
|
6269
|
+
...error.requestId !== undefined ? { requestId: error.requestId } : {},
|
|
6253
6270
|
...error.retryAfterSeconds !== undefined ? { retryAfter: error.retryAfterSeconds } : {}
|
|
6254
6271
|
};
|
|
6255
6272
|
}
|
|
6256
|
-
function
|
|
6273
|
+
function forbiddenInstructions(family) {
|
|
6274
|
+
return [
|
|
6275
|
+
"Check the active tenant and your Insights access.",
|
|
6276
|
+
...family.forbiddenExtra === "" ? [] : [family.forbiddenExtra],
|
|
6277
|
+
"Do not retry until access or tenant context changes."
|
|
6278
|
+
].join(" ");
|
|
6279
|
+
}
|
|
6280
|
+
function writeInsightsNotFound(error, message, instructions) {
|
|
6281
|
+
OutputFormatter.error({
|
|
6282
|
+
Result: RESULTS.Failure,
|
|
6283
|
+
ErrorCode: "not_found",
|
|
6284
|
+
Retry: "RetryWillNotFix",
|
|
6285
|
+
Message: message,
|
|
6286
|
+
Instructions: instructions,
|
|
6287
|
+
Context: httpErrorContext(error)
|
|
6288
|
+
});
|
|
6289
|
+
processContext.exit(EXIT_CODES.Failure);
|
|
6290
|
+
}
|
|
6291
|
+
function writeInsightsError(error, family) {
|
|
6257
6292
|
if (error instanceof InsightsHttpError) {
|
|
6258
6293
|
const context = httpErrorContext(error);
|
|
6259
6294
|
if (error.status === 401) {
|
|
6260
6295
|
OutputFormatter.error({
|
|
6261
6296
|
Result: RESULTS.AuthenticationError,
|
|
6262
|
-
Message:
|
|
6297
|
+
Message: `The Insights ${family.subject} request was not authenticated.`,
|
|
6263
6298
|
Instructions: "Run 'uip login', select the intended tenant, and try again.",
|
|
6264
6299
|
Context: context
|
|
6265
6300
|
});
|
|
@@ -6270,8 +6305,8 @@ function writeFilterError(error) {
|
|
|
6270
6305
|
OutputFormatter.error({
|
|
6271
6306
|
Result: RESULTS.Failure,
|
|
6272
6307
|
ErrorCode: "permission_denied",
|
|
6273
|
-
Message:
|
|
6274
|
-
Instructions:
|
|
6308
|
+
Message: `You cannot read Insights ${family.subject}s in the current tenant.`,
|
|
6309
|
+
Instructions: forbiddenInstructions(family),
|
|
6275
6310
|
Context: context
|
|
6276
6311
|
});
|
|
6277
6312
|
processContext.exit(EXIT_CODES.Failure);
|
|
@@ -6281,7 +6316,7 @@ function writeFilterError(error) {
|
|
|
6281
6316
|
OutputFormatter.error({
|
|
6282
6317
|
Result: RESULTS.Failure,
|
|
6283
6318
|
ErrorCode: "rate_limited",
|
|
6284
|
-
Message:
|
|
6319
|
+
Message: `Insights rate-limited the ${family.subject} request.`,
|
|
6285
6320
|
Instructions: error.retryAfterSeconds !== undefined ? `The service reported a rate-limit window of ${error.retryAfterSeconds} seconds. No automatic retry was made.` : "The service rate-limited the request. No automatic retry was made.",
|
|
6286
6321
|
Retry: "RetryLater",
|
|
6287
6322
|
Context: context
|
|
@@ -6302,29 +6337,42 @@ function writeFilterError(error) {
|
|
|
6302
6337
|
writeNetworkFailure(error, describeConnectivityError(error), error.endpoint);
|
|
6303
6338
|
return;
|
|
6304
6339
|
}
|
|
6305
|
-
if (error instanceof InsightsProtocolError || error
|
|
6340
|
+
if (error instanceof InsightsProtocolError || family.isContractError(error)) {
|
|
6306
6341
|
fail(error.message, "Retrying cannot fix a malformed response. Report the endpoint to the Insights owner if it repeats.");
|
|
6307
6342
|
return;
|
|
6308
6343
|
}
|
|
6309
6344
|
fail(error.message, "Check your authentication, tenant, and network, then try again.");
|
|
6310
6345
|
}
|
|
6311
|
-
|
|
6312
|
-
|
|
6313
|
-
|
|
6314
|
-
|
|
6346
|
+
|
|
6347
|
+
// src/utils/list-executor.ts
|
|
6348
|
+
function truncatedNote(nounPhrase) {
|
|
6349
|
+
return `More rows exist beyond this page; page with --offset or raise --limit before concluding ${nounPhrase} is absent.`;
|
|
6350
|
+
}
|
|
6351
|
+
function overPagedNote(total, scope = "") {
|
|
6352
|
+
return `The requested --offset is past the last row: ${total} rows exist${scope}. Lower --offset to see them.`;
|
|
6353
|
+
}
|
|
6354
|
+
function compareRowKeys(a, b) {
|
|
6355
|
+
if (a === b) {
|
|
6356
|
+
return 0;
|
|
6357
|
+
}
|
|
6358
|
+
return a < b ? -1 : 1;
|
|
6359
|
+
}
|
|
6360
|
+
async function executeInsightsList(options, fetchList, spec) {
|
|
6361
|
+
const config = await resolveInsightsConfig();
|
|
6362
|
+
if (config === null) {
|
|
6315
6363
|
return;
|
|
6316
6364
|
}
|
|
6317
6365
|
const [requestError, response] = await catchError2(fetchList(config));
|
|
6318
6366
|
if (requestError) {
|
|
6319
|
-
|
|
6367
|
+
writeInsightsError(requestError, spec.family);
|
|
6320
6368
|
return;
|
|
6321
6369
|
}
|
|
6322
|
-
const [contractError,
|
|
6370
|
+
const [contractError, projected] = catchError2(() => spec.project(response));
|
|
6323
6371
|
if (contractError) {
|
|
6324
|
-
|
|
6372
|
+
writeInsightsError(contractError, spec.family);
|
|
6325
6373
|
return;
|
|
6326
6374
|
}
|
|
6327
|
-
const rows =
|
|
6375
|
+
const rows = spec.finalize ? spec.finalize(projected) : projected;
|
|
6328
6376
|
const offset = options.offset ?? 0;
|
|
6329
6377
|
const page = rows.slice(offset, offset + options.limit);
|
|
6330
6378
|
const pagination = new Pagination({
|
|
@@ -6335,10 +6383,381 @@ async function executeFilterList(options, fetchList, toRows, code) {
|
|
|
6335
6383
|
});
|
|
6336
6384
|
OutputFormatter.success({
|
|
6337
6385
|
Result: RESULTS.Success,
|
|
6338
|
-
Code: code,
|
|
6386
|
+
Code: spec.code,
|
|
6339
6387
|
Data: page,
|
|
6340
6388
|
Pagination: pagination,
|
|
6341
|
-
Instructions:
|
|
6389
|
+
Instructions: spec.instructions(rows, page, pagination.HasMore)
|
|
6390
|
+
});
|
|
6391
|
+
}
|
|
6392
|
+
async function executeInsightsGet(fetchOne, spec) {
|
|
6393
|
+
const config = await resolveInsightsConfig();
|
|
6394
|
+
if (config === null) {
|
|
6395
|
+
return;
|
|
6396
|
+
}
|
|
6397
|
+
const [requestError, response] = await catchError2(fetchOne(config));
|
|
6398
|
+
if (requestError) {
|
|
6399
|
+
if (requestError instanceof InsightsHttpError && spec.onHttpError?.(requestError)) {
|
|
6400
|
+
ensureFailureExit();
|
|
6401
|
+
return;
|
|
6402
|
+
}
|
|
6403
|
+
writeInsightsError(requestError, spec.family);
|
|
6404
|
+
return;
|
|
6405
|
+
}
|
|
6406
|
+
const [contractError, data] = catchError2(() => spec.project(response, config));
|
|
6407
|
+
if (contractError) {
|
|
6408
|
+
writeInsightsError(contractError, spec.family);
|
|
6409
|
+
return;
|
|
6410
|
+
}
|
|
6411
|
+
OutputFormatter.success({
|
|
6412
|
+
Result: RESULTS.Success,
|
|
6413
|
+
Code: spec.code,
|
|
6414
|
+
Data: data,
|
|
6415
|
+
Instructions: spec.instructions(data)
|
|
6416
|
+
});
|
|
6417
|
+
}
|
|
6418
|
+
|
|
6419
|
+
// src/utils/records.ts
|
|
6420
|
+
function isRecord2(value) {
|
|
6421
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6422
|
+
}
|
|
6423
|
+
function asRecord(value) {
|
|
6424
|
+
return isRecord2(value) ? value : null;
|
|
6425
|
+
}
|
|
6426
|
+
|
|
6427
|
+
// src/utils/alerts.ts
|
|
6428
|
+
class AlertContractError extends Error {
|
|
6429
|
+
constructor(message) {
|
|
6430
|
+
super(message);
|
|
6431
|
+
this.name = "AlertContractError";
|
|
6432
|
+
}
|
|
6433
|
+
}
|
|
6434
|
+
var ALERTS_FAMILY = {
|
|
6435
|
+
subject: "Alert",
|
|
6436
|
+
forbiddenExtra: "A 403 here usually means the caller's Orchestrator folder access could not be resolved rather than an entitlement problem, so check the active tenant and your folder permissions first. 'uip insights alerts check-entitlement' reports entitlement separately.",
|
|
6437
|
+
isContractError: (error) => error instanceof AlertContractError
|
|
6438
|
+
};
|
|
6439
|
+
var MAX_INT32 = 2147483647;
|
|
6440
|
+
function parseRouteId(raw, label) {
|
|
6441
|
+
return parseBoundedInt(raw, label, { min: 1, max: MAX_INT32 });
|
|
6442
|
+
}
|
|
6443
|
+
function pickScalar(value) {
|
|
6444
|
+
if (value === undefined || value === null) {
|
|
6445
|
+
return null;
|
|
6446
|
+
}
|
|
6447
|
+
const kind = typeof value;
|
|
6448
|
+
if (kind === "string" || kind === "number" || kind === "boolean") {
|
|
6449
|
+
return value;
|
|
6450
|
+
}
|
|
6451
|
+
return null;
|
|
6452
|
+
}
|
|
6453
|
+
var ENGINE_NAMES = { 0: "curated", 1: "query" };
|
|
6454
|
+
var SIDE_EFFECT_NOTE = "This command also runs an entitlement and permission check that can bootstrap Insights permissions and queue a warehouse warmup, so it is not a free read.";
|
|
6455
|
+
var ENTITLEMENT_SIDE_EFFECT_NOTE = "Running this check can bootstrap Insights permissions and queue a warehouse warmup, so it is not a free read.";
|
|
6456
|
+
var ENTITLEMENT_UNKNOWN_CLAUSE = "This result does not show whether the tenant is entitled to Insights alerts.";
|
|
6457
|
+
var ENTITLEMENT_FILTER_CLAUSE = "When the tenant is not entitled, the backend silently returns only alerts tied to a process key.";
|
|
6458
|
+
var ACTIVE_ONLY_NOTE = "Only active alert definitions are returned.";
|
|
6459
|
+
var FOLDER_NAMES_NOTE = "Folder scopes on this command may be folder names, and folders you cannot see appear as N/A. The backend rewrites only the first folder scope it finds, so a second or nested one stays a folder key. A scope covering several folders arrives as one bracketed string rather than one value per folder, so do not count Values to count folders. Use 'alerts get' for folder keys, one value per folder.";
|
|
6460
|
+
var FOLDER_KEYS_NOTE = "Folder scopes on this command are folder keys, one value per folder. They are shown as folder names on 'alerts list' without --agentic.";
|
|
6461
|
+
var EMPTY_LIST_NOTE = `No alert definitions were returned. ${ENTITLEMENT_UNKNOWN_CLAUSE} ${ENTITLEMENT_FILTER_CLAUSE} Run 'uip insights alerts check-entitlement' before concluding that no alerts exist. ${ACTIVE_ONLY_NOTE}`;
|
|
6462
|
+
var EMPTY_AGENTIC_NOTE = "No active alert definitions match this process key in the current tenant. The backend matches the key exactly, so a wrong or mistyped key returns the same empty result as real absence. Inactive alerts and alerts for other process keys are not returned by this route.";
|
|
6463
|
+
var ENTITLEMENT_UNCONFIRMED_NOTE = `${ENTITLEMENT_UNKNOWN_CLAUSE} ${ENTITLEMENT_FILTER_CLAUSE} Run 'uip insights alerts check-entitlement' before concluding this list is complete.`;
|
|
6464
|
+
var ENGINE_QUERY_EMPTY_FIELDS = "Metric, MetricState, Operator, Threshold, and WindowSeconds do not apply and are null, and Scopes is empty";
|
|
6465
|
+
var ENGINE_QUERY_PAGE_NOTE = `One or more alerts on this page are scheduled query alerts. Their condition is a stored query. ConditionVisible says whether a readable form exists, and Condition is present only when it does. ${ENGINE_QUERY_EMPTY_FIELDS}. Use the Insights UI to see or change the query.`;
|
|
6466
|
+
var ENGINE_QUERY_ROW_NOTE = `This alert is a scheduled query alert. Its condition is a stored query. ConditionVisible says whether a readable form exists, and Condition is present only when it does. ${ENGINE_QUERY_EMPTY_FIELDS}. Use the Insights UI to see or change the query.`;
|
|
6467
|
+
var ENGINE_UNKNOWN_NOTE = "One or more alerts report an alert engine this CLI does not recognize, shown as the raw Engine value. The typed condition fields may not apply to them. Use the Insights UI to see those alerts.";
|
|
6468
|
+
var AGENTIC_BASE_NOTE = `Only active alert definitions tied to this process key are returned. ${FOLDER_KEYS_NOTE}`;
|
|
6469
|
+
var ENTITLED_TRUE_NOTE = "True means the organization holds the Insights full-mode entitlement and the current caller passed the Insights admin check. While this is true, 'alerts list' and 'alerts get' are not entitlement-filtered, so an earlier partial-result warning from those commands does not apply. They still return only active alert definitions.";
|
|
6470
|
+
var ENTITLED_FALSE_NOTE = "False means at least one of three things: the organization has no Insights full-mode entitlement, the caller is not an Insights admin, or the Insights portal service is unreachable in this tenant. The backend does not say which. While this is false, 'alerts list' and 'alerts get' return only alerts tied to a process key. The agentic list is unaffected.";
|
|
6471
|
+
var DEFINITION_NOT_FOUND_INSTRUCTIONS = `A 404 can mean the ID does not exist, the alert is inactive, or the alert was filtered out because the tenant is not entitled to Insights alerts. ${ENTITLEMENT_FILTER_CLAUSE} 'uip insights alerts list' applies the same filter, so an ID missing there is not proof it does not exist. Run 'uip insights alerts check-entitlement' first. Both of those commands also run the entitlement and permission check, so neither is a free read.`;
|
|
6472
|
+
function parseScopeValues(value) {
|
|
6473
|
+
if (value === undefined || value === null) {
|
|
6474
|
+
return [];
|
|
6475
|
+
}
|
|
6476
|
+
if (typeof value !== "string") {
|
|
6477
|
+
return (Array.isArray(value) ? value : [value]).map(pickScalar);
|
|
6478
|
+
}
|
|
6479
|
+
const [parseError, parsed] = catchError2(() => JSON.parse(value));
|
|
6480
|
+
if (!parseError && Array.isArray(parsed)) {
|
|
6481
|
+
return parsed.map(pickScalar);
|
|
6482
|
+
}
|
|
6483
|
+
return [pickScalar(value)];
|
|
6484
|
+
}
|
|
6485
|
+
function collectScopes(raw, out) {
|
|
6486
|
+
const entry = asRecord(raw);
|
|
6487
|
+
if (!entry) {
|
|
6488
|
+
return;
|
|
6489
|
+
}
|
|
6490
|
+
if (Array.isArray(entry.subFilters)) {
|
|
6491
|
+
for (const nested of entry.subFilters) {
|
|
6492
|
+
collectScopes(nested, out);
|
|
6493
|
+
}
|
|
6494
|
+
return;
|
|
6495
|
+
}
|
|
6496
|
+
out.push({
|
|
6497
|
+
field: pickScalar(entry.fieldName),
|
|
6498
|
+
values: parseScopeValues(entry.value)
|
|
6499
|
+
});
|
|
6500
|
+
}
|
|
6501
|
+
function projectScopes(rawFilter) {
|
|
6502
|
+
const filter = asRecord(rawFilter);
|
|
6503
|
+
const scopes = [];
|
|
6504
|
+
if (filter && Array.isArray(filter.subFilters)) {
|
|
6505
|
+
for (const entry of filter.subFilters) {
|
|
6506
|
+
collectScopes(entry, scopes);
|
|
6507
|
+
}
|
|
6508
|
+
}
|
|
6509
|
+
return scopes;
|
|
6510
|
+
}
|
|
6511
|
+
function extractCondition(dto) {
|
|
6512
|
+
const queryJson = asRecord(dto.queryJson);
|
|
6513
|
+
const mappings = queryJson && asRecord(queryJson.idToDisplayNameMappings);
|
|
6514
|
+
if (!queryJson || !mappings) {
|
|
6515
|
+
return null;
|
|
6516
|
+
}
|
|
6517
|
+
const metrics = Array.isArray(queryJson.aggregates) ? queryJson.aggregates : [];
|
|
6518
|
+
for (const metric of metrics) {
|
|
6519
|
+
const id = typeof metric === "string" ? metric : asRecord(metric)?.id;
|
|
6520
|
+
if (typeof id !== "string") {
|
|
6521
|
+
continue;
|
|
6522
|
+
}
|
|
6523
|
+
const mapped = mappings[id];
|
|
6524
|
+
if (typeof mapped === "string" && mapped.trim() !== "") {
|
|
6525
|
+
return mapped;
|
|
6526
|
+
}
|
|
6527
|
+
}
|
|
6528
|
+
return null;
|
|
6529
|
+
}
|
|
6530
|
+
function projectEngine(engine) {
|
|
6531
|
+
if (engine === null) {
|
|
6532
|
+
return null;
|
|
6533
|
+
}
|
|
6534
|
+
return ENGINE_NAMES[engine] ?? engine;
|
|
6535
|
+
}
|
|
6536
|
+
function projectAlertDefinition(raw) {
|
|
6537
|
+
const dto = asRecord(raw);
|
|
6538
|
+
if (!dto) {
|
|
6539
|
+
throw new AlertContractError("Insights returned an alert definition that is not an object");
|
|
6540
|
+
}
|
|
6541
|
+
const engine = typeof dto.engineType === "number" ? dto.engineType : null;
|
|
6542
|
+
const computation = asRecord(dto.computation);
|
|
6543
|
+
const trigger = asRecord(dto.trigger);
|
|
6544
|
+
const window = asRecord(dto.window);
|
|
6545
|
+
const row = {
|
|
6546
|
+
id: pickScalar(dto.id),
|
|
6547
|
+
name: pickScalar(dto.alertName),
|
|
6548
|
+
severity: pickScalar(dto.severity),
|
|
6549
|
+
isActive: pickScalar(dto.isActive),
|
|
6550
|
+
engine: projectEngine(engine),
|
|
6551
|
+
metric: pickScalar(computation?.computation),
|
|
6552
|
+
metricState: pickScalar(computation?.filterValue),
|
|
6553
|
+
operator: pickScalar(trigger?.type),
|
|
6554
|
+
threshold: pickScalar(trigger?.value),
|
|
6555
|
+
windowSeconds: pickScalar(window?.windowSizeSec),
|
|
6556
|
+
deliveryId: pickScalar(dto.deliveryId),
|
|
6557
|
+
autoSnoozeSeconds: pickScalar(dto.autoSnoozeTimeInterval),
|
|
6558
|
+
snoozedUntil: pickScalar(dto.endDeliveryPauseTime),
|
|
6559
|
+
lastTriggeredAt: pickScalar(dto.lastTriggerTime),
|
|
6560
|
+
processKey: pickScalar(dto.processKey),
|
|
6561
|
+
folderKey: pickScalar(dto.folderKey),
|
|
6562
|
+
projectKey: pickScalar(dto.projectKey),
|
|
6563
|
+
processVersion: pickScalar(dto.processVersion),
|
|
6564
|
+
scopes: projectScopes(dto.filter)
|
|
6565
|
+
};
|
|
6566
|
+
if (engine === 1) {
|
|
6567
|
+
const condition = extractCondition(dto);
|
|
6568
|
+
row.conditionVisible = condition !== null;
|
|
6569
|
+
if (condition !== null) {
|
|
6570
|
+
row.condition = condition;
|
|
6571
|
+
}
|
|
6572
|
+
}
|
|
6573
|
+
return row;
|
|
6574
|
+
}
|
|
6575
|
+
function projectDefinitionRows(response) {
|
|
6576
|
+
if (!Array.isArray(response)) {
|
|
6577
|
+
throw new AlertContractError("Insights returned an alert definition list that is not an array");
|
|
6578
|
+
}
|
|
6579
|
+
return response.map(projectAlertDefinition);
|
|
6580
|
+
}
|
|
6581
|
+
function compareDefinitionRows(a, b) {
|
|
6582
|
+
if (typeof a.id === "number" && typeof b.id === "number" && a.id !== b.id) {
|
|
6583
|
+
return a.id - b.id;
|
|
6584
|
+
}
|
|
6585
|
+
return compareRowKeys(JSON.stringify(a), JSON.stringify(b));
|
|
6586
|
+
}
|
|
6587
|
+
function countCaveats(variant, rows) {
|
|
6588
|
+
const parts = [ACTIVE_ONLY_NOTE];
|
|
6589
|
+
if (variant === "all" && !rows.some((row) => row.processKey === null)) {
|
|
6590
|
+
parts.push(ENTITLEMENT_UNCONFIRMED_NOTE);
|
|
6591
|
+
}
|
|
6592
|
+
return parts;
|
|
6593
|
+
}
|
|
6594
|
+
function pageDisclosures(variant, rows, page) {
|
|
6595
|
+
const parts = variant === "all" ? [...countCaveats(variant, rows), FOLDER_NAMES_NOTE] : [AGENTIC_BASE_NOTE];
|
|
6596
|
+
if (page.some((row) => row.engine === "query")) {
|
|
6597
|
+
parts.push(ENGINE_QUERY_PAGE_NOTE);
|
|
6598
|
+
}
|
|
6599
|
+
if (page.some((row) => typeof row.engine === "number")) {
|
|
6600
|
+
parts.push(ENGINE_UNKNOWN_NOTE);
|
|
6601
|
+
}
|
|
6602
|
+
return parts;
|
|
6603
|
+
}
|
|
6604
|
+
function buildListInstructions(variant, rows, page, hasMore) {
|
|
6605
|
+
const parts = [];
|
|
6606
|
+
if (rows.length === 0) {
|
|
6607
|
+
parts.push(variant === "all" ? EMPTY_LIST_NOTE : EMPTY_AGENTIC_NOTE);
|
|
6608
|
+
} else if (page.length === 0) {
|
|
6609
|
+
parts.push(overPagedNote(rows.length), ...countCaveats(variant, rows));
|
|
6610
|
+
} else {
|
|
6611
|
+
parts.push(...pageDisclosures(variant, rows, page));
|
|
6612
|
+
if (hasMore) {
|
|
6613
|
+
parts.push(truncatedNote("an alert"));
|
|
6614
|
+
}
|
|
6615
|
+
}
|
|
6616
|
+
if (variant === "all") {
|
|
6617
|
+
parts.push(SIDE_EFFECT_NOTE);
|
|
6618
|
+
}
|
|
6619
|
+
return parts.join(" ");
|
|
6620
|
+
}
|
|
6621
|
+
async function executeAlertsList(options, fetchList, variant) {
|
|
6622
|
+
await executeInsightsList(options, fetchList, {
|
|
6623
|
+
code: "InsightsAlertsList",
|
|
6624
|
+
family: ALERTS_FAMILY,
|
|
6625
|
+
project: projectDefinitionRows,
|
|
6626
|
+
finalize: (rows) => [...rows].sort(compareDefinitionRows),
|
|
6627
|
+
instructions: (rows, page, hasMore) => buildListInstructions(variant, rows, page, hasMore)
|
|
6628
|
+
});
|
|
6629
|
+
}
|
|
6630
|
+
function buildGetInstructions(row) {
|
|
6631
|
+
const parts = [ACTIVE_ONLY_NOTE, FOLDER_KEYS_NOTE];
|
|
6632
|
+
if (row.engine === "query") {
|
|
6633
|
+
parts.push(ENGINE_QUERY_ROW_NOTE);
|
|
6634
|
+
}
|
|
6635
|
+
if (typeof row.engine === "number") {
|
|
6636
|
+
parts.push(ENGINE_UNKNOWN_NOTE);
|
|
6637
|
+
}
|
|
6638
|
+
parts.push(SIDE_EFFECT_NOTE);
|
|
6639
|
+
return parts.join(" ");
|
|
6640
|
+
}
|
|
6641
|
+
async function executeAlertGet(alertId) {
|
|
6642
|
+
await executeInsightsGet((config) => getAlertDefinition(config, alertId), {
|
|
6643
|
+
code: "InsightsAlertGet",
|
|
6644
|
+
family: ALERTS_FAMILY,
|
|
6645
|
+
project: (response) => projectAlertDefinition(response),
|
|
6646
|
+
instructions: buildGetInstructions,
|
|
6647
|
+
onHttpError: (error) => {
|
|
6648
|
+
if (error.status !== 404) {
|
|
6649
|
+
return false;
|
|
6650
|
+
}
|
|
6651
|
+
writeInsightsNotFound(error, `Alert definition ${alertId} was not found in the current tenant.`, DEFINITION_NOT_FOUND_INSTRUCTIONS);
|
|
6652
|
+
return true;
|
|
6653
|
+
}
|
|
6654
|
+
});
|
|
6655
|
+
}
|
|
6656
|
+
async function executeCheckEntitlement() {
|
|
6657
|
+
const config = await resolveInsightsConfig();
|
|
6658
|
+
if (config === null) {
|
|
6659
|
+
return;
|
|
6660
|
+
}
|
|
6661
|
+
const [requestError, response] = await catchError2(checkAlertEntitlement(config));
|
|
6662
|
+
if (requestError) {
|
|
6663
|
+
writeInsightsError(requestError, ALERTS_FAMILY);
|
|
6664
|
+
return;
|
|
6665
|
+
}
|
|
6666
|
+
if (typeof response !== "boolean") {
|
|
6667
|
+
writeInsightsError(new AlertContractError("Insights returned an entitlement response that is not a boolean"), ALERTS_FAMILY);
|
|
6668
|
+
return;
|
|
6669
|
+
}
|
|
6670
|
+
OutputFormatter.success({
|
|
6671
|
+
Result: RESULTS.Success,
|
|
6672
|
+
Code: "InsightsAlertEntitlement",
|
|
6673
|
+
Data: { entitled: response },
|
|
6674
|
+
Instructions: `${response ? ENTITLED_TRUE_NOTE : ENTITLED_FALSE_NOTE} ${ENTITLEMENT_SIDE_EFFECT_NOTE}`
|
|
6675
|
+
});
|
|
6676
|
+
}
|
|
6677
|
+
|
|
6678
|
+
// src/utils/list-options.ts
|
|
6679
|
+
var DEFAULT_LIMIT = 50;
|
|
6680
|
+
function addListPaginationOptions(cmd) {
|
|
6681
|
+
return cmd.option("-l, --limit <number>", "Maximum rows to return", parseLimit, DEFAULT_LIMIT).option("-o, --offset <number>", "Rows to skip before returning results", parseOffset);
|
|
6682
|
+
}
|
|
6683
|
+
|
|
6684
|
+
// src/commands/alerts.ts
|
|
6685
|
+
function parseAlertId(raw) {
|
|
6686
|
+
return parseRouteId(raw, "<alert-id>");
|
|
6687
|
+
}
|
|
6688
|
+
function registerAlertsCommand(program2) {
|
|
6689
|
+
const alertsCmd = program2.command("alerts").description("Read UiPath Insights real-time alert definitions");
|
|
6690
|
+
addListPaginationOptions(alertsCmd.command("list").description("List alert definitions visible to the current caller; with --agentic, the definitions for one process key").option("--agentic", "Use the agentic route, scoped to one process key").option("--process-key <key>", "Process key to scope the agentic list to (required with --agentic)")).trackedAction(processContext, async (options) => {
|
|
6691
|
+
if (options.agentic) {
|
|
6692
|
+
const key = options.processKey?.trim() ?? "";
|
|
6693
|
+
if (key === "") {
|
|
6694
|
+
return failValidation("Missing required field: --process-key.", "Pass the Maestro or agent process key you are investigating. Filter discovery does not supply this key.");
|
|
6695
|
+
}
|
|
6696
|
+
return executeAlertsList(options, (config) => listAgenticAlertDefinitions(config, key), "agentic");
|
|
6697
|
+
}
|
|
6698
|
+
if (options.processKey !== undefined) {
|
|
6699
|
+
return failValidation("--process-key requires --agentic.", "Pass both flags to use the agentic route, or neither to list all visible definitions.");
|
|
6700
|
+
}
|
|
6701
|
+
return executeAlertsList(options, (config) => listAlertDefinitions(config, {}), "all");
|
|
6702
|
+
});
|
|
6703
|
+
alertsCmd.command("get").description("Get one alert definition by its integer ID").argument("<alert-id>", "Alert definition ID (integer)", parseAlertId).trackedAction(processContext, async (alertId) => {
|
|
6704
|
+
await executeAlertGet(String(alertId));
|
|
6705
|
+
});
|
|
6706
|
+
alertsCmd.command("check-entitlement").description("Check whether this tenant is confirmed entitled to Insights alerts").trackedAction(processContext, async () => {
|
|
6707
|
+
await executeCheckEntitlement();
|
|
6708
|
+
});
|
|
6709
|
+
}
|
|
6710
|
+
|
|
6711
|
+
// src/utils/filters.ts
|
|
6712
|
+
var FIXED_WINDOW_NOTE = "Results cover resources with Insights activity in the backend's fixed 30-day window that are visible to the current caller.";
|
|
6713
|
+
var EMPTY_RESULT_NOTE = "No rows were found in the backend's fixed 30-day activity window for the current caller. That is not proof the resource does not exist.";
|
|
6714
|
+
var OVER_PAGED_SCOPE = " in the backend's fixed 30-day activity window";
|
|
6715
|
+
function listInstructions(total, pageLength, hasMore) {
|
|
6716
|
+
if (total === 0) {
|
|
6717
|
+
return EMPTY_RESULT_NOTE;
|
|
6718
|
+
}
|
|
6719
|
+
if (pageLength === 0) {
|
|
6720
|
+
return overPagedNote(total, OVER_PAGED_SCOPE);
|
|
6721
|
+
}
|
|
6722
|
+
return hasMore ? `${FIXED_WINDOW_NOTE} ${truncatedNote("a resource")}` : FIXED_WINDOW_NOTE;
|
|
6723
|
+
}
|
|
6724
|
+
|
|
6725
|
+
class FilterContractError extends Error {
|
|
6726
|
+
constructor(message) {
|
|
6727
|
+
super(message);
|
|
6728
|
+
this.name = "FilterContractError";
|
|
6729
|
+
}
|
|
6730
|
+
}
|
|
6731
|
+
var FILTERS_FAMILY = {
|
|
6732
|
+
subject: "Filter",
|
|
6733
|
+
forbiddenExtra: "",
|
|
6734
|
+
isContractError: (error) => error instanceof FilterContractError
|
|
6735
|
+
};
|
|
6736
|
+
function pairFilterRows(input, toRow) {
|
|
6737
|
+
const left = input.left ?? [];
|
|
6738
|
+
const right = input.right ?? [];
|
|
6739
|
+
if (left.length !== right.length) {
|
|
6740
|
+
throw new FilterContractError(`Insights returned misaligned filter arrays: ${input.leftField} has ${left.length} entries but ${input.rightField} has ${right.length}`);
|
|
6741
|
+
}
|
|
6742
|
+
return left.map((value, index) => toRow(value, right[index]));
|
|
6743
|
+
}
|
|
6744
|
+
function dedupeAndSortRows(rows) {
|
|
6745
|
+
const byKey = new Map;
|
|
6746
|
+
for (const row of rows) {
|
|
6747
|
+
const key = JSON.stringify(row);
|
|
6748
|
+
if (!byKey.has(key)) {
|
|
6749
|
+
byKey.set(key, row);
|
|
6750
|
+
}
|
|
6751
|
+
}
|
|
6752
|
+
return [...byKey.entries()].sort(([a], [b]) => compareRowKeys(a, b)).map(([, row]) => row);
|
|
6753
|
+
}
|
|
6754
|
+
async function executeFilterList(options, fetchList, toRows, code) {
|
|
6755
|
+
await executeInsightsList(options, fetchList, {
|
|
6756
|
+
code,
|
|
6757
|
+
family: FILTERS_FAMILY,
|
|
6758
|
+
project: toRows,
|
|
6759
|
+
finalize: dedupeAndSortRows,
|
|
6760
|
+
instructions: (rows, page, hasMore) => listInstructions(rows.length, page.length, hasMore)
|
|
6342
6761
|
});
|
|
6343
6762
|
}
|
|
6344
6763
|
|
|
@@ -6353,7 +6772,7 @@ function toFolderRows(response) {
|
|
|
6353
6772
|
}
|
|
6354
6773
|
function registerFilterFoldersCommand(program2) {
|
|
6355
6774
|
const filterFoldersCmd = program2.command("filter-folders").description("Discover folders with recent Insights activity");
|
|
6356
|
-
|
|
6775
|
+
addListPaginationOptions(filterFoldersCmd.command("list").description("List folders with Insights activity in the backend's fixed 30-day window, restricted to folders the current caller can access")).trackedAction(processContext, async (options) => {
|
|
6357
6776
|
await executeFilterList(options, listFolderFilters, toFolderRows, "InsightsFilterFoldersList");
|
|
6358
6777
|
});
|
|
6359
6778
|
}
|
|
@@ -6369,7 +6788,7 @@ function toMachineRows(response) {
|
|
|
6369
6788
|
}
|
|
6370
6789
|
function registerFilterMachinesCommand(program2) {
|
|
6371
6790
|
const filterMachinesCmd = program2.command("filter-machines").description("Discover machines with recent Insights activity");
|
|
6372
|
-
|
|
6791
|
+
addListPaginationOptions(filterMachinesCmd.command("list").description("List machines with Insights activity in the backend's fixed 30-day window across the current tenant")).trackedAction(processContext, async (options) => {
|
|
6373
6792
|
await executeFilterList(options, listMachineFilters, toMachineRows, "InsightsFilterMachinesList");
|
|
6374
6793
|
});
|
|
6375
6794
|
}
|
|
@@ -6385,7 +6804,7 @@ function toProcessRows(response) {
|
|
|
6385
6804
|
}
|
|
6386
6805
|
function registerFilterProcessesCommand(program2) {
|
|
6387
6806
|
const filterProcessesCmd = program2.command("filter-processes").description("Discover processes with recent Insights activity");
|
|
6388
|
-
|
|
6807
|
+
addListPaginationOptions(filterProcessesCmd.command("list").description("List processes with Insights activity in the backend's fixed 30-day window, restricted to folders the current caller can access")).trackedAction(processContext, async (options) => {
|
|
6389
6808
|
await executeFilterList(options, listProcessFilters, toProcessRows, "InsightsFilterProcessesList");
|
|
6390
6809
|
});
|
|
6391
6810
|
}
|
|
@@ -6401,7 +6820,7 @@ function toQueueRows(response) {
|
|
|
6401
6820
|
}
|
|
6402
6821
|
function registerFilterQueuesCommand(program2) {
|
|
6403
6822
|
const filterQueuesCmd = program2.command("filter-queues").description("Discover queues with recent Insights activity");
|
|
6404
|
-
|
|
6823
|
+
addListPaginationOptions(filterQueuesCmd.command("list").description("List queues with Insights activity in the backend's fixed 30-day window, restricted to folders the current caller can access")).trackedAction(processContext, async (options) => {
|
|
6405
6824
|
await executeFilterList(options, listQueueFilters, toQueueRows, "InsightsFilterQueuesList");
|
|
6406
6825
|
});
|
|
6407
6826
|
}
|
|
@@ -6524,8 +6943,9 @@ var registerCommands = async (program2) => {
|
|
|
6524
6943
|
registerFilterProcessesCommand(program2);
|
|
6525
6944
|
registerFilterQueuesCommand(program2);
|
|
6526
6945
|
registerFilterMachinesCommand(program2);
|
|
6946
|
+
registerAlertsCommand(program2);
|
|
6527
6947
|
};
|
|
6528
6948
|
|
|
6529
6949
|
export { Command, metadata, registerCommands };
|
|
6530
6950
|
|
|
6531
|
-
//# debugId=
|
|
6951
|
+
//# debugId=DA3BA706A7E240F164756E2164756E21
|
package/dist/tool.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uipath/insights-tool",
|
|
3
3
|
"license": "MIT",
|
|
4
|
-
"version": "1.201.0-preview.
|
|
4
|
+
"version": "1.201.0-preview.121",
|
|
5
5
|
"description": "Query UiPath Insights data — jobs, failures, and performance metrics.",
|
|
6
6
|
"private": false,
|
|
7
7
|
"repository": {
|
|
@@ -26,5 +26,5 @@
|
|
|
26
26
|
"files": [
|
|
27
27
|
"dist"
|
|
28
28
|
],
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "c70ccfc0b12e637441d67df1d212b71d7784b5f8"
|
|
30
30
|
}
|