@uipath/rpa-tool 1.198.2 → 1.198.4

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.
Files changed (2) hide show
  1. package/dist/tool.js +183 -110
  2. package/package.json +7 -7
package/dist/tool.js CHANGED
@@ -59091,7 +59091,7 @@ var {
59091
59091
  // package.json
59092
59092
  var package_default = {
59093
59093
  name: "@uipath/rpa-tool",
59094
- version: "1.198.2",
59094
+ version: "1.198.4",
59095
59095
  description: "Tool for creating and managing UiPath RPA projects",
59096
59096
  keywords: [
59097
59097
  "uipcli-tool",
@@ -59372,9 +59372,37 @@ var registerListInstancesCommand = (program3) => {
59372
59372
  // src/commands/packager/analyze.ts
59373
59373
  import { isAbsolute as isAbsolute5, join as join11 } from "node:path";
59374
59374
 
59375
- // src/telemetry/project-shape.ts
59376
- import { readdirSync as readdirSync2, readFileSync } from "node:fs";
59377
- import { dirname as dirname2, join as join4 } from "node:path";
59375
+ // src/telemetry/studio-shaped-props.ts
59376
+ import { readFileSync } from "node:fs";
59377
+
59378
+ // src/telemetry/authoring-session.ts
59379
+ import { hostname } from "node:os";
59380
+
59381
+ // src/telemetry/identity-hash.ts
59382
+ import { createHash } from "node:crypto";
59383
+ function identityHash(value) {
59384
+ return createHash("sha256").update(value.trim().toLowerCase()).digest("hex").slice(0, 16);
59385
+ }
59386
+
59387
+ // src/telemetry/authoring-session.ts
59388
+ var SESSION_ID_ENV = "UIPATH_SESSION_ID";
59389
+ function getAuthoringSessionProps() {
59390
+ const explicit = process.env[SESSION_ID_ENV];
59391
+ if (explicit && explicit.trim().length > 0) {
59392
+ return {
59393
+ authoringSessionId: identityHash(explicit),
59394
+ authoringSessionSource: "explicit"
59395
+ };
59396
+ }
59397
+ try {
59398
+ return {
59399
+ authoringSessionId: identityHash(`${process.ppid}:${hostname()}`),
59400
+ authoringSessionSource: "ppid"
59401
+ };
59402
+ } catch {
59403
+ return {};
59404
+ }
59405
+ }
59378
59406
 
59379
59407
  // src/telemetry/project-json-path.ts
59380
59408
  import { statSync } from "node:fs";
@@ -59393,13 +59421,88 @@ function resolveProjectJsonPath(input) {
59393
59421
  return basename2(abs).toLowerCase() === "project.json" ? abs : undefined;
59394
59422
  }
59395
59423
 
59424
+ // src/telemetry/studio-shaped-props.ts
59425
+ var TELEMETRY_SOURCE = "rpa-tool";
59426
+ function asNonEmptyString(value) {
59427
+ return typeof value === "string" && value.length > 0 ? value : undefined;
59428
+ }
59429
+ function readProjectFields(input) {
59430
+ const path3 = resolveProjectJsonPath(input);
59431
+ if (!path3) {
59432
+ return {};
59433
+ }
59434
+ let project;
59435
+ try {
59436
+ project = JSON.parse(readFileSync(path3, "utf8"));
59437
+ } catch {
59438
+ return {};
59439
+ }
59440
+ const fields = {};
59441
+ const set = (key, value) => {
59442
+ const str = asNonEmptyString(value);
59443
+ if (str) {
59444
+ fields[key] = str;
59445
+ }
59446
+ };
59447
+ const projectId = asNonEmptyString(project.projectId);
59448
+ if (projectId) {
59449
+ fields.projectIdHash = identityHash(projectId);
59450
+ const noDash = projectId.trim().toLowerCase().replaceAll("-", "");
59451
+ if (/^[0-9a-f]{32}$/.test(noDash)) {
59452
+ fields.projectIdNoDash = noDash;
59453
+ }
59454
+ }
59455
+ set("targetFramework", project.targetFramework);
59456
+ set("expressionLanguage", project.expressionLanguage);
59457
+ set("projectType", project.designOptions?.outputType);
59458
+ set("projectVersion", project.projectVersion);
59459
+ return fields;
59460
+ }
59461
+ function buildStudioShapedProps(projectDir, extra) {
59462
+ const fields = projectDir ? readProjectFields(projectDir) : {};
59463
+ return {
59464
+ source: TELEMETRY_SOURCE,
59465
+ ...getAuthoringSessionProps(),
59466
+ ...fields,
59467
+ ...extra
59468
+ };
59469
+ }
59470
+
59471
+ // src/telemetry/analyze-result-telemetry.ts
59472
+ function emitAnalyzeResult(projectDir, action, counts, ruleIds) {
59473
+ try {
59474
+ const topRuleIds = [...new Set(ruleIds)].slice(0, 10).join(",");
59475
+ telemetry.trackEvent("uip.rpa.analyze.result", redactProperties({
59476
+ ...buildStudioShapedProps(projectDir, { action }),
59477
+ errorCount: String(counts.errorCount),
59478
+ ...counts.findingCount !== undefined ? { findingCount: String(counts.findingCount) } : {},
59479
+ ...counts.warningCount !== undefined ? { warningCount: String(counts.warningCount) } : {},
59480
+ ...counts.infoCount !== undefined ? { infoCount: String(counts.infoCount) } : {},
59481
+ ...topRuleIds ? { topRuleIds } : {}
59482
+ }));
59483
+ } catch {}
59484
+ }
59485
+ var ANALYZER_ERROR_LINE = /\bAnalyzer error: ([A-Z]+-[A-Z]+-\d+)\b/g;
59486
+ function parseAnalyzerErrorSummary(message) {
59487
+ if (!message) {
59488
+ return;
59489
+ }
59490
+ const ruleIds = [...message.matchAll(ANALYZER_ERROR_LINE)].map((match) => match[1]);
59491
+ if (ruleIds.length === 0) {
59492
+ return;
59493
+ }
59494
+ return { errorCount: ruleIds.length, ruleIds };
59495
+ }
59496
+
59396
59497
  // src/telemetry/project-shape.ts
59498
+ import { readdirSync as readdirSync2, readFileSync as readFileSync2 } from "node:fs";
59499
+ import { dirname as dirname2, join as join4 } from "node:path";
59397
59500
  var MAX_FILES = 500;
59398
59501
  var MAX_WALK_MS = 50;
59399
59502
  var SKIP_DIRS = new Set(["obj", "bin", "node_modules"]);
59400
59503
  function countActivities(xamlPath) {
59401
59504
  try {
59402
- const matches = readFileSync(xamlPath, "utf8").match(/WorkflowViewState\.IdRef=/g);
59505
+ const matches = readFileSync2(xamlPath, "utf8").match(/WorkflowViewState\.IdRef=/g);
59403
59506
  return matches ? matches.length : 0;
59404
59507
  } catch {
59405
59508
  return 0;
@@ -59428,7 +59531,7 @@ function readManifestCounts(jsonPath) {
59428
59531
  const counts = {};
59429
59532
  let project;
59430
59533
  try {
59431
- project = JSON.parse(readFileSync(jsonPath, "utf8"));
59534
+ project = JSON.parse(readFileSync2(jsonPath, "utf8"));
59432
59535
  } catch {
59433
59536
  return counts;
59434
59537
  }
@@ -59506,85 +59609,6 @@ function getProjectShapeProps(projectDirInput) {
59506
59609
  return shape;
59507
59610
  }
59508
59611
 
59509
- // src/telemetry/studio-shaped-props.ts
59510
- import { readFileSync as readFileSync2 } from "node:fs";
59511
-
59512
- // src/telemetry/authoring-session.ts
59513
- import { hostname } from "node:os";
59514
-
59515
- // src/telemetry/identity-hash.ts
59516
- import { createHash } from "node:crypto";
59517
- function identityHash(value) {
59518
- return createHash("sha256").update(value.trim().toLowerCase()).digest("hex").slice(0, 16);
59519
- }
59520
-
59521
- // src/telemetry/authoring-session.ts
59522
- var SESSION_ID_ENV = "UIPATH_SESSION_ID";
59523
- function getAuthoringSessionProps() {
59524
- const explicit = process.env[SESSION_ID_ENV];
59525
- if (explicit && explicit.trim().length > 0) {
59526
- return {
59527
- authoringSessionId: identityHash(explicit),
59528
- authoringSessionSource: "explicit"
59529
- };
59530
- }
59531
- try {
59532
- return {
59533
- authoringSessionId: identityHash(`${process.ppid}:${hostname()}`),
59534
- authoringSessionSource: "ppid"
59535
- };
59536
- } catch {
59537
- return {};
59538
- }
59539
- }
59540
-
59541
- // src/telemetry/studio-shaped-props.ts
59542
- var TELEMETRY_SOURCE = "rpa-tool";
59543
- function asNonEmptyString(value) {
59544
- return typeof value === "string" && value.length > 0 ? value : undefined;
59545
- }
59546
- function readProjectFields(input) {
59547
- const path3 = resolveProjectJsonPath(input);
59548
- if (!path3) {
59549
- return {};
59550
- }
59551
- let project;
59552
- try {
59553
- project = JSON.parse(readFileSync2(path3, "utf8"));
59554
- } catch {
59555
- return {};
59556
- }
59557
- const fields = {};
59558
- const set = (key, value) => {
59559
- const str = asNonEmptyString(value);
59560
- if (str) {
59561
- fields[key] = str;
59562
- }
59563
- };
59564
- const projectId = asNonEmptyString(project.projectId);
59565
- if (projectId) {
59566
- fields.projectIdHash = identityHash(projectId);
59567
- const noDash = projectId.trim().toLowerCase().replaceAll("-", "");
59568
- if (/^[0-9a-f]{32}$/.test(noDash)) {
59569
- fields.projectIdNoDash = noDash;
59570
- }
59571
- }
59572
- set("targetFramework", project.targetFramework);
59573
- set("expressionLanguage", project.expressionLanguage);
59574
- set("projectType", project.designOptions?.outputType);
59575
- set("projectVersion", project.projectVersion);
59576
- return fields;
59577
- }
59578
- function buildStudioShapedProps(projectDir, extra) {
59579
- const fields = projectDir ? readProjectFields(projectDir) : {};
59580
- return {
59581
- source: TELEMETRY_SOURCE,
59582
- ...getAuthoringSessionProps(),
59583
- ...fields,
59584
- ...extra
59585
- };
59586
- }
59587
-
59588
59612
  // src/commands/packager/packager-shared.ts
59589
59613
  import {
59590
59614
  mkdtempSync as mkdtempSync2,
@@ -60786,6 +60810,7 @@ async function resolveSessionConnection() {
60786
60810
  // src/telemetry/failure-classification.ts
60787
60811
  var NUGET_MISSING = /\bNU110[12]\b/;
60788
60812
  var COMPILER_DIAGNOSTIC = /\b(?:CS|BC)[0-9]{3,5}\b/;
60813
+ var COMPILER_PROJECT_INVALID_CODES = new Set(["4", "5", "7"]);
60789
60814
  function classifyFailure(signal) {
60790
60815
  if (signal.exitCode === 130) {
60791
60816
  return "user_cancelled";
@@ -60793,6 +60818,9 @@ function classifyFailure(signal) {
60793
60818
  if (signal.isFileLock || signal.errorCode === "permission_denied") {
60794
60819
  return "internal";
60795
60820
  }
60821
+ if (signal.errorCode !== undefined && COMPILER_PROJECT_INVALID_CODES.has(signal.errorCode)) {
60822
+ return "validation";
60823
+ }
60796
60824
  const codes = `${signal.errorCode ?? ""} ${signal.message ?? ""}`;
60797
60825
  if (NUGET_MISSING.test(codes)) {
60798
60826
  return "missing_dependency";
@@ -60870,6 +60898,13 @@ async function buildBaseOptions(opts) {
60870
60898
  }
60871
60899
  return options;
60872
60900
  }
60901
+ function emitAnalyzerFailureResult(projectDir, action, result) {
60902
+ const summary = parseAnalyzerErrorSummary(result.message);
60903
+ if (!summary) {
60904
+ return;
60905
+ }
60906
+ emitAnalyzeResult(projectDir, action, { errorCount: summary.errorCount }, summary.ruleIds);
60907
+ }
60873
60908
  function resolveProjectInput(projectDir) {
60874
60909
  const abs = resolve6(projectDir);
60875
60910
  let stats;
@@ -61015,6 +61050,9 @@ async function runPackagerCommand(opts, config) {
61015
61050
  OutputFormatter.success(new SuccessOutput(config.label, data));
61016
61051
  return true;
61017
61052
  }
61053
+ try {
61054
+ await config.onFailure?.(result);
61055
+ } catch {}
61018
61056
  const rawFailure = result.message ?? (result.errorCode ? `Error code: ${result.errorCode}` : "Unknown error");
61019
61057
  const lockFailure = detectLockedProjectFilesFailure(config.label, rawFailure);
61020
61058
  const failure = lockFailure ?? new FailureOutput("Failure", `${config.label} failed: ${rawFailure}`, config.hint);
@@ -61073,7 +61111,12 @@ function registerAnalyzeCommand(program4) {
61073
61111
  formatSuccess: (result) => {
61074
61112
  const findings = extractFindings(result);
61075
61113
  const summary = summarizeFindings(findings);
61076
- emitAnalyzeResult(opts.projectDir, findings, summary);
61114
+ emitAnalyzeResult(opts.projectDir, "analyze", {
61115
+ errorCount: summary.Critical + summary.Error,
61116
+ findingCount: findings.length,
61117
+ warningCount: summary.Warning,
61118
+ infoCount: summary.Information + summary.Verbose
61119
+ }, distinctRuleIds(findings));
61077
61120
  return {
61078
61121
  Success: true,
61079
61122
  Summary: summary,
@@ -61189,19 +61232,6 @@ function summarizeFindings(findings) {
61189
61232
  }
61190
61233
  return summary;
61191
61234
  }
61192
- function emitAnalyzeResult(projectDir, findings, summary) {
61193
- try {
61194
- const topRuleIds = distinctRuleIds(findings).slice(0, 10).join(",");
61195
- telemetry.trackEvent("uip.rpa.analyze.result", redactProperties({
61196
- ...buildStudioShapedProps(projectDir, { action: "analyze" }),
61197
- findingCount: String(findings.length),
61198
- errorCount: String(summary.Critical + summary.Error),
61199
- warningCount: String(summary.Warning),
61200
- infoCount: String(summary.Information + summary.Verbose),
61201
- ...topRuleIds ? { topRuleIds } : {}
61202
- }));
61203
- } catch {}
61204
- }
61205
61235
  function distinctRuleIds(findings) {
61206
61236
  const ids = new Set;
61207
61237
  for (const finding of findings) {
@@ -61266,7 +61296,8 @@ function registerBuildCommand(program4) {
61266
61296
  options.detailedLogPath = opts2.detailedLogPath;
61267
61297
  }
61268
61298
  return packager.buildProjectAsync(options);
61269
- }
61299
+ },
61300
+ onFailure: (result) => emitAnalyzerFailureResult(opts.projectDir, "build", result)
61270
61301
  });
61271
61302
  if (!success)
61272
61303
  processContext.exit(1);
@@ -61348,7 +61379,8 @@ function registerPackCommand(program4) {
61348
61379
  OutputPath: absoluteOutputPath,
61349
61380
  OutputType: opts.outputType ?? ""
61350
61381
  };
61351
- }
61382
+ },
61383
+ onFailure: (result) => emitAnalyzerFailureResult(opts.projectDir, "pack", result)
61352
61384
  });
61353
61385
  if (!success)
61354
61386
  processContext.exit(1);
@@ -77055,20 +77087,60 @@ class HelmRunService {
77055
77087
  }
77056
77088
  }
77057
77089
 
77058
- // src/tools/local/run-file.ts
77059
- function emitRunExceptionType(resultText, projectDir) {
77060
- if (!resultText) {
77061
- return;
77090
+ // src/telemetry/run-result-telemetry.ts
77091
+ var TERMINAL_RUN_COMMAND = "StartExecution";
77092
+ function buildRunResultTelemetry(input) {
77093
+ const exceptionType = input.resultText ? extractRunExceptionType(input.resultText) : undefined;
77094
+ if (input.command !== TERMINAL_RUN_COMMAND) {
77095
+ return exceptionType ? { runKind: input.command, exceptionType } : undefined;
77096
+ }
77097
+ const failed = input.resultText == null || resultHasErrors(input.resultText);
77098
+ const props2 = {
77099
+ runKind: input.command,
77100
+ success: String(!failed)
77101
+ };
77102
+ if (exceptionType) {
77103
+ props2.exceptionType = exceptionType;
77062
77104
  }
77105
+ if (failed) {
77106
+ props2.errorClass = classifyFailure({
77107
+ message: classificationText(input)
77108
+ });
77109
+ }
77110
+ return props2;
77111
+ }
77112
+ function classificationText(input) {
77113
+ const parts = [];
77114
+ if (input.errorText) {
77115
+ parts.push(input.errorText);
77116
+ }
77117
+ if (input.resultText) {
77118
+ try {
77119
+ const parsed = JSON.parse(input.resultText);
77120
+ const errorMessage3 = parsed?.ErrorMessage ?? parsed?.errorMessage;
77121
+ if (typeof errorMessage3 === "string") {
77122
+ parts.push(errorMessage3);
77123
+ }
77124
+ } catch {}
77125
+ }
77126
+ return parts.length > 0 ? parts.join(" ") : undefined;
77127
+ }
77128
+
77129
+ // src/tools/local/run-file.ts
77130
+ function emitRunResult(command, resultText, errorText, projectDir) {
77063
77131
  try {
77064
- const exceptionType = extractRunExceptionType(resultText);
77065
- if (!exceptionType) {
77132
+ const outcome = buildRunResultTelemetry({
77133
+ command,
77134
+ resultText,
77135
+ errorText
77136
+ });
77137
+ if (!outcome) {
77066
77138
  return;
77067
77139
  }
77068
77140
  const dir = projectDir ?? extractArg(process.argv, "project-dir", process.cwd());
77069
77141
  telemetry.trackEvent("uip.rpa.run.result", redactProperties({
77070
77142
  ...buildStudioShapedProps(dir, { action: "run" }),
77071
- exceptionType
77143
+ ...outcome
77072
77144
  }));
77073
77145
  } catch {}
77074
77146
  }
@@ -77252,7 +77324,7 @@ function runFileTool(session) {
77252
77324
  }
77253
77325
  const helmRun = new HelmRunService(session2);
77254
77326
  const helmResult = await helmRun.runFile(filePath, inputArguments ?? "", logLevel, command, skipBuild, profiling, folderPath, waitTimeoutSeconds, breakpoints);
77255
- emitRunExceptionType(helmResult.runResult, projectDir);
77327
+ emitRunResult(command, helmResult.runResult, helmResult.error, projectDir);
77256
77328
  return {
77257
77329
  content: [
77258
77330
  {
@@ -77279,7 +77351,7 @@ function runFileTool(session) {
77279
77351
  }
77280
77352
  }
77281
77353
  const result = await session2.execute((instance) => instance.services.run.executeCommand(command, filePath, inputArguments ?? "", inputVariables ?? "", logLevel, profiling), { requiresProject: true });
77282
- emitRunExceptionType(result, projectDir);
77354
+ emitRunResult(command, result, undefined, projectDir);
77283
77355
  return {
77284
77356
  content: [
77285
77357
  {
@@ -77291,6 +77363,7 @@ function runFileTool(session) {
77291
77363
  };
77292
77364
  } catch (e) {
77293
77365
  const errorMessage3 = e instanceof Error ? e.message : String(e);
77366
+ emitRunResult(command, null, errorMessage3, projectDir);
77294
77367
  console.error(`[run-file] error:`, errorMessage3);
77295
77368
  return {
77296
77369
  content: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uipath/rpa-tool",
3
- "version": "1.198.2",
3
+ "version": "1.198.4",
4
4
  "description": "Tool for creating and managing UiPath RPA projects",
5
5
  "keywords": [
6
6
  "uipcli-tool",
@@ -59,11 +59,11 @@
59
59
  "typescript": "^5.7.2"
60
60
  },
61
61
  "optionalDependencies": {
62
- "@uipath/studio-helm-win32-x64": "1.198.2",
63
- "@uipath/studio-helm-win32-arm64": "1.198.2",
64
- "@uipath/studio-helm-linux-x64": "1.198.2",
65
- "@uipath/studio-helm-linux-arm64": "1.198.2",
66
- "@uipath/studio-helm-darwin-x64": "1.198.2",
67
- "@uipath/studio-helm-darwin-arm64": "1.198.2"
62
+ "@uipath/studio-helm-win32-x64": "1.198.4",
63
+ "@uipath/studio-helm-win32-arm64": "1.198.4",
64
+ "@uipath/studio-helm-linux-x64": "1.198.4",
65
+ "@uipath/studio-helm-linux-arm64": "1.198.4",
66
+ "@uipath/studio-helm-darwin-x64": "1.198.4",
67
+ "@uipath/studio-helm-darwin-arm64": "1.198.4"
68
68
  }
69
69
  }