@uipath/resourcecatalog-tool 1.198.0-preview.95 → 1.198.0
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 +257 -150
- package/dist/tool.js +257 -150
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -21247,7 +21247,7 @@ var {
|
|
|
21247
21247
|
var package_default = {
|
|
21248
21248
|
name: "@uipath/resourcecatalog-tool",
|
|
21249
21249
|
license: "MIT",
|
|
21250
|
-
version: "1.198.0
|
|
21250
|
+
version: "1.198.0",
|
|
21251
21251
|
description: "CLI plugin for the UiPath Resource Catalog Service.",
|
|
21252
21252
|
private: false,
|
|
21253
21253
|
repository: {
|
|
@@ -27412,11 +27412,36 @@ class NodeContextStorage {
|
|
|
27412
27412
|
return this.storage.getStore();
|
|
27413
27413
|
}
|
|
27414
27414
|
}
|
|
27415
|
+
// ../../common/src/telemetry/trace-context.ts
|
|
27416
|
+
var TELEMETRY_TRACEPARENT_ENV = "TRACEPARENT";
|
|
27417
|
+
var TRACEPARENT_PATTERN = /^00-([0-9a-f]{32})-([0-9a-f]{16})-[0-9a-f]{2}$/;
|
|
27418
|
+
function getProcessEnv() {
|
|
27419
|
+
return globalThis.process?.env;
|
|
27420
|
+
}
|
|
27421
|
+
function parseInboundTraceparent(value) {
|
|
27422
|
+
if (!value) {
|
|
27423
|
+
return;
|
|
27424
|
+
}
|
|
27425
|
+
const match = TRACEPARENT_PATTERN.exec(value.trim().toLowerCase());
|
|
27426
|
+
if (!match) {
|
|
27427
|
+
return;
|
|
27428
|
+
}
|
|
27429
|
+
const [, traceId, parentSpanId] = match;
|
|
27430
|
+
if (/^0+$/.test(traceId) || /^0+$/.test(parentSpanId)) {
|
|
27431
|
+
return;
|
|
27432
|
+
}
|
|
27433
|
+
return { traceId, parentSpanId };
|
|
27434
|
+
}
|
|
27435
|
+
function getInboundTraceContext() {
|
|
27436
|
+
return parseInboundTraceparent(getProcessEnv()?.[TELEMETRY_TRACEPARENT_ENV]);
|
|
27437
|
+
}
|
|
27438
|
+
|
|
27415
27439
|
// ../../common/src/telemetry/session-id.ts
|
|
27416
27440
|
var TELEMETRY_SESSION_ID_ENV = "UIPATH_SESSION_ID";
|
|
27417
27441
|
var TELEMETRY_SESSION_ID_PROPERTY = "session_id";
|
|
27418
27442
|
var telemetrySessionIdSlot = singleton("TelemetrySessionId");
|
|
27419
|
-
|
|
27443
|
+
var telemetryOperationIdSlot = singleton("TelemetryOperationId");
|
|
27444
|
+
function getProcessEnv2() {
|
|
27420
27445
|
return globalThis.process?.env;
|
|
27421
27446
|
}
|
|
27422
27447
|
function normalizeSessionId(value) {
|
|
@@ -27427,18 +27452,165 @@ function normalizeSessionId(value) {
|
|
|
27427
27452
|
return trimmed || undefined;
|
|
27428
27453
|
}
|
|
27429
27454
|
function getConfiguredTelemetrySessionId() {
|
|
27430
|
-
return normalizeSessionId(
|
|
27455
|
+
return normalizeSessionId(getProcessEnv2()?.[TELEMETRY_SESSION_ID_ENV]);
|
|
27431
27456
|
}
|
|
27432
27457
|
function resolveTelemetrySessionId(existingSessionId) {
|
|
27433
27458
|
return getConfiguredTelemetrySessionId() ?? normalizeSessionId(existingSessionId);
|
|
27434
27459
|
}
|
|
27460
|
+
function getTelemetryOperationId() {
|
|
27461
|
+
const existing = telemetryOperationIdSlot.get();
|
|
27462
|
+
if (existing) {
|
|
27463
|
+
return existing;
|
|
27464
|
+
}
|
|
27465
|
+
const inboundTraceId = getInboundTraceContext()?.traceId;
|
|
27466
|
+
const generated = inboundTraceId ?? crypto.randomUUID().replaceAll("-", "");
|
|
27467
|
+
telemetryOperationIdSlot.set(generated);
|
|
27468
|
+
return generated;
|
|
27469
|
+
}
|
|
27435
27470
|
// ../../common/src/telemetry/global-telemetry-properties.ts
|
|
27436
27471
|
var telemetryPropsSlot = singleton("TelemetryDefaultProps");
|
|
27437
27472
|
function getGlobalTelemetryProperties() {
|
|
27438
27473
|
return telemetryPropsSlot.get();
|
|
27439
27474
|
}
|
|
27440
27475
|
|
|
27476
|
+
// ../../common/src/telemetry/pii-redactor.ts
|
|
27477
|
+
var REDACTED = "[REDACTED]";
|
|
27478
|
+
var MAX_VALUE_LENGTH = 200;
|
|
27479
|
+
var SENSITIVE_NAME_TOKENS = new Set([
|
|
27480
|
+
"token",
|
|
27481
|
+
"tokens",
|
|
27482
|
+
"secret",
|
|
27483
|
+
"secrets",
|
|
27484
|
+
"password",
|
|
27485
|
+
"passwords",
|
|
27486
|
+
"pwd",
|
|
27487
|
+
"credential",
|
|
27488
|
+
"credentials",
|
|
27489
|
+
"auth",
|
|
27490
|
+
"authentication",
|
|
27491
|
+
"authorization",
|
|
27492
|
+
"authority",
|
|
27493
|
+
"cert",
|
|
27494
|
+
"certificate",
|
|
27495
|
+
"certificates"
|
|
27496
|
+
]);
|
|
27497
|
+
var SENSITIVE_KEY_PREFIXES = new Set([
|
|
27498
|
+
"api",
|
|
27499
|
+
"access",
|
|
27500
|
+
"client",
|
|
27501
|
+
"private",
|
|
27502
|
+
"public",
|
|
27503
|
+
"signing",
|
|
27504
|
+
"encryption",
|
|
27505
|
+
"session",
|
|
27506
|
+
"master",
|
|
27507
|
+
"shared",
|
|
27508
|
+
"root",
|
|
27509
|
+
"ssh",
|
|
27510
|
+
"rsa",
|
|
27511
|
+
"aes",
|
|
27512
|
+
"hmac",
|
|
27513
|
+
"oauth"
|
|
27514
|
+
]);
|
|
27515
|
+
var UUID_PATTERN = /\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/gi;
|
|
27516
|
+
var EMAIL_PATTERN = /\b[^\s@]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/g;
|
|
27517
|
+
var JWT_PATTERN = /\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/g;
|
|
27518
|
+
var LONG_TOKEN_PATTERN = /\b[A-Za-z0-9_-]{40,}\b/g;
|
|
27519
|
+
var USER_HOME_PATTERN = /([/\\])(Users|home)([/\\])([^/\\]+)/gi;
|
|
27520
|
+
var URL_PATTERN = /\bhttps?:\/\/[^\s,;]+/gi;
|
|
27521
|
+
var URL_TRAILING_PUNCT = /[.,;:!?)\]}>'"]+$/;
|
|
27522
|
+
function shortHash(input) {
|
|
27523
|
+
let hash = 2166136261;
|
|
27524
|
+
for (let i = 0;i < input.length; i++) {
|
|
27525
|
+
hash ^= input.charCodeAt(i);
|
|
27526
|
+
hash = Math.imul(hash, 16777619);
|
|
27527
|
+
}
|
|
27528
|
+
return (hash >>> 0).toString(16).padStart(8, "0");
|
|
27529
|
+
}
|
|
27530
|
+
function redactUrl(raw) {
|
|
27531
|
+
try {
|
|
27532
|
+
const url = new URL(raw);
|
|
27533
|
+
return `${url.protocol}//${url.host}`;
|
|
27534
|
+
} catch {
|
|
27535
|
+
return `url#${shortHash(raw)}`;
|
|
27536
|
+
}
|
|
27537
|
+
}
|
|
27538
|
+
function redactValueDetectors(value) {
|
|
27539
|
+
let out = value;
|
|
27540
|
+
out = out.replace(JWT_PATTERN, () => REDACTED);
|
|
27541
|
+
out = out.replace(URL_PATTERN, (match) => {
|
|
27542
|
+
const trailing = match.match(URL_TRAILING_PUNCT)?.[0] ?? "";
|
|
27543
|
+
const core2 = trailing ? match.slice(0, -trailing.length) : match;
|
|
27544
|
+
return `${redactUrl(core2)}${trailing}`;
|
|
27545
|
+
});
|
|
27546
|
+
out = out.replace(USER_HOME_PATTERN, (_match, sep1, folder, sep2) => `${sep1}${folder}${sep2}<user>`);
|
|
27547
|
+
out = out.replace(EMAIL_PATTERN, (match) => `email#${shortHash(match)}`);
|
|
27548
|
+
out = out.replace(UUID_PATTERN, (match) => `uuid#${shortHash(match)}`);
|
|
27549
|
+
out = out.replace(LONG_TOKEN_PATTERN, () => REDACTED);
|
|
27550
|
+
if (out.length > MAX_VALUE_LENGTH) {
|
|
27551
|
+
out = `${out.slice(0, MAX_VALUE_LENGTH)}…`;
|
|
27552
|
+
}
|
|
27553
|
+
return out;
|
|
27554
|
+
}
|
|
27555
|
+
function redactValue(value) {
|
|
27556
|
+
return redactValueDetectors(value);
|
|
27557
|
+
}
|
|
27558
|
+
function redactError(error) {
|
|
27559
|
+
const safe = new Error(redactValueDetectors(error.message ?? ""));
|
|
27560
|
+
safe.name = error.name;
|
|
27561
|
+
safe.stack = typeof error.stack === "string" ? redactValueDetectors(error.stack) : undefined;
|
|
27562
|
+
return safe;
|
|
27563
|
+
}
|
|
27564
|
+
function nameTokens(name) {
|
|
27565
|
+
return name.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g, "$1 $2").split(/[\s._-]+/).map((t) => t.toLowerCase()).filter(Boolean);
|
|
27566
|
+
}
|
|
27567
|
+
function isSensitiveName(name) {
|
|
27568
|
+
const tokens = nameTokens(name);
|
|
27569
|
+
for (let i = 0;i < tokens.length; i++) {
|
|
27570
|
+
const token = tokens[i];
|
|
27571
|
+
if (SENSITIVE_NAME_TOKENS.has(token)) {
|
|
27572
|
+
return true;
|
|
27573
|
+
}
|
|
27574
|
+
if (token === "key" || token === "keys") {
|
|
27575
|
+
const prev = tokens[i - 1];
|
|
27576
|
+
if (prev && SENSITIVE_KEY_PREFIXES.has(prev)) {
|
|
27577
|
+
return true;
|
|
27578
|
+
}
|
|
27579
|
+
}
|
|
27580
|
+
}
|
|
27581
|
+
return false;
|
|
27582
|
+
}
|
|
27583
|
+
function redactProperty(name, value) {
|
|
27584
|
+
if (value === undefined || value === null) {
|
|
27585
|
+
return;
|
|
27586
|
+
}
|
|
27587
|
+
if (isSensitiveName(name)) {
|
|
27588
|
+
return REDACTED;
|
|
27589
|
+
}
|
|
27590
|
+
if (typeof value === "boolean" || typeof value === "number") {
|
|
27591
|
+
return value;
|
|
27592
|
+
}
|
|
27593
|
+
if (typeof value !== "string") {
|
|
27594
|
+
return "[OBJECT]";
|
|
27595
|
+
}
|
|
27596
|
+
return redactValueDetectors(value);
|
|
27597
|
+
}
|
|
27598
|
+
function redactProperties(properties) {
|
|
27599
|
+
const out = {};
|
|
27600
|
+
for (const [name, value] of Object.entries(properties)) {
|
|
27601
|
+
const redacted = redactProperty(name, value);
|
|
27602
|
+
if (redacted !== undefined) {
|
|
27603
|
+
out[name] = redacted;
|
|
27604
|
+
}
|
|
27605
|
+
}
|
|
27606
|
+
return out;
|
|
27607
|
+
}
|
|
27608
|
+
|
|
27441
27609
|
// ../../common/src/telemetry/telemetry-service.ts
|
|
27610
|
+
var TELEMETRY_OPERATION_ID_PROPERTY = "uip.trace.operation_id";
|
|
27611
|
+
var TELEMETRY_PARENT_ID_PROPERTY = "uip.trace.parent_id";
|
|
27612
|
+
var TELEMETRY_SPAN_ID_PROPERTY = "uip.trace.span_id";
|
|
27613
|
+
|
|
27442
27614
|
class TelemetryService {
|
|
27443
27615
|
telemetryProvider;
|
|
27444
27616
|
contextStorage;
|
|
@@ -27465,11 +27637,15 @@ class TelemetryService {
|
|
|
27465
27637
|
trackException(error, properties) {
|
|
27466
27638
|
const context = this.getCurrentContext();
|
|
27467
27639
|
const enrichedProperties = this.enrichPropertiesWithContext(properties, context);
|
|
27468
|
-
this.telemetryProvider.trackException(error, enrichedProperties);
|
|
27640
|
+
this.telemetryProvider.trackException(redactError(error), enrichedProperties);
|
|
27469
27641
|
}
|
|
27470
27642
|
async trackRequest(name, fn, properties) {
|
|
27643
|
+
const parentContext = this.getCurrentContext();
|
|
27644
|
+
const operationId = parentContext?.operationId ?? this.operationId ?? getTelemetryOperationId();
|
|
27645
|
+
const parentId = parentContext ? parentContext.id : this.inboundParentIdFor(operationId);
|
|
27471
27646
|
const context = {
|
|
27472
|
-
operationId
|
|
27647
|
+
operationId,
|
|
27648
|
+
...parentId !== undefined ? { parentId } : {},
|
|
27473
27649
|
id: this.generateId()
|
|
27474
27650
|
};
|
|
27475
27651
|
const startTime = performance.now();
|
|
@@ -27487,6 +27663,45 @@ class TelemetryService {
|
|
|
27487
27663
|
throw error;
|
|
27488
27664
|
}
|
|
27489
27665
|
}
|
|
27666
|
+
trackRequestResult(name, durationMs, success, properties, context) {
|
|
27667
|
+
const requestContext = context ?? {
|
|
27668
|
+
operationId: this.operationId ?? getTelemetryOperationId(),
|
|
27669
|
+
id: this.generateId()
|
|
27670
|
+
};
|
|
27671
|
+
const enrichedProperties = this.enrichPropertiesWithContext(properties, requestContext);
|
|
27672
|
+
this.telemetryProvider.trackRequest(name, durationMs, success, enrichedProperties);
|
|
27673
|
+
}
|
|
27674
|
+
createRequestContext() {
|
|
27675
|
+
const operationId = this.operationId ?? getTelemetryOperationId();
|
|
27676
|
+
const parentId = this.inboundParentIdFor(operationId);
|
|
27677
|
+
return {
|
|
27678
|
+
operationId,
|
|
27679
|
+
...parentId !== undefined ? { parentId } : {},
|
|
27680
|
+
id: this.generateId()
|
|
27681
|
+
};
|
|
27682
|
+
}
|
|
27683
|
+
inboundParentIdFor(operationId) {
|
|
27684
|
+
const inbound = getInboundTraceContext();
|
|
27685
|
+
return inbound && inbound.traceId === operationId ? inbound.parentSpanId : undefined;
|
|
27686
|
+
}
|
|
27687
|
+
runWithContext(context, fn) {
|
|
27688
|
+
return this.contextStorage.run(context, fn);
|
|
27689
|
+
}
|
|
27690
|
+
createDependencyContext() {
|
|
27691
|
+
const parentContext = this.getCurrentContext();
|
|
27692
|
+
if (!parentContext) {
|
|
27693
|
+
return;
|
|
27694
|
+
}
|
|
27695
|
+
return {
|
|
27696
|
+
operationId: parentContext.operationId,
|
|
27697
|
+
parentId: parentContext.id,
|
|
27698
|
+
id: this.generateId()
|
|
27699
|
+
};
|
|
27700
|
+
}
|
|
27701
|
+
trackDependencyResult(name, type2, durationMs, success, properties, context, resultCode) {
|
|
27702
|
+
const enrichedProperties = this.enrichPropertiesWithContext(properties, context);
|
|
27703
|
+
this.telemetryProvider.trackDependency(redactValue(name), type2, durationMs, success, enrichedProperties, resultCode);
|
|
27704
|
+
}
|
|
27490
27705
|
async trackDependencyOperation(name, type2, fn, properties) {
|
|
27491
27706
|
const parentContext = this.getCurrentContext();
|
|
27492
27707
|
if (!parentContext) {
|
|
@@ -27523,8 +27738,12 @@ class TelemetryService {
|
|
|
27523
27738
|
...getExecutionContextTelemetryProperties(),
|
|
27524
27739
|
...globalProperties,
|
|
27525
27740
|
...this.defaultProperties,
|
|
27526
|
-
...properties,
|
|
27527
|
-
...context
|
|
27741
|
+
...redactProperties(properties ?? {}),
|
|
27742
|
+
...context ? {
|
|
27743
|
+
[TELEMETRY_OPERATION_ID_PROPERTY]: context.operationId,
|
|
27744
|
+
...context.parentId !== undefined ? { [TELEMETRY_PARENT_ID_PROPERTY]: context.parentId } : {},
|
|
27745
|
+
[TELEMETRY_SPAN_ID_PROPERTY]: context.id
|
|
27746
|
+
} : {}
|
|
27528
27747
|
};
|
|
27529
27748
|
if (sessionId === undefined) {
|
|
27530
27749
|
delete enriched[TELEMETRY_SESSION_ID_PROPERTY];
|
|
@@ -27534,7 +27753,16 @@ class TelemetryService {
|
|
|
27534
27753
|
return enriched;
|
|
27535
27754
|
}
|
|
27536
27755
|
generateId() {
|
|
27537
|
-
|
|
27756
|
+
const bytes = new Uint8Array(8);
|
|
27757
|
+
let hex = "";
|
|
27758
|
+
do {
|
|
27759
|
+
crypto.getRandomValues(bytes);
|
|
27760
|
+
hex = "";
|
|
27761
|
+
for (const byte of bytes) {
|
|
27762
|
+
hex += byte.toString(16).padStart(2, "0");
|
|
27763
|
+
}
|
|
27764
|
+
} while (/^0+$/.test(hex));
|
|
27765
|
+
return hex;
|
|
27538
27766
|
}
|
|
27539
27767
|
}
|
|
27540
27768
|
// ../../common/src/telemetry/node-appinsights-telemetry-provider.ts
|
|
@@ -28236,134 +28464,11 @@ function buildCommandTelemetryAttribution(commandPath, skillSource) {
|
|
|
28236
28464
|
};
|
|
28237
28465
|
}
|
|
28238
28466
|
|
|
28239
|
-
// ../../common/src/telemetry/pii-redactor.ts
|
|
28240
|
-
var REDACTED = "[REDACTED]";
|
|
28241
|
-
var MAX_VALUE_LENGTH = 200;
|
|
28242
|
-
var SENSITIVE_NAME_TOKENS = new Set([
|
|
28243
|
-
"token",
|
|
28244
|
-
"tokens",
|
|
28245
|
-
"secret",
|
|
28246
|
-
"secrets",
|
|
28247
|
-
"password",
|
|
28248
|
-
"passwords",
|
|
28249
|
-
"pwd",
|
|
28250
|
-
"credential",
|
|
28251
|
-
"credentials",
|
|
28252
|
-
"auth",
|
|
28253
|
-
"authentication",
|
|
28254
|
-
"authorization",
|
|
28255
|
-
"authority",
|
|
28256
|
-
"cert",
|
|
28257
|
-
"certificate",
|
|
28258
|
-
"certificates"
|
|
28259
|
-
]);
|
|
28260
|
-
var SENSITIVE_KEY_PREFIXES = new Set([
|
|
28261
|
-
"api",
|
|
28262
|
-
"access",
|
|
28263
|
-
"client",
|
|
28264
|
-
"private",
|
|
28265
|
-
"public",
|
|
28266
|
-
"signing",
|
|
28267
|
-
"encryption",
|
|
28268
|
-
"session",
|
|
28269
|
-
"master",
|
|
28270
|
-
"shared",
|
|
28271
|
-
"root",
|
|
28272
|
-
"ssh",
|
|
28273
|
-
"rsa",
|
|
28274
|
-
"aes",
|
|
28275
|
-
"hmac",
|
|
28276
|
-
"oauth"
|
|
28277
|
-
]);
|
|
28278
|
-
var UUID_PATTERN = /\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/gi;
|
|
28279
|
-
var EMAIL_PATTERN = /\b[^\s@]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/g;
|
|
28280
|
-
var JWT_PATTERN = /\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/g;
|
|
28281
|
-
var LONG_TOKEN_PATTERN = /\b[A-Za-z0-9_-]{40,}\b/g;
|
|
28282
|
-
var USER_HOME_PATTERN = /([/\\])(Users|home)([/\\])([^/\\]+)/gi;
|
|
28283
|
-
var URL_PATTERN = /\bhttps?:\/\/[^\s,;]+/gi;
|
|
28284
|
-
var URL_TRAILING_PUNCT = /[.,;:!?)\]}>'"]+$/;
|
|
28285
|
-
function shortHash(input) {
|
|
28286
|
-
let hash = 2166136261;
|
|
28287
|
-
for (let i = 0;i < input.length; i++) {
|
|
28288
|
-
hash ^= input.charCodeAt(i);
|
|
28289
|
-
hash = Math.imul(hash, 16777619);
|
|
28290
|
-
}
|
|
28291
|
-
return (hash >>> 0).toString(16).padStart(8, "0");
|
|
28292
|
-
}
|
|
28293
|
-
function redactUrl(raw) {
|
|
28294
|
-
try {
|
|
28295
|
-
const url = new URL(raw);
|
|
28296
|
-
return `${url.protocol}//${url.host}`;
|
|
28297
|
-
} catch {
|
|
28298
|
-
return `url#${shortHash(raw)}`;
|
|
28299
|
-
}
|
|
28300
|
-
}
|
|
28301
|
-
function redactValueDetectors(value) {
|
|
28302
|
-
let out = value;
|
|
28303
|
-
out = out.replace(JWT_PATTERN, () => REDACTED);
|
|
28304
|
-
out = out.replace(URL_PATTERN, (match) => {
|
|
28305
|
-
const trailing = match.match(URL_TRAILING_PUNCT)?.[0] ?? "";
|
|
28306
|
-
const core2 = trailing ? match.slice(0, -trailing.length) : match;
|
|
28307
|
-
return `${redactUrl(core2)}${trailing}`;
|
|
28308
|
-
});
|
|
28309
|
-
out = out.replace(USER_HOME_PATTERN, (_match, sep1, folder, sep2) => `${sep1}${folder}${sep2}<user>`);
|
|
28310
|
-
out = out.replace(EMAIL_PATTERN, (match) => `email#${shortHash(match)}`);
|
|
28311
|
-
out = out.replace(UUID_PATTERN, (match) => `uuid#${shortHash(match)}`);
|
|
28312
|
-
out = out.replace(LONG_TOKEN_PATTERN, () => REDACTED);
|
|
28313
|
-
if (out.length > MAX_VALUE_LENGTH) {
|
|
28314
|
-
out = `${out.slice(0, MAX_VALUE_LENGTH)}…`;
|
|
28315
|
-
}
|
|
28316
|
-
return out;
|
|
28317
|
-
}
|
|
28318
|
-
function nameTokens(name) {
|
|
28319
|
-
return name.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g, "$1 $2").split(/[\s_-]+/).map((t) => t.toLowerCase()).filter(Boolean);
|
|
28320
|
-
}
|
|
28321
|
-
function isSensitiveName(name) {
|
|
28322
|
-
const tokens = nameTokens(name);
|
|
28323
|
-
for (let i = 0;i < tokens.length; i++) {
|
|
28324
|
-
const token = tokens[i];
|
|
28325
|
-
if (SENSITIVE_NAME_TOKENS.has(token)) {
|
|
28326
|
-
return true;
|
|
28327
|
-
}
|
|
28328
|
-
if (token === "key" || token === "keys") {
|
|
28329
|
-
const prev = tokens[i - 1];
|
|
28330
|
-
if (prev && SENSITIVE_KEY_PREFIXES.has(prev)) {
|
|
28331
|
-
return true;
|
|
28332
|
-
}
|
|
28333
|
-
}
|
|
28334
|
-
}
|
|
28335
|
-
return false;
|
|
28336
|
-
}
|
|
28337
|
-
function redactProperty(name, value) {
|
|
28338
|
-
if (value === undefined || value === null) {
|
|
28339
|
-
return;
|
|
28340
|
-
}
|
|
28341
|
-
if (isSensitiveName(name)) {
|
|
28342
|
-
return REDACTED;
|
|
28343
|
-
}
|
|
28344
|
-
if (typeof value === "boolean" || typeof value === "number") {
|
|
28345
|
-
return value;
|
|
28346
|
-
}
|
|
28347
|
-
if (typeof value !== "string") {
|
|
28348
|
-
return "[OBJECT]";
|
|
28349
|
-
}
|
|
28350
|
-
return redactValueDetectors(value);
|
|
28351
|
-
}
|
|
28352
|
-
function redactProperties(properties) {
|
|
28353
|
-
const out = {};
|
|
28354
|
-
for (const [name, value] of Object.entries(properties)) {
|
|
28355
|
-
const redacted = redactProperty(name, value);
|
|
28356
|
-
if (redacted !== undefined) {
|
|
28357
|
-
out[name] = redacted;
|
|
28358
|
-
}
|
|
28359
|
-
}
|
|
28360
|
-
return out;
|
|
28361
|
-
}
|
|
28362
|
-
|
|
28363
28467
|
// ../../common/src/trackedAction.ts
|
|
28364
28468
|
var pollSignalSlot = singleton("PollSignal");
|
|
28365
28469
|
var cliErrorCodeValues = new Set(CLI_ERROR_CODES);
|
|
28366
28470
|
var retryHintValues = new Set(RETRY_HINTS);
|
|
28471
|
+
var TELEMETRY_COMMAND_ARG_PREFIX = "uip.cmd.arg.";
|
|
28367
28472
|
var processContext = {
|
|
28368
28473
|
exit: (code) => {
|
|
28369
28474
|
process.exitCode = code;
|
|
@@ -28374,22 +28479,18 @@ var processContext = {
|
|
|
28374
28479
|
};
|
|
28375
28480
|
function extractCommandParams(cmd) {
|
|
28376
28481
|
const params = {};
|
|
28482
|
+
const add2 = (name, value) => {
|
|
28483
|
+
if (name && value !== undefined) {
|
|
28484
|
+
params[`${TELEMETRY_COMMAND_ARG_PREFIX}${name}`] = value;
|
|
28485
|
+
}
|
|
28486
|
+
};
|
|
28377
28487
|
const registered = cmd.registeredArguments ?? [];
|
|
28378
28488
|
const processed = cmd.processedArgs ?? [];
|
|
28379
28489
|
for (let i = 0;i < registered.length; i++) {
|
|
28380
|
-
|
|
28381
|
-
if (value === undefined) {
|
|
28382
|
-
continue;
|
|
28383
|
-
}
|
|
28384
|
-
const name = registered[i].name();
|
|
28385
|
-
if (name) {
|
|
28386
|
-
params[name] = value;
|
|
28387
|
-
}
|
|
28490
|
+
add2(registered[i].name(), processed[i]);
|
|
28388
28491
|
}
|
|
28389
28492
|
for (const [key, value] of Object.entries(cmd.opts())) {
|
|
28390
|
-
|
|
28391
|
-
params[key] = value;
|
|
28392
|
-
}
|
|
28493
|
+
add2(key, value);
|
|
28393
28494
|
}
|
|
28394
28495
|
return params;
|
|
28395
28496
|
}
|
|
@@ -28432,11 +28533,12 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
28432
28533
|
return this.action(async (...args) => {
|
|
28433
28534
|
const telemetryName = deriveCommandPath(command);
|
|
28434
28535
|
const props = typeof properties === "function" ? properties(...args) : properties;
|
|
28536
|
+
const requestContext = telemetry.createRequestContext();
|
|
28435
28537
|
const startTime = performance.now();
|
|
28436
28538
|
let errorMessage;
|
|
28437
28539
|
let fallbackExitCode = EXIT_CODES.Success;
|
|
28438
28540
|
clearRecordedCommandFailureTelemetry();
|
|
28439
|
-
const [error] = await catchError(fn(...args));
|
|
28541
|
+
const [error] = await catchError(telemetry.runWithContext(requestContext, () => fn(...args)));
|
|
28440
28542
|
if (error) {
|
|
28441
28543
|
errorMessage = error instanceof Error ? error.message : String(error);
|
|
28442
28544
|
logger.debug(`[trackedAction] ${telemetryName} failed: ${errorMessage}`);
|
|
@@ -28472,16 +28574,21 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
28472
28574
|
recordedFailure,
|
|
28473
28575
|
pollSignal: context.pollSignal
|
|
28474
28576
|
});
|
|
28475
|
-
|
|
28476
|
-
|
|
28577
|
+
const commandParams = extractCommandParams(command);
|
|
28578
|
+
if (props) {
|
|
28579
|
+
for (const key of Object.keys(props)) {
|
|
28580
|
+
delete commandParams[`${TELEMETRY_COMMAND_ARG_PREFIX}${key}`];
|
|
28581
|
+
}
|
|
28582
|
+
}
|
|
28583
|
+
const baseProperties = redactProperties({
|
|
28584
|
+
...commandParams,
|
|
28477
28585
|
...props,
|
|
28478
28586
|
...buildCommandTelemetryAttribution(telemetryName, process.env.UIPATH_SKILL),
|
|
28479
28587
|
command: "true",
|
|
28480
|
-
duration: String(durationMs),
|
|
28481
|
-
success: String(success),
|
|
28482
28588
|
...terminalTelemetry,
|
|
28483
28589
|
...errorMessage ? { errorMessage } : {}
|
|
28484
|
-
})
|
|
28590
|
+
});
|
|
28591
|
+
telemetry.trackRequestResult(telemetryName, durationMs, success, baseProperties, requestContext);
|
|
28485
28592
|
});
|
|
28486
28593
|
};
|
|
28487
28594
|
// ../../common/src/console-guard.ts
|
|
@@ -31760,4 +31867,4 @@ program2.name(metadata.commandPrefix).description(metadata.description).version(
|
|
|
31760
31867
|
await registerCommands(program2);
|
|
31761
31868
|
program2.parse(process.argv);
|
|
31762
31869
|
|
|
31763
|
-
//# debugId=
|
|
31870
|
+
//# debugId=22E52BACC3F14CFA64756E2164756E21
|
package/dist/tool.js
CHANGED
|
@@ -19137,7 +19137,7 @@ var init_server = __esm(() => {
|
|
|
19137
19137
|
var package_default = {
|
|
19138
19138
|
name: "@uipath/resourcecatalog-tool",
|
|
19139
19139
|
license: "MIT",
|
|
19140
|
-
version: "1.198.0
|
|
19140
|
+
version: "1.198.0",
|
|
19141
19141
|
description: "CLI plugin for the UiPath Resource Catalog Service.",
|
|
19142
19142
|
private: false,
|
|
19143
19143
|
repository: {
|
|
@@ -25303,11 +25303,36 @@ class NodeContextStorage {
|
|
|
25303
25303
|
return this.storage.getStore();
|
|
25304
25304
|
}
|
|
25305
25305
|
}
|
|
25306
|
+
// ../../common/src/telemetry/trace-context.ts
|
|
25307
|
+
var TELEMETRY_TRACEPARENT_ENV = "TRACEPARENT";
|
|
25308
|
+
var TRACEPARENT_PATTERN = /^00-([0-9a-f]{32})-([0-9a-f]{16})-[0-9a-f]{2}$/;
|
|
25309
|
+
function getProcessEnv() {
|
|
25310
|
+
return globalThis.process?.env;
|
|
25311
|
+
}
|
|
25312
|
+
function parseInboundTraceparent(value) {
|
|
25313
|
+
if (!value) {
|
|
25314
|
+
return;
|
|
25315
|
+
}
|
|
25316
|
+
const match = TRACEPARENT_PATTERN.exec(value.trim().toLowerCase());
|
|
25317
|
+
if (!match) {
|
|
25318
|
+
return;
|
|
25319
|
+
}
|
|
25320
|
+
const [, traceId, parentSpanId] = match;
|
|
25321
|
+
if (/^0+$/.test(traceId) || /^0+$/.test(parentSpanId)) {
|
|
25322
|
+
return;
|
|
25323
|
+
}
|
|
25324
|
+
return { traceId, parentSpanId };
|
|
25325
|
+
}
|
|
25326
|
+
function getInboundTraceContext() {
|
|
25327
|
+
return parseInboundTraceparent(getProcessEnv()?.[TELEMETRY_TRACEPARENT_ENV]);
|
|
25328
|
+
}
|
|
25329
|
+
|
|
25306
25330
|
// ../../common/src/telemetry/session-id.ts
|
|
25307
25331
|
var TELEMETRY_SESSION_ID_ENV = "UIPATH_SESSION_ID";
|
|
25308
25332
|
var TELEMETRY_SESSION_ID_PROPERTY = "session_id";
|
|
25309
25333
|
var telemetrySessionIdSlot = singleton("TelemetrySessionId");
|
|
25310
|
-
|
|
25334
|
+
var telemetryOperationIdSlot = singleton("TelemetryOperationId");
|
|
25335
|
+
function getProcessEnv2() {
|
|
25311
25336
|
return globalThis.process?.env;
|
|
25312
25337
|
}
|
|
25313
25338
|
function normalizeSessionId(value) {
|
|
@@ -25318,18 +25343,165 @@ function normalizeSessionId(value) {
|
|
|
25318
25343
|
return trimmed || undefined;
|
|
25319
25344
|
}
|
|
25320
25345
|
function getConfiguredTelemetrySessionId() {
|
|
25321
|
-
return normalizeSessionId(
|
|
25346
|
+
return normalizeSessionId(getProcessEnv2()?.[TELEMETRY_SESSION_ID_ENV]);
|
|
25322
25347
|
}
|
|
25323
25348
|
function resolveTelemetrySessionId(existingSessionId) {
|
|
25324
25349
|
return getConfiguredTelemetrySessionId() ?? normalizeSessionId(existingSessionId);
|
|
25325
25350
|
}
|
|
25351
|
+
function getTelemetryOperationId() {
|
|
25352
|
+
const existing = telemetryOperationIdSlot.get();
|
|
25353
|
+
if (existing) {
|
|
25354
|
+
return existing;
|
|
25355
|
+
}
|
|
25356
|
+
const inboundTraceId = getInboundTraceContext()?.traceId;
|
|
25357
|
+
const generated = inboundTraceId ?? crypto.randomUUID().replaceAll("-", "");
|
|
25358
|
+
telemetryOperationIdSlot.set(generated);
|
|
25359
|
+
return generated;
|
|
25360
|
+
}
|
|
25326
25361
|
// ../../common/src/telemetry/global-telemetry-properties.ts
|
|
25327
25362
|
var telemetryPropsSlot = singleton("TelemetryDefaultProps");
|
|
25328
25363
|
function getGlobalTelemetryProperties() {
|
|
25329
25364
|
return telemetryPropsSlot.get();
|
|
25330
25365
|
}
|
|
25331
25366
|
|
|
25367
|
+
// ../../common/src/telemetry/pii-redactor.ts
|
|
25368
|
+
var REDACTED = "[REDACTED]";
|
|
25369
|
+
var MAX_VALUE_LENGTH = 200;
|
|
25370
|
+
var SENSITIVE_NAME_TOKENS = new Set([
|
|
25371
|
+
"token",
|
|
25372
|
+
"tokens",
|
|
25373
|
+
"secret",
|
|
25374
|
+
"secrets",
|
|
25375
|
+
"password",
|
|
25376
|
+
"passwords",
|
|
25377
|
+
"pwd",
|
|
25378
|
+
"credential",
|
|
25379
|
+
"credentials",
|
|
25380
|
+
"auth",
|
|
25381
|
+
"authentication",
|
|
25382
|
+
"authorization",
|
|
25383
|
+
"authority",
|
|
25384
|
+
"cert",
|
|
25385
|
+
"certificate",
|
|
25386
|
+
"certificates"
|
|
25387
|
+
]);
|
|
25388
|
+
var SENSITIVE_KEY_PREFIXES = new Set([
|
|
25389
|
+
"api",
|
|
25390
|
+
"access",
|
|
25391
|
+
"client",
|
|
25392
|
+
"private",
|
|
25393
|
+
"public",
|
|
25394
|
+
"signing",
|
|
25395
|
+
"encryption",
|
|
25396
|
+
"session",
|
|
25397
|
+
"master",
|
|
25398
|
+
"shared",
|
|
25399
|
+
"root",
|
|
25400
|
+
"ssh",
|
|
25401
|
+
"rsa",
|
|
25402
|
+
"aes",
|
|
25403
|
+
"hmac",
|
|
25404
|
+
"oauth"
|
|
25405
|
+
]);
|
|
25406
|
+
var UUID_PATTERN = /\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/gi;
|
|
25407
|
+
var EMAIL_PATTERN = /\b[^\s@]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/g;
|
|
25408
|
+
var JWT_PATTERN = /\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/g;
|
|
25409
|
+
var LONG_TOKEN_PATTERN = /\b[A-Za-z0-9_-]{40,}\b/g;
|
|
25410
|
+
var USER_HOME_PATTERN = /([/\\])(Users|home)([/\\])([^/\\]+)/gi;
|
|
25411
|
+
var URL_PATTERN = /\bhttps?:\/\/[^\s,;]+/gi;
|
|
25412
|
+
var URL_TRAILING_PUNCT = /[.,;:!?)\]}>'"]+$/;
|
|
25413
|
+
function shortHash(input) {
|
|
25414
|
+
let hash = 2166136261;
|
|
25415
|
+
for (let i = 0;i < input.length; i++) {
|
|
25416
|
+
hash ^= input.charCodeAt(i);
|
|
25417
|
+
hash = Math.imul(hash, 16777619);
|
|
25418
|
+
}
|
|
25419
|
+
return (hash >>> 0).toString(16).padStart(8, "0");
|
|
25420
|
+
}
|
|
25421
|
+
function redactUrl(raw) {
|
|
25422
|
+
try {
|
|
25423
|
+
const url = new URL(raw);
|
|
25424
|
+
return `${url.protocol}//${url.host}`;
|
|
25425
|
+
} catch {
|
|
25426
|
+
return `url#${shortHash(raw)}`;
|
|
25427
|
+
}
|
|
25428
|
+
}
|
|
25429
|
+
function redactValueDetectors(value) {
|
|
25430
|
+
let out = value;
|
|
25431
|
+
out = out.replace(JWT_PATTERN, () => REDACTED);
|
|
25432
|
+
out = out.replace(URL_PATTERN, (match) => {
|
|
25433
|
+
const trailing = match.match(URL_TRAILING_PUNCT)?.[0] ?? "";
|
|
25434
|
+
const core2 = trailing ? match.slice(0, -trailing.length) : match;
|
|
25435
|
+
return `${redactUrl(core2)}${trailing}`;
|
|
25436
|
+
});
|
|
25437
|
+
out = out.replace(USER_HOME_PATTERN, (_match, sep1, folder, sep2) => `${sep1}${folder}${sep2}<user>`);
|
|
25438
|
+
out = out.replace(EMAIL_PATTERN, (match) => `email#${shortHash(match)}`);
|
|
25439
|
+
out = out.replace(UUID_PATTERN, (match) => `uuid#${shortHash(match)}`);
|
|
25440
|
+
out = out.replace(LONG_TOKEN_PATTERN, () => REDACTED);
|
|
25441
|
+
if (out.length > MAX_VALUE_LENGTH) {
|
|
25442
|
+
out = `${out.slice(0, MAX_VALUE_LENGTH)}…`;
|
|
25443
|
+
}
|
|
25444
|
+
return out;
|
|
25445
|
+
}
|
|
25446
|
+
function redactValue(value) {
|
|
25447
|
+
return redactValueDetectors(value);
|
|
25448
|
+
}
|
|
25449
|
+
function redactError(error) {
|
|
25450
|
+
const safe = new Error(redactValueDetectors(error.message ?? ""));
|
|
25451
|
+
safe.name = error.name;
|
|
25452
|
+
safe.stack = typeof error.stack === "string" ? redactValueDetectors(error.stack) : undefined;
|
|
25453
|
+
return safe;
|
|
25454
|
+
}
|
|
25455
|
+
function nameTokens(name) {
|
|
25456
|
+
return name.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g, "$1 $2").split(/[\s._-]+/).map((t) => t.toLowerCase()).filter(Boolean);
|
|
25457
|
+
}
|
|
25458
|
+
function isSensitiveName(name) {
|
|
25459
|
+
const tokens = nameTokens(name);
|
|
25460
|
+
for (let i = 0;i < tokens.length; i++) {
|
|
25461
|
+
const token = tokens[i];
|
|
25462
|
+
if (SENSITIVE_NAME_TOKENS.has(token)) {
|
|
25463
|
+
return true;
|
|
25464
|
+
}
|
|
25465
|
+
if (token === "key" || token === "keys") {
|
|
25466
|
+
const prev = tokens[i - 1];
|
|
25467
|
+
if (prev && SENSITIVE_KEY_PREFIXES.has(prev)) {
|
|
25468
|
+
return true;
|
|
25469
|
+
}
|
|
25470
|
+
}
|
|
25471
|
+
}
|
|
25472
|
+
return false;
|
|
25473
|
+
}
|
|
25474
|
+
function redactProperty(name, value) {
|
|
25475
|
+
if (value === undefined || value === null) {
|
|
25476
|
+
return;
|
|
25477
|
+
}
|
|
25478
|
+
if (isSensitiveName(name)) {
|
|
25479
|
+
return REDACTED;
|
|
25480
|
+
}
|
|
25481
|
+
if (typeof value === "boolean" || typeof value === "number") {
|
|
25482
|
+
return value;
|
|
25483
|
+
}
|
|
25484
|
+
if (typeof value !== "string") {
|
|
25485
|
+
return "[OBJECT]";
|
|
25486
|
+
}
|
|
25487
|
+
return redactValueDetectors(value);
|
|
25488
|
+
}
|
|
25489
|
+
function redactProperties(properties) {
|
|
25490
|
+
const out = {};
|
|
25491
|
+
for (const [name, value] of Object.entries(properties)) {
|
|
25492
|
+
const redacted = redactProperty(name, value);
|
|
25493
|
+
if (redacted !== undefined) {
|
|
25494
|
+
out[name] = redacted;
|
|
25495
|
+
}
|
|
25496
|
+
}
|
|
25497
|
+
return out;
|
|
25498
|
+
}
|
|
25499
|
+
|
|
25332
25500
|
// ../../common/src/telemetry/telemetry-service.ts
|
|
25501
|
+
var TELEMETRY_OPERATION_ID_PROPERTY = "uip.trace.operation_id";
|
|
25502
|
+
var TELEMETRY_PARENT_ID_PROPERTY = "uip.trace.parent_id";
|
|
25503
|
+
var TELEMETRY_SPAN_ID_PROPERTY = "uip.trace.span_id";
|
|
25504
|
+
|
|
25333
25505
|
class TelemetryService {
|
|
25334
25506
|
telemetryProvider;
|
|
25335
25507
|
contextStorage;
|
|
@@ -25356,11 +25528,15 @@ class TelemetryService {
|
|
|
25356
25528
|
trackException(error, properties) {
|
|
25357
25529
|
const context = this.getCurrentContext();
|
|
25358
25530
|
const enrichedProperties = this.enrichPropertiesWithContext(properties, context);
|
|
25359
|
-
this.telemetryProvider.trackException(error, enrichedProperties);
|
|
25531
|
+
this.telemetryProvider.trackException(redactError(error), enrichedProperties);
|
|
25360
25532
|
}
|
|
25361
25533
|
async trackRequest(name, fn, properties) {
|
|
25534
|
+
const parentContext = this.getCurrentContext();
|
|
25535
|
+
const operationId = parentContext?.operationId ?? this.operationId ?? getTelemetryOperationId();
|
|
25536
|
+
const parentId = parentContext ? parentContext.id : this.inboundParentIdFor(operationId);
|
|
25362
25537
|
const context = {
|
|
25363
|
-
operationId
|
|
25538
|
+
operationId,
|
|
25539
|
+
...parentId !== undefined ? { parentId } : {},
|
|
25364
25540
|
id: this.generateId()
|
|
25365
25541
|
};
|
|
25366
25542
|
const startTime = performance.now();
|
|
@@ -25378,6 +25554,45 @@ class TelemetryService {
|
|
|
25378
25554
|
throw error;
|
|
25379
25555
|
}
|
|
25380
25556
|
}
|
|
25557
|
+
trackRequestResult(name, durationMs, success, properties, context) {
|
|
25558
|
+
const requestContext = context ?? {
|
|
25559
|
+
operationId: this.operationId ?? getTelemetryOperationId(),
|
|
25560
|
+
id: this.generateId()
|
|
25561
|
+
};
|
|
25562
|
+
const enrichedProperties = this.enrichPropertiesWithContext(properties, requestContext);
|
|
25563
|
+
this.telemetryProvider.trackRequest(name, durationMs, success, enrichedProperties);
|
|
25564
|
+
}
|
|
25565
|
+
createRequestContext() {
|
|
25566
|
+
const operationId = this.operationId ?? getTelemetryOperationId();
|
|
25567
|
+
const parentId = this.inboundParentIdFor(operationId);
|
|
25568
|
+
return {
|
|
25569
|
+
operationId,
|
|
25570
|
+
...parentId !== undefined ? { parentId } : {},
|
|
25571
|
+
id: this.generateId()
|
|
25572
|
+
};
|
|
25573
|
+
}
|
|
25574
|
+
inboundParentIdFor(operationId) {
|
|
25575
|
+
const inbound = getInboundTraceContext();
|
|
25576
|
+
return inbound && inbound.traceId === operationId ? inbound.parentSpanId : undefined;
|
|
25577
|
+
}
|
|
25578
|
+
runWithContext(context, fn) {
|
|
25579
|
+
return this.contextStorage.run(context, fn);
|
|
25580
|
+
}
|
|
25581
|
+
createDependencyContext() {
|
|
25582
|
+
const parentContext = this.getCurrentContext();
|
|
25583
|
+
if (!parentContext) {
|
|
25584
|
+
return;
|
|
25585
|
+
}
|
|
25586
|
+
return {
|
|
25587
|
+
operationId: parentContext.operationId,
|
|
25588
|
+
parentId: parentContext.id,
|
|
25589
|
+
id: this.generateId()
|
|
25590
|
+
};
|
|
25591
|
+
}
|
|
25592
|
+
trackDependencyResult(name, type2, durationMs, success, properties, context, resultCode) {
|
|
25593
|
+
const enrichedProperties = this.enrichPropertiesWithContext(properties, context);
|
|
25594
|
+
this.telemetryProvider.trackDependency(redactValue(name), type2, durationMs, success, enrichedProperties, resultCode);
|
|
25595
|
+
}
|
|
25381
25596
|
async trackDependencyOperation(name, type2, fn, properties) {
|
|
25382
25597
|
const parentContext = this.getCurrentContext();
|
|
25383
25598
|
if (!parentContext) {
|
|
@@ -25414,8 +25629,12 @@ class TelemetryService {
|
|
|
25414
25629
|
...getExecutionContextTelemetryProperties(),
|
|
25415
25630
|
...globalProperties,
|
|
25416
25631
|
...this.defaultProperties,
|
|
25417
|
-
...properties,
|
|
25418
|
-
...context
|
|
25632
|
+
...redactProperties(properties ?? {}),
|
|
25633
|
+
...context ? {
|
|
25634
|
+
[TELEMETRY_OPERATION_ID_PROPERTY]: context.operationId,
|
|
25635
|
+
...context.parentId !== undefined ? { [TELEMETRY_PARENT_ID_PROPERTY]: context.parentId } : {},
|
|
25636
|
+
[TELEMETRY_SPAN_ID_PROPERTY]: context.id
|
|
25637
|
+
} : {}
|
|
25419
25638
|
};
|
|
25420
25639
|
if (sessionId === undefined) {
|
|
25421
25640
|
delete enriched[TELEMETRY_SESSION_ID_PROPERTY];
|
|
@@ -25425,7 +25644,16 @@ class TelemetryService {
|
|
|
25425
25644
|
return enriched;
|
|
25426
25645
|
}
|
|
25427
25646
|
generateId() {
|
|
25428
|
-
|
|
25647
|
+
const bytes = new Uint8Array(8);
|
|
25648
|
+
let hex = "";
|
|
25649
|
+
do {
|
|
25650
|
+
crypto.getRandomValues(bytes);
|
|
25651
|
+
hex = "";
|
|
25652
|
+
for (const byte of bytes) {
|
|
25653
|
+
hex += byte.toString(16).padStart(2, "0");
|
|
25654
|
+
}
|
|
25655
|
+
} while (/^0+$/.test(hex));
|
|
25656
|
+
return hex;
|
|
25429
25657
|
}
|
|
25430
25658
|
}
|
|
25431
25659
|
// ../../common/src/telemetry/node-appinsights-telemetry-provider.ts
|
|
@@ -26130,134 +26358,11 @@ function buildCommandTelemetryAttribution(commandPath, skillSource) {
|
|
|
26130
26358
|
};
|
|
26131
26359
|
}
|
|
26132
26360
|
|
|
26133
|
-
// ../../common/src/telemetry/pii-redactor.ts
|
|
26134
|
-
var REDACTED = "[REDACTED]";
|
|
26135
|
-
var MAX_VALUE_LENGTH = 200;
|
|
26136
|
-
var SENSITIVE_NAME_TOKENS = new Set([
|
|
26137
|
-
"token",
|
|
26138
|
-
"tokens",
|
|
26139
|
-
"secret",
|
|
26140
|
-
"secrets",
|
|
26141
|
-
"password",
|
|
26142
|
-
"passwords",
|
|
26143
|
-
"pwd",
|
|
26144
|
-
"credential",
|
|
26145
|
-
"credentials",
|
|
26146
|
-
"auth",
|
|
26147
|
-
"authentication",
|
|
26148
|
-
"authorization",
|
|
26149
|
-
"authority",
|
|
26150
|
-
"cert",
|
|
26151
|
-
"certificate",
|
|
26152
|
-
"certificates"
|
|
26153
|
-
]);
|
|
26154
|
-
var SENSITIVE_KEY_PREFIXES = new Set([
|
|
26155
|
-
"api",
|
|
26156
|
-
"access",
|
|
26157
|
-
"client",
|
|
26158
|
-
"private",
|
|
26159
|
-
"public",
|
|
26160
|
-
"signing",
|
|
26161
|
-
"encryption",
|
|
26162
|
-
"session",
|
|
26163
|
-
"master",
|
|
26164
|
-
"shared",
|
|
26165
|
-
"root",
|
|
26166
|
-
"ssh",
|
|
26167
|
-
"rsa",
|
|
26168
|
-
"aes",
|
|
26169
|
-
"hmac",
|
|
26170
|
-
"oauth"
|
|
26171
|
-
]);
|
|
26172
|
-
var UUID_PATTERN = /\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/gi;
|
|
26173
|
-
var EMAIL_PATTERN = /\b[^\s@]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/g;
|
|
26174
|
-
var JWT_PATTERN = /\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/g;
|
|
26175
|
-
var LONG_TOKEN_PATTERN = /\b[A-Za-z0-9_-]{40,}\b/g;
|
|
26176
|
-
var USER_HOME_PATTERN = /([/\\])(Users|home)([/\\])([^/\\]+)/gi;
|
|
26177
|
-
var URL_PATTERN = /\bhttps?:\/\/[^\s,;]+/gi;
|
|
26178
|
-
var URL_TRAILING_PUNCT = /[.,;:!?)\]}>'"]+$/;
|
|
26179
|
-
function shortHash(input) {
|
|
26180
|
-
let hash = 2166136261;
|
|
26181
|
-
for (let i = 0;i < input.length; i++) {
|
|
26182
|
-
hash ^= input.charCodeAt(i);
|
|
26183
|
-
hash = Math.imul(hash, 16777619);
|
|
26184
|
-
}
|
|
26185
|
-
return (hash >>> 0).toString(16).padStart(8, "0");
|
|
26186
|
-
}
|
|
26187
|
-
function redactUrl(raw) {
|
|
26188
|
-
try {
|
|
26189
|
-
const url = new URL(raw);
|
|
26190
|
-
return `${url.protocol}//${url.host}`;
|
|
26191
|
-
} catch {
|
|
26192
|
-
return `url#${shortHash(raw)}`;
|
|
26193
|
-
}
|
|
26194
|
-
}
|
|
26195
|
-
function redactValueDetectors(value) {
|
|
26196
|
-
let out = value;
|
|
26197
|
-
out = out.replace(JWT_PATTERN, () => REDACTED);
|
|
26198
|
-
out = out.replace(URL_PATTERN, (match) => {
|
|
26199
|
-
const trailing = match.match(URL_TRAILING_PUNCT)?.[0] ?? "";
|
|
26200
|
-
const core2 = trailing ? match.slice(0, -trailing.length) : match;
|
|
26201
|
-
return `${redactUrl(core2)}${trailing}`;
|
|
26202
|
-
});
|
|
26203
|
-
out = out.replace(USER_HOME_PATTERN, (_match, sep1, folder, sep2) => `${sep1}${folder}${sep2}<user>`);
|
|
26204
|
-
out = out.replace(EMAIL_PATTERN, (match) => `email#${shortHash(match)}`);
|
|
26205
|
-
out = out.replace(UUID_PATTERN, (match) => `uuid#${shortHash(match)}`);
|
|
26206
|
-
out = out.replace(LONG_TOKEN_PATTERN, () => REDACTED);
|
|
26207
|
-
if (out.length > MAX_VALUE_LENGTH) {
|
|
26208
|
-
out = `${out.slice(0, MAX_VALUE_LENGTH)}…`;
|
|
26209
|
-
}
|
|
26210
|
-
return out;
|
|
26211
|
-
}
|
|
26212
|
-
function nameTokens(name) {
|
|
26213
|
-
return name.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g, "$1 $2").split(/[\s_-]+/).map((t) => t.toLowerCase()).filter(Boolean);
|
|
26214
|
-
}
|
|
26215
|
-
function isSensitiveName(name) {
|
|
26216
|
-
const tokens = nameTokens(name);
|
|
26217
|
-
for (let i = 0;i < tokens.length; i++) {
|
|
26218
|
-
const token = tokens[i];
|
|
26219
|
-
if (SENSITIVE_NAME_TOKENS.has(token)) {
|
|
26220
|
-
return true;
|
|
26221
|
-
}
|
|
26222
|
-
if (token === "key" || token === "keys") {
|
|
26223
|
-
const prev = tokens[i - 1];
|
|
26224
|
-
if (prev && SENSITIVE_KEY_PREFIXES.has(prev)) {
|
|
26225
|
-
return true;
|
|
26226
|
-
}
|
|
26227
|
-
}
|
|
26228
|
-
}
|
|
26229
|
-
return false;
|
|
26230
|
-
}
|
|
26231
|
-
function redactProperty(name, value) {
|
|
26232
|
-
if (value === undefined || value === null) {
|
|
26233
|
-
return;
|
|
26234
|
-
}
|
|
26235
|
-
if (isSensitiveName(name)) {
|
|
26236
|
-
return REDACTED;
|
|
26237
|
-
}
|
|
26238
|
-
if (typeof value === "boolean" || typeof value === "number") {
|
|
26239
|
-
return value;
|
|
26240
|
-
}
|
|
26241
|
-
if (typeof value !== "string") {
|
|
26242
|
-
return "[OBJECT]";
|
|
26243
|
-
}
|
|
26244
|
-
return redactValueDetectors(value);
|
|
26245
|
-
}
|
|
26246
|
-
function redactProperties(properties) {
|
|
26247
|
-
const out = {};
|
|
26248
|
-
for (const [name, value] of Object.entries(properties)) {
|
|
26249
|
-
const redacted = redactProperty(name, value);
|
|
26250
|
-
if (redacted !== undefined) {
|
|
26251
|
-
out[name] = redacted;
|
|
26252
|
-
}
|
|
26253
|
-
}
|
|
26254
|
-
return out;
|
|
26255
|
-
}
|
|
26256
|
-
|
|
26257
26361
|
// ../../common/src/trackedAction.ts
|
|
26258
26362
|
var pollSignalSlot = singleton("PollSignal");
|
|
26259
26363
|
var cliErrorCodeValues = new Set(CLI_ERROR_CODES);
|
|
26260
26364
|
var retryHintValues = new Set(RETRY_HINTS);
|
|
26365
|
+
var TELEMETRY_COMMAND_ARG_PREFIX = "uip.cmd.arg.";
|
|
26261
26366
|
var processContext = {
|
|
26262
26367
|
exit: (code) => {
|
|
26263
26368
|
process.exitCode = code;
|
|
@@ -26268,22 +26373,18 @@ var processContext = {
|
|
|
26268
26373
|
};
|
|
26269
26374
|
function extractCommandParams(cmd) {
|
|
26270
26375
|
const params = {};
|
|
26376
|
+
const add2 = (name, value) => {
|
|
26377
|
+
if (name && value !== undefined) {
|
|
26378
|
+
params[`${TELEMETRY_COMMAND_ARG_PREFIX}${name}`] = value;
|
|
26379
|
+
}
|
|
26380
|
+
};
|
|
26271
26381
|
const registered = cmd.registeredArguments ?? [];
|
|
26272
26382
|
const processed = cmd.processedArgs ?? [];
|
|
26273
26383
|
for (let i = 0;i < registered.length; i++) {
|
|
26274
|
-
|
|
26275
|
-
if (value === undefined) {
|
|
26276
|
-
continue;
|
|
26277
|
-
}
|
|
26278
|
-
const name = registered[i].name();
|
|
26279
|
-
if (name) {
|
|
26280
|
-
params[name] = value;
|
|
26281
|
-
}
|
|
26384
|
+
add2(registered[i].name(), processed[i]);
|
|
26282
26385
|
}
|
|
26283
26386
|
for (const [key, value] of Object.entries(cmd.opts())) {
|
|
26284
|
-
|
|
26285
|
-
params[key] = value;
|
|
26286
|
-
}
|
|
26387
|
+
add2(key, value);
|
|
26287
26388
|
}
|
|
26288
26389
|
return params;
|
|
26289
26390
|
}
|
|
@@ -26326,11 +26427,12 @@ Command2.prototype.trackedAction = function(context, fn, properties) {
|
|
|
26326
26427
|
return this.action(async (...args) => {
|
|
26327
26428
|
const telemetryName = deriveCommandPath(command);
|
|
26328
26429
|
const props = typeof properties === "function" ? properties(...args) : properties;
|
|
26430
|
+
const requestContext = telemetry.createRequestContext();
|
|
26329
26431
|
const startTime = performance.now();
|
|
26330
26432
|
let errorMessage;
|
|
26331
26433
|
let fallbackExitCode = EXIT_CODES.Success;
|
|
26332
26434
|
clearRecordedCommandFailureTelemetry();
|
|
26333
|
-
const [error] = await catchError(fn(...args));
|
|
26435
|
+
const [error] = await catchError(telemetry.runWithContext(requestContext, () => fn(...args)));
|
|
26334
26436
|
if (error) {
|
|
26335
26437
|
errorMessage = error instanceof Error ? error.message : String(error);
|
|
26336
26438
|
logger.debug(`[trackedAction] ${telemetryName} failed: ${errorMessage}`);
|
|
@@ -26366,16 +26468,21 @@ Command2.prototype.trackedAction = function(context, fn, properties) {
|
|
|
26366
26468
|
recordedFailure,
|
|
26367
26469
|
pollSignal: context.pollSignal
|
|
26368
26470
|
});
|
|
26369
|
-
|
|
26370
|
-
|
|
26471
|
+
const commandParams = extractCommandParams(command);
|
|
26472
|
+
if (props) {
|
|
26473
|
+
for (const key of Object.keys(props)) {
|
|
26474
|
+
delete commandParams[`${TELEMETRY_COMMAND_ARG_PREFIX}${key}`];
|
|
26475
|
+
}
|
|
26476
|
+
}
|
|
26477
|
+
const baseProperties = redactProperties({
|
|
26478
|
+
...commandParams,
|
|
26371
26479
|
...props,
|
|
26372
26480
|
...buildCommandTelemetryAttribution(telemetryName, process.env.UIPATH_SKILL),
|
|
26373
26481
|
command: "true",
|
|
26374
|
-
duration: String(durationMs),
|
|
26375
|
-
success: String(success),
|
|
26376
26482
|
...terminalTelemetry,
|
|
26377
26483
|
...errorMessage ? { errorMessage } : {}
|
|
26378
|
-
})
|
|
26484
|
+
});
|
|
26485
|
+
telemetry.trackRequestResult(telemetryName, durationMs, success, baseProperties, requestContext);
|
|
26379
26486
|
});
|
|
26380
26487
|
};
|
|
26381
26488
|
// ../../common/src/console-guard.ts
|
|
@@ -29658,4 +29765,4 @@ export {
|
|
|
29658
29765
|
metadata
|
|
29659
29766
|
};
|
|
29660
29767
|
|
|
29661
|
-
//# debugId=
|
|
29768
|
+
//# debugId=B8F89B4C288A876264756E2164756E21
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uipath/resourcecatalog-tool",
|
|
3
3
|
"license": "MIT",
|
|
4
|
-
"version": "1.198.0
|
|
4
|
+
"version": "1.198.0",
|
|
5
5
|
"description": "CLI plugin for the UiPath Resource Catalog Service.",
|
|
6
6
|
"private": false,
|
|
7
7
|
"repository": {
|
|
@@ -26,5 +26,5 @@
|
|
|
26
26
|
"files": [
|
|
27
27
|
"dist"
|
|
28
28
|
],
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "1fadf03d7a8dd102742571dff569fdac11808afb"
|
|
30
30
|
}
|