@uipath/authz-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 +316 -136
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -2109,6 +2109,8 @@ function settlePromiseLike(thenable) {
|
|
|
2109
2109
|
// ../../auth/src/constants.ts
|
|
2110
2110
|
var UIPATH_HOME_DIR = ".uipath";
|
|
2111
2111
|
var AUTH_FILENAME = ".auth";
|
|
2112
|
+
var AUTH_FILE_MODE = 384;
|
|
2113
|
+
var AUTH_DIR_MODE = 448;
|
|
2112
2114
|
var DEFAULT_BASE_URL = "https://cloud.uipath.com";
|
|
2113
2115
|
var DEFAULT_AUTH_TIMEOUT_MS = 5 * 60 * 1000;
|
|
2114
2116
|
|
|
@@ -2254,12 +2256,26 @@ class NodeFileSystem {
|
|
|
2254
2256
|
throw error;
|
|
2255
2257
|
}
|
|
2256
2258
|
}
|
|
2257
|
-
async writeFile(filePath, data) {
|
|
2259
|
+
async writeFile(filePath, data, options) {
|
|
2258
2260
|
const dir = path.dirname(filePath);
|
|
2259
2261
|
if (dir) {
|
|
2260
2262
|
await fs.mkdir(dir, { recursive: true });
|
|
2261
2263
|
}
|
|
2262
|
-
|
|
2264
|
+
if (options?.mode === undefined || process.platform === "win32") {
|
|
2265
|
+
if (options?.exclusive) {
|
|
2266
|
+
await fs.writeFile(filePath, data, { flag: "wx" });
|
|
2267
|
+
} else {
|
|
2268
|
+
await fs.writeFile(filePath, data);
|
|
2269
|
+
}
|
|
2270
|
+
return;
|
|
2271
|
+
}
|
|
2272
|
+
const handle = await fs.open(filePath, options.exclusive ? "wx" : "w", options.mode);
|
|
2273
|
+
try {
|
|
2274
|
+
await handle.chmod(options.mode);
|
|
2275
|
+
await handle.writeFile(data);
|
|
2276
|
+
} finally {
|
|
2277
|
+
await handle.close();
|
|
2278
|
+
}
|
|
2263
2279
|
}
|
|
2264
2280
|
async appendFile(filePath, data) {
|
|
2265
2281
|
const dir = path.dirname(filePath);
|
|
@@ -2294,7 +2310,8 @@ class NodeFileSystem {
|
|
|
2294
2310
|
isDirectory: () => stats.isDirectory(),
|
|
2295
2311
|
size: stats.size,
|
|
2296
2312
|
mtimeMs: stats.mtimeMs,
|
|
2297
|
-
ctimeMs: stats.ctimeMs
|
|
2313
|
+
ctimeMs: stats.ctimeMs,
|
|
2314
|
+
mode: stats.mode
|
|
2298
2315
|
};
|
|
2299
2316
|
} catch (error) {
|
|
2300
2317
|
if (this.isEnoent(error))
|
|
@@ -2305,8 +2322,13 @@ class NodeFileSystem {
|
|
|
2305
2322
|
async exists(filePath) {
|
|
2306
2323
|
return existsSync(filePath);
|
|
2307
2324
|
}
|
|
2308
|
-
async mkdir(dirPath) {
|
|
2309
|
-
await fs.mkdir(dirPath, { recursive: true });
|
|
2325
|
+
async mkdir(dirPath, options) {
|
|
2326
|
+
await fs.mkdir(dirPath, { recursive: true, mode: options?.mode });
|
|
2327
|
+
}
|
|
2328
|
+
async chmod(targetPath, mode) {
|
|
2329
|
+
if (process.platform === "win32")
|
|
2330
|
+
return;
|
|
2331
|
+
await fs.chmod(targetPath, mode);
|
|
2310
2332
|
}
|
|
2311
2333
|
async acquireLock(lockPath) {
|
|
2312
2334
|
const canonicalPath = await this.canonicalizeLockTarget(lockPath);
|
|
@@ -2456,7 +2478,7 @@ class NodeFileSystem {
|
|
|
2456
2478
|
async getTempDir() {
|
|
2457
2479
|
return await fs.mkdtemp(path.join(os.tmpdir(), "uipath-fs-"));
|
|
2458
2480
|
}
|
|
2459
|
-
async copyDirectory(sourcePath, destPath) {
|
|
2481
|
+
async copyDirectory(sourcePath, destPath, options) {
|
|
2460
2482
|
const sourceStats = await this.stat(sourcePath);
|
|
2461
2483
|
if (!sourceStats) {
|
|
2462
2484
|
throw new Error(`Source directory does not exist: ${sourcePath}`);
|
|
@@ -2473,7 +2495,9 @@ class NodeFileSystem {
|
|
|
2473
2495
|
if (!entryStats)
|
|
2474
2496
|
continue;
|
|
2475
2497
|
if (entryStats.isDirectory()) {
|
|
2476
|
-
|
|
2498
|
+
if (options?.skipDirectoryNames?.includes(entry))
|
|
2499
|
+
continue;
|
|
2500
|
+
await this.copyDirectory(srcEntry, destEntry, options);
|
|
2477
2501
|
} else if (entryStats.isFile()) {
|
|
2478
2502
|
const content = await this.readFile(srcEntry);
|
|
2479
2503
|
if (content !== null) {
|
|
@@ -3221,6 +3245,38 @@ var loadEnvFileAsync = async ({ envPath }) => {
|
|
|
3221
3245
|
}
|
|
3222
3246
|
return parseEnvContent(content);
|
|
3223
3247
|
};
|
|
3248
|
+
var findAuthHomeDir = (fs, dir) => {
|
|
3249
|
+
let current = dir;
|
|
3250
|
+
for (;; ) {
|
|
3251
|
+
if (fs.path.basename(current) === UIPATH_HOME_DIR)
|
|
3252
|
+
return current;
|
|
3253
|
+
const parent = fs.path.dirname(current);
|
|
3254
|
+
if (parent === current)
|
|
3255
|
+
return;
|
|
3256
|
+
current = parent;
|
|
3257
|
+
}
|
|
3258
|
+
};
|
|
3259
|
+
var TEMP_FILE_ATTEMPTS = 5;
|
|
3260
|
+
var isFileExists = (error) => error instanceof Error && error.code === "EEXIST";
|
|
3261
|
+
var writeTempFile = async (fs, targetPath, content) => {
|
|
3262
|
+
for (let attempt = 1;; attempt++) {
|
|
3263
|
+
const tempPath = `${targetPath}.${crypto.randomUUID()}.tmp`;
|
|
3264
|
+
try {
|
|
3265
|
+
await fs.writeFile(tempPath, content, {
|
|
3266
|
+
mode: AUTH_FILE_MODE,
|
|
3267
|
+
exclusive: true
|
|
3268
|
+
});
|
|
3269
|
+
return tempPath;
|
|
3270
|
+
} catch (error) {
|
|
3271
|
+
if (!isFileExists(error)) {
|
|
3272
|
+
await fs.rm(tempPath).catch(() => {});
|
|
3273
|
+
throw error;
|
|
3274
|
+
}
|
|
3275
|
+
if (attempt === TEMP_FILE_ATTEMPTS)
|
|
3276
|
+
throw error;
|
|
3277
|
+
}
|
|
3278
|
+
}
|
|
3279
|
+
};
|
|
3224
3280
|
var saveEnvFileAsync = async ({
|
|
3225
3281
|
envPath,
|
|
3226
3282
|
data,
|
|
@@ -3248,10 +3304,18 @@ var saveEnvFileAsync = async ({
|
|
|
3248
3304
|
`)}
|
|
3249
3305
|
`;
|
|
3250
3306
|
const dir = fs.path.dirname(absolutePath);
|
|
3251
|
-
await fs.mkdir(dir);
|
|
3252
|
-
const
|
|
3253
|
-
|
|
3254
|
-
|
|
3307
|
+
await fs.mkdir(dir, { mode: AUTH_DIR_MODE });
|
|
3308
|
+
const authHomeDir = findAuthHomeDir(fs, dir);
|
|
3309
|
+
if (authHomeDir !== undefined) {
|
|
3310
|
+
await fs.chmod?.(authHomeDir, AUTH_DIR_MODE);
|
|
3311
|
+
}
|
|
3312
|
+
const tempPath = await writeTempFile(fs, absolutePath, content);
|
|
3313
|
+
try {
|
|
3314
|
+
await fs.rename(tempPath, absolutePath);
|
|
3315
|
+
} catch (error) {
|
|
3316
|
+
await fs.rm(tempPath).catch(() => {});
|
|
3317
|
+
throw error;
|
|
3318
|
+
}
|
|
3255
3319
|
};
|
|
3256
3320
|
|
|
3257
3321
|
// ../../auth/src/loginStatus.ts
|
|
@@ -3933,13 +3997,15 @@ var ProjectDimensions = {
|
|
|
3933
3997
|
SolutionKey: "SolutionKey",
|
|
3934
3998
|
SolutionProjectKey: "SolutionProjectKey",
|
|
3935
3999
|
SolutionIdentityStatus: "SolutionIdentityStatus",
|
|
3936
|
-
PreviousSolutionKey: "PreviousSolutionKey"
|
|
4000
|
+
PreviousSolutionKey: "PreviousSolutionKey",
|
|
4001
|
+
PreviousProjectKey: "PreviousProjectKey"
|
|
3937
4002
|
};
|
|
3938
4003
|
var GUID_KEY_DIMENSIONS = new Set([
|
|
3939
4004
|
ProjectDimensions.ProjectKey,
|
|
3940
4005
|
ProjectDimensions.SolutionKey,
|
|
3941
4006
|
ProjectDimensions.SolutionProjectKey,
|
|
3942
|
-
ProjectDimensions.PreviousSolutionKey
|
|
4007
|
+
ProjectDimensions.PreviousSolutionKey,
|
|
4008
|
+
ProjectDimensions.PreviousProjectKey
|
|
3943
4009
|
]);
|
|
3944
4010
|
var ShipDimensions = {
|
|
3945
4011
|
ShipKind: "ShipKind",
|
|
@@ -4387,7 +4453,7 @@ var package_default = {
|
|
|
4387
4453
|
name: "@uipath/authz-sdk",
|
|
4388
4454
|
author: "UiPath",
|
|
4389
4455
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
4390
|
-
version: "1.
|
|
4456
|
+
version: "1.207.0",
|
|
4391
4457
|
description: "SDK for the UiPath Authorization Service API.",
|
|
4392
4458
|
repository: {
|
|
4393
4459
|
type: "git",
|
|
@@ -5016,9 +5082,7 @@ async function withinProjectIdentityBudget(work, onTimeout) {
|
|
|
5016
5082
|
}
|
|
5017
5083
|
}
|
|
5018
5084
|
|
|
5019
|
-
// ../../common/src/
|
|
5020
|
-
var PSEUDONYM_DOMAIN = "uipath-cli/telemetry/pseudonym/v1:";
|
|
5021
|
-
var PSEUDONYM_HEX_LENGTH = 32;
|
|
5085
|
+
// ../../common/src/sha256.ts
|
|
5022
5086
|
var SHA256_K = new Uint32Array([
|
|
5023
5087
|
1116352408,
|
|
5024
5088
|
1899447441,
|
|
@@ -5098,7 +5162,7 @@ var SHA256_INITIAL_STATE = new Uint32Array([
|
|
|
5098
5162
|
function rotr(value, bits) {
|
|
5099
5163
|
return (value >>> bits | value << 32 - bits) >>> 0;
|
|
5100
5164
|
}
|
|
5101
|
-
function
|
|
5165
|
+
function sha256Words(input) {
|
|
5102
5166
|
const bytes = new TextEncoder().encode(input);
|
|
5103
5167
|
const paddedLength = bytes.length + 9 + 63 >> 6 << 6;
|
|
5104
5168
|
const buffer = new Uint8Array(paddedLength);
|
|
@@ -5154,12 +5218,19 @@ function sha256Hex(input) {
|
|
|
5154
5218
|
state[6] = state[6] + g >>> 0;
|
|
5155
5219
|
state[7] = state[7] + h >>> 0;
|
|
5156
5220
|
}
|
|
5221
|
+
return state;
|
|
5222
|
+
}
|
|
5223
|
+
function sha256Hex(input) {
|
|
5157
5224
|
let hex = "";
|
|
5158
|
-
for (const word of
|
|
5225
|
+
for (const word of sha256Words(input)) {
|
|
5159
5226
|
hex += word.toString(16).padStart(8, "0");
|
|
5160
5227
|
}
|
|
5161
5228
|
return hex;
|
|
5162
5229
|
}
|
|
5230
|
+
|
|
5231
|
+
// ../../common/src/telemetry/pseudonymize.ts
|
|
5232
|
+
var PSEUDONYM_DOMAIN = "uipath-cli/telemetry/pseudonym/v1:";
|
|
5233
|
+
var PSEUDONYM_HEX_LENGTH = 32;
|
|
5163
5234
|
function resolveSha256Hex() {
|
|
5164
5235
|
try {
|
|
5165
5236
|
const nodeCrypto = __require("node:crypto");
|
|
@@ -5525,13 +5596,25 @@ function settlePromiseLike2(thenable) {
|
|
|
5525
5596
|
return Promise.resolve(thenable).then((data) => [undefined, data]).catch((error) => [toError(error), undefined]);
|
|
5526
5597
|
}
|
|
5527
5598
|
|
|
5599
|
+
// ../../common/src/result-types.ts
|
|
5600
|
+
var RESULTS = {
|
|
5601
|
+
Success: "Success",
|
|
5602
|
+
Failure: "Failure",
|
|
5603
|
+
ConfigError: "ConfigError",
|
|
5604
|
+
AuthenticationError: "AuthenticationError",
|
|
5605
|
+
ValidationError: "ValidationError",
|
|
5606
|
+
TimeoutError: "TimeoutError"
|
|
5607
|
+
};
|
|
5608
|
+
|
|
5528
5609
|
// ../../common/src/error-codes.ts
|
|
5529
5610
|
var CLI_ERROR_CODES = [
|
|
5530
5611
|
"invalid_argument",
|
|
5612
|
+
"confirmation_required",
|
|
5531
5613
|
"authentication_required",
|
|
5532
5614
|
"permission_denied",
|
|
5533
5615
|
"local_permission_denied",
|
|
5534
5616
|
"not_found",
|
|
5617
|
+
"not_enabled",
|
|
5535
5618
|
"rate_limited",
|
|
5536
5619
|
"network_error",
|
|
5537
5620
|
"timeout",
|
|
@@ -5570,6 +5653,12 @@ function carriedRetry(error) {
|
|
|
5570
5653
|
const retry = error.retry;
|
|
5571
5654
|
return isRetryHint(retry) ? retry : undefined;
|
|
5572
5655
|
}
|
|
5656
|
+
function carriedResult(error) {
|
|
5657
|
+
if (!error || typeof error !== "object")
|
|
5658
|
+
return;
|
|
5659
|
+
const result = error.result;
|
|
5660
|
+
return typeof result === "string" && result !== RESULTS.Success && Object.values(RESULTS).includes(result) ? result : undefined;
|
|
5661
|
+
}
|
|
5573
5662
|
function defaultRetryForErrorCode(errorCode) {
|
|
5574
5663
|
switch (errorCode) {
|
|
5575
5664
|
case "network_error":
|
|
@@ -5959,6 +6048,8 @@ async function extractErrorDetails(error, options) {
|
|
|
5959
6048
|
}
|
|
5960
6049
|
if (parsedBody?.errorCode && typeof parsedBody.errorCode === "string") {
|
|
5961
6050
|
context.errorCode = parsedBody.errorCode;
|
|
6051
|
+
} else if (typeof parsedBody?.errorCode === "number") {
|
|
6052
|
+
context.errorCode = String(parsedBody.errorCode);
|
|
5962
6053
|
} else if (parsedBody?.code && typeof parsedBody.code === "string") {
|
|
5963
6054
|
context.errorCode = parsedBody.code;
|
|
5964
6055
|
}
|
|
@@ -6097,16 +6188,6 @@ function instructionsFor(ctx, err) {
|
|
|
6097
6188
|
}
|
|
6098
6189
|
}
|
|
6099
6190
|
|
|
6100
|
-
// ../../common/src/result-types.ts
|
|
6101
|
-
var RESULTS = {
|
|
6102
|
-
Success: "Success",
|
|
6103
|
-
Failure: "Failure",
|
|
6104
|
-
ConfigError: "ConfigError",
|
|
6105
|
-
AuthenticationError: "AuthenticationError",
|
|
6106
|
-
ValidationError: "ValidationError",
|
|
6107
|
-
TimeoutError: "TimeoutError"
|
|
6108
|
-
};
|
|
6109
|
-
|
|
6110
6191
|
// ../../common/src/classified-failure.ts
|
|
6111
6192
|
async function authContextFailure(error, sessionInstructions) {
|
|
6112
6193
|
const details = await extractErrorDetails(error);
|
|
@@ -6552,7 +6633,10 @@ var AUTH_ERROR_CODES = new Set([
|
|
|
6552
6633
|
var LOCAL_PERMISSION_CLI_ERROR_CODES = new Set([
|
|
6553
6634
|
"local_permission_denied"
|
|
6554
6635
|
]);
|
|
6555
|
-
var VALIDATION_ERROR_CODES = new Set([
|
|
6636
|
+
var VALIDATION_ERROR_CODES = new Set([
|
|
6637
|
+
"invalid_argument",
|
|
6638
|
+
"confirmation_required"
|
|
6639
|
+
]);
|
|
6556
6640
|
var NETWORK_HTTP_ERROR_CODES = new Set([
|
|
6557
6641
|
"network_error",
|
|
6558
6642
|
"rate_limited",
|
|
@@ -6778,6 +6862,103 @@ var CommonTelemetryEvents = {
|
|
|
6778
6862
|
ShipSucceeded: "Cli.ShipSucceeded"
|
|
6779
6863
|
};
|
|
6780
6864
|
|
|
6865
|
+
// ../../common/src/telemetry/trace-context.ts
|
|
6866
|
+
var TELEMETRY_TRACEPARENT_ENV = "TRACEPARENT";
|
|
6867
|
+
var TRACEPARENT_PATTERN = /^00-([0-9a-f]{32})-([0-9a-f]{16})-[0-9a-f]{2}$/;
|
|
6868
|
+
function getProcessEnv() {
|
|
6869
|
+
return globalThis.process?.env;
|
|
6870
|
+
}
|
|
6871
|
+
function parseInboundTraceparent(value) {
|
|
6872
|
+
if (!value) {
|
|
6873
|
+
return;
|
|
6874
|
+
}
|
|
6875
|
+
const match = TRACEPARENT_PATTERN.exec(value.trim().toLowerCase());
|
|
6876
|
+
if (!match) {
|
|
6877
|
+
return;
|
|
6878
|
+
}
|
|
6879
|
+
const [, traceId, parentSpanId] = match;
|
|
6880
|
+
if (/^0+$/.test(traceId) || /^0+$/.test(parentSpanId)) {
|
|
6881
|
+
return;
|
|
6882
|
+
}
|
|
6883
|
+
return { traceId, parentSpanId };
|
|
6884
|
+
}
|
|
6885
|
+
function getInboundTraceContext() {
|
|
6886
|
+
return parseInboundTraceparent(getProcessEnv()?.[TELEMETRY_TRACEPARENT_ENV]);
|
|
6887
|
+
}
|
|
6888
|
+
|
|
6889
|
+
// ../../common/src/telemetry/session-id.ts
|
|
6890
|
+
var TELEMETRY_SESSION_ID_ENV = "UIPATH_SESSION_ID";
|
|
6891
|
+
var SESSION_ID_MAX_LENGTH = 64;
|
|
6892
|
+
var RANDOM_SESSION_ID_LENGTH = 32;
|
|
6893
|
+
var TELEMETRY_SESSION_SOURCE_PROPERTY = "SessionIdSource";
|
|
6894
|
+
var CONTROL_CHARACTERS = /\p{Cc}/gu;
|
|
6895
|
+
var INHERITED_SESSION_SOURCES = [
|
|
6896
|
+
{ envVar: "CLAUDE_CODE_SESSION_ID", source: "claude-code" },
|
|
6897
|
+
{ envVar: "CODEX_THREAD_ID", source: "codex" },
|
|
6898
|
+
{ envVar: "ANTIGRAVITY_TRAJECTORY_ID", source: "antigravity" },
|
|
6899
|
+
{ envVar: "TERM_SESSION_ID", source: "terminal" },
|
|
6900
|
+
{ envVar: "WT_SESSION", source: "terminal" }
|
|
6901
|
+
];
|
|
6902
|
+
var telemetrySessionSlot = singleton("TelemetrySession");
|
|
6903
|
+
var telemetryOperationIdSlot = singleton("TelemetryOperationId");
|
|
6904
|
+
function getProcessEnv2() {
|
|
6905
|
+
return globalThis.process?.env;
|
|
6906
|
+
}
|
|
6907
|
+
function normalizeSessionId(value) {
|
|
6908
|
+
if (typeof value !== "string" && typeof value !== "number" && typeof value !== "boolean") {
|
|
6909
|
+
return;
|
|
6910
|
+
}
|
|
6911
|
+
const cleaned = String(value).replace(CONTROL_CHARACTERS, "").trim().slice(0, SESSION_ID_MAX_LENGTH);
|
|
6912
|
+
return cleaned || undefined;
|
|
6913
|
+
}
|
|
6914
|
+
function getConfiguredTelemetrySessionId() {
|
|
6915
|
+
return normalizeSessionId(getProcessEnv2()?.[TELEMETRY_SESSION_ID_ENV]);
|
|
6916
|
+
}
|
|
6917
|
+
function getInheritedSession(env) {
|
|
6918
|
+
for (const candidate of INHERITED_SESSION_SOURCES) {
|
|
6919
|
+
const handle = normalizeSessionId(env[candidate.envVar]);
|
|
6920
|
+
if (handle) {
|
|
6921
|
+
return { id: handle, source: candidate.source };
|
|
6922
|
+
}
|
|
6923
|
+
}
|
|
6924
|
+
return;
|
|
6925
|
+
}
|
|
6926
|
+
function generateRandomSession() {
|
|
6927
|
+
const bytes = new Uint8Array(RANDOM_SESSION_ID_LENGTH / 2);
|
|
6928
|
+
crypto.getRandomValues(bytes);
|
|
6929
|
+
let hex = "";
|
|
6930
|
+
for (const byte of bytes) {
|
|
6931
|
+
hex += byte.toString(16).padStart(2, "0");
|
|
6932
|
+
}
|
|
6933
|
+
return { id: hex, source: "random" };
|
|
6934
|
+
}
|
|
6935
|
+
function resolveTelemetrySession() {
|
|
6936
|
+
const existing = telemetrySessionSlot.get();
|
|
6937
|
+
if (existing) {
|
|
6938
|
+
return existing;
|
|
6939
|
+
}
|
|
6940
|
+
const declaredHandle = getConfiguredTelemetrySessionId();
|
|
6941
|
+
const resolved = declaredHandle ? { id: declaredHandle, source: "declared" } : getInheritedSession(getProcessEnv2() ?? {}) ?? generateRandomSession();
|
|
6942
|
+
telemetrySessionSlot.set(resolved);
|
|
6943
|
+
return resolved;
|
|
6944
|
+
}
|
|
6945
|
+
function getTelemetrySessionId() {
|
|
6946
|
+
return resolveTelemetrySession().id;
|
|
6947
|
+
}
|
|
6948
|
+
function getTelemetrySessionSource() {
|
|
6949
|
+
return resolveTelemetrySession().source;
|
|
6950
|
+
}
|
|
6951
|
+
function getTelemetryOperationId() {
|
|
6952
|
+
const existing = telemetryOperationIdSlot.get();
|
|
6953
|
+
if (existing) {
|
|
6954
|
+
return existing;
|
|
6955
|
+
}
|
|
6956
|
+
const inboundTraceId = getInboundTraceContext()?.traceId;
|
|
6957
|
+
const generated = inboundTraceId ?? crypto.randomUUID().replaceAll("-", "");
|
|
6958
|
+
telemetryOperationIdSlot.set(generated);
|
|
6959
|
+
return generated;
|
|
6960
|
+
}
|
|
6961
|
+
|
|
6781
6962
|
// ../../common/src/registry.ts
|
|
6782
6963
|
import { execFileSync } from "node:child_process";
|
|
6783
6964
|
function readRegistryValue(keyPath, valueName) {
|
|
@@ -6999,102 +7180,6 @@ class NodeContextStorage {
|
|
|
6999
7180
|
return this.storage.getStore();
|
|
7000
7181
|
}
|
|
7001
7182
|
}
|
|
7002
|
-
// ../../common/src/telemetry/trace-context.ts
|
|
7003
|
-
var TELEMETRY_TRACEPARENT_ENV = "TRACEPARENT";
|
|
7004
|
-
var TRACEPARENT_PATTERN = /^00-([0-9a-f]{32})-([0-9a-f]{16})-[0-9a-f]{2}$/;
|
|
7005
|
-
function getProcessEnv() {
|
|
7006
|
-
return globalThis.process?.env;
|
|
7007
|
-
}
|
|
7008
|
-
function parseInboundTraceparent(value) {
|
|
7009
|
-
if (!value) {
|
|
7010
|
-
return;
|
|
7011
|
-
}
|
|
7012
|
-
const match = TRACEPARENT_PATTERN.exec(value.trim().toLowerCase());
|
|
7013
|
-
if (!match) {
|
|
7014
|
-
return;
|
|
7015
|
-
}
|
|
7016
|
-
const [, traceId, parentSpanId] = match;
|
|
7017
|
-
if (/^0+$/.test(traceId) || /^0+$/.test(parentSpanId)) {
|
|
7018
|
-
return;
|
|
7019
|
-
}
|
|
7020
|
-
return { traceId, parentSpanId };
|
|
7021
|
-
}
|
|
7022
|
-
function getInboundTraceContext() {
|
|
7023
|
-
return parseInboundTraceparent(getProcessEnv()?.[TELEMETRY_TRACEPARENT_ENV]);
|
|
7024
|
-
}
|
|
7025
|
-
|
|
7026
|
-
// ../../common/src/telemetry/session-id.ts
|
|
7027
|
-
var TELEMETRY_SESSION_ID_ENV = "UIPATH_SESSION_ID";
|
|
7028
|
-
var SESSION_ID_MAX_LENGTH = 64;
|
|
7029
|
-
var RANDOM_SESSION_ID_LENGTH = 32;
|
|
7030
|
-
var TELEMETRY_SESSION_SOURCE_PROPERTY = "SessionIdSource";
|
|
7031
|
-
var CONTROL_CHARACTERS = /\p{Cc}/gu;
|
|
7032
|
-
var INHERITED_SESSION_SOURCES = [
|
|
7033
|
-
{ envVar: "CLAUDE_CODE_SESSION_ID", source: "claude-code" },
|
|
7034
|
-
{ envVar: "CODEX_THREAD_ID", source: "codex" },
|
|
7035
|
-
{ envVar: "ANTIGRAVITY_TRAJECTORY_ID", source: "antigravity" },
|
|
7036
|
-
{ envVar: "TERM_SESSION_ID", source: "terminal" },
|
|
7037
|
-
{ envVar: "WT_SESSION", source: "terminal" }
|
|
7038
|
-
];
|
|
7039
|
-
var telemetrySessionSlot = singleton("TelemetrySession");
|
|
7040
|
-
var telemetryOperationIdSlot = singleton("TelemetryOperationId");
|
|
7041
|
-
function getProcessEnv2() {
|
|
7042
|
-
return globalThis.process?.env;
|
|
7043
|
-
}
|
|
7044
|
-
function normalizeSessionId(value) {
|
|
7045
|
-
if (typeof value !== "string" && typeof value !== "number" && typeof value !== "boolean") {
|
|
7046
|
-
return;
|
|
7047
|
-
}
|
|
7048
|
-
const cleaned = String(value).replace(CONTROL_CHARACTERS, "").trim().slice(0, SESSION_ID_MAX_LENGTH);
|
|
7049
|
-
return cleaned || undefined;
|
|
7050
|
-
}
|
|
7051
|
-
function getConfiguredTelemetrySessionId() {
|
|
7052
|
-
return normalizeSessionId(getProcessEnv2()?.[TELEMETRY_SESSION_ID_ENV]);
|
|
7053
|
-
}
|
|
7054
|
-
function getInheritedSession(env) {
|
|
7055
|
-
for (const candidate of INHERITED_SESSION_SOURCES) {
|
|
7056
|
-
const handle = normalizeSessionId(env[candidate.envVar]);
|
|
7057
|
-
if (handle) {
|
|
7058
|
-
return { id: handle, source: candidate.source };
|
|
7059
|
-
}
|
|
7060
|
-
}
|
|
7061
|
-
return;
|
|
7062
|
-
}
|
|
7063
|
-
function generateRandomSession() {
|
|
7064
|
-
const bytes = new Uint8Array(RANDOM_SESSION_ID_LENGTH / 2);
|
|
7065
|
-
crypto.getRandomValues(bytes);
|
|
7066
|
-
let hex = "";
|
|
7067
|
-
for (const byte of bytes) {
|
|
7068
|
-
hex += byte.toString(16).padStart(2, "0");
|
|
7069
|
-
}
|
|
7070
|
-
return { id: hex, source: "random" };
|
|
7071
|
-
}
|
|
7072
|
-
function resolveTelemetrySession() {
|
|
7073
|
-
const existing = telemetrySessionSlot.get();
|
|
7074
|
-
if (existing) {
|
|
7075
|
-
return existing;
|
|
7076
|
-
}
|
|
7077
|
-
const declaredHandle = getConfiguredTelemetrySessionId();
|
|
7078
|
-
const resolved = declaredHandle ? { id: declaredHandle, source: "declared" } : getInheritedSession(getProcessEnv2() ?? {}) ?? generateRandomSession();
|
|
7079
|
-
telemetrySessionSlot.set(resolved);
|
|
7080
|
-
return resolved;
|
|
7081
|
-
}
|
|
7082
|
-
function getTelemetrySessionId() {
|
|
7083
|
-
return resolveTelemetrySession().id;
|
|
7084
|
-
}
|
|
7085
|
-
function getTelemetrySessionSource() {
|
|
7086
|
-
return resolveTelemetrySession().source;
|
|
7087
|
-
}
|
|
7088
|
-
function getTelemetryOperationId() {
|
|
7089
|
-
const existing = telemetryOperationIdSlot.get();
|
|
7090
|
-
if (existing) {
|
|
7091
|
-
return existing;
|
|
7092
|
-
}
|
|
7093
|
-
const inboundTraceId = getInboundTraceContext()?.traceId;
|
|
7094
|
-
const generated = inboundTraceId ?? crypto.randomUUID().replaceAll("-", "");
|
|
7095
|
-
telemetryOperationIdSlot.set(generated);
|
|
7096
|
-
return generated;
|
|
7097
|
-
}
|
|
7098
7183
|
// ../../common/src/telemetry/span-clock.ts
|
|
7099
7184
|
function startSpanClock() {
|
|
7100
7185
|
const started = performance.now();
|
|
@@ -7299,6 +7384,7 @@ var MAX_SPOOL_AGE_MS = 72 * 60 * 60 * 1000;
|
|
|
7299
7384
|
// ../../common/src/telemetry/telemetry-init.ts
|
|
7300
7385
|
var telemetryInstanceSlot = singleton("TelemetryService");
|
|
7301
7386
|
var DEFAULT_AI_CONNECTION_STRING = atob("SW5zdHJ1bWVudGF0aW9uS2V5PTliZDM3NDgyLTgxMGUtNDQyYS1hYWE2LWQzOGVmNjVjNjY3NDtJbmdlc3Rpb25FbmRwb2ludD1odHRwczovL3dlc3RldXJvcGUtNS5pbi5hcHBsaWNhdGlvbmluc2lnaHRzLmF6dXJlLmNvbS87TGl2ZUVuZHBvaW50PWh0dHBzOi8vd2VzdGV1cm9wZS5saXZlZGlhZ25vc3RpY3MubW9uaXRvci5henVyZS5jb20vO0FwcGxpY2F0aW9uSWQ9MzU2OTdlZjEtOGJkMC00ZjE5LWEyN2MtZDg3Y2NhYzY2ZDJj");
|
|
7387
|
+
var browserProviderSlot = singleton("BrowserAppInsightsTelemetryProvider");
|
|
7302
7388
|
function getGlobalTelemetryInstance() {
|
|
7303
7389
|
const existing = telemetryInstanceSlot.get();
|
|
7304
7390
|
if (existing && typeof existing === "object" && "trackEvent" in existing && typeof existing.trackEvent === "function") {
|
|
@@ -7482,7 +7568,7 @@ function printOutput(data, format = "json", logFn, asciiSafe = false, tableRowSt
|
|
|
7482
7568
|
const pagedRows = extractPagedRows(data.Data);
|
|
7483
7569
|
const items = pagedRows ?? (Array.isArray(data.Data) ? data.Data : [data.Data]);
|
|
7484
7570
|
items.forEach((item) => {
|
|
7485
|
-
const values = Object.values(item).map((v) => v ?? "").join("\t");
|
|
7571
|
+
const values = item === null || typeof item !== "object" ? String(item ?? "") : Object.values(item).map((v) => v ?? "").join("\t");
|
|
7486
7572
|
logFn(values);
|
|
7487
7573
|
});
|
|
7488
7574
|
} else {
|
|
@@ -7497,7 +7583,8 @@ function printOutput(data, format = "json", logFn, asciiSafe = false, tableRowSt
|
|
|
7497
7583
|
default: {
|
|
7498
7584
|
const hasData = "Data" in data && data.Data != null;
|
|
7499
7585
|
const pagedRows = hasData ? extractPagedRows(data.Data) : null;
|
|
7500
|
-
const
|
|
7586
|
+
const resolvedRows = pagedRows ? pagedRows : Array.isArray(data.Data) ? data.Data : null;
|
|
7587
|
+
const rows = resolvedRows && isPrimitiveArray(resolvedRows) ? resolvedRows.map((entry) => ({ Value: entry })) : resolvedRows;
|
|
7501
7588
|
if (hasData && !(rows !== null && rows.length === 0)) {
|
|
7502
7589
|
const logValue = data.Log;
|
|
7503
7590
|
if (rows !== null) {
|
|
@@ -7554,6 +7641,9 @@ function printTable(data, logFn, externalLogValue, tableRowStyle) {
|
|
|
7554
7641
|
function isPlainObjectArray(value) {
|
|
7555
7642
|
return Array.isArray(value) && value.length > 0 && value.every(isPlainRecord);
|
|
7556
7643
|
}
|
|
7644
|
+
function isPrimitiveArray(value) {
|
|
7645
|
+
return Array.isArray(value) && value.length > 0 && value.every((entry) => entry === null || typeof entry !== "object");
|
|
7646
|
+
}
|
|
7557
7647
|
function isNonEmptyPlainObject(value) {
|
|
7558
7648
|
return isPlainRecord(value) && Object.keys(value).length > 0;
|
|
7559
7649
|
}
|
|
@@ -7900,12 +7990,12 @@ class FilterEvaluationError extends Error {
|
|
|
7900
7990
|
instructions;
|
|
7901
7991
|
retry = "RetryWillNotFix";
|
|
7902
7992
|
result = RESULTS.ValidationError;
|
|
7903
|
-
constructor(filter, cause) {
|
|
7993
|
+
constructor(filter, cause, hint) {
|
|
7904
7994
|
const underlying = cause instanceof Error ? cause.message : String(cause);
|
|
7905
|
-
super(`Filter '${filter}' failed to evaluate: ${underlying}`);
|
|
7995
|
+
super(`Filter '${filter}' failed to evaluate: ${underlying}` + (hint ? ` ${hint.detail}` : ""));
|
|
7906
7996
|
this.name = "FilterEvaluationError";
|
|
7907
7997
|
this.filter = filter;
|
|
7908
|
-
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(@)'.";
|
|
7998
|
+
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(@)'.";
|
|
7909
7999
|
}
|
|
7910
8000
|
}
|
|
7911
8001
|
|
|
@@ -8027,6 +8117,93 @@ function nameList(names, cap = 12) {
|
|
|
8027
8117
|
const rest = names.length - shown.length;
|
|
8028
8118
|
return shown.join(", ") + (rest > 0 ? `, and ${rest} more` : "");
|
|
8029
8119
|
}
|
|
8120
|
+
function notFieldsOn(names, scope) {
|
|
8121
|
+
return `${nameList(names)} ${names.length === 1 ? "is not a field" : "are not fields"} on the ${scope} it read`;
|
|
8122
|
+
}
|
|
8123
|
+
function failingFieldRead(ast, isList, fn, argIndex) {
|
|
8124
|
+
const [left, right, condition] = ast.children ?? [];
|
|
8125
|
+
let scopes = [];
|
|
8126
|
+
if (!isList) {
|
|
8127
|
+
scopes = [ast];
|
|
8128
|
+
} else if (ast.type === "FilterProjection" && left?.type === "Identity") {
|
|
8129
|
+
scopes = [condition, right];
|
|
8130
|
+
} else if (ast.type === "Projection" && (left?.type === "Identity" || left?.type === "Flatten" && left.children?.[0]?.type === "Identity")) {
|
|
8131
|
+
scopes = [right];
|
|
8132
|
+
}
|
|
8133
|
+
const reads = new Set;
|
|
8134
|
+
let tracked = 0;
|
|
8135
|
+
const visit = (node) => {
|
|
8136
|
+
if (!node)
|
|
8137
|
+
return;
|
|
8138
|
+
switch (node.type) {
|
|
8139
|
+
case "Function": {
|
|
8140
|
+
const arg = node.children?.[argIndex - 1];
|
|
8141
|
+
if (node.name === fn && arg?.type === "Field" && arg.name) {
|
|
8142
|
+
reads.add(arg.name);
|
|
8143
|
+
tracked++;
|
|
8144
|
+
}
|
|
8145
|
+
node.children?.forEach(visit);
|
|
8146
|
+
return;
|
|
8147
|
+
}
|
|
8148
|
+
case "AndExpression":
|
|
8149
|
+
case "OrExpression":
|
|
8150
|
+
case "NotExpression":
|
|
8151
|
+
case "Comparator":
|
|
8152
|
+
case "MultiSelectList":
|
|
8153
|
+
case "MultiSelectHash":
|
|
8154
|
+
node.children?.forEach(visit);
|
|
8155
|
+
return;
|
|
8156
|
+
case "KeyValuePair":
|
|
8157
|
+
visit(node.value);
|
|
8158
|
+
return;
|
|
8159
|
+
}
|
|
8160
|
+
};
|
|
8161
|
+
scopes.forEach(visit);
|
|
8162
|
+
const calls = (node) => {
|
|
8163
|
+
if (node === null || typeof node !== "object")
|
|
8164
|
+
return 0;
|
|
8165
|
+
const own = node.type === "Function" && node.name === fn ? 1 : 0;
|
|
8166
|
+
const next = node.type === "KeyValuePair" ? [node.value] : node.children ?? [];
|
|
8167
|
+
return own + next.reduce((sum, child) => sum + calls(child), 0);
|
|
8168
|
+
};
|
|
8169
|
+
return reads.size === 1 && tracked === calls(ast) ? [...reads][0] : undefined;
|
|
8170
|
+
}
|
|
8171
|
+
function fieldExpression(name) {
|
|
8172
|
+
return /^[A-Za-z_]\w*$/.test(name) ? name : JSON.stringify(name);
|
|
8173
|
+
}
|
|
8174
|
+
function evaluationHint(codec, filter, data, cause) {
|
|
8175
|
+
const underlying = cause instanceof Error ? cause.message : String(cause);
|
|
8176
|
+
const failure = /\b(\w+)\(\) expected argument (\d+) to be type (\S+) but received type null\b/.exec(underlying);
|
|
8177
|
+
if (!failure)
|
|
8178
|
+
return;
|
|
8179
|
+
const [, fn, position, expected] = failure;
|
|
8180
|
+
const name = failingFieldRead(codec.compile(filter), Array.isArray(data), fn, Number(position));
|
|
8181
|
+
if (name === undefined)
|
|
8182
|
+
return;
|
|
8183
|
+
const present = availableFields(data);
|
|
8184
|
+
if (present.length === 0)
|
|
8185
|
+
return;
|
|
8186
|
+
const scope = `${countRecords(data)} record(s)`;
|
|
8187
|
+
if (!present.includes(name)) {
|
|
8188
|
+
return {
|
|
8189
|
+
detail: `${notFieldsOn([name], scope)}. Available fields: ${nameList(present)}.`,
|
|
8190
|
+
instructions: "Use a field the records have; names are case-sensitive."
|
|
8191
|
+
};
|
|
8192
|
+
}
|
|
8193
|
+
const records = Array.isArray(data) ? data : [data];
|
|
8194
|
+
const unset = records.filter((r) => r?.[name] == null).length;
|
|
8195
|
+
const field = fieldExpression(name);
|
|
8196
|
+
let fallback;
|
|
8197
|
+
if (expected.split(",").includes("string")) {
|
|
8198
|
+
fallback = "''";
|
|
8199
|
+
} else if (expected.split(",").includes("array")) {
|
|
8200
|
+
fallback = "`[]`";
|
|
8201
|
+
}
|
|
8202
|
+
return {
|
|
8203
|
+
detail: `\`${name}\` is null or missing on ${unset} of the ${scope} it read.`,
|
|
8204
|
+
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.`
|
|
8205
|
+
};
|
|
8206
|
+
}
|
|
8030
8207
|
function buildFilterWarning(filter, data, outcome) {
|
|
8031
8208
|
const present = availableFields(data);
|
|
8032
8209
|
const refs = referencedFields(filter);
|
|
@@ -8034,7 +8211,7 @@ function buildFilterWarning(filter, data, outcome) {
|
|
|
8034
8211
|
const unchecked = refs.nested.filter((name) => !present.includes(name));
|
|
8035
8212
|
const count = countRecords(data);
|
|
8036
8213
|
const scope = `${count} record(s)`;
|
|
8037
|
-
const isNotAField = (names) =>
|
|
8214
|
+
const isNotAField = (names) => notFieldsOn(names, scope);
|
|
8038
8215
|
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" : "";
|
|
8039
8216
|
const withSoundness = (base) => soundness ? `${base}, and ${soundness}` : base;
|
|
8040
8217
|
let detail;
|
|
@@ -8085,7 +8262,8 @@ function applyFilter(data, filter, onWarning) {
|
|
|
8085
8262
|
try {
|
|
8086
8263
|
result = codec.search(data, filter);
|
|
8087
8264
|
} catch (err) {
|
|
8088
|
-
|
|
8265
|
+
const [, hint] = catchError2(() => evaluationHint(codec, filter, data, err));
|
|
8266
|
+
throw new FilterEvaluationError(filter, err, hint);
|
|
8089
8267
|
}
|
|
8090
8268
|
const inputCount = countRecords(data);
|
|
8091
8269
|
const warn = (outcome) => {
|
|
@@ -8976,7 +9154,7 @@ Command2.prototype.trackedAction = function(context, fn, properties) {
|
|
|
8976
9154
|
logger.debug(`[trackedAction] ${telemetryName} failed: ${errorMessage}`);
|
|
8977
9155
|
const typed = error;
|
|
8978
9156
|
const customInstructions = typeof typed.instructions === "string" ? typed.instructions : undefined;
|
|
8979
|
-
const customResult =
|
|
9157
|
+
const customResult = carriedResult(error);
|
|
8980
9158
|
const cancellationExitCode = typed.exitCode === 130 || isPromptCancellation(error) ? 130 : undefined;
|
|
8981
9159
|
const classified = cancellationExitCode === undefined ? await extractErrorDetails(error) : undefined;
|
|
8982
9160
|
const finalResult = customResult ?? classified?.result ?? RESULTS.Failure;
|
|
@@ -9338,6 +9516,8 @@ var FAILURE_STATUSES = new Set([
|
|
|
9338
9516
|
"canceled",
|
|
9339
9517
|
"stopped"
|
|
9340
9518
|
]);
|
|
9519
|
+
// ../../common/src/relayed-output.ts
|
|
9520
|
+
var RELAYED_OUTPUT_SYMBOL = Symbol.for("@uipath/common/relayed-output");
|
|
9341
9521
|
// ../../common/src/screen-logger.ts
|
|
9342
9522
|
var ScreenLogger;
|
|
9343
9523
|
((ScreenLogger) => {
|
|
@@ -9605,7 +9785,7 @@ var package_default2 = {
|
|
|
9605
9785
|
name: "@uipath/identity-sdk",
|
|
9606
9786
|
author: "UiPath",
|
|
9607
9787
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
9608
|
-
version: "1.
|
|
9788
|
+
version: "1.207.0",
|
|
9609
9789
|
repository: {
|
|
9610
9790
|
type: "git",
|
|
9611
9791
|
url: "https://github.com/UiPath/cli.git",
|
|
@@ -12059,4 +12239,4 @@ export {
|
|
|
12059
12239
|
registerCommands
|
|
12060
12240
|
};
|
|
12061
12241
|
|
|
12062
|
-
//# debugId=
|
|
12242
|
+
//# debugId=BC4A51F8880692A264756E2164756E21
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@uipath/authz-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 Authorization service. 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
|
}
|