@uipath/resourcecatalog-tool 1.199.0-preview.92 → 1.199.0-preview.99
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.199.0-preview.
|
|
21250
|
+
version: "1.199.0-preview.99",
|
|
21251
21251
|
description: "CLI plugin for the UiPath Resource Catalog Service.",
|
|
21252
21252
|
private: false,
|
|
21253
21253
|
repository: {
|
|
@@ -27418,11 +27418,36 @@ class NodeContextStorage {
|
|
|
27418
27418
|
return this.storage.getStore();
|
|
27419
27419
|
}
|
|
27420
27420
|
}
|
|
27421
|
+
// ../../common/src/telemetry/trace-context.ts
|
|
27422
|
+
var TELEMETRY_TRACEPARENT_ENV = "TRACEPARENT";
|
|
27423
|
+
var TRACEPARENT_PATTERN = /^00-([0-9a-f]{32})-([0-9a-f]{16})-[0-9a-f]{2}$/;
|
|
27424
|
+
function getProcessEnv() {
|
|
27425
|
+
return globalThis.process?.env;
|
|
27426
|
+
}
|
|
27427
|
+
function parseInboundTraceparent(value) {
|
|
27428
|
+
if (!value) {
|
|
27429
|
+
return;
|
|
27430
|
+
}
|
|
27431
|
+
const match = TRACEPARENT_PATTERN.exec(value.trim().toLowerCase());
|
|
27432
|
+
if (!match) {
|
|
27433
|
+
return;
|
|
27434
|
+
}
|
|
27435
|
+
const [, traceId, parentSpanId] = match;
|
|
27436
|
+
if (/^0+$/.test(traceId) || /^0+$/.test(parentSpanId)) {
|
|
27437
|
+
return;
|
|
27438
|
+
}
|
|
27439
|
+
return { traceId, parentSpanId };
|
|
27440
|
+
}
|
|
27441
|
+
function getInboundTraceContext() {
|
|
27442
|
+
return parseInboundTraceparent(getProcessEnv()?.[TELEMETRY_TRACEPARENT_ENV]);
|
|
27443
|
+
}
|
|
27444
|
+
|
|
27421
27445
|
// ../../common/src/telemetry/session-id.ts
|
|
27422
27446
|
var TELEMETRY_SESSION_ID_ENV = "UIPATH_SESSION_ID";
|
|
27423
27447
|
var TELEMETRY_SESSION_ID_PROPERTY = "session_id";
|
|
27424
27448
|
var telemetrySessionIdSlot = singleton("TelemetrySessionId");
|
|
27425
|
-
|
|
27449
|
+
var telemetryOperationIdSlot = singleton("TelemetryOperationId");
|
|
27450
|
+
function getProcessEnv2() {
|
|
27426
27451
|
return globalThis.process?.env;
|
|
27427
27452
|
}
|
|
27428
27453
|
function normalizeSessionId(value) {
|
|
@@ -27433,18 +27458,165 @@ function normalizeSessionId(value) {
|
|
|
27433
27458
|
return trimmed || undefined;
|
|
27434
27459
|
}
|
|
27435
27460
|
function getConfiguredTelemetrySessionId() {
|
|
27436
|
-
return normalizeSessionId(
|
|
27461
|
+
return normalizeSessionId(getProcessEnv2()?.[TELEMETRY_SESSION_ID_ENV]);
|
|
27437
27462
|
}
|
|
27438
27463
|
function resolveTelemetrySessionId(existingSessionId) {
|
|
27439
27464
|
return getConfiguredTelemetrySessionId() ?? normalizeSessionId(existingSessionId);
|
|
27440
27465
|
}
|
|
27466
|
+
function getTelemetryOperationId() {
|
|
27467
|
+
const existing = telemetryOperationIdSlot.get();
|
|
27468
|
+
if (existing) {
|
|
27469
|
+
return existing;
|
|
27470
|
+
}
|
|
27471
|
+
const inboundTraceId = getInboundTraceContext()?.traceId;
|
|
27472
|
+
const generated = inboundTraceId ?? crypto.randomUUID().replaceAll("-", "");
|
|
27473
|
+
telemetryOperationIdSlot.set(generated);
|
|
27474
|
+
return generated;
|
|
27475
|
+
}
|
|
27441
27476
|
// ../../common/src/telemetry/global-telemetry-properties.ts
|
|
27442
27477
|
var telemetryPropsSlot = singleton("TelemetryDefaultProps");
|
|
27443
27478
|
function getGlobalTelemetryProperties() {
|
|
27444
27479
|
return telemetryPropsSlot.get();
|
|
27445
27480
|
}
|
|
27446
27481
|
|
|
27482
|
+
// ../../common/src/telemetry/pii-redactor.ts
|
|
27483
|
+
var REDACTED = "[REDACTED]";
|
|
27484
|
+
var MAX_VALUE_LENGTH = 200;
|
|
27485
|
+
var SENSITIVE_NAME_TOKENS = new Set([
|
|
27486
|
+
"token",
|
|
27487
|
+
"tokens",
|
|
27488
|
+
"secret",
|
|
27489
|
+
"secrets",
|
|
27490
|
+
"password",
|
|
27491
|
+
"passwords",
|
|
27492
|
+
"pwd",
|
|
27493
|
+
"credential",
|
|
27494
|
+
"credentials",
|
|
27495
|
+
"auth",
|
|
27496
|
+
"authentication",
|
|
27497
|
+
"authorization",
|
|
27498
|
+
"authority",
|
|
27499
|
+
"cert",
|
|
27500
|
+
"certificate",
|
|
27501
|
+
"certificates"
|
|
27502
|
+
]);
|
|
27503
|
+
var SENSITIVE_KEY_PREFIXES = new Set([
|
|
27504
|
+
"api",
|
|
27505
|
+
"access",
|
|
27506
|
+
"client",
|
|
27507
|
+
"private",
|
|
27508
|
+
"public",
|
|
27509
|
+
"signing",
|
|
27510
|
+
"encryption",
|
|
27511
|
+
"session",
|
|
27512
|
+
"master",
|
|
27513
|
+
"shared",
|
|
27514
|
+
"root",
|
|
27515
|
+
"ssh",
|
|
27516
|
+
"rsa",
|
|
27517
|
+
"aes",
|
|
27518
|
+
"hmac",
|
|
27519
|
+
"oauth"
|
|
27520
|
+
]);
|
|
27521
|
+
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;
|
|
27522
|
+
var EMAIL_PATTERN = /\b[^\s@]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/g;
|
|
27523
|
+
var JWT_PATTERN = /\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/g;
|
|
27524
|
+
var LONG_TOKEN_PATTERN = /\b[A-Za-z0-9_-]{40,}\b/g;
|
|
27525
|
+
var USER_HOME_PATTERN = /([/\\])(Users|home)([/\\])([^/\\]+)/gi;
|
|
27526
|
+
var URL_PATTERN = /\bhttps?:\/\/[^\s,;]+/gi;
|
|
27527
|
+
var URL_TRAILING_PUNCT = /[.,;:!?)\]}>'"]+$/;
|
|
27528
|
+
function shortHash(input) {
|
|
27529
|
+
let hash = 2166136261;
|
|
27530
|
+
for (let i = 0;i < input.length; i++) {
|
|
27531
|
+
hash ^= input.charCodeAt(i);
|
|
27532
|
+
hash = Math.imul(hash, 16777619);
|
|
27533
|
+
}
|
|
27534
|
+
return (hash >>> 0).toString(16).padStart(8, "0");
|
|
27535
|
+
}
|
|
27536
|
+
function redactUrl(raw) {
|
|
27537
|
+
try {
|
|
27538
|
+
const url = new URL(raw);
|
|
27539
|
+
return `${url.protocol}//${url.host}`;
|
|
27540
|
+
} catch {
|
|
27541
|
+
return `url#${shortHash(raw)}`;
|
|
27542
|
+
}
|
|
27543
|
+
}
|
|
27544
|
+
function redactValueDetectors(value) {
|
|
27545
|
+
let out = value;
|
|
27546
|
+
out = out.replace(JWT_PATTERN, () => REDACTED);
|
|
27547
|
+
out = out.replace(URL_PATTERN, (match) => {
|
|
27548
|
+
const trailing = match.match(URL_TRAILING_PUNCT)?.[0] ?? "";
|
|
27549
|
+
const core2 = trailing ? match.slice(0, -trailing.length) : match;
|
|
27550
|
+
return `${redactUrl(core2)}${trailing}`;
|
|
27551
|
+
});
|
|
27552
|
+
out = out.replace(USER_HOME_PATTERN, (_match, sep1, folder, sep2) => `${sep1}${folder}${sep2}<user>`);
|
|
27553
|
+
out = out.replace(EMAIL_PATTERN, (match) => `email#${shortHash(match)}`);
|
|
27554
|
+
out = out.replace(UUID_PATTERN, (match) => `uuid#${shortHash(match)}`);
|
|
27555
|
+
out = out.replace(LONG_TOKEN_PATTERN, () => REDACTED);
|
|
27556
|
+
if (out.length > MAX_VALUE_LENGTH) {
|
|
27557
|
+
out = `${out.slice(0, MAX_VALUE_LENGTH)}…`;
|
|
27558
|
+
}
|
|
27559
|
+
return out;
|
|
27560
|
+
}
|
|
27561
|
+
function redactValue(value) {
|
|
27562
|
+
return redactValueDetectors(value);
|
|
27563
|
+
}
|
|
27564
|
+
function redactError(error) {
|
|
27565
|
+
const safe = new Error(redactValueDetectors(error.message ?? ""));
|
|
27566
|
+
safe.name = error.name;
|
|
27567
|
+
safe.stack = typeof error.stack === "string" ? redactValueDetectors(error.stack) : undefined;
|
|
27568
|
+
return safe;
|
|
27569
|
+
}
|
|
27570
|
+
function nameTokens(name) {
|
|
27571
|
+
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);
|
|
27572
|
+
}
|
|
27573
|
+
function isSensitiveName(name) {
|
|
27574
|
+
const tokens = nameTokens(name);
|
|
27575
|
+
for (let i = 0;i < tokens.length; i++) {
|
|
27576
|
+
const token = tokens[i];
|
|
27577
|
+
if (SENSITIVE_NAME_TOKENS.has(token)) {
|
|
27578
|
+
return true;
|
|
27579
|
+
}
|
|
27580
|
+
if (token === "key" || token === "keys") {
|
|
27581
|
+
const prev = tokens[i - 1];
|
|
27582
|
+
if (prev && SENSITIVE_KEY_PREFIXES.has(prev)) {
|
|
27583
|
+
return true;
|
|
27584
|
+
}
|
|
27585
|
+
}
|
|
27586
|
+
}
|
|
27587
|
+
return false;
|
|
27588
|
+
}
|
|
27589
|
+
function redactProperty(name, value) {
|
|
27590
|
+
if (value === undefined || value === null) {
|
|
27591
|
+
return;
|
|
27592
|
+
}
|
|
27593
|
+
if (isSensitiveName(name)) {
|
|
27594
|
+
return REDACTED;
|
|
27595
|
+
}
|
|
27596
|
+
if (typeof value === "boolean" || typeof value === "number") {
|
|
27597
|
+
return value;
|
|
27598
|
+
}
|
|
27599
|
+
if (typeof value !== "string") {
|
|
27600
|
+
return "[OBJECT]";
|
|
27601
|
+
}
|
|
27602
|
+
return redactValueDetectors(value);
|
|
27603
|
+
}
|
|
27604
|
+
function redactProperties(properties) {
|
|
27605
|
+
const out = {};
|
|
27606
|
+
for (const [name, value] of Object.entries(properties)) {
|
|
27607
|
+
const redacted = redactProperty(name, value);
|
|
27608
|
+
if (redacted !== undefined) {
|
|
27609
|
+
out[name] = redacted;
|
|
27610
|
+
}
|
|
27611
|
+
}
|
|
27612
|
+
return out;
|
|
27613
|
+
}
|
|
27614
|
+
|
|
27447
27615
|
// ../../common/src/telemetry/telemetry-service.ts
|
|
27616
|
+
var TELEMETRY_OPERATION_ID_PROPERTY = "uip.trace.operation_id";
|
|
27617
|
+
var TELEMETRY_PARENT_ID_PROPERTY = "uip.trace.parent_id";
|
|
27618
|
+
var TELEMETRY_SPAN_ID_PROPERTY = "uip.trace.span_id";
|
|
27619
|
+
|
|
27448
27620
|
class TelemetryService {
|
|
27449
27621
|
telemetryProvider;
|
|
27450
27622
|
contextStorage;
|
|
@@ -27471,11 +27643,15 @@ class TelemetryService {
|
|
|
27471
27643
|
trackException(error, properties) {
|
|
27472
27644
|
const context = this.getCurrentContext();
|
|
27473
27645
|
const enrichedProperties = this.enrichPropertiesWithContext(properties, context);
|
|
27474
|
-
this.telemetryProvider.trackException(error, enrichedProperties);
|
|
27646
|
+
this.telemetryProvider.trackException(redactError(error), enrichedProperties);
|
|
27475
27647
|
}
|
|
27476
27648
|
async trackRequest(name, fn, properties) {
|
|
27649
|
+
const parentContext = this.getCurrentContext();
|
|
27650
|
+
const operationId = parentContext?.operationId ?? this.operationId ?? getTelemetryOperationId();
|
|
27651
|
+
const parentId = parentContext ? parentContext.id : this.inboundParentIdFor(operationId);
|
|
27477
27652
|
const context = {
|
|
27478
|
-
operationId
|
|
27653
|
+
operationId,
|
|
27654
|
+
...parentId !== undefined ? { parentId } : {},
|
|
27479
27655
|
id: this.generateId()
|
|
27480
27656
|
};
|
|
27481
27657
|
const startTime = performance.now();
|
|
@@ -27493,6 +27669,45 @@ class TelemetryService {
|
|
|
27493
27669
|
throw error;
|
|
27494
27670
|
}
|
|
27495
27671
|
}
|
|
27672
|
+
trackRequestResult(name, durationMs, success, properties, context) {
|
|
27673
|
+
const requestContext = context ?? {
|
|
27674
|
+
operationId: this.operationId ?? getTelemetryOperationId(),
|
|
27675
|
+
id: this.generateId()
|
|
27676
|
+
};
|
|
27677
|
+
const enrichedProperties = this.enrichPropertiesWithContext(properties, requestContext);
|
|
27678
|
+
this.telemetryProvider.trackRequest(name, durationMs, success, enrichedProperties);
|
|
27679
|
+
}
|
|
27680
|
+
createRequestContext() {
|
|
27681
|
+
const operationId = this.operationId ?? getTelemetryOperationId();
|
|
27682
|
+
const parentId = this.inboundParentIdFor(operationId);
|
|
27683
|
+
return {
|
|
27684
|
+
operationId,
|
|
27685
|
+
...parentId !== undefined ? { parentId } : {},
|
|
27686
|
+
id: this.generateId()
|
|
27687
|
+
};
|
|
27688
|
+
}
|
|
27689
|
+
inboundParentIdFor(operationId) {
|
|
27690
|
+
const inbound = getInboundTraceContext();
|
|
27691
|
+
return inbound && inbound.traceId === operationId ? inbound.parentSpanId : undefined;
|
|
27692
|
+
}
|
|
27693
|
+
runWithContext(context, fn) {
|
|
27694
|
+
return this.contextStorage.run(context, fn);
|
|
27695
|
+
}
|
|
27696
|
+
createDependencyContext() {
|
|
27697
|
+
const parentContext = this.getCurrentContext();
|
|
27698
|
+
if (!parentContext) {
|
|
27699
|
+
return;
|
|
27700
|
+
}
|
|
27701
|
+
return {
|
|
27702
|
+
operationId: parentContext.operationId,
|
|
27703
|
+
parentId: parentContext.id,
|
|
27704
|
+
id: this.generateId()
|
|
27705
|
+
};
|
|
27706
|
+
}
|
|
27707
|
+
trackDependencyResult(name, type2, durationMs, success, properties, context, resultCode) {
|
|
27708
|
+
const enrichedProperties = this.enrichPropertiesWithContext(properties, context);
|
|
27709
|
+
this.telemetryProvider.trackDependency(redactValue(name), type2, durationMs, success, enrichedProperties, resultCode);
|
|
27710
|
+
}
|
|
27496
27711
|
async trackDependencyOperation(name, type2, fn, properties) {
|
|
27497
27712
|
const parentContext = this.getCurrentContext();
|
|
27498
27713
|
if (!parentContext) {
|
|
@@ -27529,8 +27744,12 @@ class TelemetryService {
|
|
|
27529
27744
|
...getExecutionContextTelemetryProperties(),
|
|
27530
27745
|
...globalProperties,
|
|
27531
27746
|
...this.defaultProperties,
|
|
27532
|
-
...properties,
|
|
27533
|
-
...context
|
|
27747
|
+
...redactProperties(properties ?? {}),
|
|
27748
|
+
...context ? {
|
|
27749
|
+
[TELEMETRY_OPERATION_ID_PROPERTY]: context.operationId,
|
|
27750
|
+
...context.parentId !== undefined ? { [TELEMETRY_PARENT_ID_PROPERTY]: context.parentId } : {},
|
|
27751
|
+
[TELEMETRY_SPAN_ID_PROPERTY]: context.id
|
|
27752
|
+
} : {}
|
|
27534
27753
|
};
|
|
27535
27754
|
if (sessionId === undefined) {
|
|
27536
27755
|
delete enriched[TELEMETRY_SESSION_ID_PROPERTY];
|
|
@@ -27540,7 +27759,16 @@ class TelemetryService {
|
|
|
27540
27759
|
return enriched;
|
|
27541
27760
|
}
|
|
27542
27761
|
generateId() {
|
|
27543
|
-
|
|
27762
|
+
const bytes = new Uint8Array(8);
|
|
27763
|
+
let hex = "";
|
|
27764
|
+
do {
|
|
27765
|
+
crypto.getRandomValues(bytes);
|
|
27766
|
+
hex = "";
|
|
27767
|
+
for (const byte of bytes) {
|
|
27768
|
+
hex += byte.toString(16).padStart(2, "0");
|
|
27769
|
+
}
|
|
27770
|
+
} while (/^0+$/.test(hex));
|
|
27771
|
+
return hex;
|
|
27544
27772
|
}
|
|
27545
27773
|
}
|
|
27546
27774
|
// ../../common/src/telemetry/node-appinsights-telemetry-provider.ts
|
|
@@ -28243,134 +28471,11 @@ function buildCommandTelemetryAttribution(commandPath, skillSource) {
|
|
|
28243
28471
|
};
|
|
28244
28472
|
}
|
|
28245
28473
|
|
|
28246
|
-
// ../../common/src/telemetry/pii-redactor.ts
|
|
28247
|
-
var REDACTED = "[REDACTED]";
|
|
28248
|
-
var MAX_VALUE_LENGTH = 200;
|
|
28249
|
-
var SENSITIVE_NAME_TOKENS = new Set([
|
|
28250
|
-
"token",
|
|
28251
|
-
"tokens",
|
|
28252
|
-
"secret",
|
|
28253
|
-
"secrets",
|
|
28254
|
-
"password",
|
|
28255
|
-
"passwords",
|
|
28256
|
-
"pwd",
|
|
28257
|
-
"credential",
|
|
28258
|
-
"credentials",
|
|
28259
|
-
"auth",
|
|
28260
|
-
"authentication",
|
|
28261
|
-
"authorization",
|
|
28262
|
-
"authority",
|
|
28263
|
-
"cert",
|
|
28264
|
-
"certificate",
|
|
28265
|
-
"certificates"
|
|
28266
|
-
]);
|
|
28267
|
-
var SENSITIVE_KEY_PREFIXES = new Set([
|
|
28268
|
-
"api",
|
|
28269
|
-
"access",
|
|
28270
|
-
"client",
|
|
28271
|
-
"private",
|
|
28272
|
-
"public",
|
|
28273
|
-
"signing",
|
|
28274
|
-
"encryption",
|
|
28275
|
-
"session",
|
|
28276
|
-
"master",
|
|
28277
|
-
"shared",
|
|
28278
|
-
"root",
|
|
28279
|
-
"ssh",
|
|
28280
|
-
"rsa",
|
|
28281
|
-
"aes",
|
|
28282
|
-
"hmac",
|
|
28283
|
-
"oauth"
|
|
28284
|
-
]);
|
|
28285
|
-
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;
|
|
28286
|
-
var EMAIL_PATTERN = /\b[^\s@]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/g;
|
|
28287
|
-
var JWT_PATTERN = /\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/g;
|
|
28288
|
-
var LONG_TOKEN_PATTERN = /\b[A-Za-z0-9_-]{40,}\b/g;
|
|
28289
|
-
var USER_HOME_PATTERN = /([/\\])(Users|home)([/\\])([^/\\]+)/gi;
|
|
28290
|
-
var URL_PATTERN = /\bhttps?:\/\/[^\s,;]+/gi;
|
|
28291
|
-
var URL_TRAILING_PUNCT = /[.,;:!?)\]}>'"]+$/;
|
|
28292
|
-
function shortHash(input) {
|
|
28293
|
-
let hash = 2166136261;
|
|
28294
|
-
for (let i = 0;i < input.length; i++) {
|
|
28295
|
-
hash ^= input.charCodeAt(i);
|
|
28296
|
-
hash = Math.imul(hash, 16777619);
|
|
28297
|
-
}
|
|
28298
|
-
return (hash >>> 0).toString(16).padStart(8, "0");
|
|
28299
|
-
}
|
|
28300
|
-
function redactUrl(raw) {
|
|
28301
|
-
try {
|
|
28302
|
-
const url = new URL(raw);
|
|
28303
|
-
return `${url.protocol}//${url.host}`;
|
|
28304
|
-
} catch {
|
|
28305
|
-
return `url#${shortHash(raw)}`;
|
|
28306
|
-
}
|
|
28307
|
-
}
|
|
28308
|
-
function redactValueDetectors(value) {
|
|
28309
|
-
let out = value;
|
|
28310
|
-
out = out.replace(JWT_PATTERN, () => REDACTED);
|
|
28311
|
-
out = out.replace(URL_PATTERN, (match) => {
|
|
28312
|
-
const trailing = match.match(URL_TRAILING_PUNCT)?.[0] ?? "";
|
|
28313
|
-
const core2 = trailing ? match.slice(0, -trailing.length) : match;
|
|
28314
|
-
return `${redactUrl(core2)}${trailing}`;
|
|
28315
|
-
});
|
|
28316
|
-
out = out.replace(USER_HOME_PATTERN, (_match, sep1, folder, sep2) => `${sep1}${folder}${sep2}<user>`);
|
|
28317
|
-
out = out.replace(EMAIL_PATTERN, (match) => `email#${shortHash(match)}`);
|
|
28318
|
-
out = out.replace(UUID_PATTERN, (match) => `uuid#${shortHash(match)}`);
|
|
28319
|
-
out = out.replace(LONG_TOKEN_PATTERN, () => REDACTED);
|
|
28320
|
-
if (out.length > MAX_VALUE_LENGTH) {
|
|
28321
|
-
out = `${out.slice(0, MAX_VALUE_LENGTH)}…`;
|
|
28322
|
-
}
|
|
28323
|
-
return out;
|
|
28324
|
-
}
|
|
28325
|
-
function nameTokens(name) {
|
|
28326
|
-
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);
|
|
28327
|
-
}
|
|
28328
|
-
function isSensitiveName(name) {
|
|
28329
|
-
const tokens = nameTokens(name);
|
|
28330
|
-
for (let i = 0;i < tokens.length; i++) {
|
|
28331
|
-
const token = tokens[i];
|
|
28332
|
-
if (SENSITIVE_NAME_TOKENS.has(token)) {
|
|
28333
|
-
return true;
|
|
28334
|
-
}
|
|
28335
|
-
if (token === "key" || token === "keys") {
|
|
28336
|
-
const prev = tokens[i - 1];
|
|
28337
|
-
if (prev && SENSITIVE_KEY_PREFIXES.has(prev)) {
|
|
28338
|
-
return true;
|
|
28339
|
-
}
|
|
28340
|
-
}
|
|
28341
|
-
}
|
|
28342
|
-
return false;
|
|
28343
|
-
}
|
|
28344
|
-
function redactProperty(name, value) {
|
|
28345
|
-
if (value === undefined || value === null) {
|
|
28346
|
-
return;
|
|
28347
|
-
}
|
|
28348
|
-
if (isSensitiveName(name)) {
|
|
28349
|
-
return REDACTED;
|
|
28350
|
-
}
|
|
28351
|
-
if (typeof value === "boolean" || typeof value === "number") {
|
|
28352
|
-
return value;
|
|
28353
|
-
}
|
|
28354
|
-
if (typeof value !== "string") {
|
|
28355
|
-
return "[OBJECT]";
|
|
28356
|
-
}
|
|
28357
|
-
return redactValueDetectors(value);
|
|
28358
|
-
}
|
|
28359
|
-
function redactProperties(properties) {
|
|
28360
|
-
const out = {};
|
|
28361
|
-
for (const [name, value] of Object.entries(properties)) {
|
|
28362
|
-
const redacted = redactProperty(name, value);
|
|
28363
|
-
if (redacted !== undefined) {
|
|
28364
|
-
out[name] = redacted;
|
|
28365
|
-
}
|
|
28366
|
-
}
|
|
28367
|
-
return out;
|
|
28368
|
-
}
|
|
28369
|
-
|
|
28370
28474
|
// ../../common/src/trackedAction.ts
|
|
28371
28475
|
var pollSignalSlot = singleton("PollSignal");
|
|
28372
28476
|
var cliErrorCodeValues = new Set(CLI_ERROR_CODES);
|
|
28373
28477
|
var retryHintValues = new Set(RETRY_HINTS);
|
|
28478
|
+
var TELEMETRY_COMMAND_ARG_PREFIX = "uip.cmd.arg.";
|
|
28374
28479
|
var processContext = {
|
|
28375
28480
|
exit: (code) => {
|
|
28376
28481
|
process.exitCode = code;
|
|
@@ -28381,22 +28486,18 @@ var processContext = {
|
|
|
28381
28486
|
};
|
|
28382
28487
|
function extractCommandParams(cmd) {
|
|
28383
28488
|
const params = {};
|
|
28489
|
+
const add2 = (name, value) => {
|
|
28490
|
+
if (name && value !== undefined) {
|
|
28491
|
+
params[`${TELEMETRY_COMMAND_ARG_PREFIX}${name}`] = value;
|
|
28492
|
+
}
|
|
28493
|
+
};
|
|
28384
28494
|
const registered = cmd.registeredArguments ?? [];
|
|
28385
28495
|
const processed = cmd.processedArgs ?? [];
|
|
28386
28496
|
for (let i = 0;i < registered.length; i++) {
|
|
28387
|
-
|
|
28388
|
-
if (value === undefined) {
|
|
28389
|
-
continue;
|
|
28390
|
-
}
|
|
28391
|
-
const name = registered[i].name();
|
|
28392
|
-
if (name) {
|
|
28393
|
-
params[name] = value;
|
|
28394
|
-
}
|
|
28497
|
+
add2(registered[i].name(), processed[i]);
|
|
28395
28498
|
}
|
|
28396
28499
|
for (const [key, value] of Object.entries(cmd.opts())) {
|
|
28397
|
-
|
|
28398
|
-
params[key] = value;
|
|
28399
|
-
}
|
|
28500
|
+
add2(key, value);
|
|
28400
28501
|
}
|
|
28401
28502
|
return params;
|
|
28402
28503
|
}
|
|
@@ -28439,11 +28540,12 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
28439
28540
|
return this.action(async (...args) => {
|
|
28440
28541
|
const telemetryName = deriveCommandPath(command);
|
|
28441
28542
|
const props = typeof properties === "function" ? properties(...args) : properties;
|
|
28543
|
+
const requestContext = telemetry.createRequestContext();
|
|
28442
28544
|
const startTime = performance.now();
|
|
28443
28545
|
let errorMessage;
|
|
28444
28546
|
let fallbackExitCode = EXIT_CODES.Success;
|
|
28445
28547
|
clearRecordedCommandFailureTelemetry();
|
|
28446
|
-
const [error] = await catchError(fn(...args));
|
|
28548
|
+
const [error] = await catchError(telemetry.runWithContext(requestContext, () => fn(...args)));
|
|
28447
28549
|
if (error) {
|
|
28448
28550
|
errorMessage = error instanceof Error ? error.message : String(error);
|
|
28449
28551
|
logger.debug(`[trackedAction] ${telemetryName} failed: ${errorMessage}`);
|
|
@@ -28479,16 +28581,21 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
28479
28581
|
recordedFailure,
|
|
28480
28582
|
pollSignal: context.pollSignal
|
|
28481
28583
|
});
|
|
28482
|
-
|
|
28483
|
-
|
|
28584
|
+
const commandParams = extractCommandParams(command);
|
|
28585
|
+
if (props) {
|
|
28586
|
+
for (const key of Object.keys(props)) {
|
|
28587
|
+
delete commandParams[`${TELEMETRY_COMMAND_ARG_PREFIX}${key}`];
|
|
28588
|
+
}
|
|
28589
|
+
}
|
|
28590
|
+
const baseProperties = redactProperties({
|
|
28591
|
+
...commandParams,
|
|
28484
28592
|
...props,
|
|
28485
28593
|
...buildCommandTelemetryAttribution(telemetryName, process.env.UIPATH_SKILL),
|
|
28486
28594
|
command: "true",
|
|
28487
|
-
duration: String(durationMs),
|
|
28488
|
-
success: String(success),
|
|
28489
28595
|
...terminalTelemetry,
|
|
28490
28596
|
...errorMessage ? { errorMessage } : {}
|
|
28491
|
-
})
|
|
28597
|
+
});
|
|
28598
|
+
telemetry.trackRequestResult(telemetryName, durationMs, success, baseProperties, requestContext);
|
|
28492
28599
|
});
|
|
28493
28600
|
};
|
|
28494
28601
|
// ../../common/src/console-guard.ts
|
|
@@ -31767,4 +31874,4 @@ program2.name(metadata.commandPrefix).description(metadata.description).version(
|
|
|
31767
31874
|
await registerCommands(program2);
|
|
31768
31875
|
program2.parse(process.argv);
|
|
31769
31876
|
|
|
31770
|
-
//# debugId=
|
|
31877
|
+
//# debugId=1F5909EF9C75DCEC64756E2164756E21
|
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.199.0-preview.
|
|
19140
|
+
version: "1.199.0-preview.99",
|
|
19141
19141
|
description: "CLI plugin for the UiPath Resource Catalog Service.",
|
|
19142
19142
|
private: false,
|
|
19143
19143
|
repository: {
|
|
@@ -25309,11 +25309,36 @@ class NodeContextStorage {
|
|
|
25309
25309
|
return this.storage.getStore();
|
|
25310
25310
|
}
|
|
25311
25311
|
}
|
|
25312
|
+
// ../../common/src/telemetry/trace-context.ts
|
|
25313
|
+
var TELEMETRY_TRACEPARENT_ENV = "TRACEPARENT";
|
|
25314
|
+
var TRACEPARENT_PATTERN = /^00-([0-9a-f]{32})-([0-9a-f]{16})-[0-9a-f]{2}$/;
|
|
25315
|
+
function getProcessEnv() {
|
|
25316
|
+
return globalThis.process?.env;
|
|
25317
|
+
}
|
|
25318
|
+
function parseInboundTraceparent(value) {
|
|
25319
|
+
if (!value) {
|
|
25320
|
+
return;
|
|
25321
|
+
}
|
|
25322
|
+
const match = TRACEPARENT_PATTERN.exec(value.trim().toLowerCase());
|
|
25323
|
+
if (!match) {
|
|
25324
|
+
return;
|
|
25325
|
+
}
|
|
25326
|
+
const [, traceId, parentSpanId] = match;
|
|
25327
|
+
if (/^0+$/.test(traceId) || /^0+$/.test(parentSpanId)) {
|
|
25328
|
+
return;
|
|
25329
|
+
}
|
|
25330
|
+
return { traceId, parentSpanId };
|
|
25331
|
+
}
|
|
25332
|
+
function getInboundTraceContext() {
|
|
25333
|
+
return parseInboundTraceparent(getProcessEnv()?.[TELEMETRY_TRACEPARENT_ENV]);
|
|
25334
|
+
}
|
|
25335
|
+
|
|
25312
25336
|
// ../../common/src/telemetry/session-id.ts
|
|
25313
25337
|
var TELEMETRY_SESSION_ID_ENV = "UIPATH_SESSION_ID";
|
|
25314
25338
|
var TELEMETRY_SESSION_ID_PROPERTY = "session_id";
|
|
25315
25339
|
var telemetrySessionIdSlot = singleton("TelemetrySessionId");
|
|
25316
|
-
|
|
25340
|
+
var telemetryOperationIdSlot = singleton("TelemetryOperationId");
|
|
25341
|
+
function getProcessEnv2() {
|
|
25317
25342
|
return globalThis.process?.env;
|
|
25318
25343
|
}
|
|
25319
25344
|
function normalizeSessionId(value) {
|
|
@@ -25324,18 +25349,165 @@ function normalizeSessionId(value) {
|
|
|
25324
25349
|
return trimmed || undefined;
|
|
25325
25350
|
}
|
|
25326
25351
|
function getConfiguredTelemetrySessionId() {
|
|
25327
|
-
return normalizeSessionId(
|
|
25352
|
+
return normalizeSessionId(getProcessEnv2()?.[TELEMETRY_SESSION_ID_ENV]);
|
|
25328
25353
|
}
|
|
25329
25354
|
function resolveTelemetrySessionId(existingSessionId) {
|
|
25330
25355
|
return getConfiguredTelemetrySessionId() ?? normalizeSessionId(existingSessionId);
|
|
25331
25356
|
}
|
|
25357
|
+
function getTelemetryOperationId() {
|
|
25358
|
+
const existing = telemetryOperationIdSlot.get();
|
|
25359
|
+
if (existing) {
|
|
25360
|
+
return existing;
|
|
25361
|
+
}
|
|
25362
|
+
const inboundTraceId = getInboundTraceContext()?.traceId;
|
|
25363
|
+
const generated = inboundTraceId ?? crypto.randomUUID().replaceAll("-", "");
|
|
25364
|
+
telemetryOperationIdSlot.set(generated);
|
|
25365
|
+
return generated;
|
|
25366
|
+
}
|
|
25332
25367
|
// ../../common/src/telemetry/global-telemetry-properties.ts
|
|
25333
25368
|
var telemetryPropsSlot = singleton("TelemetryDefaultProps");
|
|
25334
25369
|
function getGlobalTelemetryProperties() {
|
|
25335
25370
|
return telemetryPropsSlot.get();
|
|
25336
25371
|
}
|
|
25337
25372
|
|
|
25373
|
+
// ../../common/src/telemetry/pii-redactor.ts
|
|
25374
|
+
var REDACTED = "[REDACTED]";
|
|
25375
|
+
var MAX_VALUE_LENGTH = 200;
|
|
25376
|
+
var SENSITIVE_NAME_TOKENS = new Set([
|
|
25377
|
+
"token",
|
|
25378
|
+
"tokens",
|
|
25379
|
+
"secret",
|
|
25380
|
+
"secrets",
|
|
25381
|
+
"password",
|
|
25382
|
+
"passwords",
|
|
25383
|
+
"pwd",
|
|
25384
|
+
"credential",
|
|
25385
|
+
"credentials",
|
|
25386
|
+
"auth",
|
|
25387
|
+
"authentication",
|
|
25388
|
+
"authorization",
|
|
25389
|
+
"authority",
|
|
25390
|
+
"cert",
|
|
25391
|
+
"certificate",
|
|
25392
|
+
"certificates"
|
|
25393
|
+
]);
|
|
25394
|
+
var SENSITIVE_KEY_PREFIXES = new Set([
|
|
25395
|
+
"api",
|
|
25396
|
+
"access",
|
|
25397
|
+
"client",
|
|
25398
|
+
"private",
|
|
25399
|
+
"public",
|
|
25400
|
+
"signing",
|
|
25401
|
+
"encryption",
|
|
25402
|
+
"session",
|
|
25403
|
+
"master",
|
|
25404
|
+
"shared",
|
|
25405
|
+
"root",
|
|
25406
|
+
"ssh",
|
|
25407
|
+
"rsa",
|
|
25408
|
+
"aes",
|
|
25409
|
+
"hmac",
|
|
25410
|
+
"oauth"
|
|
25411
|
+
]);
|
|
25412
|
+
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;
|
|
25413
|
+
var EMAIL_PATTERN = /\b[^\s@]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/g;
|
|
25414
|
+
var JWT_PATTERN = /\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/g;
|
|
25415
|
+
var LONG_TOKEN_PATTERN = /\b[A-Za-z0-9_-]{40,}\b/g;
|
|
25416
|
+
var USER_HOME_PATTERN = /([/\\])(Users|home)([/\\])([^/\\]+)/gi;
|
|
25417
|
+
var URL_PATTERN = /\bhttps?:\/\/[^\s,;]+/gi;
|
|
25418
|
+
var URL_TRAILING_PUNCT = /[.,;:!?)\]}>'"]+$/;
|
|
25419
|
+
function shortHash(input) {
|
|
25420
|
+
let hash = 2166136261;
|
|
25421
|
+
for (let i = 0;i < input.length; i++) {
|
|
25422
|
+
hash ^= input.charCodeAt(i);
|
|
25423
|
+
hash = Math.imul(hash, 16777619);
|
|
25424
|
+
}
|
|
25425
|
+
return (hash >>> 0).toString(16).padStart(8, "0");
|
|
25426
|
+
}
|
|
25427
|
+
function redactUrl(raw) {
|
|
25428
|
+
try {
|
|
25429
|
+
const url = new URL(raw);
|
|
25430
|
+
return `${url.protocol}//${url.host}`;
|
|
25431
|
+
} catch {
|
|
25432
|
+
return `url#${shortHash(raw)}`;
|
|
25433
|
+
}
|
|
25434
|
+
}
|
|
25435
|
+
function redactValueDetectors(value) {
|
|
25436
|
+
let out = value;
|
|
25437
|
+
out = out.replace(JWT_PATTERN, () => REDACTED);
|
|
25438
|
+
out = out.replace(URL_PATTERN, (match) => {
|
|
25439
|
+
const trailing = match.match(URL_TRAILING_PUNCT)?.[0] ?? "";
|
|
25440
|
+
const core2 = trailing ? match.slice(0, -trailing.length) : match;
|
|
25441
|
+
return `${redactUrl(core2)}${trailing}`;
|
|
25442
|
+
});
|
|
25443
|
+
out = out.replace(USER_HOME_PATTERN, (_match, sep1, folder, sep2) => `${sep1}${folder}${sep2}<user>`);
|
|
25444
|
+
out = out.replace(EMAIL_PATTERN, (match) => `email#${shortHash(match)}`);
|
|
25445
|
+
out = out.replace(UUID_PATTERN, (match) => `uuid#${shortHash(match)}`);
|
|
25446
|
+
out = out.replace(LONG_TOKEN_PATTERN, () => REDACTED);
|
|
25447
|
+
if (out.length > MAX_VALUE_LENGTH) {
|
|
25448
|
+
out = `${out.slice(0, MAX_VALUE_LENGTH)}…`;
|
|
25449
|
+
}
|
|
25450
|
+
return out;
|
|
25451
|
+
}
|
|
25452
|
+
function redactValue(value) {
|
|
25453
|
+
return redactValueDetectors(value);
|
|
25454
|
+
}
|
|
25455
|
+
function redactError(error) {
|
|
25456
|
+
const safe = new Error(redactValueDetectors(error.message ?? ""));
|
|
25457
|
+
safe.name = error.name;
|
|
25458
|
+
safe.stack = typeof error.stack === "string" ? redactValueDetectors(error.stack) : undefined;
|
|
25459
|
+
return safe;
|
|
25460
|
+
}
|
|
25461
|
+
function nameTokens(name) {
|
|
25462
|
+
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);
|
|
25463
|
+
}
|
|
25464
|
+
function isSensitiveName(name) {
|
|
25465
|
+
const tokens = nameTokens(name);
|
|
25466
|
+
for (let i = 0;i < tokens.length; i++) {
|
|
25467
|
+
const token = tokens[i];
|
|
25468
|
+
if (SENSITIVE_NAME_TOKENS.has(token)) {
|
|
25469
|
+
return true;
|
|
25470
|
+
}
|
|
25471
|
+
if (token === "key" || token === "keys") {
|
|
25472
|
+
const prev = tokens[i - 1];
|
|
25473
|
+
if (prev && SENSITIVE_KEY_PREFIXES.has(prev)) {
|
|
25474
|
+
return true;
|
|
25475
|
+
}
|
|
25476
|
+
}
|
|
25477
|
+
}
|
|
25478
|
+
return false;
|
|
25479
|
+
}
|
|
25480
|
+
function redactProperty(name, value) {
|
|
25481
|
+
if (value === undefined || value === null) {
|
|
25482
|
+
return;
|
|
25483
|
+
}
|
|
25484
|
+
if (isSensitiveName(name)) {
|
|
25485
|
+
return REDACTED;
|
|
25486
|
+
}
|
|
25487
|
+
if (typeof value === "boolean" || typeof value === "number") {
|
|
25488
|
+
return value;
|
|
25489
|
+
}
|
|
25490
|
+
if (typeof value !== "string") {
|
|
25491
|
+
return "[OBJECT]";
|
|
25492
|
+
}
|
|
25493
|
+
return redactValueDetectors(value);
|
|
25494
|
+
}
|
|
25495
|
+
function redactProperties(properties) {
|
|
25496
|
+
const out = {};
|
|
25497
|
+
for (const [name, value] of Object.entries(properties)) {
|
|
25498
|
+
const redacted = redactProperty(name, value);
|
|
25499
|
+
if (redacted !== undefined) {
|
|
25500
|
+
out[name] = redacted;
|
|
25501
|
+
}
|
|
25502
|
+
}
|
|
25503
|
+
return out;
|
|
25504
|
+
}
|
|
25505
|
+
|
|
25338
25506
|
// ../../common/src/telemetry/telemetry-service.ts
|
|
25507
|
+
var TELEMETRY_OPERATION_ID_PROPERTY = "uip.trace.operation_id";
|
|
25508
|
+
var TELEMETRY_PARENT_ID_PROPERTY = "uip.trace.parent_id";
|
|
25509
|
+
var TELEMETRY_SPAN_ID_PROPERTY = "uip.trace.span_id";
|
|
25510
|
+
|
|
25339
25511
|
class TelemetryService {
|
|
25340
25512
|
telemetryProvider;
|
|
25341
25513
|
contextStorage;
|
|
@@ -25362,11 +25534,15 @@ class TelemetryService {
|
|
|
25362
25534
|
trackException(error, properties) {
|
|
25363
25535
|
const context = this.getCurrentContext();
|
|
25364
25536
|
const enrichedProperties = this.enrichPropertiesWithContext(properties, context);
|
|
25365
|
-
this.telemetryProvider.trackException(error, enrichedProperties);
|
|
25537
|
+
this.telemetryProvider.trackException(redactError(error), enrichedProperties);
|
|
25366
25538
|
}
|
|
25367
25539
|
async trackRequest(name, fn, properties) {
|
|
25540
|
+
const parentContext = this.getCurrentContext();
|
|
25541
|
+
const operationId = parentContext?.operationId ?? this.operationId ?? getTelemetryOperationId();
|
|
25542
|
+
const parentId = parentContext ? parentContext.id : this.inboundParentIdFor(operationId);
|
|
25368
25543
|
const context = {
|
|
25369
|
-
operationId
|
|
25544
|
+
operationId,
|
|
25545
|
+
...parentId !== undefined ? { parentId } : {},
|
|
25370
25546
|
id: this.generateId()
|
|
25371
25547
|
};
|
|
25372
25548
|
const startTime = performance.now();
|
|
@@ -25384,6 +25560,45 @@ class TelemetryService {
|
|
|
25384
25560
|
throw error;
|
|
25385
25561
|
}
|
|
25386
25562
|
}
|
|
25563
|
+
trackRequestResult(name, durationMs, success, properties, context) {
|
|
25564
|
+
const requestContext = context ?? {
|
|
25565
|
+
operationId: this.operationId ?? getTelemetryOperationId(),
|
|
25566
|
+
id: this.generateId()
|
|
25567
|
+
};
|
|
25568
|
+
const enrichedProperties = this.enrichPropertiesWithContext(properties, requestContext);
|
|
25569
|
+
this.telemetryProvider.trackRequest(name, durationMs, success, enrichedProperties);
|
|
25570
|
+
}
|
|
25571
|
+
createRequestContext() {
|
|
25572
|
+
const operationId = this.operationId ?? getTelemetryOperationId();
|
|
25573
|
+
const parentId = this.inboundParentIdFor(operationId);
|
|
25574
|
+
return {
|
|
25575
|
+
operationId,
|
|
25576
|
+
...parentId !== undefined ? { parentId } : {},
|
|
25577
|
+
id: this.generateId()
|
|
25578
|
+
};
|
|
25579
|
+
}
|
|
25580
|
+
inboundParentIdFor(operationId) {
|
|
25581
|
+
const inbound = getInboundTraceContext();
|
|
25582
|
+
return inbound && inbound.traceId === operationId ? inbound.parentSpanId : undefined;
|
|
25583
|
+
}
|
|
25584
|
+
runWithContext(context, fn) {
|
|
25585
|
+
return this.contextStorage.run(context, fn);
|
|
25586
|
+
}
|
|
25587
|
+
createDependencyContext() {
|
|
25588
|
+
const parentContext = this.getCurrentContext();
|
|
25589
|
+
if (!parentContext) {
|
|
25590
|
+
return;
|
|
25591
|
+
}
|
|
25592
|
+
return {
|
|
25593
|
+
operationId: parentContext.operationId,
|
|
25594
|
+
parentId: parentContext.id,
|
|
25595
|
+
id: this.generateId()
|
|
25596
|
+
};
|
|
25597
|
+
}
|
|
25598
|
+
trackDependencyResult(name, type2, durationMs, success, properties, context, resultCode) {
|
|
25599
|
+
const enrichedProperties = this.enrichPropertiesWithContext(properties, context);
|
|
25600
|
+
this.telemetryProvider.trackDependency(redactValue(name), type2, durationMs, success, enrichedProperties, resultCode);
|
|
25601
|
+
}
|
|
25387
25602
|
async trackDependencyOperation(name, type2, fn, properties) {
|
|
25388
25603
|
const parentContext = this.getCurrentContext();
|
|
25389
25604
|
if (!parentContext) {
|
|
@@ -25420,8 +25635,12 @@ class TelemetryService {
|
|
|
25420
25635
|
...getExecutionContextTelemetryProperties(),
|
|
25421
25636
|
...globalProperties,
|
|
25422
25637
|
...this.defaultProperties,
|
|
25423
|
-
...properties,
|
|
25424
|
-
...context
|
|
25638
|
+
...redactProperties(properties ?? {}),
|
|
25639
|
+
...context ? {
|
|
25640
|
+
[TELEMETRY_OPERATION_ID_PROPERTY]: context.operationId,
|
|
25641
|
+
...context.parentId !== undefined ? { [TELEMETRY_PARENT_ID_PROPERTY]: context.parentId } : {},
|
|
25642
|
+
[TELEMETRY_SPAN_ID_PROPERTY]: context.id
|
|
25643
|
+
} : {}
|
|
25425
25644
|
};
|
|
25426
25645
|
if (sessionId === undefined) {
|
|
25427
25646
|
delete enriched[TELEMETRY_SESSION_ID_PROPERTY];
|
|
@@ -25431,7 +25650,16 @@ class TelemetryService {
|
|
|
25431
25650
|
return enriched;
|
|
25432
25651
|
}
|
|
25433
25652
|
generateId() {
|
|
25434
|
-
|
|
25653
|
+
const bytes = new Uint8Array(8);
|
|
25654
|
+
let hex = "";
|
|
25655
|
+
do {
|
|
25656
|
+
crypto.getRandomValues(bytes);
|
|
25657
|
+
hex = "";
|
|
25658
|
+
for (const byte of bytes) {
|
|
25659
|
+
hex += byte.toString(16).padStart(2, "0");
|
|
25660
|
+
}
|
|
25661
|
+
} while (/^0+$/.test(hex));
|
|
25662
|
+
return hex;
|
|
25435
25663
|
}
|
|
25436
25664
|
}
|
|
25437
25665
|
// ../../common/src/telemetry/node-appinsights-telemetry-provider.ts
|
|
@@ -26137,134 +26365,11 @@ function buildCommandTelemetryAttribution(commandPath, skillSource) {
|
|
|
26137
26365
|
};
|
|
26138
26366
|
}
|
|
26139
26367
|
|
|
26140
|
-
// ../../common/src/telemetry/pii-redactor.ts
|
|
26141
|
-
var REDACTED = "[REDACTED]";
|
|
26142
|
-
var MAX_VALUE_LENGTH = 200;
|
|
26143
|
-
var SENSITIVE_NAME_TOKENS = new Set([
|
|
26144
|
-
"token",
|
|
26145
|
-
"tokens",
|
|
26146
|
-
"secret",
|
|
26147
|
-
"secrets",
|
|
26148
|
-
"password",
|
|
26149
|
-
"passwords",
|
|
26150
|
-
"pwd",
|
|
26151
|
-
"credential",
|
|
26152
|
-
"credentials",
|
|
26153
|
-
"auth",
|
|
26154
|
-
"authentication",
|
|
26155
|
-
"authorization",
|
|
26156
|
-
"authority",
|
|
26157
|
-
"cert",
|
|
26158
|
-
"certificate",
|
|
26159
|
-
"certificates"
|
|
26160
|
-
]);
|
|
26161
|
-
var SENSITIVE_KEY_PREFIXES = new Set([
|
|
26162
|
-
"api",
|
|
26163
|
-
"access",
|
|
26164
|
-
"client",
|
|
26165
|
-
"private",
|
|
26166
|
-
"public",
|
|
26167
|
-
"signing",
|
|
26168
|
-
"encryption",
|
|
26169
|
-
"session",
|
|
26170
|
-
"master",
|
|
26171
|
-
"shared",
|
|
26172
|
-
"root",
|
|
26173
|
-
"ssh",
|
|
26174
|
-
"rsa",
|
|
26175
|
-
"aes",
|
|
26176
|
-
"hmac",
|
|
26177
|
-
"oauth"
|
|
26178
|
-
]);
|
|
26179
|
-
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;
|
|
26180
|
-
var EMAIL_PATTERN = /\b[^\s@]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/g;
|
|
26181
|
-
var JWT_PATTERN = /\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/g;
|
|
26182
|
-
var LONG_TOKEN_PATTERN = /\b[A-Za-z0-9_-]{40,}\b/g;
|
|
26183
|
-
var USER_HOME_PATTERN = /([/\\])(Users|home)([/\\])([^/\\]+)/gi;
|
|
26184
|
-
var URL_PATTERN = /\bhttps?:\/\/[^\s,;]+/gi;
|
|
26185
|
-
var URL_TRAILING_PUNCT = /[.,;:!?)\]}>'"]+$/;
|
|
26186
|
-
function shortHash(input) {
|
|
26187
|
-
let hash = 2166136261;
|
|
26188
|
-
for (let i = 0;i < input.length; i++) {
|
|
26189
|
-
hash ^= input.charCodeAt(i);
|
|
26190
|
-
hash = Math.imul(hash, 16777619);
|
|
26191
|
-
}
|
|
26192
|
-
return (hash >>> 0).toString(16).padStart(8, "0");
|
|
26193
|
-
}
|
|
26194
|
-
function redactUrl(raw) {
|
|
26195
|
-
try {
|
|
26196
|
-
const url = new URL(raw);
|
|
26197
|
-
return `${url.protocol}//${url.host}`;
|
|
26198
|
-
} catch {
|
|
26199
|
-
return `url#${shortHash(raw)}`;
|
|
26200
|
-
}
|
|
26201
|
-
}
|
|
26202
|
-
function redactValueDetectors(value) {
|
|
26203
|
-
let out = value;
|
|
26204
|
-
out = out.replace(JWT_PATTERN, () => REDACTED);
|
|
26205
|
-
out = out.replace(URL_PATTERN, (match) => {
|
|
26206
|
-
const trailing = match.match(URL_TRAILING_PUNCT)?.[0] ?? "";
|
|
26207
|
-
const core2 = trailing ? match.slice(0, -trailing.length) : match;
|
|
26208
|
-
return `${redactUrl(core2)}${trailing}`;
|
|
26209
|
-
});
|
|
26210
|
-
out = out.replace(USER_HOME_PATTERN, (_match, sep1, folder, sep2) => `${sep1}${folder}${sep2}<user>`);
|
|
26211
|
-
out = out.replace(EMAIL_PATTERN, (match) => `email#${shortHash(match)}`);
|
|
26212
|
-
out = out.replace(UUID_PATTERN, (match) => `uuid#${shortHash(match)}`);
|
|
26213
|
-
out = out.replace(LONG_TOKEN_PATTERN, () => REDACTED);
|
|
26214
|
-
if (out.length > MAX_VALUE_LENGTH) {
|
|
26215
|
-
out = `${out.slice(0, MAX_VALUE_LENGTH)}…`;
|
|
26216
|
-
}
|
|
26217
|
-
return out;
|
|
26218
|
-
}
|
|
26219
|
-
function nameTokens(name) {
|
|
26220
|
-
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);
|
|
26221
|
-
}
|
|
26222
|
-
function isSensitiveName(name) {
|
|
26223
|
-
const tokens = nameTokens(name);
|
|
26224
|
-
for (let i = 0;i < tokens.length; i++) {
|
|
26225
|
-
const token = tokens[i];
|
|
26226
|
-
if (SENSITIVE_NAME_TOKENS.has(token)) {
|
|
26227
|
-
return true;
|
|
26228
|
-
}
|
|
26229
|
-
if (token === "key" || token === "keys") {
|
|
26230
|
-
const prev = tokens[i - 1];
|
|
26231
|
-
if (prev && SENSITIVE_KEY_PREFIXES.has(prev)) {
|
|
26232
|
-
return true;
|
|
26233
|
-
}
|
|
26234
|
-
}
|
|
26235
|
-
}
|
|
26236
|
-
return false;
|
|
26237
|
-
}
|
|
26238
|
-
function redactProperty(name, value) {
|
|
26239
|
-
if (value === undefined || value === null) {
|
|
26240
|
-
return;
|
|
26241
|
-
}
|
|
26242
|
-
if (isSensitiveName(name)) {
|
|
26243
|
-
return REDACTED;
|
|
26244
|
-
}
|
|
26245
|
-
if (typeof value === "boolean" || typeof value === "number") {
|
|
26246
|
-
return value;
|
|
26247
|
-
}
|
|
26248
|
-
if (typeof value !== "string") {
|
|
26249
|
-
return "[OBJECT]";
|
|
26250
|
-
}
|
|
26251
|
-
return redactValueDetectors(value);
|
|
26252
|
-
}
|
|
26253
|
-
function redactProperties(properties) {
|
|
26254
|
-
const out = {};
|
|
26255
|
-
for (const [name, value] of Object.entries(properties)) {
|
|
26256
|
-
const redacted = redactProperty(name, value);
|
|
26257
|
-
if (redacted !== undefined) {
|
|
26258
|
-
out[name] = redacted;
|
|
26259
|
-
}
|
|
26260
|
-
}
|
|
26261
|
-
return out;
|
|
26262
|
-
}
|
|
26263
|
-
|
|
26264
26368
|
// ../../common/src/trackedAction.ts
|
|
26265
26369
|
var pollSignalSlot = singleton("PollSignal");
|
|
26266
26370
|
var cliErrorCodeValues = new Set(CLI_ERROR_CODES);
|
|
26267
26371
|
var retryHintValues = new Set(RETRY_HINTS);
|
|
26372
|
+
var TELEMETRY_COMMAND_ARG_PREFIX = "uip.cmd.arg.";
|
|
26268
26373
|
var processContext = {
|
|
26269
26374
|
exit: (code) => {
|
|
26270
26375
|
process.exitCode = code;
|
|
@@ -26275,22 +26380,18 @@ var processContext = {
|
|
|
26275
26380
|
};
|
|
26276
26381
|
function extractCommandParams(cmd) {
|
|
26277
26382
|
const params = {};
|
|
26383
|
+
const add2 = (name, value) => {
|
|
26384
|
+
if (name && value !== undefined) {
|
|
26385
|
+
params[`${TELEMETRY_COMMAND_ARG_PREFIX}${name}`] = value;
|
|
26386
|
+
}
|
|
26387
|
+
};
|
|
26278
26388
|
const registered = cmd.registeredArguments ?? [];
|
|
26279
26389
|
const processed = cmd.processedArgs ?? [];
|
|
26280
26390
|
for (let i = 0;i < registered.length; i++) {
|
|
26281
|
-
|
|
26282
|
-
if (value === undefined) {
|
|
26283
|
-
continue;
|
|
26284
|
-
}
|
|
26285
|
-
const name = registered[i].name();
|
|
26286
|
-
if (name) {
|
|
26287
|
-
params[name] = value;
|
|
26288
|
-
}
|
|
26391
|
+
add2(registered[i].name(), processed[i]);
|
|
26289
26392
|
}
|
|
26290
26393
|
for (const [key, value] of Object.entries(cmd.opts())) {
|
|
26291
|
-
|
|
26292
|
-
params[key] = value;
|
|
26293
|
-
}
|
|
26394
|
+
add2(key, value);
|
|
26294
26395
|
}
|
|
26295
26396
|
return params;
|
|
26296
26397
|
}
|
|
@@ -26333,11 +26434,12 @@ Command2.prototype.trackedAction = function(context, fn, properties) {
|
|
|
26333
26434
|
return this.action(async (...args) => {
|
|
26334
26435
|
const telemetryName = deriveCommandPath(command);
|
|
26335
26436
|
const props = typeof properties === "function" ? properties(...args) : properties;
|
|
26437
|
+
const requestContext = telemetry.createRequestContext();
|
|
26336
26438
|
const startTime = performance.now();
|
|
26337
26439
|
let errorMessage;
|
|
26338
26440
|
let fallbackExitCode = EXIT_CODES.Success;
|
|
26339
26441
|
clearRecordedCommandFailureTelemetry();
|
|
26340
|
-
const [error] = await catchError(fn(...args));
|
|
26442
|
+
const [error] = await catchError(telemetry.runWithContext(requestContext, () => fn(...args)));
|
|
26341
26443
|
if (error) {
|
|
26342
26444
|
errorMessage = error instanceof Error ? error.message : String(error);
|
|
26343
26445
|
logger.debug(`[trackedAction] ${telemetryName} failed: ${errorMessage}`);
|
|
@@ -26373,16 +26475,21 @@ Command2.prototype.trackedAction = function(context, fn, properties) {
|
|
|
26373
26475
|
recordedFailure,
|
|
26374
26476
|
pollSignal: context.pollSignal
|
|
26375
26477
|
});
|
|
26376
|
-
|
|
26377
|
-
|
|
26478
|
+
const commandParams = extractCommandParams(command);
|
|
26479
|
+
if (props) {
|
|
26480
|
+
for (const key of Object.keys(props)) {
|
|
26481
|
+
delete commandParams[`${TELEMETRY_COMMAND_ARG_PREFIX}${key}`];
|
|
26482
|
+
}
|
|
26483
|
+
}
|
|
26484
|
+
const baseProperties = redactProperties({
|
|
26485
|
+
...commandParams,
|
|
26378
26486
|
...props,
|
|
26379
26487
|
...buildCommandTelemetryAttribution(telemetryName, process.env.UIPATH_SKILL),
|
|
26380
26488
|
command: "true",
|
|
26381
|
-
duration: String(durationMs),
|
|
26382
|
-
success: String(success),
|
|
26383
26489
|
...terminalTelemetry,
|
|
26384
26490
|
...errorMessage ? { errorMessage } : {}
|
|
26385
|
-
})
|
|
26491
|
+
});
|
|
26492
|
+
telemetry.trackRequestResult(telemetryName, durationMs, success, baseProperties, requestContext);
|
|
26386
26493
|
});
|
|
26387
26494
|
};
|
|
26388
26495
|
// ../../common/src/console-guard.ts
|
|
@@ -29665,4 +29772,4 @@ export {
|
|
|
29665
29772
|
metadata
|
|
29666
29773
|
};
|
|
29667
29774
|
|
|
29668
|
-
//# debugId=
|
|
29775
|
+
//# debugId=6303A2CF6B2DF43964756E2164756E21
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uipath/resourcecatalog-tool",
|
|
3
3
|
"license": "MIT",
|
|
4
|
-
"version": "1.199.0-preview.
|
|
4
|
+
"version": "1.199.0-preview.99",
|
|
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": "6ba217cddceb86e3fa39ed82e49c5062878a85c6"
|
|
30
30
|
}
|