@uipath/common 1.0.4 → 1.195.0
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/attachment-binding.d.ts +55 -0
- package/dist/error-handler.d.ts +8 -0
- package/dist/formatter.d.ts +46 -1
- package/dist/index.browser.d.ts +23 -0
- package/dist/index.browser.js +5873 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +5915 -5405
- package/dist/option-aliases.d.ts +19 -0
- package/dist/orchestrator-urls.d.ts +1 -2
- package/dist/polling/index.d.ts +2 -0
- package/dist/polling/poll-failure-mapping.d.ts +21 -0
- package/dist/sdk-user-agent.d.ts +12 -0
- package/dist/sdk-user-agent.js +143 -0
- package/package.json +41 -47
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Commander collector for repeatable string options. Use with `.option(...,
|
|
3
|
+
* appendOption, [] as string[])` to accumulate values across multiple flag
|
|
4
|
+
* occurrences (e.g. `--attachment a=b --attachment c=d`).
|
|
5
|
+
*/
|
|
6
|
+
export declare function appendOption(value: string, previous: string[] | undefined): string[];
|
|
7
|
+
/** A parsed `name=path` --attachment spec. */
|
|
8
|
+
export interface ParsedAttachmentSpec {
|
|
9
|
+
name: string;
|
|
10
|
+
path: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Standard `Instructions` text for an OutputFormatter error when the user's
|
|
14
|
+
* `--attachment` spec is malformed.
|
|
15
|
+
*/
|
|
16
|
+
export declare const ATTACHMENT_INSTRUCTIONS = "Provide --attachment as 'name=path' where 'name' matches a file-typed workflow input variable and 'path' points at a readable local file. Repeat the flag to attach multiple files.";
|
|
17
|
+
/**
|
|
18
|
+
* Standard `Instructions` text when `--attachment` upload fails (auth, network,
|
|
19
|
+
* permissions). Pair with the underlying error message in `Message`.
|
|
20
|
+
*/
|
|
21
|
+
export declare const ATTACHMENT_UPLOAD_INSTRUCTIONS = "Check that the active tenant has Orchestrator access and the file is readable, then retry.";
|
|
22
|
+
/**
|
|
23
|
+
* Parse a `name=path` --attachment spec for Maestro-engine file-variable
|
|
24
|
+
* binding (used by `flow debug` and `flow process run`).
|
|
25
|
+
*
|
|
26
|
+
* `name=` is mandatory: the engine resolves `=js:($vars.<scope>.input.<name>)`
|
|
27
|
+
* expressions in connector multipart slots against the uploaded
|
|
28
|
+
* `JobAttachmentReference`, so it needs the explicit workflow-variable name
|
|
29
|
+
* as the binding key. A bare path has no binding target and is rejected.
|
|
30
|
+
*
|
|
31
|
+
* Distinct from `or jobs run --attachment` which auto-derives a name from
|
|
32
|
+
* the basename when '=' is absent (no binding key required there).
|
|
33
|
+
*/
|
|
34
|
+
export declare function parseAttachmentSpec(spec: string): ParsedAttachmentSpec;
|
|
35
|
+
/**
|
|
36
|
+
* Read each spec's bytes (fail-fast on any error), then upload all via the
|
|
37
|
+
* caller-supplied `upload` function (e.g. `uploadJobAttachment` from
|
|
38
|
+
* `@uipath/orchestrator-sdk`) in parallel. Returns references in input order.
|
|
39
|
+
*
|
|
40
|
+
* Two-phase to avoid orphaned attachments when a local path is bad: phase 1
|
|
41
|
+
* reads + validates every file before any network write. A read failure
|
|
42
|
+
* short-circuits before any upload begins. A mid-upload failure on one spec
|
|
43
|
+
* can still leave a sibling's attachment orphaned — accepted trade-off;
|
|
44
|
+
* Orchestrator has no atomic-batch endpoint.
|
|
45
|
+
*
|
|
46
|
+
* The `fileName` passed to `upload` is the local basename (not the LHS of
|
|
47
|
+
* `name=path`) so users recognize their uploaded file in the Orchestrator
|
|
48
|
+
* UI. The spec's `name` is preserved on the returned record for callers to
|
|
49
|
+
* use as the binding key in their inputs payload.
|
|
50
|
+
*/
|
|
51
|
+
export declare function resolveAttachmentInputs<R>(specs: ParsedAttachmentSpec[], upload: (bytes: Uint8Array, fileName: string) => Promise<R>): Promise<{
|
|
52
|
+
name: string;
|
|
53
|
+
path: string;
|
|
54
|
+
reference: R;
|
|
55
|
+
}[]>;
|
package/dist/error-handler.d.ts
CHANGED
|
@@ -11,6 +11,14 @@ export interface ErrorDetails {
|
|
|
11
11
|
details: string;
|
|
12
12
|
/** Machine-readable context for agents (HTTP status, request ID, retry-after, etc.) */
|
|
13
13
|
context?: ErrorContext;
|
|
14
|
+
/**
|
|
15
|
+
* Per-field validation errors lifted from an ASP.NET ProblemDetails body
|
|
16
|
+
* (application/problem+json). Shape: `{ fieldName: ["msg", ...] }`.
|
|
17
|
+
* Surfaced as `Errors` on the OutputFormatter envelope so agents can
|
|
18
|
+
* react to the specific field that failed validation instead of parsing
|
|
19
|
+
* the free-text Message.
|
|
20
|
+
*/
|
|
21
|
+
parsedErrors?: Record<string, string[]>;
|
|
14
22
|
}
|
|
15
23
|
/**
|
|
16
24
|
* Options for customising error extraction behaviour.
|
package/dist/formatter.d.ts
CHANGED
|
@@ -75,10 +75,19 @@ export interface ErrorContext {
|
|
|
75
75
|
}
|
|
76
76
|
export declare class FailureOutput {
|
|
77
77
|
Result: FailureResultType;
|
|
78
|
+
Code?: string;
|
|
78
79
|
Message: string;
|
|
79
80
|
Instructions: string;
|
|
80
81
|
Context?: ErrorContext;
|
|
81
82
|
Log?: string;
|
|
83
|
+
/**
|
|
84
|
+
* Optional structured payload for failure envelopes that need to carry
|
|
85
|
+
* actionable detail beyond the Message string (e.g. JobKey + JobState
|
|
86
|
+
* + SubState for the `jobs start --wait-for-completion` failure path).
|
|
87
|
+
* Mirrors SuccessOutput.Data so consumers can use a single accessor
|
|
88
|
+
* across success / failure paths.
|
|
89
|
+
*/
|
|
90
|
+
Data?: DataRecord | DataRecord[];
|
|
82
91
|
constructor(result: FailureResultType, message: string, instructions: string, context?: ErrorContext);
|
|
83
92
|
}
|
|
84
93
|
export type StructuredOutput = SuccessOutput | FailureOutput;
|
|
@@ -96,11 +105,47 @@ export type StructuredOutput = SuccessOutput | FailureOutput;
|
|
|
96
105
|
* closed-box guarantee must additionally wrap {@link applyFilter}.
|
|
97
106
|
*/
|
|
98
107
|
export declare function validateOutputFilter(filter: string): Error | null;
|
|
108
|
+
/**
|
|
109
|
+
* Thrown when a `--output-filter` expression parses successfully but fails at
|
|
110
|
+
* evaluation time (e.g. type-coercion errors when functions receive unexpected
|
|
111
|
+
* types). Carries `instructions` and `result` so {@link trackedAction} can
|
|
112
|
+
* surface filter-specific guidance through the failure envelope instead of the
|
|
113
|
+
* generic "unexpected error" fallback.
|
|
114
|
+
*
|
|
115
|
+
* Uses a duck-type `__brand` rather than relying on `instanceof`, because each
|
|
116
|
+
* tool bundles its own copy of `@uipath/common` and class identity differs
|
|
117
|
+
* across bundle boundaries.
|
|
118
|
+
*/
|
|
119
|
+
export declare class FilterEvaluationError extends Error {
|
|
120
|
+
readonly __brand: "FilterEvaluationError";
|
|
121
|
+
readonly filter: string;
|
|
122
|
+
readonly instructions: string;
|
|
123
|
+
readonly result: FailureResultType;
|
|
124
|
+
constructor(filter: string, cause: unknown);
|
|
125
|
+
}
|
|
99
126
|
/**
|
|
100
127
|
* OutputFormatter namespace for formatting and displaying output.
|
|
101
128
|
*/
|
|
102
129
|
export declare namespace OutputFormatter {
|
|
103
|
-
|
|
130
|
+
/**
|
|
131
|
+
* Emit a success envelope.
|
|
132
|
+
*
|
|
133
|
+
* By default every key in `data.Data` is normalized to PascalCase for
|
|
134
|
+
* cross-command output consistency (see {@link normalizeDataKeys}).
|
|
135
|
+
*
|
|
136
|
+
* Pass `{ preserveDataKeys: true }` when the `Data` payload is content that
|
|
137
|
+
* is copied verbatim back into a UiPath artifact and whose key casing is
|
|
138
|
+
* therefore load-bearing — most notably `registry get` node definitions,
|
|
139
|
+
* whose camelCase field names (`inputDefinition`, `inputString`, …) are
|
|
140
|
+
* pasted straight into `.flow` files. PascalCasing those names produces a
|
|
141
|
+
* flow that passes `flow validate` but faults at runtime (the agent/job
|
|
142
|
+
* receives `InputString` while its schema requires `inputString`). With
|
|
143
|
+
* this flag the `Data` payload keeps its original casing; the envelope
|
|
144
|
+
* keys (`Result`/`Code`/`Data`/`Log`/…) are still PascalCased.
|
|
145
|
+
*/
|
|
146
|
+
function success(data: SuccessOutput, options?: {
|
|
147
|
+
preserveDataKeys?: boolean;
|
|
148
|
+
}): void;
|
|
104
149
|
/**
|
|
105
150
|
* Format and display an error, then set {@link process.exitCode} to the
|
|
106
151
|
* value from {@link EXIT_CODES} for `data.Result` (falls back to 1).
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export * from "./catch-error";
|
|
2
|
+
export * from "./command-examples";
|
|
3
|
+
export * from "./command-help";
|
|
4
|
+
export * from "./command-walker";
|
|
5
|
+
export * from "./completer";
|
|
6
|
+
export { installConsoleGuard, restoreConsole } from "./console-guard";
|
|
7
|
+
export * from "./constants";
|
|
8
|
+
export * from "./env-reference";
|
|
9
|
+
export * from "./error-handler";
|
|
10
|
+
export * from "./error-instructions";
|
|
11
|
+
export * from "./guid";
|
|
12
|
+
export * from "./jsonpath";
|
|
13
|
+
export * from "./logger";
|
|
14
|
+
export * from "./option-validators";
|
|
15
|
+
export * from "./orchestrator-urls";
|
|
16
|
+
export * from "./output-context";
|
|
17
|
+
export * from "./output-format-context";
|
|
18
|
+
export * from "./output-sink";
|
|
19
|
+
export * from "./polling";
|
|
20
|
+
export * from "./screen-logger";
|
|
21
|
+
export * from "./singleton";
|
|
22
|
+
export * from "./telemetry/telemetry-events.js";
|
|
23
|
+
export * from "./tool-provider";
|