@uipath/common 1.205.0-preview.276 → 1.206.0-preview.279
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 +2 -2
- package/dist/catch-error.d.ts +1 -0
- package/dist/catch-error.js +146 -15
- package/dist/classified-failure.d.ts +15 -17
- package/dist/command-examples.d.ts +5 -1
- package/dist/concurrency.d.ts +7 -0
- package/dist/entity-field-rules.js +1 -17
- package/dist/entity-name-rules.js +1 -17
- package/dist/error-codes.d.ts +41 -0
- package/dist/error-handler.d.ts +18 -1
- package/dist/error-handler.js +283 -58
- package/dist/error-instructions.d.ts +2 -1
- package/dist/exit-code.d.ts +30 -3
- package/dist/formatter.d.ts +18 -44
- package/dist/guid.js +1 -17
- package/dist/http-status.d.ts +18 -0
- package/dist/index.browser.d.ts +6 -0
- package/dist/index.browser.js +4010 -3568
- package/dist/index.d.ts +6 -0
- package/dist/index.js +7931 -7202
- package/dist/named-second.d.ts +27 -0
- package/dist/pass-through-tail.d.ts +54 -0
- package/dist/polling/poll-failure-mapping.d.ts +10 -7
- package/dist/polling/types.d.ts +8 -2
- package/dist/project-telemetry.d.ts +84 -0
- package/dist/report-failure.d.ts +31 -0
- package/dist/result-types.d.ts +12 -0
- package/dist/sdk-user-agent.js +19 -2
- package/dist/telemetry/index.d.ts +2 -0
- package/dist/telemetry/index.js +1816 -1734
- package/dist/telemetry/project-identity.d.ts +35 -0
- package/dist/telemetry/ship-succeeded.d.ts +7 -1
- package/dist/telemetry/telemetry-config.d.ts +2 -0
- package/dist/telemetry/telemetry-dimensions.d.ts +19 -1
- package/dist/telemetry/telemetry-events.d.ts +1 -0
- package/dist/telemetry/telemetry-init.d.ts +9 -3
- package/dist/testing.d.ts +57 -0
- package/dist/testing.js +3623 -0
- package/dist/timings.d.ts +4 -3
- package/dist/zip.js +139 -115
- package/package.json +6 -2
|
@@ -35,7 +35,7 @@ export declare function parseAttachmentSpec(spec: string): ParsedAttachmentSpec;
|
|
|
35
35
|
/** A spec whose file has been read: bytes plus the basename used as the upload name. */
|
|
36
36
|
export interface PreparedAttachmentSpec extends ParsedAttachmentSpec {
|
|
37
37
|
fileName: string;
|
|
38
|
-
bytes: Uint8Array
|
|
38
|
+
bytes: Uint8Array<ArrayBuffer>;
|
|
39
39
|
}
|
|
40
40
|
/**
|
|
41
41
|
* Phase 1 of {@link resolveAttachmentInputs}: read every spec's bytes before
|
|
@@ -62,7 +62,7 @@ export declare function readAttachmentSpecs(specs: ParsedAttachmentSpec[]): Prom
|
|
|
62
62
|
* UI. The spec's `name` is preserved on the returned record for callers to
|
|
63
63
|
* use as the binding key in their inputs payload.
|
|
64
64
|
*/
|
|
65
|
-
export declare function resolveAttachmentInputs<R>(specs: ParsedAttachmentSpec[], upload: (bytes: Uint8Array
|
|
65
|
+
export declare function resolveAttachmentInputs<R>(specs: ParsedAttachmentSpec[], upload: (bytes: Uint8Array<ArrayBuffer>, fileName: string) => Promise<R>): Promise<{
|
|
66
66
|
name: string;
|
|
67
67
|
path: string;
|
|
68
68
|
reference: R;
|
package/dist/catch-error.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ type CatchErrorResult<T> = [undefined, T] | [Error, undefined];
|
|
|
14
14
|
*/
|
|
15
15
|
export declare function describeThrownValue(value: unknown): string;
|
|
16
16
|
export declare function catchError<T>(fnOrPromise: Promise<T>): Promise<CatchErrorResult<T>>;
|
|
17
|
+
export declare function catchError(fnOrPromise: () => never): CatchErrorResult<never>;
|
|
17
18
|
export declare function catchError<T>(fnOrPromise: () => Promise<T>): Promise<CatchErrorResult<T>>;
|
|
18
19
|
export declare function catchError<T>(fnOrPromise: () => T): CatchErrorResult<T>;
|
|
19
20
|
export {};
|
package/dist/catch-error.js
CHANGED
|
@@ -1,18 +1,149 @@
|
|
|
1
|
-
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
// src/telemetry/telemetry-dimensions.ts
|
|
2
|
+
var BaseDimensions = {
|
|
3
|
+
ApplicationName: "ApplicationName",
|
|
4
|
+
ProductVersion: "ProductVersion",
|
|
5
|
+
InstallationId: "InstallationId",
|
|
6
|
+
CloudUserId: "CloudUserId",
|
|
7
|
+
CloudTenantId: "CloudTenantId",
|
|
8
|
+
CloudOrganizationId: "CloudOrganizationId",
|
|
9
|
+
IsInternalUser: "IsInternalUser",
|
|
10
|
+
Environment: "Environment",
|
|
11
|
+
BaseUrl: "BaseUrl",
|
|
12
|
+
Region: "Region",
|
|
13
|
+
Agent: "Agent",
|
|
14
|
+
AgentVersion: "AgentVersion",
|
|
15
|
+
AgentModel: "AgentModel",
|
|
16
|
+
ToolName: "ToolName",
|
|
17
|
+
ToolVersion: "ToolVersion",
|
|
18
|
+
ExecutionContext: "ExecutionContext",
|
|
19
|
+
CiProvider: "CiProvider",
|
|
20
|
+
SessionIdSource: "SessionIdSource",
|
|
21
|
+
SessionId: "SessionId"
|
|
22
|
+
};
|
|
23
|
+
var CommandDimensions = {
|
|
24
|
+
IsCommand: "IsCommand",
|
|
25
|
+
IsReexec: "IsReexec",
|
|
26
|
+
CommandName: "CommandName",
|
|
27
|
+
ExitCode: "ExitCode",
|
|
28
|
+
TerminalOutcome: "TerminalOutcome",
|
|
29
|
+
ErrorClass: "ErrorClass",
|
|
30
|
+
TerminalSignal: "TerminalSignal",
|
|
31
|
+
ErrorMessage: "ErrorMessage",
|
|
32
|
+
SkillName: "SkillName",
|
|
33
|
+
ProductArea: "ProductArea",
|
|
34
|
+
Mode: "Mode"
|
|
35
|
+
};
|
|
36
|
+
var ProjectDimensions = {
|
|
37
|
+
ProjectKey: "ProjectKey",
|
|
38
|
+
ProjectType: "ProjectType",
|
|
39
|
+
ProjectIdentityStatus: "ProjectIdentityStatus",
|
|
40
|
+
SolutionKey: "SolutionKey",
|
|
41
|
+
SolutionProjectKey: "SolutionProjectKey",
|
|
42
|
+
SolutionIdentityStatus: "SolutionIdentityStatus",
|
|
43
|
+
PreviousSolutionKey: "PreviousSolutionKey"
|
|
44
|
+
};
|
|
45
|
+
var GUID_KEY_DIMENSIONS = new Set([
|
|
46
|
+
ProjectDimensions.ProjectKey,
|
|
47
|
+
ProjectDimensions.SolutionKey,
|
|
48
|
+
ProjectDimensions.SolutionProjectKey,
|
|
49
|
+
ProjectDimensions.PreviousSolutionKey
|
|
50
|
+
]);
|
|
51
|
+
var ShipDimensions = {
|
|
52
|
+
ShipKind: "ShipKind",
|
|
53
|
+
Target: "Target",
|
|
54
|
+
ProjectType: "ProjectType",
|
|
55
|
+
ProjectTypes: "ProjectTypes",
|
|
56
|
+
ArtifactCorrelationKey: "ArtifactCorrelationKey",
|
|
57
|
+
PackageName: "PackageName",
|
|
58
|
+
PackageVersion: "PackageVersion",
|
|
59
|
+
PackageVersionKey: "PackageVersionKey",
|
|
60
|
+
DeploymentKey: "DeploymentKey",
|
|
61
|
+
SolutionId: "SolutionId",
|
|
62
|
+
FolderKey: "FolderKey",
|
|
63
|
+
FeedId: "FeedId"
|
|
64
|
+
};
|
|
65
|
+
var ErrorDimensions = {
|
|
66
|
+
Result: "Result",
|
|
67
|
+
ErrorCode: "ErrorCode",
|
|
68
|
+
Retry: "Retry",
|
|
69
|
+
ErrorMessage: "ErrorMessage",
|
|
70
|
+
HttpStatus: "HttpStatus",
|
|
71
|
+
UpstreamErrorCode: "UpstreamErrorCode"
|
|
72
|
+
};
|
|
73
|
+
var AuthDimensions = {
|
|
74
|
+
AuthenticationMethod: "AuthenticationMethod",
|
|
75
|
+
Success: "Success",
|
|
76
|
+
Reason: "Reason"
|
|
14
77
|
};
|
|
15
|
-
var
|
|
78
|
+
var SkillsDimensions = {
|
|
79
|
+
SchemaVersion: "SchemaVersion",
|
|
80
|
+
AgentType: "AgentType",
|
|
81
|
+
SkillsVersion: "SkillsVersion",
|
|
82
|
+
UipSubcommand: "UipSubcommand",
|
|
83
|
+
FileExtension: "FileExtension",
|
|
84
|
+
SubagentModel: "SubagentModel",
|
|
85
|
+
SubagentType: "SubagentType",
|
|
86
|
+
PermissionMode: "PermissionMode",
|
|
87
|
+
EffortLevel: "EffortLevel",
|
|
88
|
+
SessionSource: "SessionSource",
|
|
89
|
+
Outcome: "Outcome",
|
|
90
|
+
DurationMs: "DurationMs",
|
|
91
|
+
Source: "Source"
|
|
92
|
+
};
|
|
93
|
+
var PackagerDimensions = {
|
|
94
|
+
ProjectId: "ProjectId",
|
|
95
|
+
ProjectType: "ProjectType",
|
|
96
|
+
SolutionId: "SolutionId"
|
|
97
|
+
};
|
|
98
|
+
var ScopeDimensions = {
|
|
99
|
+
FolderId: "FolderId"
|
|
100
|
+
};
|
|
101
|
+
var ID_DIMENSIONS = new Set([
|
|
102
|
+
BaseDimensions.CloudUserId,
|
|
103
|
+
BaseDimensions.CloudTenantId,
|
|
104
|
+
BaseDimensions.CloudOrganizationId,
|
|
105
|
+
BaseDimensions.InstallationId,
|
|
106
|
+
ShipDimensions.ArtifactCorrelationKey,
|
|
107
|
+
ShipDimensions.PackageVersionKey,
|
|
108
|
+
ShipDimensions.DeploymentKey,
|
|
109
|
+
ShipDimensions.SolutionId,
|
|
110
|
+
ShipDimensions.FolderKey,
|
|
111
|
+
ShipDimensions.FeedId,
|
|
112
|
+
PackagerDimensions.ProjectId
|
|
113
|
+
]);
|
|
114
|
+
var RESERVED_DIMENSION_NAMES = new Set([
|
|
115
|
+
...Object.values(BaseDimensions),
|
|
116
|
+
...Object.values(CommandDimensions),
|
|
117
|
+
...Object.values(ShipDimensions),
|
|
118
|
+
...Object.values(ProjectDimensions),
|
|
119
|
+
...Object.values(ErrorDimensions),
|
|
120
|
+
...Object.values(AuthDimensions),
|
|
121
|
+
...Object.values(SkillsDimensions),
|
|
122
|
+
...Object.values(PackagerDimensions),
|
|
123
|
+
...Object.values(ScopeDimensions)
|
|
124
|
+
]);
|
|
125
|
+
var CURATED_DIMENSIONS = new Set([
|
|
126
|
+
BaseDimensions.ApplicationName,
|
|
127
|
+
BaseDimensions.ProductVersion,
|
|
128
|
+
BaseDimensions.InstallationId,
|
|
129
|
+
BaseDimensions.CloudUserId,
|
|
130
|
+
BaseDimensions.CloudTenantId,
|
|
131
|
+
BaseDimensions.CloudOrganizationId,
|
|
132
|
+
BaseDimensions.IsInternalUser,
|
|
133
|
+
BaseDimensions.Environment,
|
|
134
|
+
BaseDimensions.BaseUrl,
|
|
135
|
+
BaseDimensions.Region,
|
|
136
|
+
BaseDimensions.Agent,
|
|
137
|
+
BaseDimensions.AgentVersion,
|
|
138
|
+
BaseDimensions.ToolVersion,
|
|
139
|
+
BaseDimensions.ExecutionContext,
|
|
140
|
+
BaseDimensions.CiProvider,
|
|
141
|
+
BaseDimensions.SessionIdSource,
|
|
142
|
+
BaseDimensions.SessionId,
|
|
143
|
+
...Object.values(CommandDimensions),
|
|
144
|
+
...Object.values(ShipDimensions),
|
|
145
|
+
...Object.values(ProjectDimensions)
|
|
146
|
+
]);
|
|
16
147
|
|
|
17
148
|
// src/telemetry/pseudonymize.ts
|
|
18
149
|
var SHA256_K = new Uint32Array([
|
|
@@ -294,4 +425,4 @@ export {
|
|
|
294
425
|
describeThrownValue
|
|
295
426
|
};
|
|
296
427
|
|
|
297
|
-
//# debugId=
|
|
428
|
+
//# debugId=7DBED933CEA029B064756E2164756E21
|
|
@@ -1,26 +1,24 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ErrorContext, FailureOutput } from "./formatter";
|
|
2
2
|
/**
|
|
3
3
|
* Build the standard failure envelope for `error`, classified.
|
|
4
4
|
*
|
|
5
5
|
* `Message` says what the command was doing; `Instructions` carries the detail
|
|
6
|
-
* from {@link extractErrorDetails}, along with the `
|
|
7
|
-
* `Context` that agents branch on. Building the envelope from
|
|
8
|
-
* `extractErrorMessage` instead drops those
|
|
9
|
-
*
|
|
6
|
+
* from {@link extractErrorDetails}, along with the `Result`, `ErrorCode`,
|
|
7
|
+
* `Retry` and `Context` that agents branch on. Building the envelope from
|
|
8
|
+
* `extractErrorMessage` instead drops those, so a transient 5xx reports as
|
|
9
|
+
* `unknown_error` / `RetryWillNotFix` and callers are told never to retry.
|
|
10
10
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* over the real formatter and command specs could no longer assert on it.
|
|
11
|
+
* `Result` is the classified one, so the exit code follows the failure: a 401
|
|
12
|
+
* or 403 exits 2 (`AuthenticationError`), a 400 or 422 exits 3
|
|
13
|
+
* (`ValidationError`), everything else 1.
|
|
15
14
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* OutputFormatter.error(await classifiedFailure("Error listing folders", err));
|
|
20
|
-
* processContext.exit(1);
|
|
21
|
-
* ```
|
|
15
|
+
* Returns the envelope rather than emitting it, for a caller that has to add
|
|
16
|
+
* to it before printing. A caller that only prints it uses `reportFailure`,
|
|
17
|
+
* which classifies, prints, and records the exit code in one call.
|
|
22
18
|
*/
|
|
23
19
|
export declare function classifiedFailure(message: string, error: unknown): Promise<FailureOutput>;
|
|
20
|
+
/** Classify a failed session lookup while keeping its actionable next step. */
|
|
21
|
+
export declare function authContextFailure(error: unknown, sessionInstructions?: string): Promise<FailureOutput>;
|
|
24
22
|
/**
|
|
25
23
|
* The failure envelope for an operation the connected environment does not
|
|
26
24
|
* offer: its service is not deployed there, or the feature behind it is off.
|
|
@@ -29,8 +27,8 @@ export declare function classifiedFailure(message: string, error: unknown): Prom
|
|
|
29
27
|
*
|
|
30
28
|
* `operation` names what the caller tried ("Tagged attachment upload") and
|
|
31
29
|
* becomes the standard Message, so every tool reports this the same way;
|
|
32
|
-
* `instructions` says what is missing and what to do instead.
|
|
33
|
-
*
|
|
30
|
+
* `instructions` says what is missing and what to do instead. Print it with
|
|
31
|
+
* `OutputFormatter.error()`, which records the exit code.
|
|
34
32
|
*/
|
|
35
33
|
export declare function notSupportedFailure(operation: string, instructions: string, context?: ErrorContext): FailureOutput;
|
|
36
34
|
/**
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Command } from "commander";
|
|
2
|
+
import type { Pagination } from "./formatter";
|
|
2
3
|
/**
|
|
3
4
|
* Structured example output data, stored as objects for format-agnostic rendering.
|
|
4
5
|
* The `Code` mirrors the SuccessOutput.Code the real command would emit;
|
|
@@ -6,7 +7,10 @@ import { Command } from "commander";
|
|
|
6
7
|
*/
|
|
7
8
|
export interface CommandExampleOutput {
|
|
8
9
|
Code: string;
|
|
9
|
-
|
|
10
|
+
/** An object, a list of rows, or a list of plain values (e.g. names). */
|
|
11
|
+
Data: Record<string, unknown> | Record<string, unknown>[] | string[];
|
|
12
|
+
/** For a list example, the paging envelope the real command emits. */
|
|
13
|
+
Pagination?: Pagination;
|
|
10
14
|
}
|
|
11
15
|
/**
|
|
12
16
|
* A single usage example for a leaf command.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `Promise.all(items.map(fn))` with at most `limit` calls running at once.
|
|
3
|
+
* Results keep the input order. The first rejection rejects the whole call
|
|
4
|
+
* and no worker starts another item after it; calls already running are
|
|
5
|
+
* left to finish, and their results are dropped.
|
|
6
|
+
*/
|
|
7
|
+
export declare function mapWithConcurrency<T, R>(items: readonly T[], limit: number, fn: (item: T, index: number) => Promise<R>): Promise<R[]>;
|
|
@@ -1,19 +1,3 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __returnValue = (v) => v;
|
|
3
|
-
function __exportSetter(name, newValue) {
|
|
4
|
-
this[name] = __returnValue.bind(null, newValue);
|
|
5
|
-
}
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, {
|
|
9
|
-
get: all[name],
|
|
10
|
-
enumerable: true,
|
|
11
|
-
configurable: true,
|
|
12
|
-
set: __exportSetter.bind(all, name)
|
|
13
|
-
});
|
|
14
|
-
};
|
|
15
|
-
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
16
|
-
|
|
17
1
|
// src/entity-field-rules.ts
|
|
18
2
|
var MAX_SAFE_NUMERIC_BOUND = 9007199254740991;
|
|
19
3
|
var LENGTH_LIMIT_RANGES = {
|
|
@@ -119,4 +103,4 @@ export {
|
|
|
119
103
|
findInvalidFieldConstraints
|
|
120
104
|
};
|
|
121
105
|
|
|
122
|
-
//# debugId=
|
|
106
|
+
//# debugId=4CC27DBD3780F4F164756E2164756E21
|
|
@@ -1,19 +1,3 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __returnValue = (v) => v;
|
|
3
|
-
function __exportSetter(name, newValue) {
|
|
4
|
-
this[name] = __returnValue.bind(null, newValue);
|
|
5
|
-
}
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, {
|
|
9
|
-
get: all[name],
|
|
10
|
-
enumerable: true,
|
|
11
|
-
configurable: true,
|
|
12
|
-
set: __exportSetter.bind(all, name)
|
|
13
|
-
});
|
|
14
|
-
};
|
|
15
|
-
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
16
|
-
|
|
17
1
|
// src/entity-name-rules.ts
|
|
18
2
|
var RESERVED_SQL_KEYWORDS_LOWER = new Set(["group", "order"]);
|
|
19
3
|
var ENTITY_NAME_PATTERN = /^[a-zA-Z][a-zA-Z0-9_]{2,99}$/;
|
|
@@ -258,4 +242,4 @@ export {
|
|
|
258
242
|
validateNameFormat
|
|
259
243
|
};
|
|
260
244
|
|
|
261
|
-
//# debugId=
|
|
245
|
+
//# debugId=C732283995CFDE3364756E2164756E21
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The failure envelope's `ErrorCode` and `Retry` vocabularies, and the readers
|
|
3
|
+
* for an error that classified itself.
|
|
4
|
+
*
|
|
5
|
+
* This lives in its own dependency-free module, not in `formatter.ts`, because
|
|
6
|
+
* `error-handler.ts` needs these at runtime and is re-exported from
|
|
7
|
+
* `index.browser.ts`. `formatter.ts` transitively imports `telemetry-init`
|
|
8
|
+
* (and through it node builtins), so a value import of it from a
|
|
9
|
+
* browser-reachable module breaks the browser bundle.
|
|
10
|
+
*
|
|
11
|
+
* `formatter.ts` re-exports every name here, so `@uipath/common` consumers see
|
|
12
|
+
* one import site regardless of which file defines them.
|
|
13
|
+
*/
|
|
14
|
+
export declare const CLI_ERROR_CODES: readonly ["invalid_argument", "authentication_required", "permission_denied", "local_permission_denied", "not_found", "rate_limited", "network_error", "timeout", "server_error", "method_not_allowed", "not_supported", "configuration_error", "execution_failed", "unknown_error"];
|
|
15
|
+
export type CliErrorCode = (typeof CLI_ERROR_CODES)[number];
|
|
16
|
+
export declare const RETRY_HINTS: readonly ["RetryWillNotFix", "RetryLater", "RetryAfter1Second", "RetryAfter10Seconds", "RetryAfter30Seconds", "RetryAfter60Seconds"];
|
|
17
|
+
export type RetryHint = (typeof RETRY_HINTS)[number];
|
|
18
|
+
/**
|
|
19
|
+
* Narrow an arbitrary value to a {@link CliErrorCode}.
|
|
20
|
+
*
|
|
21
|
+
* Codes read off a caught error (or any other value the CLI did not produce
|
|
22
|
+
* itself) have to be checked rather than cast, or an unrecognised string
|
|
23
|
+
* reaches the output as an ErrorCode no consumer knows how to branch on.
|
|
24
|
+
*/
|
|
25
|
+
export declare function isCliErrorCode(value: unknown): value is CliErrorCode;
|
|
26
|
+
/** Narrow an arbitrary value to a {@link RetryHint}. See {@link isCliErrorCode}. */
|
|
27
|
+
export declare function isRetryHint(value: unknown): value is RetryHint;
|
|
28
|
+
/**
|
|
29
|
+
* The `ErrorCode` an error carries, when it classified itself.
|
|
30
|
+
*
|
|
31
|
+
* Companion to `carriedInstructions` (error-handler): a thrower that knows its
|
|
32
|
+
* failure mode can say so, and the renderer and `extractErrorDetails` use it
|
|
33
|
+
* instead of inferring one. Duck-typed and validated for the same reason — the
|
|
34
|
+
* error may have crossed a bundle boundary, and an unrecognised string must not
|
|
35
|
+
* reach the envelope as a code no consumer can branch on.
|
|
36
|
+
*/
|
|
37
|
+
export declare function carriedErrorCode(error: unknown): CliErrorCode | undefined;
|
|
38
|
+
/** The `Retry` hint an error carries. See {@link carriedErrorCode}. */
|
|
39
|
+
export declare function carriedRetry(error: unknown): RetryHint | undefined;
|
|
40
|
+
/** The `Retry` an `ErrorCode` implies when nothing more specific is known. */
|
|
41
|
+
export declare function defaultRetryForErrorCode(errorCode: CliErrorCode): RetryHint;
|
package/dist/error-handler.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { type CliErrorCode, type RetryHint } from "./error-codes";
|
|
1
2
|
import { parseHttpStatusFromMessage } from "./error-graph";
|
|
2
|
-
import type {
|
|
3
|
+
import type { ErrorContext, FailureResultType } from "./formatter";
|
|
3
4
|
export { parseHttpStatusFromMessage };
|
|
4
5
|
/**
|
|
5
6
|
* Structured error details returned by {@link extractErrorDetails}.
|
|
@@ -104,6 +105,19 @@ export declare function describeConnectivityError(error: unknown): ConnectivityE
|
|
|
104
105
|
*/
|
|
105
106
|
export declare function describePermissionError(error: unknown): LocalPermissionError | undefined;
|
|
106
107
|
export declare function isHtmlDocument(body: string): boolean;
|
|
108
|
+
/**
|
|
109
|
+
* `ErrorCode` / `Retry` for a thrown error, without reading its response body.
|
|
110
|
+
*
|
|
111
|
+
* The classification {@link extractErrorDetails} applies — the status comes
|
|
112
|
+
* from the error graph, never from the body, and a class the error carries
|
|
113
|
+
* wins — for synchronous callers that only need the class, such as a poll
|
|
114
|
+
* that gave up on its last error. It skips the `Retry-After` refinement,
|
|
115
|
+
* which needs the response headers.
|
|
116
|
+
*/
|
|
117
|
+
export declare function classifyThrownError(error: unknown): {
|
|
118
|
+
errorCode: CliErrorCode;
|
|
119
|
+
retry: RetryHint;
|
|
120
|
+
};
|
|
107
121
|
/**
|
|
108
122
|
* Extract a structured error message and details from an unknown thrown value.
|
|
109
123
|
*
|
|
@@ -118,6 +132,9 @@ export declare function isHtmlDocument(body: string): boolean;
|
|
|
118
132
|
* - 403 → permissions message (customisable via `options.forbiddenMessage`)
|
|
119
133
|
* - 405 → endpoint hint
|
|
120
134
|
* - Other → `HTTP {status}: {body message}`
|
|
135
|
+
*
|
|
136
|
+
* `errorCode` / `retry` come from the status, connectivity or permission
|
|
137
|
+
* shape, unless the error carries its own (see {@link withCarriedClass}).
|
|
121
138
|
*/
|
|
122
139
|
export declare function extractErrorDetails(error: unknown, options?: ExtractErrorOptions): Promise<ErrorDetails>;
|
|
123
140
|
/**
|