@uipath/audit-commands 1.206.0-preview.306 → 1.207.0-preview.307
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 +315 -134
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -2165,13 +2165,15 @@ var ProjectDimensions = {
|
|
|
2165
2165
|
SolutionKey: "SolutionKey",
|
|
2166
2166
|
SolutionProjectKey: "SolutionProjectKey",
|
|
2167
2167
|
SolutionIdentityStatus: "SolutionIdentityStatus",
|
|
2168
|
-
PreviousSolutionKey: "PreviousSolutionKey"
|
|
2168
|
+
PreviousSolutionKey: "PreviousSolutionKey",
|
|
2169
|
+
PreviousProjectKey: "PreviousProjectKey"
|
|
2169
2170
|
};
|
|
2170
2171
|
var GUID_KEY_DIMENSIONS = new Set([
|
|
2171
2172
|
ProjectDimensions.ProjectKey,
|
|
2172
2173
|
ProjectDimensions.SolutionKey,
|
|
2173
2174
|
ProjectDimensions.SolutionProjectKey,
|
|
2174
|
-
ProjectDimensions.PreviousSolutionKey
|
|
2175
|
+
ProjectDimensions.PreviousSolutionKey,
|
|
2176
|
+
ProjectDimensions.PreviousProjectKey
|
|
2175
2177
|
]);
|
|
2176
2178
|
var ShipDimensions = {
|
|
2177
2179
|
ShipKind: "ShipKind",
|
|
@@ -2631,7 +2633,7 @@ var package_default = {
|
|
|
2631
2633
|
name: "@uipath/audit-sdk",
|
|
2632
2634
|
author: "UiPath",
|
|
2633
2635
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
2634
|
-
version: "1.
|
|
2636
|
+
version: "1.207.0",
|
|
2635
2637
|
description: "SDK for the UiPath Audit Service — query audit event sources, list events, download long-term-store exports, and manage audit exclusion rules.",
|
|
2636
2638
|
repository: {
|
|
2637
2639
|
type: "git",
|
|
@@ -3146,6 +3148,8 @@ function settlePromiseLike(thenable) {
|
|
|
3146
3148
|
// ../../auth/src/constants.ts
|
|
3147
3149
|
var UIPATH_HOME_DIR = ".uipath";
|
|
3148
3150
|
var AUTH_FILENAME = ".auth";
|
|
3151
|
+
var AUTH_FILE_MODE = 384;
|
|
3152
|
+
var AUTH_DIR_MODE = 448;
|
|
3149
3153
|
var DEFAULT_BASE_URL = "https://cloud.uipath.com";
|
|
3150
3154
|
var DEFAULT_AUTH_TIMEOUT_MS = 5 * 60 * 1000;
|
|
3151
3155
|
|
|
@@ -3291,12 +3295,26 @@ class NodeFileSystem {
|
|
|
3291
3295
|
throw error;
|
|
3292
3296
|
}
|
|
3293
3297
|
}
|
|
3294
|
-
async writeFile(filePath, data) {
|
|
3298
|
+
async writeFile(filePath, data, options) {
|
|
3295
3299
|
const dir = path.dirname(filePath);
|
|
3296
3300
|
if (dir) {
|
|
3297
3301
|
await fs.mkdir(dir, { recursive: true });
|
|
3298
3302
|
}
|
|
3299
|
-
|
|
3303
|
+
if (options?.mode === undefined || process.platform === "win32") {
|
|
3304
|
+
if (options?.exclusive) {
|
|
3305
|
+
await fs.writeFile(filePath, data, { flag: "wx" });
|
|
3306
|
+
} else {
|
|
3307
|
+
await fs.writeFile(filePath, data);
|
|
3308
|
+
}
|
|
3309
|
+
return;
|
|
3310
|
+
}
|
|
3311
|
+
const handle = await fs.open(filePath, options.exclusive ? "wx" : "w", options.mode);
|
|
3312
|
+
try {
|
|
3313
|
+
await handle.chmod(options.mode);
|
|
3314
|
+
await handle.writeFile(data);
|
|
3315
|
+
} finally {
|
|
3316
|
+
await handle.close();
|
|
3317
|
+
}
|
|
3300
3318
|
}
|
|
3301
3319
|
async appendFile(filePath, data) {
|
|
3302
3320
|
const dir = path.dirname(filePath);
|
|
@@ -3331,7 +3349,8 @@ class NodeFileSystem {
|
|
|
3331
3349
|
isDirectory: () => stats.isDirectory(),
|
|
3332
3350
|
size: stats.size,
|
|
3333
3351
|
mtimeMs: stats.mtimeMs,
|
|
3334
|
-
ctimeMs: stats.ctimeMs
|
|
3352
|
+
ctimeMs: stats.ctimeMs,
|
|
3353
|
+
mode: stats.mode
|
|
3335
3354
|
};
|
|
3336
3355
|
} catch (error) {
|
|
3337
3356
|
if (this.isEnoent(error))
|
|
@@ -3342,8 +3361,13 @@ class NodeFileSystem {
|
|
|
3342
3361
|
async exists(filePath) {
|
|
3343
3362
|
return existsSync(filePath);
|
|
3344
3363
|
}
|
|
3345
|
-
async mkdir(dirPath) {
|
|
3346
|
-
await fs.mkdir(dirPath, { recursive: true });
|
|
3364
|
+
async mkdir(dirPath, options) {
|
|
3365
|
+
await fs.mkdir(dirPath, { recursive: true, mode: options?.mode });
|
|
3366
|
+
}
|
|
3367
|
+
async chmod(targetPath, mode) {
|
|
3368
|
+
if (process.platform === "win32")
|
|
3369
|
+
return;
|
|
3370
|
+
await fs.chmod(targetPath, mode);
|
|
3347
3371
|
}
|
|
3348
3372
|
async acquireLock(lockPath) {
|
|
3349
3373
|
const canonicalPath = await this.canonicalizeLockTarget(lockPath);
|
|
@@ -3493,7 +3517,7 @@ class NodeFileSystem {
|
|
|
3493
3517
|
async getTempDir() {
|
|
3494
3518
|
return await fs.mkdtemp(path.join(os.tmpdir(), "uipath-fs-"));
|
|
3495
3519
|
}
|
|
3496
|
-
async copyDirectory(sourcePath, destPath) {
|
|
3520
|
+
async copyDirectory(sourcePath, destPath, options) {
|
|
3497
3521
|
const sourceStats = await this.stat(sourcePath);
|
|
3498
3522
|
if (!sourceStats) {
|
|
3499
3523
|
throw new Error(`Source directory does not exist: ${sourcePath}`);
|
|
@@ -3510,7 +3534,9 @@ class NodeFileSystem {
|
|
|
3510
3534
|
if (!entryStats)
|
|
3511
3535
|
continue;
|
|
3512
3536
|
if (entryStats.isDirectory()) {
|
|
3513
|
-
|
|
3537
|
+
if (options?.skipDirectoryNames?.includes(entry))
|
|
3538
|
+
continue;
|
|
3539
|
+
await this.copyDirectory(srcEntry, destEntry, options);
|
|
3514
3540
|
} else if (entryStats.isFile()) {
|
|
3515
3541
|
const content = await this.readFile(srcEntry);
|
|
3516
3542
|
if (content !== null) {
|
|
@@ -4258,6 +4284,38 @@ var loadEnvFileAsync = async ({ envPath }) => {
|
|
|
4258
4284
|
}
|
|
4259
4285
|
return parseEnvContent(content);
|
|
4260
4286
|
};
|
|
4287
|
+
var findAuthHomeDir = (fs, dir) => {
|
|
4288
|
+
let current = dir;
|
|
4289
|
+
for (;; ) {
|
|
4290
|
+
if (fs.path.basename(current) === UIPATH_HOME_DIR)
|
|
4291
|
+
return current;
|
|
4292
|
+
const parent = fs.path.dirname(current);
|
|
4293
|
+
if (parent === current)
|
|
4294
|
+
return;
|
|
4295
|
+
current = parent;
|
|
4296
|
+
}
|
|
4297
|
+
};
|
|
4298
|
+
var TEMP_FILE_ATTEMPTS = 5;
|
|
4299
|
+
var isFileExists = (error) => error instanceof Error && error.code === "EEXIST";
|
|
4300
|
+
var writeTempFile = async (fs, targetPath, content) => {
|
|
4301
|
+
for (let attempt = 1;; attempt++) {
|
|
4302
|
+
const tempPath = `${targetPath}.${crypto.randomUUID()}.tmp`;
|
|
4303
|
+
try {
|
|
4304
|
+
await fs.writeFile(tempPath, content, {
|
|
4305
|
+
mode: AUTH_FILE_MODE,
|
|
4306
|
+
exclusive: true
|
|
4307
|
+
});
|
|
4308
|
+
return tempPath;
|
|
4309
|
+
} catch (error) {
|
|
4310
|
+
if (!isFileExists(error)) {
|
|
4311
|
+
await fs.rm(tempPath).catch(() => {});
|
|
4312
|
+
throw error;
|
|
4313
|
+
}
|
|
4314
|
+
if (attempt === TEMP_FILE_ATTEMPTS)
|
|
4315
|
+
throw error;
|
|
4316
|
+
}
|
|
4317
|
+
}
|
|
4318
|
+
};
|
|
4261
4319
|
var saveEnvFileAsync = async ({
|
|
4262
4320
|
envPath,
|
|
4263
4321
|
data,
|
|
@@ -4285,10 +4343,18 @@ var saveEnvFileAsync = async ({
|
|
|
4285
4343
|
`)}
|
|
4286
4344
|
`;
|
|
4287
4345
|
const dir = fs.path.dirname(absolutePath);
|
|
4288
|
-
await fs.mkdir(dir);
|
|
4289
|
-
const
|
|
4290
|
-
|
|
4291
|
-
|
|
4346
|
+
await fs.mkdir(dir, { mode: AUTH_DIR_MODE });
|
|
4347
|
+
const authHomeDir = findAuthHomeDir(fs, dir);
|
|
4348
|
+
if (authHomeDir !== undefined) {
|
|
4349
|
+
await fs.chmod?.(authHomeDir, AUTH_DIR_MODE);
|
|
4350
|
+
}
|
|
4351
|
+
const tempPath = await writeTempFile(fs, absolutePath, content);
|
|
4352
|
+
try {
|
|
4353
|
+
await fs.rename(tempPath, absolutePath);
|
|
4354
|
+
} catch (error) {
|
|
4355
|
+
await fs.rm(tempPath).catch(() => {});
|
|
4356
|
+
throw error;
|
|
4357
|
+
}
|
|
4292
4358
|
};
|
|
4293
4359
|
|
|
4294
4360
|
// ../../auth/src/loginStatus.ts
|
|
@@ -4988,9 +5054,7 @@ async function withinProjectIdentityBudget(work, onTimeout) {
|
|
|
4988
5054
|
}
|
|
4989
5055
|
}
|
|
4990
5056
|
|
|
4991
|
-
// ../../common/src/
|
|
4992
|
-
var PSEUDONYM_DOMAIN = "uipath-cli/telemetry/pseudonym/v1:";
|
|
4993
|
-
var PSEUDONYM_HEX_LENGTH = 32;
|
|
5057
|
+
// ../../common/src/sha256.ts
|
|
4994
5058
|
var SHA256_K = new Uint32Array([
|
|
4995
5059
|
1116352408,
|
|
4996
5060
|
1899447441,
|
|
@@ -5070,7 +5134,7 @@ var SHA256_INITIAL_STATE = new Uint32Array([
|
|
|
5070
5134
|
function rotr(value, bits) {
|
|
5071
5135
|
return (value >>> bits | value << 32 - bits) >>> 0;
|
|
5072
5136
|
}
|
|
5073
|
-
function
|
|
5137
|
+
function sha256Words(input) {
|
|
5074
5138
|
const bytes = new TextEncoder().encode(input);
|
|
5075
5139
|
const paddedLength = bytes.length + 9 + 63 >> 6 << 6;
|
|
5076
5140
|
const buffer = new Uint8Array(paddedLength);
|
|
@@ -5126,12 +5190,19 @@ function sha256Hex(input) {
|
|
|
5126
5190
|
state[6] = state[6] + g >>> 0;
|
|
5127
5191
|
state[7] = state[7] + h >>> 0;
|
|
5128
5192
|
}
|
|
5193
|
+
return state;
|
|
5194
|
+
}
|
|
5195
|
+
function sha256Hex(input) {
|
|
5129
5196
|
let hex = "";
|
|
5130
|
-
for (const word of
|
|
5197
|
+
for (const word of sha256Words(input)) {
|
|
5131
5198
|
hex += word.toString(16).padStart(8, "0");
|
|
5132
5199
|
}
|
|
5133
5200
|
return hex;
|
|
5134
5201
|
}
|
|
5202
|
+
|
|
5203
|
+
// ../../common/src/telemetry/pseudonymize.ts
|
|
5204
|
+
var PSEUDONYM_DOMAIN = "uipath-cli/telemetry/pseudonym/v1:";
|
|
5205
|
+
var PSEUDONYM_HEX_LENGTH = 32;
|
|
5135
5206
|
function resolveSha256Hex() {
|
|
5136
5207
|
try {
|
|
5137
5208
|
const nodeCrypto = __require("node:crypto");
|
|
@@ -5497,13 +5568,25 @@ function settlePromiseLike2(thenable) {
|
|
|
5497
5568
|
return Promise.resolve(thenable).then((data) => [undefined, data]).catch((error) => [toError(error), undefined]);
|
|
5498
5569
|
}
|
|
5499
5570
|
|
|
5571
|
+
// ../../common/src/result-types.ts
|
|
5572
|
+
var RESULTS = {
|
|
5573
|
+
Success: "Success",
|
|
5574
|
+
Failure: "Failure",
|
|
5575
|
+
ConfigError: "ConfigError",
|
|
5576
|
+
AuthenticationError: "AuthenticationError",
|
|
5577
|
+
ValidationError: "ValidationError",
|
|
5578
|
+
TimeoutError: "TimeoutError"
|
|
5579
|
+
};
|
|
5580
|
+
|
|
5500
5581
|
// ../../common/src/error-codes.ts
|
|
5501
5582
|
var CLI_ERROR_CODES = [
|
|
5502
5583
|
"invalid_argument",
|
|
5584
|
+
"confirmation_required",
|
|
5503
5585
|
"authentication_required",
|
|
5504
5586
|
"permission_denied",
|
|
5505
5587
|
"local_permission_denied",
|
|
5506
5588
|
"not_found",
|
|
5589
|
+
"not_enabled",
|
|
5507
5590
|
"rate_limited",
|
|
5508
5591
|
"network_error",
|
|
5509
5592
|
"timeout",
|
|
@@ -5542,6 +5625,12 @@ function carriedRetry(error) {
|
|
|
5542
5625
|
const retry = error.retry;
|
|
5543
5626
|
return isRetryHint(retry) ? retry : undefined;
|
|
5544
5627
|
}
|
|
5628
|
+
function carriedResult(error) {
|
|
5629
|
+
if (!error || typeof error !== "object")
|
|
5630
|
+
return;
|
|
5631
|
+
const result = error.result;
|
|
5632
|
+
return typeof result === "string" && result !== RESULTS.Success && Object.values(RESULTS).includes(result) ? result : undefined;
|
|
5633
|
+
}
|
|
5545
5634
|
function defaultRetryForErrorCode(errorCode) {
|
|
5546
5635
|
switch (errorCode) {
|
|
5547
5636
|
case "network_error":
|
|
@@ -5931,6 +6020,8 @@ async function extractErrorDetails(error, options) {
|
|
|
5931
6020
|
}
|
|
5932
6021
|
if (parsedBody?.errorCode && typeof parsedBody.errorCode === "string") {
|
|
5933
6022
|
context.errorCode = parsedBody.errorCode;
|
|
6023
|
+
} else if (typeof parsedBody?.errorCode === "number") {
|
|
6024
|
+
context.errorCode = String(parsedBody.errorCode);
|
|
5934
6025
|
} else if (parsedBody?.code && typeof parsedBody.code === "string") {
|
|
5935
6026
|
context.errorCode = parsedBody.code;
|
|
5936
6027
|
}
|
|
@@ -5991,15 +6082,6 @@ async function extractErrorMessage(error, options) {
|
|
|
5991
6082
|
const { message } = await extractErrorDetails(error, options);
|
|
5992
6083
|
return message;
|
|
5993
6084
|
}
|
|
5994
|
-
// ../../common/src/result-types.ts
|
|
5995
|
-
var RESULTS = {
|
|
5996
|
-
Success: "Success",
|
|
5997
|
-
Failure: "Failure",
|
|
5998
|
-
ConfigError: "ConfigError",
|
|
5999
|
-
AuthenticationError: "AuthenticationError",
|
|
6000
|
-
ValidationError: "ValidationError",
|
|
6001
|
-
TimeoutError: "TimeoutError"
|
|
6002
|
-
};
|
|
6003
6085
|
// ../../../node_modules/commander/index.js
|
|
6004
6086
|
var exports_commander = {};
|
|
6005
6087
|
__exportCjs(exports_commander, {
|
|
@@ -6432,7 +6514,10 @@ var AUTH_ERROR_CODES = new Set([
|
|
|
6432
6514
|
var LOCAL_PERMISSION_CLI_ERROR_CODES = new Set([
|
|
6433
6515
|
"local_permission_denied"
|
|
6434
6516
|
]);
|
|
6435
|
-
var VALIDATION_ERROR_CODES = new Set([
|
|
6517
|
+
var VALIDATION_ERROR_CODES = new Set([
|
|
6518
|
+
"invalid_argument",
|
|
6519
|
+
"confirmation_required"
|
|
6520
|
+
]);
|
|
6436
6521
|
var NETWORK_HTTP_ERROR_CODES = new Set([
|
|
6437
6522
|
"network_error",
|
|
6438
6523
|
"rate_limited",
|
|
@@ -6658,6 +6743,103 @@ var CommonTelemetryEvents = {
|
|
|
6658
6743
|
ShipSucceeded: "Cli.ShipSucceeded"
|
|
6659
6744
|
};
|
|
6660
6745
|
|
|
6746
|
+
// ../../common/src/telemetry/trace-context.ts
|
|
6747
|
+
var TELEMETRY_TRACEPARENT_ENV = "TRACEPARENT";
|
|
6748
|
+
var TRACEPARENT_PATTERN = /^00-([0-9a-f]{32})-([0-9a-f]{16})-[0-9a-f]{2}$/;
|
|
6749
|
+
function getProcessEnv() {
|
|
6750
|
+
return globalThis.process?.env;
|
|
6751
|
+
}
|
|
6752
|
+
function parseInboundTraceparent(value) {
|
|
6753
|
+
if (!value) {
|
|
6754
|
+
return;
|
|
6755
|
+
}
|
|
6756
|
+
const match = TRACEPARENT_PATTERN.exec(value.trim().toLowerCase());
|
|
6757
|
+
if (!match) {
|
|
6758
|
+
return;
|
|
6759
|
+
}
|
|
6760
|
+
const [, traceId, parentSpanId] = match;
|
|
6761
|
+
if (/^0+$/.test(traceId) || /^0+$/.test(parentSpanId)) {
|
|
6762
|
+
return;
|
|
6763
|
+
}
|
|
6764
|
+
return { traceId, parentSpanId };
|
|
6765
|
+
}
|
|
6766
|
+
function getInboundTraceContext() {
|
|
6767
|
+
return parseInboundTraceparent(getProcessEnv()?.[TELEMETRY_TRACEPARENT_ENV]);
|
|
6768
|
+
}
|
|
6769
|
+
|
|
6770
|
+
// ../../common/src/telemetry/session-id.ts
|
|
6771
|
+
var TELEMETRY_SESSION_ID_ENV = "UIPATH_SESSION_ID";
|
|
6772
|
+
var SESSION_ID_MAX_LENGTH = 64;
|
|
6773
|
+
var RANDOM_SESSION_ID_LENGTH = 32;
|
|
6774
|
+
var TELEMETRY_SESSION_SOURCE_PROPERTY = "SessionIdSource";
|
|
6775
|
+
var CONTROL_CHARACTERS = /\p{Cc}/gu;
|
|
6776
|
+
var INHERITED_SESSION_SOURCES = [
|
|
6777
|
+
{ envVar: "CLAUDE_CODE_SESSION_ID", source: "claude-code" },
|
|
6778
|
+
{ envVar: "CODEX_THREAD_ID", source: "codex" },
|
|
6779
|
+
{ envVar: "ANTIGRAVITY_TRAJECTORY_ID", source: "antigravity" },
|
|
6780
|
+
{ envVar: "TERM_SESSION_ID", source: "terminal" },
|
|
6781
|
+
{ envVar: "WT_SESSION", source: "terminal" }
|
|
6782
|
+
];
|
|
6783
|
+
var telemetrySessionSlot = singleton("TelemetrySession");
|
|
6784
|
+
var telemetryOperationIdSlot = singleton("TelemetryOperationId");
|
|
6785
|
+
function getProcessEnv2() {
|
|
6786
|
+
return globalThis.process?.env;
|
|
6787
|
+
}
|
|
6788
|
+
function normalizeSessionId(value) {
|
|
6789
|
+
if (typeof value !== "string" && typeof value !== "number" && typeof value !== "boolean") {
|
|
6790
|
+
return;
|
|
6791
|
+
}
|
|
6792
|
+
const cleaned = String(value).replace(CONTROL_CHARACTERS, "").trim().slice(0, SESSION_ID_MAX_LENGTH);
|
|
6793
|
+
return cleaned || undefined;
|
|
6794
|
+
}
|
|
6795
|
+
function getConfiguredTelemetrySessionId() {
|
|
6796
|
+
return normalizeSessionId(getProcessEnv2()?.[TELEMETRY_SESSION_ID_ENV]);
|
|
6797
|
+
}
|
|
6798
|
+
function getInheritedSession(env) {
|
|
6799
|
+
for (const candidate of INHERITED_SESSION_SOURCES) {
|
|
6800
|
+
const handle = normalizeSessionId(env[candidate.envVar]);
|
|
6801
|
+
if (handle) {
|
|
6802
|
+
return { id: handle, source: candidate.source };
|
|
6803
|
+
}
|
|
6804
|
+
}
|
|
6805
|
+
return;
|
|
6806
|
+
}
|
|
6807
|
+
function generateRandomSession() {
|
|
6808
|
+
const bytes = new Uint8Array(RANDOM_SESSION_ID_LENGTH / 2);
|
|
6809
|
+
crypto.getRandomValues(bytes);
|
|
6810
|
+
let hex = "";
|
|
6811
|
+
for (const byte of bytes) {
|
|
6812
|
+
hex += byte.toString(16).padStart(2, "0");
|
|
6813
|
+
}
|
|
6814
|
+
return { id: hex, source: "random" };
|
|
6815
|
+
}
|
|
6816
|
+
function resolveTelemetrySession() {
|
|
6817
|
+
const existing = telemetrySessionSlot.get();
|
|
6818
|
+
if (existing) {
|
|
6819
|
+
return existing;
|
|
6820
|
+
}
|
|
6821
|
+
const declaredHandle = getConfiguredTelemetrySessionId();
|
|
6822
|
+
const resolved = declaredHandle ? { id: declaredHandle, source: "declared" } : getInheritedSession(getProcessEnv2() ?? {}) ?? generateRandomSession();
|
|
6823
|
+
telemetrySessionSlot.set(resolved);
|
|
6824
|
+
return resolved;
|
|
6825
|
+
}
|
|
6826
|
+
function getTelemetrySessionId() {
|
|
6827
|
+
return resolveTelemetrySession().id;
|
|
6828
|
+
}
|
|
6829
|
+
function getTelemetrySessionSource() {
|
|
6830
|
+
return resolveTelemetrySession().source;
|
|
6831
|
+
}
|
|
6832
|
+
function getTelemetryOperationId() {
|
|
6833
|
+
const existing = telemetryOperationIdSlot.get();
|
|
6834
|
+
if (existing) {
|
|
6835
|
+
return existing;
|
|
6836
|
+
}
|
|
6837
|
+
const inboundTraceId = getInboundTraceContext()?.traceId;
|
|
6838
|
+
const generated = inboundTraceId ?? crypto.randomUUID().replaceAll("-", "");
|
|
6839
|
+
telemetryOperationIdSlot.set(generated);
|
|
6840
|
+
return generated;
|
|
6841
|
+
}
|
|
6842
|
+
|
|
6661
6843
|
// ../../common/src/registry.ts
|
|
6662
6844
|
import { execFileSync } from "node:child_process";
|
|
6663
6845
|
function readRegistryValue(keyPath, valueName) {
|
|
@@ -6879,102 +7061,6 @@ class NodeContextStorage {
|
|
|
6879
7061
|
return this.storage.getStore();
|
|
6880
7062
|
}
|
|
6881
7063
|
}
|
|
6882
|
-
// ../../common/src/telemetry/trace-context.ts
|
|
6883
|
-
var TELEMETRY_TRACEPARENT_ENV = "TRACEPARENT";
|
|
6884
|
-
var TRACEPARENT_PATTERN = /^00-([0-9a-f]{32})-([0-9a-f]{16})-[0-9a-f]{2}$/;
|
|
6885
|
-
function getProcessEnv() {
|
|
6886
|
-
return globalThis.process?.env;
|
|
6887
|
-
}
|
|
6888
|
-
function parseInboundTraceparent(value) {
|
|
6889
|
-
if (!value) {
|
|
6890
|
-
return;
|
|
6891
|
-
}
|
|
6892
|
-
const match = TRACEPARENT_PATTERN.exec(value.trim().toLowerCase());
|
|
6893
|
-
if (!match) {
|
|
6894
|
-
return;
|
|
6895
|
-
}
|
|
6896
|
-
const [, traceId, parentSpanId] = match;
|
|
6897
|
-
if (/^0+$/.test(traceId) || /^0+$/.test(parentSpanId)) {
|
|
6898
|
-
return;
|
|
6899
|
-
}
|
|
6900
|
-
return { traceId, parentSpanId };
|
|
6901
|
-
}
|
|
6902
|
-
function getInboundTraceContext() {
|
|
6903
|
-
return parseInboundTraceparent(getProcessEnv()?.[TELEMETRY_TRACEPARENT_ENV]);
|
|
6904
|
-
}
|
|
6905
|
-
|
|
6906
|
-
// ../../common/src/telemetry/session-id.ts
|
|
6907
|
-
var TELEMETRY_SESSION_ID_ENV = "UIPATH_SESSION_ID";
|
|
6908
|
-
var SESSION_ID_MAX_LENGTH = 64;
|
|
6909
|
-
var RANDOM_SESSION_ID_LENGTH = 32;
|
|
6910
|
-
var TELEMETRY_SESSION_SOURCE_PROPERTY = "SessionIdSource";
|
|
6911
|
-
var CONTROL_CHARACTERS = /\p{Cc}/gu;
|
|
6912
|
-
var INHERITED_SESSION_SOURCES = [
|
|
6913
|
-
{ envVar: "CLAUDE_CODE_SESSION_ID", source: "claude-code" },
|
|
6914
|
-
{ envVar: "CODEX_THREAD_ID", source: "codex" },
|
|
6915
|
-
{ envVar: "ANTIGRAVITY_TRAJECTORY_ID", source: "antigravity" },
|
|
6916
|
-
{ envVar: "TERM_SESSION_ID", source: "terminal" },
|
|
6917
|
-
{ envVar: "WT_SESSION", source: "terminal" }
|
|
6918
|
-
];
|
|
6919
|
-
var telemetrySessionSlot = singleton("TelemetrySession");
|
|
6920
|
-
var telemetryOperationIdSlot = singleton("TelemetryOperationId");
|
|
6921
|
-
function getProcessEnv2() {
|
|
6922
|
-
return globalThis.process?.env;
|
|
6923
|
-
}
|
|
6924
|
-
function normalizeSessionId(value) {
|
|
6925
|
-
if (typeof value !== "string" && typeof value !== "number" && typeof value !== "boolean") {
|
|
6926
|
-
return;
|
|
6927
|
-
}
|
|
6928
|
-
const cleaned = String(value).replace(CONTROL_CHARACTERS, "").trim().slice(0, SESSION_ID_MAX_LENGTH);
|
|
6929
|
-
return cleaned || undefined;
|
|
6930
|
-
}
|
|
6931
|
-
function getConfiguredTelemetrySessionId() {
|
|
6932
|
-
return normalizeSessionId(getProcessEnv2()?.[TELEMETRY_SESSION_ID_ENV]);
|
|
6933
|
-
}
|
|
6934
|
-
function getInheritedSession(env) {
|
|
6935
|
-
for (const candidate of INHERITED_SESSION_SOURCES) {
|
|
6936
|
-
const handle = normalizeSessionId(env[candidate.envVar]);
|
|
6937
|
-
if (handle) {
|
|
6938
|
-
return { id: handle, source: candidate.source };
|
|
6939
|
-
}
|
|
6940
|
-
}
|
|
6941
|
-
return;
|
|
6942
|
-
}
|
|
6943
|
-
function generateRandomSession() {
|
|
6944
|
-
const bytes = new Uint8Array(RANDOM_SESSION_ID_LENGTH / 2);
|
|
6945
|
-
crypto.getRandomValues(bytes);
|
|
6946
|
-
let hex = "";
|
|
6947
|
-
for (const byte of bytes) {
|
|
6948
|
-
hex += byte.toString(16).padStart(2, "0");
|
|
6949
|
-
}
|
|
6950
|
-
return { id: hex, source: "random" };
|
|
6951
|
-
}
|
|
6952
|
-
function resolveTelemetrySession() {
|
|
6953
|
-
const existing = telemetrySessionSlot.get();
|
|
6954
|
-
if (existing) {
|
|
6955
|
-
return existing;
|
|
6956
|
-
}
|
|
6957
|
-
const declaredHandle = getConfiguredTelemetrySessionId();
|
|
6958
|
-
const resolved = declaredHandle ? { id: declaredHandle, source: "declared" } : getInheritedSession(getProcessEnv2() ?? {}) ?? generateRandomSession();
|
|
6959
|
-
telemetrySessionSlot.set(resolved);
|
|
6960
|
-
return resolved;
|
|
6961
|
-
}
|
|
6962
|
-
function getTelemetrySessionId() {
|
|
6963
|
-
return resolveTelemetrySession().id;
|
|
6964
|
-
}
|
|
6965
|
-
function getTelemetrySessionSource() {
|
|
6966
|
-
return resolveTelemetrySession().source;
|
|
6967
|
-
}
|
|
6968
|
-
function getTelemetryOperationId() {
|
|
6969
|
-
const existing = telemetryOperationIdSlot.get();
|
|
6970
|
-
if (existing) {
|
|
6971
|
-
return existing;
|
|
6972
|
-
}
|
|
6973
|
-
const inboundTraceId = getInboundTraceContext()?.traceId;
|
|
6974
|
-
const generated = inboundTraceId ?? crypto.randomUUID().replaceAll("-", "");
|
|
6975
|
-
telemetryOperationIdSlot.set(generated);
|
|
6976
|
-
return generated;
|
|
6977
|
-
}
|
|
6978
7064
|
// ../../common/src/telemetry/span-clock.ts
|
|
6979
7065
|
function startSpanClock() {
|
|
6980
7066
|
const started = performance.now();
|
|
@@ -7179,6 +7265,7 @@ var MAX_SPOOL_AGE_MS = 72 * 60 * 60 * 1000;
|
|
|
7179
7265
|
// ../../common/src/telemetry/telemetry-init.ts
|
|
7180
7266
|
var telemetryInstanceSlot = singleton("TelemetryService");
|
|
7181
7267
|
var DEFAULT_AI_CONNECTION_STRING = atob("SW5zdHJ1bWVudGF0aW9uS2V5PTliZDM3NDgyLTgxMGUtNDQyYS1hYWE2LWQzOGVmNjVjNjY3NDtJbmdlc3Rpb25FbmRwb2ludD1odHRwczovL3dlc3RldXJvcGUtNS5pbi5hcHBsaWNhdGlvbmluc2lnaHRzLmF6dXJlLmNvbS87TGl2ZUVuZHBvaW50PWh0dHBzOi8vd2VzdGV1cm9wZS5saXZlZGlhZ25vc3RpY3MubW9uaXRvci5henVyZS5jb20vO0FwcGxpY2F0aW9uSWQ9MzU2OTdlZjEtOGJkMC00ZjE5LWEyN2MtZDg3Y2NhYzY2ZDJj");
|
|
7268
|
+
var browserProviderSlot = singleton("BrowserAppInsightsTelemetryProvider");
|
|
7182
7269
|
function getGlobalTelemetryInstance() {
|
|
7183
7270
|
const existing = telemetryInstanceSlot.get();
|
|
7184
7271
|
if (existing && typeof existing === "object" && "trackEvent" in existing && typeof existing.trackEvent === "function") {
|
|
@@ -7362,7 +7449,7 @@ function printOutput(data, format = "json", logFn, asciiSafe = false, tableRowSt
|
|
|
7362
7449
|
const pagedRows = extractPagedRows(data.Data);
|
|
7363
7450
|
const items = pagedRows ?? (Array.isArray(data.Data) ? data.Data : [data.Data]);
|
|
7364
7451
|
items.forEach((item) => {
|
|
7365
|
-
const values = Object.values(item).map((v) => v ?? "").join("\t");
|
|
7452
|
+
const values = item === null || typeof item !== "object" ? String(item ?? "") : Object.values(item).map((v) => v ?? "").join("\t");
|
|
7366
7453
|
logFn(values);
|
|
7367
7454
|
});
|
|
7368
7455
|
} else {
|
|
@@ -7377,7 +7464,8 @@ function printOutput(data, format = "json", logFn, asciiSafe = false, tableRowSt
|
|
|
7377
7464
|
default: {
|
|
7378
7465
|
const hasData = "Data" in data && data.Data != null;
|
|
7379
7466
|
const pagedRows = hasData ? extractPagedRows(data.Data) : null;
|
|
7380
|
-
const
|
|
7467
|
+
const resolvedRows = pagedRows ? pagedRows : Array.isArray(data.Data) ? data.Data : null;
|
|
7468
|
+
const rows = resolvedRows && isPrimitiveArray(resolvedRows) ? resolvedRows.map((entry) => ({ Value: entry })) : resolvedRows;
|
|
7381
7469
|
if (hasData && !(rows !== null && rows.length === 0)) {
|
|
7382
7470
|
const logValue = data.Log;
|
|
7383
7471
|
if (rows !== null) {
|
|
@@ -7434,6 +7522,9 @@ function printTable(data, logFn, externalLogValue, tableRowStyle) {
|
|
|
7434
7522
|
function isPlainObjectArray(value) {
|
|
7435
7523
|
return Array.isArray(value) && value.length > 0 && value.every(isPlainRecord);
|
|
7436
7524
|
}
|
|
7525
|
+
function isPrimitiveArray(value) {
|
|
7526
|
+
return Array.isArray(value) && value.length > 0 && value.every((entry) => entry === null || typeof entry !== "object");
|
|
7527
|
+
}
|
|
7437
7528
|
function isNonEmptyPlainObject(value) {
|
|
7438
7529
|
return isPlainRecord(value) && Object.keys(value).length > 0;
|
|
7439
7530
|
}
|
|
@@ -7780,12 +7871,12 @@ class FilterEvaluationError extends Error {
|
|
|
7780
7871
|
instructions;
|
|
7781
7872
|
retry = "RetryWillNotFix";
|
|
7782
7873
|
result = RESULTS.ValidationError;
|
|
7783
|
-
constructor(filter, cause) {
|
|
7874
|
+
constructor(filter, cause, hint) {
|
|
7784
7875
|
const underlying = cause instanceof Error ? cause.message : String(cause);
|
|
7785
|
-
super(`Filter '${filter}' failed to evaluate: ${underlying}`);
|
|
7876
|
+
super(`Filter '${filter}' failed to evaluate: ${underlying}` + (hint ? ` ${hint.detail}` : ""));
|
|
7786
7877
|
this.name = "FilterEvaluationError";
|
|
7787
7878
|
this.filter = filter;
|
|
7788
|
-
this.instructions = `The --output-filter expression '${filter}' failed at evaluation time. ` + "Note that --output-filter operates on the 'Data' field of the envelope, not the full object. " + "For example, on a list result use 'length(@)' instead of 'Data | length(@)'.";
|
|
7879
|
+
this.instructions = (hint ? `${hint.instructions} ` : "") + `The --output-filter expression '${filter}' failed at evaluation time. ` + "Note that --output-filter operates on the 'Data' field of the envelope, not the full object. " + "For example, on a list result use 'length(@)' instead of 'Data | length(@)'.";
|
|
7789
7880
|
}
|
|
7790
7881
|
}
|
|
7791
7882
|
|
|
@@ -7907,6 +7998,93 @@ function nameList(names, cap = 12) {
|
|
|
7907
7998
|
const rest = names.length - shown.length;
|
|
7908
7999
|
return shown.join(", ") + (rest > 0 ? `, and ${rest} more` : "");
|
|
7909
8000
|
}
|
|
8001
|
+
function notFieldsOn(names, scope) {
|
|
8002
|
+
return `${nameList(names)} ${names.length === 1 ? "is not a field" : "are not fields"} on the ${scope} it read`;
|
|
8003
|
+
}
|
|
8004
|
+
function failingFieldRead(ast, isList, fn, argIndex) {
|
|
8005
|
+
const [left, right, condition] = ast.children ?? [];
|
|
8006
|
+
let scopes = [];
|
|
8007
|
+
if (!isList) {
|
|
8008
|
+
scopes = [ast];
|
|
8009
|
+
} else if (ast.type === "FilterProjection" && left?.type === "Identity") {
|
|
8010
|
+
scopes = [condition, right];
|
|
8011
|
+
} else if (ast.type === "Projection" && (left?.type === "Identity" || left?.type === "Flatten" && left.children?.[0]?.type === "Identity")) {
|
|
8012
|
+
scopes = [right];
|
|
8013
|
+
}
|
|
8014
|
+
const reads = new Set;
|
|
8015
|
+
let tracked = 0;
|
|
8016
|
+
const visit = (node) => {
|
|
8017
|
+
if (!node)
|
|
8018
|
+
return;
|
|
8019
|
+
switch (node.type) {
|
|
8020
|
+
case "Function": {
|
|
8021
|
+
const arg = node.children?.[argIndex - 1];
|
|
8022
|
+
if (node.name === fn && arg?.type === "Field" && arg.name) {
|
|
8023
|
+
reads.add(arg.name);
|
|
8024
|
+
tracked++;
|
|
8025
|
+
}
|
|
8026
|
+
node.children?.forEach(visit);
|
|
8027
|
+
return;
|
|
8028
|
+
}
|
|
8029
|
+
case "AndExpression":
|
|
8030
|
+
case "OrExpression":
|
|
8031
|
+
case "NotExpression":
|
|
8032
|
+
case "Comparator":
|
|
8033
|
+
case "MultiSelectList":
|
|
8034
|
+
case "MultiSelectHash":
|
|
8035
|
+
node.children?.forEach(visit);
|
|
8036
|
+
return;
|
|
8037
|
+
case "KeyValuePair":
|
|
8038
|
+
visit(node.value);
|
|
8039
|
+
return;
|
|
8040
|
+
}
|
|
8041
|
+
};
|
|
8042
|
+
scopes.forEach(visit);
|
|
8043
|
+
const calls = (node) => {
|
|
8044
|
+
if (node === null || typeof node !== "object")
|
|
8045
|
+
return 0;
|
|
8046
|
+
const own = node.type === "Function" && node.name === fn ? 1 : 0;
|
|
8047
|
+
const next = node.type === "KeyValuePair" ? [node.value] : node.children ?? [];
|
|
8048
|
+
return own + next.reduce((sum, child) => sum + calls(child), 0);
|
|
8049
|
+
};
|
|
8050
|
+
return reads.size === 1 && tracked === calls(ast) ? [...reads][0] : undefined;
|
|
8051
|
+
}
|
|
8052
|
+
function fieldExpression(name) {
|
|
8053
|
+
return /^[A-Za-z_]\w*$/.test(name) ? name : JSON.stringify(name);
|
|
8054
|
+
}
|
|
8055
|
+
function evaluationHint(codec, filter, data, cause) {
|
|
8056
|
+
const underlying = cause instanceof Error ? cause.message : String(cause);
|
|
8057
|
+
const failure = /\b(\w+)\(\) expected argument (\d+) to be type (\S+) but received type null\b/.exec(underlying);
|
|
8058
|
+
if (!failure)
|
|
8059
|
+
return;
|
|
8060
|
+
const [, fn, position, expected] = failure;
|
|
8061
|
+
const name = failingFieldRead(codec.compile(filter), Array.isArray(data), fn, Number(position));
|
|
8062
|
+
if (name === undefined)
|
|
8063
|
+
return;
|
|
8064
|
+
const present = availableFields(data);
|
|
8065
|
+
if (present.length === 0)
|
|
8066
|
+
return;
|
|
8067
|
+
const scope = `${countRecords(data)} record(s)`;
|
|
8068
|
+
if (!present.includes(name)) {
|
|
8069
|
+
return {
|
|
8070
|
+
detail: `${notFieldsOn([name], scope)}. Available fields: ${nameList(present)}.`,
|
|
8071
|
+
instructions: "Use a field the records have; names are case-sensitive."
|
|
8072
|
+
};
|
|
8073
|
+
}
|
|
8074
|
+
const records = Array.isArray(data) ? data : [data];
|
|
8075
|
+
const unset = records.filter((r) => r?.[name] == null).length;
|
|
8076
|
+
const field = fieldExpression(name);
|
|
8077
|
+
let fallback;
|
|
8078
|
+
if (expected.split(",").includes("string")) {
|
|
8079
|
+
fallback = "''";
|
|
8080
|
+
} else if (expected.split(",").includes("array")) {
|
|
8081
|
+
fallback = "`[]`";
|
|
8082
|
+
}
|
|
8083
|
+
return {
|
|
8084
|
+
detail: `\`${name}\` is null or missing on ${unset} of the ${scope} it read.`,
|
|
8085
|
+
instructions: fallback ? `Give it a default where ${fn}() reads it, e.g. \`${field} || ${fallback}\`.` : `Filter out the records where \`${name}\` is null before ${fn}() reads it.`
|
|
8086
|
+
};
|
|
8087
|
+
}
|
|
7910
8088
|
function buildFilterWarning(filter, data, outcome) {
|
|
7911
8089
|
const present = availableFields(data);
|
|
7912
8090
|
const refs = referencedFields(filter);
|
|
@@ -7914,7 +8092,7 @@ function buildFilterWarning(filter, data, outcome) {
|
|
|
7914
8092
|
const unchecked = refs.nested.filter((name) => !present.includes(name));
|
|
7915
8093
|
const count = countRecords(data);
|
|
7916
8094
|
const scope = `${count} record(s)`;
|
|
7917
|
-
const isNotAField = (names) =>
|
|
8095
|
+
const isNotAField = (names) => notFieldsOn(names, scope);
|
|
7918
8096
|
const soundness = unchecked.length > 0 ? `${nameList(unchecked)} ${unchecked.length === 1 ? "reads" : "read"} below the top level, so ${unchecked.length === 1 ? "it was" : "they were"} not checked against the record keys` : refs.top.length > 0 ? "every field it names exists" : "";
|
|
7919
8097
|
const withSoundness = (base) => soundness ? `${base}, and ${soundness}` : base;
|
|
7920
8098
|
let detail;
|
|
@@ -7965,7 +8143,8 @@ function applyFilter(data, filter, onWarning) {
|
|
|
7965
8143
|
try {
|
|
7966
8144
|
result = codec.search(data, filter);
|
|
7967
8145
|
} catch (err) {
|
|
7968
|
-
|
|
8146
|
+
const [, hint] = catchError2(() => evaluationHint(codec, filter, data, err));
|
|
8147
|
+
throw new FilterEvaluationError(filter, err, hint);
|
|
7969
8148
|
}
|
|
7970
8149
|
const inputCount = countRecords(data);
|
|
7971
8150
|
const warn = (outcome) => {
|
|
@@ -8856,7 +9035,7 @@ Command2.prototype.trackedAction = function(context, fn, properties) {
|
|
|
8856
9035
|
logger.debug(`[trackedAction] ${telemetryName} failed: ${errorMessage}`);
|
|
8857
9036
|
const typed = error;
|
|
8858
9037
|
const customInstructions = typeof typed.instructions === "string" ? typed.instructions : undefined;
|
|
8859
|
-
const customResult =
|
|
9038
|
+
const customResult = carriedResult(error);
|
|
8860
9039
|
const cancellationExitCode = typed.exitCode === 130 || isPromptCancellation(error) ? 130 : undefined;
|
|
8861
9040
|
const classified = cancellationExitCode === undefined ? await extractErrorDetails(error) : undefined;
|
|
8862
9041
|
const finalResult = customResult ?? classified?.result ?? RESULTS.Failure;
|
|
@@ -9236,6 +9415,8 @@ var FAILURE_STATUSES = new Set([
|
|
|
9236
9415
|
"canceled",
|
|
9237
9416
|
"stopped"
|
|
9238
9417
|
]);
|
|
9418
|
+
// ../../common/src/relayed-output.ts
|
|
9419
|
+
var RELAYED_OUTPUT_SYMBOL = Symbol.for("@uipath/common/relayed-output");
|
|
9239
9420
|
// ../../common/src/screen-logger.ts
|
|
9240
9421
|
var ScreenLogger;
|
|
9241
9422
|
((ScreenLogger) => {
|
|
@@ -10820,4 +11001,4 @@ export {
|
|
|
10820
11001
|
registerCommands
|
|
10821
11002
|
};
|
|
10822
11003
|
|
|
10823
|
-
//# debugId=
|
|
11004
|
+
//# debugId=51068F6063239BD564756E2164756E21
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@uipath/audit-commands",
|
|
3
3
|
"author": "UiPath",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
|
-
"version": "1.
|
|
5
|
+
"version": "1.207.0-preview.307",
|
|
6
6
|
"description": "Admin CLI commands for the UiPath Audit Service — query event sources, paginate events, export ZIPs from the long-term store, and configure the exclusion rules that stop events being recorded. Library composed by admin-tool, not a standalone CLI tool.",
|
|
7
7
|
"private": false,
|
|
8
8
|
"repository": {
|
|
@@ -26,5 +26,5 @@
|
|
|
26
26
|
"files": [
|
|
27
27
|
"dist"
|
|
28
28
|
],
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "a625ed8ac421089170db3cb8b95c497f3c7b0d62"
|
|
30
30
|
}
|