@uipath/maestro-sdk 1.204.0 → 1.205.0-preview.258

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.
@@ -876,6 +876,16 @@ class NodeFileSystem {
876
876
  async rename(oldPath, newPath) {
877
877
  await fs6.rename(oldPath, newPath);
878
878
  }
879
+ async isSymbolicLink(filePath) {
880
+ try {
881
+ return (await fs6.lstat(filePath)).isSymbolicLink();
882
+ } catch (error) {
883
+ if (this.isEnoent(error) || this.hasErrnoCode(error, "ENOTDIR")) {
884
+ return false;
885
+ }
886
+ throw error;
887
+ }
888
+ }
879
889
  async realpath(filePath) {
880
890
  try {
881
891
  return await fs6.realpath(filePath);
@@ -1935,7 +1945,7 @@ function getGlobalLogFilePath() {
1935
1945
  function getLogFilePath() {
1936
1946
  return logger.getLogFilePath();
1937
1947
  }
1938
- var logFilePathSlot, DEFAULT_LOG_LEVEL = 3 /* ERROR */, SimpleLogger, loggerSingleton, logger;
1948
+ var logFilePathSlot, DEFAULT_LOG_LEVEL = 2 /* WARN */, SimpleLogger, loggerSingleton, logger;
1939
1949
  var init_logger = __esm(() => {
1940
1950
  init_src();
1941
1951
  init_catch_error();
@@ -6823,7 +6833,9 @@ var init_telemetry_dimensions = __esm(() => {
6823
6833
  Result: "Result",
6824
6834
  ErrorCode: "ErrorCode",
6825
6835
  Retry: "Retry",
6826
- ErrorMessage: "ErrorMessage"
6836
+ ErrorMessage: "ErrorMessage",
6837
+ HttpStatus: "HttpStatus",
6838
+ UpstreamErrorCode: "UpstreamErrorCode"
6827
6839
  };
6828
6840
  AuthDimensions = {
6829
6841
  AuthenticationMethod: "AuthenticationMethod",
@@ -8788,7 +8800,9 @@ var init_formatter = __esm(() => {
8788
8800
  "timeout",
8789
8801
  "server_error",
8790
8802
  "method_not_allowed",
8803
+ "not_supported",
8791
8804
  "configuration_error",
8805
+ "execution_failed",
8792
8806
  "unknown_error"
8793
8807
  ];
8794
8808
  RETRY_HINTS = [
@@ -8902,7 +8916,9 @@ var init_formatter = __esm(() => {
8902
8916
  [ErrorDimensions.Result]: data.Result,
8903
8917
  [ErrorDimensions.ErrorCode]: data.ErrorCode,
8904
8918
  [ErrorDimensions.Retry]: data.Retry,
8905
- [ErrorDimensions.ErrorMessage]: data.Message
8919
+ [ErrorDimensions.ErrorMessage]: data.Message,
8920
+ [ErrorDimensions.HttpStatus]: data.Context?.httpStatus?.toString(),
8921
+ [ErrorDimensions.UpstreamErrorCode]: data.Context?.errorCode
8906
8922
  });
8907
8923
  }
8908
8924
  logOutput(normalizeOutputKeys(envelope), getOutputFormat());
@@ -11635,6 +11651,9 @@ async function hashContent(content) {
11635
11651
  throw new Error("Unable to compute SHA-256 hash in this environment.");
11636
11652
  }
11637
11653
 
11654
+ // ../common/src/entity-field-rules.ts
11655
+ var init_entity_field_rules = () => {};
11656
+
11638
11657
  // ../common/src/entity-name-rules.ts
11639
11658
  var RESERVED_SQL_KEYWORDS_LOWER, RESERVED_FIELD_NAMES_LOWER, RESERVED_KEYWORDS_LOWER;
11640
11659
  var init_entity_name_rules = __esm(() => {
@@ -11869,6 +11888,17 @@ var init_host_global_options = __esm(() => {
11869
11888
  BOOLEAN_FLAGS = new Set(HOST_GLOBAL_FLAGS);
11870
11889
  });
11871
11890
 
11891
+ // ../common/src/http-status.ts
11892
+ function httpStatusOf(error) {
11893
+ if (!error || typeof error !== "object") {
11894
+ return;
11895
+ }
11896
+ if ("response" in error && error.response && typeof error.response === "object" && "status" in error.response && typeof error.response.status === "number") {
11897
+ return error.response.status;
11898
+ }
11899
+ return "status" in error && typeof error.status === "number" ? error.status : undefined;
11900
+ }
11901
+
11872
11902
  // ../common/src/interactivity-context.ts
11873
11903
  var modeSlot, interactiveFlagSlot;
11874
11904
  var init_interactivity_context = __esm(() => {
@@ -11878,6 +11908,11 @@ var init_interactivity_context = __esm(() => {
11878
11908
  interactiveFlagSlot = singleton("InteractiveFlag");
11879
11909
  });
11880
11910
 
11911
+ // ../common/src/json-option.ts
11912
+ var init_json_option = __esm(() => {
11913
+ init_src();
11914
+ });
11915
+
11881
11916
  // ../common/src/mime-types.ts
11882
11917
  var MIME_TYPES_BY_EXTENSION;
11883
11918
  var init_mime_types = __esm(() => {
@@ -11919,9 +11954,15 @@ var init_mime_types = __esm(() => {
11919
11954
  // ../common/src/option-aliases.ts
11920
11955
  var init_option_aliases = __esm(() => {
11921
11956
  init_esm();
11957
+ init_formatter();
11922
11958
  init_output_context();
11923
11959
  });
11924
11960
 
11961
+ // ../common/src/option-groups.ts
11962
+ var init_option_groups = __esm(() => {
11963
+ init_formatter();
11964
+ });
11965
+
11925
11966
  // ../common/src/option-validators.ts
11926
11967
  function parseLimit(raw, _previous) {
11927
11968
  return parseBoundedInt(raw, "--limit", { min: 1, max: 1e4 });
@@ -12111,6 +12152,11 @@ var init_sdk_user_agent = __esm(() => {
12111
12152
  AGENT_PROPERTY = BaseDimensions.Agent;
12112
12153
  sdkUserAgentHostToken = singleton("SdkUserAgentHostToken");
12113
12154
  });
12155
+
12156
+ // ../common/src/shell-quote.ts
12157
+ function quoteForShell(value) {
12158
+ return `'${value.replace(/'/g, "'\\''")}'`;
12159
+ }
12114
12160
  // ../common/src/stdin.ts
12115
12161
  async function readStdin() {
12116
12162
  if (process.stdin.isTTY) {
@@ -12167,6 +12213,7 @@ var init_src2 = __esm(() => {
12167
12213
  init_completer();
12168
12214
  init_confirmation();
12169
12215
  init_constants();
12216
+ init_entity_field_rules();
12170
12217
  init_entity_name_rules();
12171
12218
  init_error_handler();
12172
12219
  init_error_instructions();
@@ -12174,9 +12221,11 @@ var init_src2 = __esm(() => {
12174
12221
  init_guid();
12175
12222
  init_host_global_options();
12176
12223
  init_interactivity_context();
12224
+ init_json_option();
12177
12225
  init_logger();
12178
12226
  init_mime_types();
12179
12227
  init_option_aliases();
12228
+ init_option_groups();
12180
12229
  init_option_validators();
12181
12230
  init_output_codecs();
12182
12231
  init_output_context();
@@ -12495,4 +12544,4 @@ export {
12495
12544
  studioWebPost
12496
12545
  };
12497
12546
 
12498
- //# debugId=188E7EE40FCDF00A64756E2164756E21
12547
+ //# debugId=9CFC537F53455B4764756E2164756E21
@@ -876,6 +876,16 @@ class NodeFileSystem {
876
876
  async rename(oldPath, newPath) {
877
877
  await fs6.rename(oldPath, newPath);
878
878
  }
879
+ async isSymbolicLink(filePath) {
880
+ try {
881
+ return (await fs6.lstat(filePath)).isSymbolicLink();
882
+ } catch (error) {
883
+ if (this.isEnoent(error) || this.hasErrnoCode(error, "ENOTDIR")) {
884
+ return false;
885
+ }
886
+ throw error;
887
+ }
888
+ }
879
889
  async realpath(filePath) {
880
890
  try {
881
891
  return await fs6.realpath(filePath);
@@ -1935,7 +1945,7 @@ function getGlobalLogFilePath() {
1935
1945
  function getLogFilePath() {
1936
1946
  return logger.getLogFilePath();
1937
1947
  }
1938
- var logFilePathSlot, DEFAULT_LOG_LEVEL = 3 /* ERROR */, SimpleLogger, loggerSingleton, logger;
1948
+ var logFilePathSlot, DEFAULT_LOG_LEVEL = 2 /* WARN */, SimpleLogger, loggerSingleton, logger;
1939
1949
  var init_logger = __esm(() => {
1940
1950
  init_src();
1941
1951
  init_catch_error();
@@ -6823,7 +6833,9 @@ var init_telemetry_dimensions = __esm(() => {
6823
6833
  Result: "Result",
6824
6834
  ErrorCode: "ErrorCode",
6825
6835
  Retry: "Retry",
6826
- ErrorMessage: "ErrorMessage"
6836
+ ErrorMessage: "ErrorMessage",
6837
+ HttpStatus: "HttpStatus",
6838
+ UpstreamErrorCode: "UpstreamErrorCode"
6827
6839
  };
6828
6840
  AuthDimensions = {
6829
6841
  AuthenticationMethod: "AuthenticationMethod",
@@ -8788,7 +8800,9 @@ var init_formatter = __esm(() => {
8788
8800
  "timeout",
8789
8801
  "server_error",
8790
8802
  "method_not_allowed",
8803
+ "not_supported",
8791
8804
  "configuration_error",
8805
+ "execution_failed",
8792
8806
  "unknown_error"
8793
8807
  ];
8794
8808
  RETRY_HINTS = [
@@ -8902,7 +8916,9 @@ var init_formatter = __esm(() => {
8902
8916
  [ErrorDimensions.Result]: data.Result,
8903
8917
  [ErrorDimensions.ErrorCode]: data.ErrorCode,
8904
8918
  [ErrorDimensions.Retry]: data.Retry,
8905
- [ErrorDimensions.ErrorMessage]: data.Message
8919
+ [ErrorDimensions.ErrorMessage]: data.Message,
8920
+ [ErrorDimensions.HttpStatus]: data.Context?.httpStatus?.toString(),
8921
+ [ErrorDimensions.UpstreamErrorCode]: data.Context?.errorCode
8906
8922
  });
8907
8923
  }
8908
8924
  logOutput(normalizeOutputKeys(envelope), getOutputFormat());
@@ -11635,6 +11651,9 @@ async function hashContent(content) {
11635
11651
  throw new Error("Unable to compute SHA-256 hash in this environment.");
11636
11652
  }
11637
11653
 
11654
+ // ../common/src/entity-field-rules.ts
11655
+ var init_entity_field_rules = () => {};
11656
+
11638
11657
  // ../common/src/entity-name-rules.ts
11639
11658
  var RESERVED_SQL_KEYWORDS_LOWER, RESERVED_FIELD_NAMES_LOWER, RESERVED_KEYWORDS_LOWER;
11640
11659
  var init_entity_name_rules = __esm(() => {
@@ -11869,6 +11888,17 @@ var init_host_global_options = __esm(() => {
11869
11888
  BOOLEAN_FLAGS = new Set(HOST_GLOBAL_FLAGS);
11870
11889
  });
11871
11890
 
11891
+ // ../common/src/http-status.ts
11892
+ function httpStatusOf(error) {
11893
+ if (!error || typeof error !== "object") {
11894
+ return;
11895
+ }
11896
+ if ("response" in error && error.response && typeof error.response === "object" && "status" in error.response && typeof error.response.status === "number") {
11897
+ return error.response.status;
11898
+ }
11899
+ return "status" in error && typeof error.status === "number" ? error.status : undefined;
11900
+ }
11901
+
11872
11902
  // ../common/src/interactivity-context.ts
11873
11903
  var modeSlot, interactiveFlagSlot;
11874
11904
  var init_interactivity_context = __esm(() => {
@@ -11878,6 +11908,11 @@ var init_interactivity_context = __esm(() => {
11878
11908
  interactiveFlagSlot = singleton("InteractiveFlag");
11879
11909
  });
11880
11910
 
11911
+ // ../common/src/json-option.ts
11912
+ var init_json_option = __esm(() => {
11913
+ init_src();
11914
+ });
11915
+
11881
11916
  // ../common/src/mime-types.ts
11882
11917
  var MIME_TYPES_BY_EXTENSION;
11883
11918
  var init_mime_types = __esm(() => {
@@ -11919,9 +11954,15 @@ var init_mime_types = __esm(() => {
11919
11954
  // ../common/src/option-aliases.ts
11920
11955
  var init_option_aliases = __esm(() => {
11921
11956
  init_esm();
11957
+ init_formatter();
11922
11958
  init_output_context();
11923
11959
  });
11924
11960
 
11961
+ // ../common/src/option-groups.ts
11962
+ var init_option_groups = __esm(() => {
11963
+ init_formatter();
11964
+ });
11965
+
11925
11966
  // ../common/src/option-validators.ts
11926
11967
  function parseLimit(raw, _previous) {
11927
11968
  return parseBoundedInt(raw, "--limit", { min: 1, max: 1e4 });
@@ -12111,6 +12152,11 @@ var init_sdk_user_agent = __esm(() => {
12111
12152
  AGENT_PROPERTY = BaseDimensions.Agent;
12112
12153
  sdkUserAgentHostToken = singleton("SdkUserAgentHostToken");
12113
12154
  });
12155
+
12156
+ // ../common/src/shell-quote.ts
12157
+ function quoteForShell(value) {
12158
+ return `'${value.replace(/'/g, "'\\''")}'`;
12159
+ }
12114
12160
  // ../common/src/stdin.ts
12115
12161
  async function readStdin() {
12116
12162
  if (process.stdin.isTTY) {
@@ -12167,6 +12213,7 @@ var init_src2 = __esm(() => {
12167
12213
  init_completer();
12168
12214
  init_confirmation();
12169
12215
  init_constants();
12216
+ init_entity_field_rules();
12170
12217
  init_entity_name_rules();
12171
12218
  init_error_handler();
12172
12219
  init_error_instructions();
@@ -12174,9 +12221,11 @@ var init_src2 = __esm(() => {
12174
12221
  init_guid();
12175
12222
  init_host_global_options();
12176
12223
  init_interactivity_context();
12224
+ init_json_option();
12177
12225
  init_logger();
12178
12226
  init_mime_types();
12179
12227
  init_option_aliases();
12228
+ init_option_groups();
12180
12229
  init_option_validators();
12181
12230
  init_output_codecs();
12182
12231
  init_output_context();
@@ -12526,7 +12575,10 @@ function injectSolutionProjectProcessEntries(fpsProperties, solutionProjects) {
12526
12575
  const entries = solutionProjects.map((project) => ({
12527
12576
  name: project.name,
12528
12577
  projectType: project.projectType,
12529
- executorInfo: JSON.stringify(project.projectType === "Function" ? {
12578
+ executorInfo: JSON.stringify(project.projectType === "BusinessRules" ? {
12579
+ projectId: project.projectId,
12580
+ solutionId: project.solutionId
12581
+ } : project.projectType === "Function" ? {
12530
12582
  projectId: project.projectId,
12531
12583
  command: "debug",
12532
12584
  args: ["--attach=none"],
@@ -12868,32 +12920,64 @@ class DebugVariablesFetchFailedError extends Error {
12868
12920
  this.name = "DebugVariablesFetchFailedError";
12869
12921
  }
12870
12922
  }
12923
+ function undefinedGlobals(response, expected) {
12924
+ const defined = response?.globalDefinitions;
12925
+ if (defined === undefined || defined === null) {
12926
+ return [];
12927
+ }
12928
+ return expected.filter((id) => !Object.hasOwn(defined, id));
12929
+ }
12871
12930
  async function fetchDebugInstanceVariables(config, instanceId, options) {
12872
12931
  const endpoint = `/api/v1/debug-instances/${encodeURIComponent(instanceId)}/variables`;
12873
12932
  const delays = options?.delays ?? FETCH_VARIABLES_RETRY_DELAYS_MS;
12874
12933
  const attemptTimeoutMs = options?.attemptTimeoutMs ?? FETCH_VARIABLES_ATTEMPT_TIMEOUT_MS;
12875
12934
  const totalAttempts = delays.length + 1;
12876
12935
  const traceIds = [];
12936
+ const startedAt = Date.now();
12937
+ const terminalStatusAt = options?.terminalStatusAt;
12938
+ const timing = () => {
12939
+ const now = Date.now();
12940
+ return {
12941
+ elapsedMs: now - startedAt,
12942
+ ...terminalStatusAt === undefined ? {} : { sinceTerminalMs: now - terminalStatusAt }
12943
+ };
12944
+ };
12945
+ const failures = [];
12877
12946
  let lastMessage = "";
12878
12947
  let lastStatus;
12948
+ let lastMissing = [];
12879
12949
  for (let attempt = 1;attempt <= totalAttempts; attempt++) {
12880
12950
  const controller = new AbortController;
12881
12951
  const timer = setTimeout(() => controller.abort(), attemptTimeoutMs);
12882
12952
  const [error, result] = await catchError(debugPimsGet(config, endpoint, "fetch-output-variables", { signal: controller.signal }));
12883
12953
  clearTimeout(timer);
12884
- if (!error) {
12954
+ const missing = error ? [] : undefinedGlobals(result, options?.expectGlobals ?? []);
12955
+ if (!error && missing.length === 0) {
12956
+ options?.onFetched?.({
12957
+ attempts: attempt,
12958
+ failures: [...failures],
12959
+ ...timing()
12960
+ });
12885
12961
  return result;
12886
12962
  }
12887
- if (controller.signal.aborted) {
12963
+ if (!error) {
12964
+ lastMissing = missing;
12965
+ failures.push("unmaterialized");
12966
+ lastMessage = `the response does not define the declared output variable(s) ${missing.join(", ")} yet (record not materialized)`;
12967
+ lastStatus = undefined;
12968
+ } else if (controller.signal.aborted) {
12969
+ failures.push("timeout");
12888
12970
  lastMessage = `timed out after ${attemptTimeoutMs / 1000}s`;
12889
12971
  lastStatus = undefined;
12890
12972
  } else if (error instanceof MaestroHttpError) {
12973
+ failures.push("http");
12891
12974
  lastMessage = error.message;
12892
12975
  lastStatus = error.httpStatus;
12893
12976
  if (error.parsedTraceId) {
12894
12977
  traceIds.push(error.parsedTraceId);
12895
12978
  }
12896
12979
  } else {
12980
+ failures.push("network");
12897
12981
  lastMessage = error.message;
12898
12982
  lastStatus = undefined;
12899
12983
  }
@@ -12909,7 +12993,13 @@ async function fetchDebugInstanceVariables(config, instanceId, options) {
12909
12993
  ...lastStatus === undefined ? {} : { httpStatus: lastStatus },
12910
12994
  attempts: totalAttempts,
12911
12995
  traceIds,
12912
- endpoint
12996
+ endpoint,
12997
+ ...lastMissing.length === 0 ? {} : {
12998
+ missingGlobals: lastMissing,
12999
+ expectedGlobals: [...options?.expectGlobals ?? []]
13000
+ },
13001
+ failures,
13002
+ ...timing()
12913
13003
  });
12914
13004
  }
12915
13005
  function isFaultedDebugStatus(status) {
@@ -13019,12 +13109,14 @@ async function uploadAndDebugSolution(params) {
13019
13109
  logger.info(`Debug instance created — instanceId: ${debugInstance.instanceId}`);
13020
13110
  logger.info("Polling for completion...");
13021
13111
  const finalResponse = await pollDebugInstanceStatus(apiConfig, debugInstance.instanceId, params.callbacks, params.pollInterval, params.maxPolls, session.jobKey);
13112
+ const terminalStatusAt = Date.now();
13022
13113
  const incidents = await resolveFaultIncidents(apiConfig, debugInstance.instanceId, finalResponse.status);
13023
13114
  return {
13024
13115
  jobKey: session.jobKey,
13025
13116
  instanceId: debugInstance.instanceId,
13026
13117
  runId: debugInstance.runId,
13027
13118
  finalStatus: finalResponse.status,
13119
+ terminalStatusAt,
13028
13120
  elementExecutions: finalResponse.elementExecutions.map((e) => ({
13029
13121
  elementId: e.elementId,
13030
13122
  elementType: e.elementType,
@@ -13118,4 +13210,4 @@ export {
13118
13210
  uploadAndDebugSolution
13119
13211
  };
13120
13212
 
13121
- //# debugId=701C6E3BDA6285E964756E2164756E21
13213
+ //# debugId=0EB707A77CFC2B0D64756E2164756E21