@uipath/common 1.203.0-preview.205 → 1.204.0-preview.206

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.
@@ -32,10 +32,24 @@ export declare const ATTACHMENT_UPLOAD_INSTRUCTIONS = "Check that the active ten
32
32
  * the basename when '=' is absent (no binding key required there).
33
33
  */
34
34
  export declare function parseAttachmentSpec(spec: string): ParsedAttachmentSpec;
35
+ /** A spec whose file has been read: bytes plus the basename used as the upload name. */
36
+ export interface PreparedAttachmentSpec extends ParsedAttachmentSpec {
37
+ fileName: string;
38
+ bytes: Uint8Array;
39
+ }
40
+ /**
41
+ * Phase 1 of {@link resolveAttachmentInputs}: read every spec's bytes before
42
+ * any network write. Fails fast on the first unreadable or empty file, so a bad
43
+ * local path never orphans an attachment. Exported on its own for callers that
44
+ * upload later (agent debug uploads inside its service, after the Studio Web
45
+ * import). The original error is kept on `cause` so classification can find it.
46
+ */
47
+ export declare function readAttachmentSpecs(specs: ParsedAttachmentSpec[]): Promise<PreparedAttachmentSpec[]>;
35
48
  /**
36
49
  * Read each spec's bytes (fail-fast on any error), then upload all via the
37
50
  * caller-supplied `upload` function (e.g. `uploadJobAttachment` from
38
51
  * `@uipath/orchestrator-sdk`) in parallel. Returns references in input order.
52
+ * See {@link readAttachmentSpecs} for the read phase.
39
53
  *
40
54
  * Two-phase to avoid orphaned attachments when a local path is bad: phase 1
41
55
  * reads + validates every file before any network write. A read failure
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Bounded breadth-first walk over `.cause` and `AggregateError.errors`,
3
+ * yielding each object node once. Node's `fetch` wraps the real failure in a
4
+ * generic `TypeError: fetch failed` and races (IPv4/IPv6, proxy fallbacks)
5
+ * collect per-attempt failures in `AggregateError.errors`, so the useful
6
+ * code can sit anywhere in the graph. The step cap and `seen` guard keep a
7
+ * pathological/cyclic graph from looping; 32 is far more than any real
8
+ * failure nests.
9
+ */
10
+ export declare function walkErrorGraph(error: unknown): Generator<Record<string, unknown>, undefined, undefined>;
11
+ /**
12
+ * Parse an `HTTP <status>` prefix out of an error message. SDK wrappers often
13
+ * throw plain `Error`s shaped `HTTP 403: <body>` with no structured status
14
+ * field; every classifier that treats "has a status" as "the service
15
+ * answered" must see these too, or the local-vs-service split drifts between
16
+ * layers. Shared by `extractErrorDetails` and `instructionsFor`.
17
+ */
18
+ export declare function parseHttpStatusFromMessage(message: string): number | undefined;
19
+ /**
20
+ * The failing HTTP status found anywhere in the error graph, not just on the
21
+ * outer node.
22
+ *
23
+ * Resolvers and command helpers wrap an SDK error as
24
+ * `new Error(\`...: ${await extractErrorMessage(err)}\`, { cause: err })`.
25
+ * That moves the SDK's `status` / `response.status` one or more levels down,
26
+ * and the `HTTP <status>` token the wrapper splices into its own message is
27
+ * no longer at the start, so neither `err.status` nor
28
+ * {@link parseHttpStatusFromMessage} sees it on the outer node — a wrapped
29
+ * 5xx classified as `unknown_error` / `RetryWillNotFix` instead of
30
+ * `server_error` / `RetryLater`.
31
+ *
32
+ * Only 4xx/5xx count: a 2xx buried in the graph belongs to a call that
33
+ * succeeded, and the outer node is where a non-failing status would matter.
34
+ * Used for classification and `Context.httpStatus` only — message building
35
+ * still reads the outer node, so a wrapper keeps the text it chose.
36
+ */
37
+ export declare function findHttpStatusInGraph(error: unknown): number | undefined;
@@ -1,4 +1,6 @@
1
+ import { parseHttpStatusFromMessage } from "./error-graph";
1
2
  import type { CliErrorCode, ErrorContext, FailureResultType, RetryHint } from "./formatter";
3
+ export { parseHttpStatusFromMessage };
2
4
  /**
3
5
  * Structured error details returned by {@link extractErrorDetails}.
4
6
  */
@@ -101,14 +103,6 @@ export declare function describeConnectivityError(error: unknown): ConnectivityE
101
103
  * failures, not the local OS's.
102
104
  */
103
105
  export declare function describePermissionError(error: unknown): LocalPermissionError | undefined;
104
- /**
105
- * Parse an `HTTP <status>` prefix out of an error message. SDK wrappers often
106
- * throw plain `Error`s shaped `HTTP 403: <body>` with no structured status
107
- * field; every classifier that treats "has a status" as "the service
108
- * answered" must see these too, or the local-vs-service split drifts between
109
- * layers. Shared by {@link extractErrorDetails} and `instructionsFor`.
110
- */
111
- export declare function parseHttpStatusFromMessage(message: string): number | undefined;
112
106
  export declare function isHtmlDocument(body: string): boolean;
113
107
  /**
114
108
  * Extract a structured error message and details from an unknown thrown value.