@uipath/common 1.196.0 → 1.197.0-preview.59

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.
@@ -0,0 +1,32 @@
1
+ // src/catch-error.ts
2
+ function isPromiseLike(value) {
3
+ return value !== null && typeof value === "object" && typeof value.then === "function";
4
+ }
5
+ function catchError(fnOrPromise) {
6
+ if (isPromiseLike(fnOrPromise)) {
7
+ return settlePromiseLike(fnOrPromise);
8
+ }
9
+ try {
10
+ const result = fnOrPromise();
11
+ if (isPromiseLike(result)) {
12
+ return settlePromiseLike(result);
13
+ }
14
+ return [undefined, result];
15
+ } catch (error) {
16
+ return [
17
+ error instanceof Error ? error : new Error(String(error)),
18
+ undefined
19
+ ];
20
+ }
21
+ }
22
+ function settlePromiseLike(thenable) {
23
+ return Promise.resolve(thenable).then((data) => [undefined, data]).catch((error) => [
24
+ error instanceof Error ? error : new Error(String(error)),
25
+ undefined
26
+ ]);
27
+ }
28
+ export {
29
+ catchError
30
+ };
31
+
32
+ //# debugId=246638ED7A60E04D64756E2164756E21
@@ -31,6 +31,31 @@ export interface ExtractErrorOptions {
31
31
  /** Custom message for HTTP 403 Forbidden errors. Uses a generic default if omitted. */
32
32
  forbiddenMessage?: string;
33
33
  }
34
+ /**
35
+ * A connectivity failure (TLS trust or socket/DNS), already classified with
36
+ * actionable guidance. Returned by {@link describeConnectivityError}.
37
+ */
38
+ export interface ConnectivityError {
39
+ /** The OS/TLS error code, e.g. `SELF_SIGNED_CERT_IN_CHAIN`. */
40
+ code: string;
41
+ /** Whether the failure is a TLS trust problem or a plain network problem. */
42
+ kind: "tls" | "network";
43
+ /** The most specific message found while walking the cause chain. */
44
+ message: string;
45
+ /** Actionable, user-facing remediation steps. */
46
+ instructions: string;
47
+ }
48
+ /**
49
+ * Classify an outbound connectivity failure by walking the `cause` chain.
50
+ *
51
+ * Node's native `fetch` wraps the real failure (a TLS or socket error) inside
52
+ * a generic `TypeError: fetch failed`, so the useful code/message lives on
53
+ * `error.cause` (sometimes nested deeper). This unwraps that chain and, when
54
+ * it finds a known TLS or network code, returns the specific message plus
55
+ * remediation steps. Returns `undefined` for anything that isn't a recognised
56
+ * connectivity failure so callers can fall back to their normal handling.
57
+ */
58
+ export declare function describeConnectivityError(error: unknown): ConnectivityError | undefined;
34
59
  export declare function isHtmlDocument(body: string): boolean;
35
60
  /**
36
61
  * Extract a structured error message and details from an unknown thrown value.
@@ -94,6 +94,12 @@ export declare class FailureOutput {
94
94
  * across success / failure paths.
95
95
  */
96
96
  Data?: DataRecord | DataRecord[];
97
+ /**
98
+ * Print the error and set the exit code, but don't emit the `uip.error`
99
+ * telemetry event — rate-limits high-frequency identical failures (e.g. a
100
+ * stuck auth-refresh loop). Stripped before the envelope is rendered.
101
+ */
102
+ SuppressTelemetry?: boolean;
97
103
  constructor(result: FailureResultType, message: string, instructions: string, context?: ErrorContext, errorCode?: CliErrorCode, retry?: RetryHint);
98
104
  }
99
105
  export type StructuredOutput = SuccessOutput | FailureOutput;
@@ -10,7 +10,6 @@ export * from "./env-reference";
10
10
  export * from "./error-handler";
11
11
  export * from "./error-instructions";
12
12
  export * from "./guid";
13
- export * from "./jsonpath";
14
13
  export * from "./logger";
15
14
  export * from "./option-validators";
16
15
  export * from "./orchestrator-urls";
@@ -20,6 +19,13 @@ export * from "./output-sink";
20
19
  export * from "./package-metadata-options";
21
20
  export * from "./polling";
22
21
  export * from "./screen-logger";
22
+ export * from "./sdk-user-agent";
23
23
  export * from "./singleton";
24
+ export { BrowserContextStorage } from "./telemetry/browser-context-storage.js";
25
+ export { ConsoleTelemetryProvider } from "./telemetry/console-telemetry-provider.js";
26
+ export type { IContextStorage } from "./telemetry/context-storage.js";
24
27
  export * from "./telemetry/telemetry-events.js";
28
+ export type { ITelemetryProvider } from "./telemetry/telemetry-provider.js";
29
+ export type { ITelemetryService, TelemetryContext, TelemetryProperties, } from "./telemetry/telemetry-service.js";
30
+ export { TelemetryService } from "./telemetry/telemetry-service.js";
25
31
  export * from "./tool-provider";