@uipath/project-packager 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/browser.js CHANGED
@@ -22746,10 +22746,33 @@ class ConsoleTelemetryProvider {
22746
22746
  console.debug(`[Telemetry] Dependency: ${name} [${type}] (${duration}ms, ${success ? "ok" : "fail"})`);
22747
22747
  }
22748
22748
  }
22749
+ var TELEMETRY_TRACEPARENT_ENV = "TRACEPARENT";
22750
+ var TRACEPARENT_PATTERN = /^00-([0-9a-f]{32})-([0-9a-f]{16})-[0-9a-f]{2}$/;
22751
+ function getProcessEnv() {
22752
+ return globalThis.process?.env;
22753
+ }
22754
+ function parseInboundTraceparent(value) {
22755
+ if (!value) {
22756
+ return;
22757
+ }
22758
+ const match = TRACEPARENT_PATTERN.exec(value.trim().toLowerCase());
22759
+ if (!match) {
22760
+ return;
22761
+ }
22762
+ const [, traceId, parentSpanId] = match;
22763
+ if (/^0+$/.test(traceId) || /^0+$/.test(parentSpanId)) {
22764
+ return;
22765
+ }
22766
+ return { traceId, parentSpanId };
22767
+ }
22768
+ function getInboundTraceContext() {
22769
+ return parseInboundTraceparent(getProcessEnv()?.[TELEMETRY_TRACEPARENT_ENV]);
22770
+ }
22749
22771
  var TELEMETRY_SESSION_ID_ENV = "UIPATH_SESSION_ID";
22750
22772
  var TELEMETRY_SESSION_ID_PROPERTY = "session_id";
22751
22773
  var telemetrySessionIdSlot = singleton("TelemetrySessionId");
22752
- function getProcessEnv() {
22774
+ var telemetryOperationIdSlot = singleton("TelemetryOperationId");
22775
+ function getProcessEnv2() {
22753
22776
  return globalThis.process?.env;
22754
22777
  }
22755
22778
  function normalizeSessionId(value) {
@@ -22760,11 +22783,21 @@ function normalizeSessionId(value) {
22760
22783
  return trimmed || undefined;
22761
22784
  }
22762
22785
  function getConfiguredTelemetrySessionId() {
22763
- return normalizeSessionId(getProcessEnv()?.[TELEMETRY_SESSION_ID_ENV]);
22786
+ return normalizeSessionId(getProcessEnv2()?.[TELEMETRY_SESSION_ID_ENV]);
22764
22787
  }
22765
22788
  function resolveTelemetrySessionId(existingSessionId) {
22766
22789
  return getConfiguredTelemetrySessionId() ?? normalizeSessionId(existingSessionId);
22767
22790
  }
22791
+ function getTelemetryOperationId() {
22792
+ const existing = telemetryOperationIdSlot.get();
22793
+ if (existing) {
22794
+ return existing;
22795
+ }
22796
+ const inboundTraceId = getInboundTraceContext()?.traceId;
22797
+ const generated = inboundTraceId ?? crypto.randomUUID().replaceAll("-", "");
22798
+ telemetryOperationIdSlot.set(generated);
22799
+ return generated;
22800
+ }
22768
22801
  var KNOWN_AGENTS = [
22769
22802
  { envVar: "CLAUDECODE", value: "1", id: "claude-code" },
22770
22803
  { envVar: "CURSOR_AGENT", value: "1", id: "cursor" },
@@ -22891,6 +22924,140 @@ function getExecutionContextTelemetryProperties() {
22891
22924
  ...detected.ciProvider ? { ci_provider: detected.ciProvider } : {}
22892
22925
  };
22893
22926
  }
22927
+ var REDACTED = "[REDACTED]";
22928
+ var MAX_VALUE_LENGTH = 200;
22929
+ var SENSITIVE_NAME_TOKENS = new Set([
22930
+ "token",
22931
+ "tokens",
22932
+ "secret",
22933
+ "secrets",
22934
+ "password",
22935
+ "passwords",
22936
+ "pwd",
22937
+ "credential",
22938
+ "credentials",
22939
+ "auth",
22940
+ "authentication",
22941
+ "authorization",
22942
+ "authority",
22943
+ "cert",
22944
+ "certificate",
22945
+ "certificates"
22946
+ ]);
22947
+ var SENSITIVE_KEY_PREFIXES = new Set([
22948
+ "api",
22949
+ "access",
22950
+ "client",
22951
+ "private",
22952
+ "public",
22953
+ "signing",
22954
+ "encryption",
22955
+ "session",
22956
+ "master",
22957
+ "shared",
22958
+ "root",
22959
+ "ssh",
22960
+ "rsa",
22961
+ "aes",
22962
+ "hmac",
22963
+ "oauth"
22964
+ ]);
22965
+ 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;
22966
+ var EMAIL_PATTERN = /\b[^\s@]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/g;
22967
+ var JWT_PATTERN = /\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/g;
22968
+ var LONG_TOKEN_PATTERN = /\b[A-Za-z0-9_-]{40,}\b/g;
22969
+ var USER_HOME_PATTERN = /([/\\])(Users|home)([/\\])([^/\\]+)/gi;
22970
+ var URL_PATTERN = /\bhttps?:\/\/[^\s,;]+/gi;
22971
+ var URL_TRAILING_PUNCT = /[.,;:!?)\]}>'"]+$/;
22972
+ function shortHash(input) {
22973
+ let hash = 2166136261;
22974
+ for (let i2 = 0;i2 < input.length; i2++) {
22975
+ hash ^= input.charCodeAt(i2);
22976
+ hash = Math.imul(hash, 16777619);
22977
+ }
22978
+ return (hash >>> 0).toString(16).padStart(8, "0");
22979
+ }
22980
+ function redactUrl(raw) {
22981
+ try {
22982
+ const url = new URL(raw);
22983
+ return `${url.protocol}//${url.host}`;
22984
+ } catch {
22985
+ return `url#${shortHash(raw)}`;
22986
+ }
22987
+ }
22988
+ function redactValueDetectors(value) {
22989
+ let out = value;
22990
+ out = out.replace(JWT_PATTERN, () => REDACTED);
22991
+ out = out.replace(URL_PATTERN, (match) => {
22992
+ const trailing = match.match(URL_TRAILING_PUNCT)?.[0] ?? "";
22993
+ const core = trailing ? match.slice(0, -trailing.length) : match;
22994
+ return `${redactUrl(core)}${trailing}`;
22995
+ });
22996
+ out = out.replace(USER_HOME_PATTERN, (_match, sep1, folder, sep2) => `${sep1}${folder}${sep2}<user>`);
22997
+ out = out.replace(EMAIL_PATTERN, (match) => `email#${shortHash(match)}`);
22998
+ out = out.replace(UUID_PATTERN, (match) => `uuid#${shortHash(match)}`);
22999
+ out = out.replace(LONG_TOKEN_PATTERN, () => REDACTED);
23000
+ if (out.length > MAX_VALUE_LENGTH) {
23001
+ out = `${out.slice(0, MAX_VALUE_LENGTH)}…`;
23002
+ }
23003
+ return out;
23004
+ }
23005
+ function redactValue(value) {
23006
+ return redactValueDetectors(value);
23007
+ }
23008
+ function redactError(error) {
23009
+ const safe = new Error(redactValueDetectors(error.message ?? ""));
23010
+ safe.name = error.name;
23011
+ safe.stack = typeof error.stack === "string" ? redactValueDetectors(error.stack) : undefined;
23012
+ return safe;
23013
+ }
23014
+ function nameTokens(name) {
23015
+ 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);
23016
+ }
23017
+ function isSensitiveName(name) {
23018
+ const tokens = nameTokens(name);
23019
+ for (let i2 = 0;i2 < tokens.length; i2++) {
23020
+ const token = tokens[i2];
23021
+ if (SENSITIVE_NAME_TOKENS.has(token)) {
23022
+ return true;
23023
+ }
23024
+ if (token === "key" || token === "keys") {
23025
+ const prev = tokens[i2 - 1];
23026
+ if (prev && SENSITIVE_KEY_PREFIXES.has(prev)) {
23027
+ return true;
23028
+ }
23029
+ }
23030
+ }
23031
+ return false;
23032
+ }
23033
+ function redactProperty(name, value) {
23034
+ if (value === undefined || value === null) {
23035
+ return;
23036
+ }
23037
+ if (isSensitiveName(name)) {
23038
+ return REDACTED;
23039
+ }
23040
+ if (typeof value === "boolean" || typeof value === "number") {
23041
+ return value;
23042
+ }
23043
+ if (typeof value !== "string") {
23044
+ return "[OBJECT]";
23045
+ }
23046
+ return redactValueDetectors(value);
23047
+ }
23048
+ function redactProperties(properties) {
23049
+ const out = {};
23050
+ for (const [name, value] of Object.entries(properties)) {
23051
+ const redacted = redactProperty(name, value);
23052
+ if (redacted !== undefined) {
23053
+ out[name] = redacted;
23054
+ }
23055
+ }
23056
+ return out;
23057
+ }
23058
+ var TELEMETRY_OPERATION_ID_PROPERTY = "uip.trace.operation_id";
23059
+ var TELEMETRY_PARENT_ID_PROPERTY = "uip.trace.parent_id";
23060
+ var TELEMETRY_SPAN_ID_PROPERTY = "uip.trace.span_id";
22894
23061
 
