@uipath/common 1.1.0 → 1.196.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/confirmation.d.ts +28 -0
- package/dist/content-hash.d.ts +8 -0
- package/dist/error-handler.d.ts +13 -1
- package/dist/formatter.d.ts +54 -2
- package/dist/index.browser.d.ts +2 -0
- package/dist/index.browser.js +17951 -49
- package/dist/index.d.ts +6 -0
- package/dist/index.js +3619 -2897
- package/dist/interactivity-context.d.ts +33 -0
- package/dist/orchestrator-urls.d.ts +1 -2
- package/dist/package-metadata-options.d.ts +36 -0
- package/dist/package-metadata-options.js +27 -0
- package/dist/polling/index.d.ts +2 -0
- package/dist/polling/poll-failure-mapping.d.ts +21 -0
- package/dist/stdin.d.ts +1 -0
- package/dist/telemetry/global-telemetry-properties.d.ts +8 -0
- package/dist/telemetry/index.js +38 -1
- package/dist/telemetry/node-appinsights-telemetry-provider.d.ts +1 -2
- package/dist/telemetry/telemetry-service.d.ts +9 -1
- package/package.json +44 -45
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flags that affirm a destructive operation. `--yes` is the canonical flag for
|
|
3
|
+
* delete/remove commands; `--force` is the established alias used by overwrite
|
|
4
|
+
* commands (`init`, `pull`). Either one satisfies the guard.
|
|
5
|
+
*
|
|
6
|
+
* Add the flag to a command with
|
|
7
|
+
* `.option("-y, --yes", "Confirm this irreversible operation (required; the CLI never prompts)")`
|
|
8
|
+
* and gate the handler with {@link requireConfirmation}.
|
|
9
|
+
*/
|
|
10
|
+
export interface ConfirmationFlags {
|
|
11
|
+
yes?: boolean;
|
|
12
|
+
force?: boolean;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Guard a destructive operation. Returns `true` when the caller passed `--yes`
|
|
16
|
+
* (or `--force`). Otherwise emits a structured failure naming the flag to pass,
|
|
17
|
+
* sets a non-zero exit code via {@link processContext}, and returns `false` so
|
|
18
|
+
* the handler can bail in one line:
|
|
19
|
+
*
|
|
20
|
+
* ```ts
|
|
21
|
+
* if (!requireConfirmation(options, `delete folder '${id}'`)) return;
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @param flags - the parsed command options (must carry `yes`/`force`).
|
|
25
|
+
* @param operation - a short description of what will happen, e.g.
|
|
26
|
+
* `"delete folder 'Finance'"`. Surfaced in the error message.
|
|
27
|
+
*/
|
|
28
|
+
export declare function requireConfirmation(flags: ConfirmationFlags, operation: string): boolean;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generate a SHA-256 hex hash of content for change detection.
|
|
3
|
+
* Prefers the Web Crypto API; falls back to node:crypto outside the browser.
|
|
4
|
+
*
|
|
5
|
+
* @param content - String content to hash
|
|
6
|
+
* @returns Hex string of the hash
|
|
7
|
+
*/
|
|
8
|
+
export declare function hashContent(content: string): Promise<string>;
|
package/dist/error-handler.d.ts
CHANGED
|
@@ -1,16 +1,28 @@
|
|
|
1
|
-
import type { ErrorContext, FailureResultType } from "./formatter";
|
|
1
|
+
import type { CliErrorCode, ErrorContext, FailureResultType, RetryHint } from "./formatter";
|
|
2
2
|
/**
|
|
3
3
|
* Structured error details returned by {@link extractErrorDetails}.
|
|
4
4
|
*/
|
|
5
5
|
export interface ErrorDetails {
|
|
6
6
|
/** Categorised failure type suitable for OutputFormatter.error() Result field */
|
|
7
7
|
result: FailureResultType;
|
|
8
|
+
/** Stable CLI-owned error code suitable for agent control flow */
|
|
9
|
+
errorCode: CliErrorCode;
|
|
8
10
|
/** Human-readable error message suitable for OutputFormatter.error() */
|
|
9
11
|
message: string;
|
|
12
|
+
/** Stable retry guidance suitable for agent control flow */
|
|
13
|
+
retry: RetryHint;
|
|
10
14
|
/** Raw details from the response body or error object for debugging */
|
|
11
15
|
details: string;
|
|
12
16
|
/** Machine-readable context for agents (HTTP status, request ID, retry-after, etc.) */
|
|
13
17
|
context?: ErrorContext;
|
|
18
|
+
/**
|
|
19
|
+
* Per-field validation errors lifted from an ASP.NET ProblemDetails body
|
|
20
|
+
* (application/problem+json). Shape: `{ fieldName: ["msg", ...] }`.
|
|
21
|
+
* Surfaced as `Errors` on the OutputFormatter envelope so agents can
|
|
22
|
+
* react to the specific field that failed validation instead of parsing
|
|
23
|
+
* the free-text Message.
|
|
24
|
+
*/
|
|
25
|
+
parsedErrors?: Record<string, string[]>;
|
|
14
26
|
}
|
|
15
27
|
/**
|
|
16
28
|
* Options for customising error extraction behaviour.
|
package/dist/formatter.d.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
export type OutputFormat = "table" | "json" | "yaml" | "plain";
|
|
2
2
|
export type ResultType = "Success" | "Failure" | "ConfigError" | "AuthenticationError" | "ValidationError" | "TimeoutError";
|
|
3
3
|
export type FailureResultType = Exclude<ResultType, "Success">;
|
|
4
|
+
export declare const CLI_ERROR_CODES: readonly ["invalid_argument", "authentication_required", "permission_denied", "not_found", "rate_limited", "network_error", "timeout", "server_error", "method_not_allowed", "configuration_error", "unknown_error"];
|
|
5
|
+
export type CliErrorCode = (typeof CLI_ERROR_CODES)[number];
|
|
6
|
+
export declare const RETRY_HINTS: readonly ["RetryWillNotFix", "RetryLater", "RetryAfter1Second", "RetryAfter10Seconds", "RetryAfter30Seconds", "RetryAfter60Seconds"];
|
|
7
|
+
export type RetryHint = (typeof RETRY_HINTS)[number];
|
|
4
8
|
/** Canonical string constants for {@link ResultType} values. */
|
|
5
9
|
export declare const RESULTS: {
|
|
6
10
|
readonly Success: "Success";
|
|
@@ -76,11 +80,21 @@ export interface ErrorContext {
|
|
|
76
80
|
export declare class FailureOutput {
|
|
77
81
|
Result: FailureResultType;
|
|
78
82
|
Code?: string;
|
|
83
|
+
ErrorCode?: CliErrorCode;
|
|
79
84
|
Message: string;
|
|
80
85
|
Instructions: string;
|
|
86
|
+
Retry?: RetryHint;
|
|
81
87
|
Context?: ErrorContext;
|
|
82
88
|
Log?: string;
|
|
83
|
-
|
|
89
|
+
/**
|
|
90
|
+
* Optional structured payload for failure envelopes that need to carry
|
|
91
|
+
* actionable detail beyond the Message string (e.g. JobKey + JobState
|
|
92
|
+
* + SubState for the `jobs start --wait-for-completion` failure path).
|
|
93
|
+
* Mirrors SuccessOutput.Data so consumers can use a single accessor
|
|
94
|
+
* across success / failure paths.
|
|
95
|
+
*/
|
|
96
|
+
Data?: DataRecord | DataRecord[];
|
|
97
|
+
constructor(result: FailureResultType, message: string, instructions: string, context?: ErrorContext, errorCode?: CliErrorCode, retry?: RetryHint);
|
|
84
98
|
}
|
|
85
99
|
export type StructuredOutput = SuccessOutput | FailureOutput;
|
|
86
100
|
/**
|
|
@@ -97,11 +111,49 @@ export type StructuredOutput = SuccessOutput | FailureOutput;
|
|
|
97
111
|
* closed-box guarantee must additionally wrap {@link applyFilter}.
|
|
98
112
|
*/
|
|
99
113
|
export declare function validateOutputFilter(filter: string): Error | null;
|
|
114
|
+
/**
|
|
115
|
+
* Thrown when a `--output-filter` expression parses successfully but fails at
|
|
116
|
+
* evaluation time (e.g. type-coercion errors when functions receive unexpected
|
|
117
|
+
* types). Carries `instructions` and `result` so {@link trackedAction} can
|
|
118
|
+
* surface filter-specific guidance through the failure envelope instead of the
|
|
119
|
+
* generic "unexpected error" fallback.
|
|
120
|
+
*
|
|
121
|
+
* Uses a duck-type `__brand` rather than relying on `instanceof`, because each
|
|
122
|
+
* tool bundles its own copy of `@uipath/common` and class identity differs
|
|
123
|
+
* across bundle boundaries.
|
|
124
|
+
*/
|
|
125
|
+
export declare class FilterEvaluationError extends Error {
|
|
126
|
+
readonly __brand: "FilterEvaluationError";
|
|
127
|
+
readonly filter: string;
|
|
128
|
+
readonly errorCode: CliErrorCode;
|
|
129
|
+
readonly instructions: string;
|
|
130
|
+
readonly retry: RetryHint;
|
|
131
|
+
readonly result: FailureResultType;
|
|
132
|
+
constructor(filter: string, cause: unknown);
|
|
133
|
+
}
|
|
100
134
|
/**
|
|
101
135
|
* OutputFormatter namespace for formatting and displaying output.
|
|
102
136
|
*/
|
|
103
137
|
export declare namespace OutputFormatter {
|
|
104
|
-
|
|
138
|
+
/**
|
|
139
|
+
* Emit a success envelope.
|
|
140
|
+
*
|
|
141
|
+
* By default every key in `data.Data` is normalized to PascalCase for
|
|
142
|
+
* cross-command output consistency (see {@link normalizeDataKeys}).
|
|
143
|
+
*
|
|
144
|
+
* Pass `{ preserveDataKeys: true }` when the `Data` payload is content that
|
|
145
|
+
* is copied verbatim back into a UiPath artifact and whose key casing is
|
|
146
|
+
* therefore load-bearing — most notably `registry get` node definitions,
|
|
147
|
+
* whose camelCase field names (`inputDefinition`, `inputString`, …) are
|
|
148
|
+
* pasted straight into `.flow` files. PascalCasing those names produces a
|
|
149
|
+
* flow that passes `flow validate` but faults at runtime (the agent/job
|
|
150
|
+
* receives `InputString` while its schema requires `inputString`). With
|
|
151
|
+
* this flag the `Data` payload keeps its original casing; the envelope
|
|
152
|
+
* keys (`Result`/`Code`/`Data`/`Log`/…) are still PascalCased.
|
|
153
|
+
*/
|
|
154
|
+
function success(data: SuccessOutput, options?: {
|
|
155
|
+
preserveDataKeys?: boolean;
|
|
156
|
+
}): void;
|
|
105
157
|
/**
|
|
106
158
|
* Format and display an error, then set {@link process.exitCode} to the
|
|
107
159
|
* value from {@link EXIT_CODES} for `data.Result` (falls back to 1).
|
package/dist/index.browser.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export * from "./command-walker";
|
|
|
5
5
|
export * from "./completer";
|
|
6
6
|
export { installConsoleGuard, restoreConsole } from "./console-guard";
|
|
7
7
|
export * from "./constants";
|
|
8
|
+
export * from "./content-hash";
|
|
8
9
|
export * from "./env-reference";
|
|
9
10
|
export * from "./error-handler";
|
|
10
11
|
export * from "./error-instructions";
|
|
@@ -16,6 +17,7 @@ export * from "./orchestrator-urls";
|
|
|
16
17
|
export * from "./output-context";
|
|
17
18
|
export * from "./output-format-context";
|
|
18
19
|
export * from "./output-sink";
|
|
20
|
+
export * from "./package-metadata-options";
|
|
19
21
|
export * from "./polling";
|
|
20
22
|
export * from "./screen-logger";
|
|
21
23
|
export * from "./singleton";
|