22895
23062
  class TelemetryService {
22896
23063
  telemetryProvider;
@@ -22918,11 +23085,15 @@ class TelemetryService {
22918
23085
  trackException(error, properties) {
22919
23086
  const context = this.getCurrentContext();
22920
23087
  const enrichedProperties = this.enrichPropertiesWithContext(properties, context);
22921
- this.telemetryProvider.trackException(error, enrichedProperties);
23088
+ this.telemetryProvider.trackException(redactError(error), enrichedProperties);
22922
23089
  }
22923
23090
  async trackRequest(name, fn, properties) {
23091
+ const parentContext = this.getCurrentContext();
23092
+ const operationId = parentContext?.operationId ?? this.operationId ?? getTelemetryOperationId();
23093
+ const parentId = parentContext ? parentContext.id : this.inboundParentIdFor(operationId);
22924
23094
  const context = {
22925
- operationId: this.operationId ?? this.generateId(),
23095
+ operationId,
23096
+ ...parentId !== undefined ? { parentId } : {},
22926
23097
  id: this.generateId()
22927
23098
  };
22928
23099
  const startTime = performance.now();
@@ -22940,6 +23111,45 @@ class TelemetryService {
22940
23111
  throw error;
22941
23112
  }
22942
23113
  }
23114
+ trackRequestResult(name, durationMs, success, properties, context) {
23115
+ const requestContext = context ?? {
23116
+ operationId: this.operationId ?? getTelemetryOperationId(),
23117
+ id: this.generateId()
23118
+ };
23119
+ const enrichedProperties = this.enrichPropertiesWithContext(properties, requestContext);
23120
+ this.telemetryProvider.trackRequest(name, durationMs, success, enrichedProperties);
23121
+ }
23122
+ createRequestContext() {
23123
+ const operationId = this.operationId ?? getTelemetryOperationId();
23124
+ const parentId = this.inboundParentIdFor(operationId);
23125
+ return {
23126
+ operationId,
23127
+ ...parentId !== undefined ? { parentId } : {},
23128
+ id: this.generateId()
23129
+ };
23130
+ }
23131
+ inboundParentIdFor(operationId) {
23132
+ const inbound = getInboundTraceContext();
23133
+ return inbound && inbound.traceId === operationId ? inbound.parentSpanId : undefined;
23134
+ }
23135
+ runWithContext(context, fn) {
23136
+ return this.contextStorage.run(context, fn);
23137
+ }
23138
+ createDependencyContext() {
23139
+ const parentContext = this.getCurrentContext();
23140
+ if (!parentContext) {
23141
+ return;
23142
+ }
23143
+ return {
23144
+ operationId: parentContext.operationId,
23145
+ parentId: parentContext.id,
23146
+ id: this.generateId()
23147
+ };
23148
+ }
23149
+ trackDependencyResult(name, type, durationMs, success, properties, context, resultCode) {
23150
+ const enrichedProperties = this.enrichPropertiesWithContext(properties, context);
23151
+ this.telemetryProvider.trackDependency(redactValue(name), type, durationMs, success, enrichedProperties, resultCode);
23152
+ }
22943
23153
  async trackDependencyOperation(name, type, fn, properties) {
22944
23154
  const parentContext = this.getCurrentContext();
22945
23155
  if (!parentContext) {
@@ -22976,8 +23186,12 @@ class TelemetryService {
22976
23186
  ...getExecutionContextTelemetryProperties(),
22977
23187
  ...globalProperties,
22978
23188
  ...this.defaultProperties,
22979
- ...properties,
22980
- ...context
23189
+ ...redactProperties(properties ?? {}),
23190
+ ...context ? {
23191
+ [TELEMETRY_OPERATION_ID_PROPERTY]: context.operationId,
23192
+ ...context.parentId !== undefined ? { [TELEMETRY_PARENT_ID_PROPERTY]: context.parentId } : {},
23193
+ [TELEMETRY_SPAN_ID_PROPERTY]: context.id
23194
+ } : {}
22981
23195
  };
22982
23196
  if (sessionId === undefined) {
22983
23197
  delete enriched[TELEMETRY_SESSION_ID_PROPERTY];
@@ -22987,7 +23201,16 @@ class TelemetryService {
22987
23201
  return enriched;
22988
23202
  }
22989
23203
  generateId() {
22990
- return crypto.randomUUID().replaceAll("-", "");
23204
+ const bytes = new Uint8Array(8);
23205
+ let hex = "";
23206
+ do {
23207
+ crypto.getRandomValues(bytes);
23208
+ hex = "";
23209
+ for (const byte of bytes) {
23210
+ hex += byte.toString(16).padStart(2, "0");
23211
+ }
23212
+ } while (/^0+$/.test(hex));
23213
+ return hex;
22991
23214
  }
22992
23215
  }
22993
23216
  var factorySlot = singleton("PackagerFactoryProvider");
@@ -24007,4 +24230,4 @@ export {
24007
24230
  BaseBrowserPackagerFactory
24008
24231
  };
24009
24232
 
24010
- //# debugId=FB4C63AEE91C68CE64756E2164756E21
24233
+ //# debugId=8E4DCDC9DC780CF764756E2164756E21
package/dist/index.js CHANGED
@@ -22746,10 +22746,33 @@ class ConsoleTelemetryProvider {
22746
22746
  console.debug(`[Telemetry] Dependency: ${name} [${type}] (${duration}ms, ${success ? "ok" : "fail"})`);
22747
22747
  }
22748
22748
  }
22749
+ var TELEMETRY_TRACEPARENT_ENV = "TRACEPARENT";
22750
+ var TRACEPARENT_PATTERN = /^00-([0-9a-f]{32})-([0-9a-f]{16})-[0-9a-f]{2}$/;
22751
+ function getProcessEnv() {
22752
+ return globalThis.process?.env;
22753
+ }
22754
+ function parseInboundTraceparent(value) {
22755
+ if (!value) {
22756
+ return;
22757
+ }
22758
+ const match = TRACEPARENT_PATTERN.exec(value.trim().toLowerCase());
22759
+ if (!match) {
22760
+ return;
22761
+ }
22762
+ const [, traceId, parentSpanId] = match;
22763
+ if (/^0+$/.test(traceId) || /^0+$/.test(parentSpanId)) {
22764
+ return;
22765
+ }
22766
+ return { traceId, parentSpanId };
22767
+ }
22768
+ function getInboundTraceContext() {
22769
+ return parseInboundTraceparent(getProcessEnv()?.[TELEMETRY_TRACEPARENT_ENV]);
22770
+ }
22749
22771
  var TELEMETRY_SESSION_ID_ENV = "UIPATH_SESSION_ID";
22750
22772
  var TELEMETRY_SESSION_ID_PROPERTY = "session_id";
22751
22773
  var telemetrySessionIdSlot = singleton("TelemetrySessionId");
22752
- function getProcessEnv() {
22774
+ var telemetryOperationIdSlot = singleton("TelemetryOperationId");
22775
+ function getProcessEnv2() {
22753
22776
  return globalThis.process?.env;
22754
22777
  }
22755
22778
  function normalizeSessionId(value) {
@@ -22760,11 +22783,21 @@ function normalizeSessionId(value) {
22760
22783
  return trimmed || undefined;
22761
22784
  }
22762
22785
  function getConfiguredTelemetrySessionId() {
22763
- return normalizeSessionId(getProcessEnv()?.[TELEMETRY_SESSION_ID_ENV]);
22786
+ return normalizeSessionId(getProcessEnv2()?.[TELEMETRY_SESSION_ID_ENV]);
22764
22787
  }
22765
22788
  function resolveTelemetrySessionId(existingSessionId) {
22766
22789
  return getConfiguredTelemetrySessionId() ?? normalizeSessionId(existingSessionId);
22767
22790
  }
22791
+ function getTelemetryOperationId() {
22792
+ const existing = telemetryOperationIdSlot.get();
22793
+ if (existing) {
22794
+ return existing;
22795
+ }
22796
+ const inboundTraceId = getInboundTraceContext()?.traceId;
22797
+ const generated = inboundTraceId ?? crypto.randomUUID().replaceAll("-", "");
22798
+ telemetryOperationIdSlot.set(generated);
22799
+ return generated;
22800
+ }
22768
22801
  var KNOWN_AGENTS = [
22769
22802
  { envVar: "CLAUDECODE", value: "1", id: "claude-code" },
22770
22803
  { envVar: "CURSOR_AGENT", value: "1", id: "cursor" },
@@ -22891,6 +22924,140 @@ function getExecutionContextTelemetryProperties() {
22891
22924
  ...detected.ciProvider ? { ci_provider: detected.ciProvider } : {}
22892
22925
  };
22893
22926
  }
22927
+ var REDACTED = "[REDACTED]";
22928
+ var MAX_VALUE_LENGTH = 200;
22929
+ var SENSITIVE_NAME_TOKENS = new Set([
22930
+ "token",
22931
+ "tokens",
22932
+ "secret",
22933
+ "secrets",
22934
+ "password",
22935
+ "passwords",
22936
+ "pwd",
22937
+ "credential",
22938
+ "credentials",
22939
+ "auth",
22940
+ "authentication",
22941
+ "authorization",
22942
+ "authority",
22943
+ "cert",
22944
+ "certificate",
22945
+ "certificates"
22946
+ ]);
22947
+ var SENSITIVE_KEY_PREFIXES = new Set([
22948
+ "api",
22949
+ "access",
22950
+ "client",
22951
+ "private",
22952
+ "public",
22953
+ "signing",
22954
+ "encryption",
22955
+ "session",
22956
+ "master",
22957
+ "shared",
22958
+ "root",
22959
+ "ssh",
22960
+ "rsa",
22961
+ "aes",
22962
+ "hmac",
22963
+ "oauth"
22964
+ ]);
22965
+ 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;
22966
+ var EMAIL_PATTERN = /\b[^\s@]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/g;
22967
+ var JWT_PATTERN = /\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/g;
22968
+ var LONG_TOKEN_PATTERN = /\b[A-Za-z0-9_-]{40,}\b/g;
22969
+ var USER_HOME_PATTERN = /([/\\])(Users|home)([/\\])([^/\\]+)/gi;
22970
+ var URL_PATTERN = /\bhttps?:\/\/[^\s,;]+/gi;
22971
+ var URL_TRAILING_PUNCT = /[.,;:!?)\]}>'"]+$/;
22972
+ function shortHash(input) {
22973
+ let hash = 2166136261;
22974
+ for (let i2 = 0;i2 < input.length; i2++) {
22975
+ hash ^= input.charCodeAt(i2);
22976
+ hash = Math.imul(hash, 16777619);
22977
+ }
22978
+ return (hash >>> 0).toString(16).padStart(8, "0");
22979
+ }
22980
+ function redactUrl(raw) {
22981
+ try {
22982
+ const url = new URL(raw);
22983
+ return `${url.protocol}//${url.host}`;
22984
+ } catch {
22985
+ return `url#${shortHash(raw)}`;
22986
+ }
22987
+ }
22988
+ function redactValueDetectors(value) {
22989
+ let out = value;
22990
+ out = out.replace(JWT_PATTERN, () => REDACTED);
22991
+ out = out.replace(URL_PATTERN, (match) => {
22992
+ const trailing = match.match(URL_TRAILING_PUNCT)?.[0] ?? "";
22993
+ const core = trailing ? match.slice(0, -trailing.length) : match;
22994
+ return `${redactUrl(core)}${trailing}`;
22995
+ });
22996
+ out = out.replace(USER_HOME_PATTERN, (_match, sep1, folder, sep2) => `${sep1}${folder}${sep2}<user>`);
22997
+ out = out.replace(EMAIL_PATTERN, (match) => `email#${shortHash(match)}`);
22998
+ out = out.replace(UUID_PATTERN, (match) => `uuid#${shortHash(match)}`);
22999
+ out = out.replace(LONG_TOKEN_PATTERN, () => REDACTED);
23000
+ if (out.length > MAX_VALUE_LENGTH) {
23001
+ out = `${out.slice(0, MAX_VALUE_LENGTH)}…`;
23002
+ }
23003
+ return out;
23004
+ }
23005
+ function redactValue(value) {
23006
+ return redactValueDetectors(value);
23007
+ }
23008
+ function redactError(error) {
23009
+ const safe = new Error(redactValueDetectors(error.message ?? ""));
23010
+ safe.name = error.name;
23011
+ safe.stack = typeof error.stack === "string" ? redactValueDetectors(error.stack) : undefined;
23012
+ return safe;
23013
+ }
23014
+ function nameTokens(name) {
23015
+ 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);
23016
+ }
23017
+ function isSensitiveName(name) {
23018
+ const tokens = nameTokens(name);
23019
+ for (let i2 = 0;i2 < tokens.length; i2++) {
23020
+ const token = tokens[i2];
23021
+ if (SENSITIVE_NAME_TOKENS.has(token)) {
23022
+ return true;
23023
+ }
23024
+ if (token === "key" || token === "keys") {
23025
+ const prev = tokens[i2 - 1];
23026
+ if (prev && SENSITIVE_KEY_PREFIXES.has(prev)) {
23027
+ return true;
23028
+ }
23029
+ }
23030
+ }
23031
+ return false;
23032
+ }
23033
+ function redactProperty(name, value) {
23034
+ if (value === undefined || value === null) {
23035
+ return;
23036
+ }
23037
+ if (isSensitiveName(name)) {
23038
+ return REDACTED;
23039
+ }
23040
+ if (typeof value === "boolean" || typeof value === "number") {
23041
+ return value;
23042
+ }
23043
+ if (typeof value !== "string") {
23044
+ return "[OBJECT]";
23045
+ }
23046
+ return redactValueDetectors(value);
23047
+ }
23048
+ function redactProperties(properties) {
23049
+ const out = {};
23050
+ for (const [name, value] of Object.entries(properties)) {
23051
+ const redacted = redactProperty(name, value);
23052
+ if (redacted !== undefined) {
23053
+ out[name] = redacted;
23054
+ }
23055
+ }
23056
+ return out;
23057
+ }
23058
+ var TELEMETRY_OPERATION_ID_PROPERTY = "uip.trace.operation_id";
23059
+ var TELEMETRY_PARENT_ID_PROPERTY = "uip.trace.parent_id";
23060
+ var TELEMETRY_SPAN_ID_PROPERTY = "uip.trace.span_id";
22894
23061
 
22895
23062
  class TelemetryService {
22896
23063
  telemetryProvider;
@@ -22918,11 +23085,15 @@ class TelemetryService {
22918
23085
  trackException(error, properties) {
22919
23086
  const context = this.getCurrentContext();
22920
23087
  const enrichedProperties = this.enrichPropertiesWithContext(properties, context);
22921
- this.telemetryProvider.trackException(error, enrichedProperties);
23088
+ this.telemetryProvider.trackException(redactError(error), enrichedProperties);
22922
23089
  }
22923
23090
  async trackRequest(name, fn, properties) {
23091
+ const parentContext = this.getCurrentContext();
23092
+ const operationId = parentContext?.operationId ?? this.operationId ?? getTelemetryOperationId();
23093
+ const parentId = parentContext ? parentContext.id : this.inboundParentIdFor(operationId);
22924
23094
  const context = {
22925
- operationId: this.operationId ?? this.generateId(),
23095
+ operationId,
23096
+ ...parentId !== undefined ? { parentId } : {},
22926
23097
  id: this.generateId()
22927
23098
  };
22928
23099
  const startTime = performance.now();
@@ -22940,6 +23111,45 @@ class TelemetryService {
22940
23111
  throw error;
22941
23112
  }
22942
23113
  }
23114
+ trackRequestResult(name, durationMs, success, properties, context) {
23115
+ const requestContext = context ?? {
23116
+ operationId: this.operationId ?? getTelemetryOperationId(),
23117
+ id: this.generateId()
23118
+ };
23119
+ const enrichedProperties = this.enrichPropertiesWithContext(properties, requestContext);
23120
+ this.telemetryProvider.trackRequest(name, durationMs, success, enrichedProperties);
23121
+ }
23122
+ createRequestContext() {
23123
+ const operationId = this.operationId ?? getTelemetryOperationId();
23124
+ const parentId = this.inboundParentIdFor(operationId);
23125
+ return {
23126
+ operationId,
23127
+ ...parentId !== undefined ? { parentId } : {},
23128
+ id: this.generateId()
23129
+ };
23130
+ }
23131
+ inboundParentIdFor(operationId) {
23132
+ const inbound = getInboundTraceContext();
23133
+ return inbound && inbound.traceId === operationId ? inbound.parentSpanId : undefined;
23134
+ }
23135
+ runWithContext(context, fn) {
23136
+ return this.contextStorage.run(context, fn);
23137
+ }
23138
+ createDependencyContext() {
23139
+ const parentContext = this.getCurrentContext();
23140
+ if (!parentContext) {
23141
+ return;
23142
+ }
23143
+ return {
23144
+ operationId: parentContext.operationId,
23145
+ parentId: parentContext.id,
23146
+ id: this.generateId()
23147
+ };
23148
+ }
23149
+ trackDependencyResult(name, type, durationMs, success, properties, context, resultCode) {
23150
+ const enrichedProperties = this.enrichPropertiesWithContext(properties, context);
23151
+ this.telemetryProvider.trackDependency(redactValue(name), type, durationMs, success, enrichedProperties, resultCode);
23152
+ }
22943
23153
  async trackDependencyOperation(name, type, fn, properties) {
22944
23154
  const parentContext = this.getCurrentContext();
22945
23155
  if (!parentContext) {
@@ -22976,8 +23186,12 @@ class TelemetryService {
22976
23186
  ...getExecutionContextTelemetryProperties(),
22977
23187
  ...globalProperties,
22978
23188
  ...this.defaultProperties,
22979
- ...properties,
22980
- ...context
23189
+ ...redactProperties(properties ?? {}),
23190
+ ...context ? {
23191
+ [TELEMETRY_OPERATION_ID_PROPERTY]: context.operationId,
23192
+ ...context.parentId !== undefined ? { [TELEMETRY_PARENT_ID_PROPERTY]: context.parentId } : {},
23193
+ [TELEMETRY_SPAN_ID_PROPERTY]: context.id
23194
+ } : {}
22981
23195
  };
22982
23196
  if (sessionId === undefined) {
22983
23197
  delete enriched[TELEMETRY_SESSION_ID_PROPERTY];
@@ -22987,7 +23201,16 @@ class TelemetryService {
22987
23201
  return enriched;
22988
23202
  }
22989
23203
  generateId() {
22990
- return crypto.randomUUID().replaceAll("-", "");
23204
+ const bytes = new Uint8Array(8);
23205
+ let hex = "";
23206
+ do {
23207
+ crypto.getRandomValues(bytes);
23208
+ hex = "";
23209
+ for (const byte of bytes) {
23210
+ hex += byte.toString(16).padStart(2, "0");
23211
+ }
23212
+ } while (/^0+$/.test(hex));
23213
+ return hex;
22991
23214
  }
22992
23215
  }
22993
23216
  var factorySlot = singleton("PackagerFactoryProvider");
@@ -23390,7 +23613,7 @@ import { translate as translate3 } from "@uipath/solutionpackager-tool-core";
23390
23613
  var package_default = {
23391
23614
  name: "@uipath/project-packager",
23392
23615
  license: "MIT",
23393
- version: "1.199.0-preview.92",
23616
+ version: "1.199.0-preview.99",
23394
23617
  description: "UiPath Project Packager - core library for packing individual UiPath projects",
23395
23618
  type: "module",
23396
23619
  main: "./dist/index.js",
@@ -24665,4 +24888,4 @@ export {
24665
24888
  BrowserContextStorage
24666
24889
  };
24667
24890
 
24668
- //# debugId=F3DBB5787131612164756E2164756E21
24891
+ //# debugId=B19F04E171BC4A5564756E2164756E21
package/dist/node.js CHANGED
@@ -10039,10 +10039,33 @@ class NodeContextStorage {
10039
10039
  return this.storage.getStore();
10040
10040
  }
10041
10041
  }
10042
+ var TELEMETRY_TRACEPARENT_ENV = "TRACEPARENT";
10043
+ var TRACEPARENT_PATTERN = /^00-([0-9a-f]{32})-([0-9a-f]{16})-[0-9a-f]{2}$/;
10044
+ function getProcessEnv() {
10045
+ return globalThis.process?.env;
10046
+ }
10047
+ function parseInboundTraceparent(value) {
10048
+ if (!value) {
10049
+ return;
10050
+ }
10051
+ const match = TRACEPARENT_PATTERN.exec(value.trim().toLowerCase());
10052
+ if (!match) {
10053
+ return;
10054
+ }
10055
+ const [, traceId, parentSpanId] = match;
10056
+ if (/^0+$/.test(traceId) || /^0+$/.test(parentSpanId)) {
10057
+ return;
10058
+ }
10059
+ return { traceId, parentSpanId };
10060
+ }
10061
+ function getInboundTraceContext() {
10062
+ return parseInboundTraceparent(getProcessEnv()?.[TELEMETRY_TRACEPARENT_ENV]);
10063
+ }
10042
10064
  var TELEMETRY_SESSION_ID_ENV = "UIPATH_SESSION_ID";
10043
10065
  var TELEMETRY_SESSION_ID_PROPERTY = "session_id";
10044
10066
  var telemetrySessionIdSlot = singleton("TelemetrySessionId");
10045
- function getProcessEnv() {
10067
+ var telemetryOperationIdSlot = singleton("TelemetryOperationId");
10068
+ function getProcessEnv2() {
10046
10069
  return globalThis.process?.env;
10047
10070
  }
10048
10071
  function normalizeSessionId(value) {
@@ -10053,15 +10076,159 @@ function normalizeSessionId(value) {
10053
10076
  return trimmed || undefined;
10054
10077
  }
10055
10078
  function getConfiguredTelemetrySessionId() {
10056
- return normalizeSessionId(getProcessEnv()?.[TELEMETRY_SESSION_ID_ENV]);
10079
+ return normalizeSessionId(getProcessEnv2()?.[TELEMETRY_SESSION_ID_ENV]);
10057
10080
  }
10058
10081
  function resolveTelemetrySessionId(existingSessionId) {
10059
10082
  return getConfiguredTelemetrySessionId() ?? normalizeSessionId(existingSessionId);
10060
10083
  }
10084
+ function getTelemetryOperationId() {
10085
+ const existing = telemetryOperationIdSlot.get();
10086
+ if (existing) {
10087
+ return existing;
10088
+ }
10089
+ const inboundTraceId = getInboundTraceContext()?.traceId;
10090
+ const generated = inboundTraceId ?? crypto.randomUUID().replaceAll("-", "");
10091
+ telemetryOperationIdSlot.set(generated);
10092
+ return generated;
10093
+ }
10061
10094
  var telemetryPropsSlot = singleton("TelemetryDefaultProps");
10062
10095
  function getGlobalTelemetryProperties() {
10063
10096
  return telemetryPropsSlot.get();
10064
10097
  }
10098
+ var REDACTED = "[REDACTED]";
10099
+ var MAX_VALUE_LENGTH = 200;
10100
+ var SENSITIVE_NAME_TOKENS = new Set([
10101
+ "token",
10102
+ "tokens",
10103
+ "secret",
10104
+ "secrets",
10105
+ "password",
10106
+ "passwords",
10107
+ "pwd",
10108
+ "credential",
10109
+ "credentials",
10110
+ "auth",
10111
+ "authentication",
10112
+ "authorization",
10113
+ "authority",
10114
+ "cert",
10115
+ "certificate",
10116
+ "certificates"
10117
+ ]);
10118
+ var SENSITIVE_KEY_PREFIXES = new Set([
10119
+ "api",
10120
+ "access",
10121
+ "client",
10122
+ "private",
10123
+ "public",
10124
+ "signing",
10125
+ "encryption",
10126
+ "session",
10127
+ "master",
10128
+ "shared",
10129
+ "root",
10130
+ "ssh",
10131
+ "rsa",
10132
+ "aes",
10133
+ "hmac",
10134
+ "oauth"
10135
+ ]);
10136
+ 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;
10137
+ var EMAIL_PATTERN = /\b[^\s@]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/g;
10138
+ var JWT_PATTERN = /\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/g;
10139
+ var LONG_TOKEN_PATTERN = /\b[A-Za-z0-9_-]{40,}\b/g;
10140
+ var USER_HOME_PATTERN = /([/\\])(Users|home)([/\\])([^/\\]+)/gi;
10141
+ var URL_PATTERN = /\bhttps?:\/\/[^\s,;]+/gi;
10142
+ var URL_TRAILING_PUNCT = /[.,;:!?)\]}>'"]+$/;
10143
+ function shortHash(input) {
10144
+ let hash = 2166136261;
10145
+ for (let i = 0;i < input.length; i++) {
10146
+ hash ^= input.charCodeAt(i);
10147
+ hash = Math.imul(hash, 16777619);
10148
+ }
10149
+ return (hash >>> 0).toString(16).padStart(8, "0");
10150
+ }
10151
+ function redactUrl(raw) {
10152
+ try {
10153
+ const url = new URL(raw);
10154
+ return `${url.protocol}//${url.host}`;
10155
+ } catch {
10156
+ return `url#${shortHash(raw)}`;
10157
+ }
10158
+ }
10159
+ function redactValueDetectors(value) {
10160
+ let out = value;
10161
+ out = out.replace(JWT_PATTERN, () => REDACTED);
10162
+ out = out.replace(URL_PATTERN, (match) => {
10163
+ const trailing = match.match(URL_TRAILING_PUNCT)?.[0] ?? "";
10164
+ const core2 = trailing ? match.slice(0, -trailing.length) : match;
10165
+ return `${redactUrl(core2)}${trailing}`;
10166
+ });
10167
+ out = out.replace(USER_HOME_PATTERN, (_match, sep1, folder, sep2) => `${sep1}${folder}${sep2}<user>`);
10168
+ out = out.replace(EMAIL_PATTERN, (match) => `email#${shortHash(match)}`);
10169
+ out = out.replace(UUID_PATTERN, (match) => `uuid#${shortHash(match)}`);
10170
+ out = out.replace(LONG_TOKEN_PATTERN, () => REDACTED);
10171
+ if (out.length > MAX_VALUE_LENGTH) {
10172
+ out = `${out.slice(0, MAX_VALUE_LENGTH)}…`;
10173
+ }
10174
+ return out;
10175
+ }
10176
+ function redactValue(value) {
10177
+ return redactValueDetectors(value);
10178
+ }
10179
+ function redactError(error) {
10180
+ const safe = new Error(redactValueDetectors(error.message ?? ""));
10181
+ safe.name = error.name;
10182
+ safe.stack = typeof error.stack === "string" ? redactValueDetectors(error.stack) : undefined;
10183
+ return safe;
10184
+ }
10185
+ function nameTokens(name) {
10186
+ 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);
10187
+ }
10188
+ function isSensitiveName(name) {
10189
+ const tokens = nameTokens(name);
10190
+ for (let i = 0;i < tokens.length; i++) {
10191
+ const token = tokens[i];
10192
+ if (SENSITIVE_NAME_TOKENS.has(token)) {
10193
+ return true;
10194
+ }
10195
+ if (token === "key" || token === "keys") {
10196
+ const prev = tokens[i - 1];
10197
+ if (prev && SENSITIVE_KEY_PREFIXES.has(prev)) {
10198
+ return true;
10199
+ }
10200
+ }
10201
+ }
10202
+ return false;
10203
+ }
10204
+ function redactProperty(name, value) {
10205
+ if (value === undefined || value === null) {
10206
+ return;
10207
+ }
10208
+ if (isSensitiveName(name)) {
10209
+ return REDACTED;
10210
+ }
10211
+ if (typeof value === "boolean" || typeof value === "number") {
10212
+ return value;
10213
+ }
10214
+ if (typeof value !== "string") {
10215
+ return "[OBJECT]";
10216
+ }
10217
+ return redactValueDetectors(value);
10218
+ }
10219
+ function redactProperties(properties) {
10220
+ const out = {};
10221
+ for (const [name, value] of Object.entries(properties)) {
10222
+ const redacted = redactProperty(name, value);
10223
+ if (redacted !== undefined) {
10224
+ out[name] = redacted;
10225
+ }
10226
+ }
10227
+ return out;
10228
+ }
10229
+ var TELEMETRY_OPERATION_ID_PROPERTY = "uip.trace.operation_id";
10230
+ var TELEMETRY_PARENT_ID_PROPERTY = "uip.trace.parent_id";
10231
+ var TELEMETRY_SPAN_ID_PROPERTY = "uip.trace.span_id";
10065
10232
 
10066
10233
  class TelemetryService {
10067
10234
  telemetryProvider;
@@ -10089,11 +10256,15 @@ class TelemetryService {
10089
10256
  trackException(error, properties) {
10090
10257
  const context = this.getCurrentContext();
10091
10258
  const enrichedProperties = this.enrichPropertiesWithContext(properties, context);
10092
- this.telemetryProvider.trackException(error, enrichedProperties);
10259
+ this.telemetryProvider.trackException(redactError(error), enrichedProperties);
10093
10260
  }
10094
10261
  async trackRequest(name, fn, properties) {
10262
+ const parentContext = this.getCurrentContext();
10263
+ const operationId = parentContext?.operationId ?? this.operationId ?? getTelemetryOperationId();
10264
+ const parentId = parentContext ? parentContext.id : this.inboundParentIdFor(operationId);
10095
10265
  const context = {
10096
- operationId: this.operationId ?? this.generateId(),
10266
+ operationId,
10267
+ ...parentId !== undefined ? { parentId } : {},
10097
10268
  id: this.generateId()
10098
10269
  };
10099
10270
  const startTime = performance.now();
@@ -10111,6 +10282,45 @@ class TelemetryService {
10111
10282
  throw error;
10112
10283
  }
10113
10284
  }
10285
+ trackRequestResult(name, durationMs, success, properties, context) {
10286
+ const requestContext = context ?? {
10287
+ operationId: this.operationId ?? getTelemetryOperationId(),
10288
+ id: this.generateId()
10289
+ };
10290
+ const enrichedProperties = this.enrichPropertiesWithContext(properties, requestContext);
10291
+ this.telemetryProvider.trackRequest(name, durationMs, success, enrichedProperties);
10292
+ }
10293
+ createRequestContext() {
10294
+ const operationId = this.operationId ?? getTelemetryOperationId();
10295
+ const parentId = this.inboundParentIdFor(operationId);
10296
+ return {
10297
+ operationId,
10298
+ ...parentId !== undefined ? { parentId } : {},
10299
+ id: this.generateId()
10300
+ };
10301
+ }
10302
+ inboundParentIdFor(operationId) {
10303
+ const inbound = getInboundTraceContext();
10304
+ return inbound && inbound.traceId === operationId ? inbound.parentSpanId : undefined;
10305
+ }
10306
+ runWithContext(context, fn) {
10307
+ return this.contextStorage.run(context, fn);
10308
+ }
10309
+ createDependencyContext() {
10310
+ const parentContext = this.getCurrentContext();
10311
+ if (!parentContext) {
10312
+ return;
10313
+ }
10314
+ return {
10315
+ operationId: parentContext.operationId,
10316
+ parentId: parentContext.id,
10317
+ id: this.generateId()
10318
+ };
10319
+ }
10320
+ trackDependencyResult(name, type2, durationMs, success, properties, context, resultCode) {
10321
+ const enrichedProperties = this.enrichPropertiesWithContext(properties, context);
10322
+ this.telemetryProvider.trackDependency(redactValue(name), type2, durationMs, success, enrichedProperties, resultCode);
10323
+ }
10114
10324
  async trackDependencyOperation(name, type2, fn, properties) {
10115
10325
  const parentContext = this.getCurrentContext();
10116
10326
  if (!parentContext) {
@@ -10147,8 +10357,12 @@ class TelemetryService {
10147
10357
  ...getExecutionContextTelemetryProperties(),
10148
10358
  ...globalProperties,
10149
10359
  ...this.defaultProperties,
10150
- ...properties,
10151
- ...context
10360
+ ...redactProperties(properties ?? {}),
10361
+ ...context ? {
10362
+ [TELEMETRY_OPERATION_ID_PROPERTY]: context.operationId,
10363
+ ...context.parentId !== undefined ? { [TELEMETRY_PARENT_ID_PROPERTY]: context.parentId } : {},
10364
+ [TELEMETRY_SPAN_ID_PROPERTY]: context.id
10365
+ } : {}
10152
10366
  };
10153
10367
  if (sessionId === undefined) {
10154
10368
  delete enriched[TELEMETRY_SESSION_ID_PROPERTY];
@@ -10158,7 +10372,16 @@ class TelemetryService {
10158
10372
  return enriched;
10159
10373
  }
10160
10374
  generateId() {
10161
- return crypto.randomUUID().replaceAll("-", "");
10375
+ const bytes = new Uint8Array(8);
10376
+ let hex = "";
10377
+ do {
10378
+ crypto.getRandomValues(bytes);
10379
+ hex = "";
10380
+ for (const byte of bytes) {
10381
+ hex += byte.toString(16).padStart(2, "0");
10382
+ }
10383
+ } while (/^0+$/.test(hex));
10384
+ return hex;
10162
10385
  }
10163
10386
  }
10164
10387
  var providerSlot = singleton("TelemetryProvider");
@@ -10853,149 +11076,24 @@ function buildCommandTelemetryAttribution(commandPath, skillSource) {
10853
11076
  ...getCommandProductModeAttribution(commandPath)
10854
11077
  };
10855
11078
  }
10856
- var REDACTED = "[REDACTED]";
10857
- var MAX_VALUE_LENGTH = 200;
10858
- var SENSITIVE_NAME_TOKENS = new Set([
10859
- "token",
10860
- "tokens",
10861
- "secret",
10862
- "secrets",
10863
- "password",
10864
- "passwords",
10865
- "pwd",
10866
- "credential",
10867
- "credentials",
10868
- "auth",
10869
- "authentication",
10870
- "authorization",
10871
- "authority",
10872
- "cert",
10873
- "certificate",
10874
- "certificates"
10875
- ]);
10876
- var SENSITIVE_KEY_PREFIXES = new Set([
10877
- "api",
10878
- "access",
10879
- "client",
10880
- "private",
10881
- "public",
10882
- "signing",
10883
- "encryption",
10884
- "session",
10885
- "master",
10886
- "shared",
10887
- "root",
10888
- "ssh",
10889
- "rsa",
10890
- "aes",
10891
- "hmac",
10892
- "oauth"
10893
- ]);
10894
- 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;
10895
- var EMAIL_PATTERN = /\b[^\s@]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/g;
10896
- var JWT_PATTERN = /\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/g;
10897
- var LONG_TOKEN_PATTERN = /\b[A-Za-z0-9_-]{40,}\b/g;
10898
- var USER_HOME_PATTERN = /([/\\])(Users|home)([/\\])([^/\\]+)/gi;
10899
- var URL_PATTERN = /\bhttps?:\/\/[^\s,;]+/gi;
10900
- var URL_TRAILING_PUNCT = /[.,;:!?)\]}>'"]+$/;
10901
- function shortHash(input) {
10902
- let hash = 2166136261;
10903
- for (let i = 0;i < input.length; i++) {
10904
- hash ^= input.charCodeAt(i);
10905
- hash = Math.imul(hash, 16777619);
10906
- }
10907
- return (hash >>> 0).toString(16).padStart(8, "0");
10908
- }
10909
- function redactUrl(raw) {
10910
- try {
10911
- const url = new URL(raw);
10912
- return `${url.protocol}//${url.host}`;
10913
- } catch {
10914
- return `url#${shortHash(raw)}`;
10915
- }
10916
- }
10917
- function redactValueDetectors(value) {
10918
- let out = value;
10919
- out = out.replace(JWT_PATTERN, () => REDACTED);
10920
- out = out.replace(URL_PATTERN, (match) => {
10921
- const trailing = match.match(URL_TRAILING_PUNCT)?.[0] ?? "";
10922
- const core2 = trailing ? match.slice(0, -trailing.length) : match;
10923
- return `${redactUrl(core2)}${trailing}`;
10924
- });
10925
- out = out.replace(USER_HOME_PATTERN, (_match, sep1, folder, sep2) => `${sep1}${folder}${sep2}<user>`);
10926
- out = out.replace(EMAIL_PATTERN, (match) => `email#${shortHash(match)}`);
10927
- out = out.replace(UUID_PATTERN, (match) => `uuid#${shortHash(match)}`);
10928
- out = out.replace(LONG_TOKEN_PATTERN, () => REDACTED);
10929
- if (out.length > MAX_VALUE_LENGTH) {
10930
- out = `${out.slice(0, MAX_VALUE_LENGTH)}…`;
10931
- }
10932
- return out;
10933
- }
10934
- function nameTokens(name) {
10935
- 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);
10936
- }
10937
- function isSensitiveName(name) {
10938
- const tokens = nameTokens(name);
10939
- for (let i = 0;i < tokens.length; i++) {
10940
- const token = tokens[i];
10941
- if (SENSITIVE_NAME_TOKENS.has(token)) {
10942
- return true;
10943
- }
10944
- if (token === "key" || token === "keys") {
10945
- const prev = tokens[i - 1];
10946
- if (prev && SENSITIVE_KEY_PREFIXES.has(prev)) {
10947
- return true;
10948
- }
10949
- }
10950
- }
10951
- return false;
10952
- }
10953
- function redactProperty(name, value) {
10954
- if (value === undefined || value === null) {
10955
- return;
10956
- }
10957
- if (isSensitiveName(name)) {
10958
- return REDACTED;
10959
- }
10960
- if (typeof value === "boolean" || typeof value === "number") {
10961
- return value;
10962
- }
10963
- if (typeof value !== "string") {
10964
- return "[OBJECT]";
10965
- }
10966
- return redactValueDetectors(value);
10967
- }
10968
- function redactProperties(properties) {
10969
- const out = {};
10970
- for (const [name, value] of Object.entries(properties)) {
10971
- const redacted = redactProperty(name, value);
10972
- if (redacted !== undefined) {
10973
- out[name] = redacted;
10974
- }
10975
- }
10976
- return out;
10977
- }
10978
11079
  var pollSignalSlot = singleton("PollSignal");
10979
11080
  var cliErrorCodeValues = new Set(CLI_ERROR_CODES);
10980
11081
  var retryHintValues = new Set(RETRY_HINTS);
11082
+ var TELEMETRY_COMMAND_ARG_PREFIX = "uip.cmd.arg.";
10981
11083
  function extractCommandParams(cmd) {
10982
11084
  const params = {};
11085
+ const add2 = (name, value) => {
11086
+ if (name && value !== undefined) {
11087
+ params[`${TELEMETRY_COMMAND_ARG_PREFIX}${name}`] = value;
11088
+ }
11089
+ };
10983
11090
  const registered = cmd.registeredArguments ?? [];
10984
11091
  const processed = cmd.processedArgs ?? [];
10985
11092
  for (let i = 0;i < registered.length; i++) {
10986
- const value = processed[i];
10987
- if (value === undefined) {
10988
- continue;
10989
- }
10990
- const name = registered[i].name();
10991
- if (name) {
10992
- params[name] = value;
10993
- }
11093
+ add2(registered[i].name(), processed[i]);
10994
11094
  }
10995
11095
  for (const [key, value] of Object.entries(cmd.opts())) {
10996
- if (value !== undefined) {
10997
- params[key] = value;
10998
- }
11096
+ add2(key, value);
10999
11097
  }
11000
11098
  return params;
11001
11099
  }
@@ -11038,11 +11136,12 @@ Command.prototype.trackedAction = function(context, fn, properties) {
11038
11136
  return this.action(async (...args) => {
11039
11137
  const telemetryName = deriveCommandPath(command);
11040
11138
  const props = typeof properties === "function" ? properties(...args) : properties;
11139
+ const requestContext = telemetry.createRequestContext();
11041
11140
  const startTime = performance.now();
11042
11141
  let errorMessage;
11043
11142
  let fallbackExitCode = EXIT_CODES.Success;
11044
11143
  clearRecordedCommandFailureTelemetry();
11045
- const [error] = await catchError(fn(...args));
11144
+ const [error] = await catchError(telemetry.runWithContext(requestContext, () => fn(...args)));
11046
11145
  if (error) {
11047
11146
  errorMessage = error instanceof Error ? error.message : String(error);
11048
11147
  logger.debug(`[trackedAction] ${telemetryName} failed: ${errorMessage}`);
@@ -11078,16 +11177,21 @@ Command.prototype.trackedAction = function(context, fn, properties) {
11078
11177
  recordedFailure,
11079
11178
  pollSignal: context.pollSignal
11080
11179
  });
11081
- telemetry.trackEvent(telemetryName, redactProperties({
11082
- ...extractCommandParams(command),
11180
+ const commandParams = extractCommandParams(command);
11181
+ if (props) {
11182
+ for (const key of Object.keys(props)) {
11183
+ delete commandParams[`${TELEMETRY_COMMAND_ARG_PREFIX}${key}`];
11184
+ }
11185
+ }
11186
+ const baseProperties = redactProperties({
11187
+ ...commandParams,
11083
11188
  ...props,
11084
11189
  ...buildCommandTelemetryAttribution(telemetryName, process.env.UIPATH_SKILL),
11085
11190
  command: "true",
11086
- duration: String(durationMs),
11087
- success: String(success),
11088
11191
  ...terminalTelemetry,
11089
11192
  ...errorMessage ? { errorMessage } : {}
11090
- }));
11193
+ });
11194
+ telemetry.trackRequestResult(telemetryName, durationMs, success, baseProperties, requestContext);
11091
11195
  });
11092
11196
  };
11093
11197
  var guardInstalledSlot = singleton("ConsoleGuardInstalled");
@@ -12567,7 +12671,7 @@ import { translate as translate9 } from "@uipath/solutionpackager-tool-core";
12567
12671
  var package_default = {
12568
12672
  name: "@uipath/project-packager",
12569
12673
  license: "MIT",
12570
- version: "1.199.0-preview.92",
12674
+ version: "1.199.0-preview.99",
12571
12675
  description: "UiPath Project Packager - core library for packing individual UiPath projects",
12572
12676
  type: "module",
12573
12677
  main: "./dist/index.js",
@@ -13024,4 +13128,4 @@ export {
13024
13128
  BaseNodePackagerFactory
13025
13129
  };
13026
13130
 
13027
- //# debugId=E631A09787A43CB864756E2164756E21
13131
+ //# debugId=CCA662744595352D64756E2164756E21
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@uipath/project-packager",
3
3
  "license": "MIT",
4
- "version": "1.199.0-preview.92",
4
+ "version": "1.199.0-preview.99",
5
5
  "description": "UiPath Project Packager - core library for packing individual UiPath projects",
6
6
  "type": "module",
7
7
  "main": "./dist/index.js",
@@ -39,5 +39,5 @@
39
39
  "peerDependencies": {
40
40
  "fflate": "^0.8.2"
41
41
  },
42
- "gitHead": "d7b66f18f30e2e80a17293b6a0b656b54da35d49"
42
+ "gitHead": "6ba217cddceb86e3fa39ed82e49c5062878a85c6"
43
43
  }