Skip to content

Commit 85058b3

Browse files
committed
chore(smithy-client): consolidate shared types to types package
1 parent c2e88a4 commit 85058b3

File tree

7 files changed

+51
-56
lines changed

7 files changed

+51
-56
lines changed

packages/smithy-client/src/document-type.ts

Lines changed: 0 additions & 10 deletions
This file was deleted.

packages/smithy-client/src/exception.ts

Lines changed: 0 additions & 27 deletions
This file was deleted.

packages/smithy-client/src/index.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
export * from "./client";
22
export * from "./command";
3-
export * from "./document-type";
4-
export * from "./exception";
53
export * from "./extended-encode-uri-component";
64
export * from "./get-array-if-single-item";
75
export * from "./get-value-from-text-node";
@@ -11,5 +9,3 @@ export * from "./ser-utils";
119
export * from "./date-utils";
1210
export * from "./split-every";
1311
export * from "./constants";
14-
export * from "./retryable-trait";
15-
export * from "./sdk-error";

packages/smithy-client/src/retryable-trait.ts

Lines changed: 0 additions & 10 deletions
This file was deleted.

packages/smithy-client/src/sdk-error.ts

Lines changed: 0 additions & 5 deletions
This file was deleted.

packages/types/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export * from "./pagination";
1010
export * from "./serde";
1111
export * from "./middleware";
1212
export * from "./response";
13+
export * from "./shapes";
1314
export * from "./signature";
1415
export * from "./transfer";
1516
export * from "./util";

packages/types/src/shapes.ts

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
import { MetadataBearer } from "./response";
2+
3+
/**
4+
* A document type represents an untyped JSON-like value.
5+
*
6+
* Not all protocols support document types, and the serialization format of a
7+
* document type is protocol specific. All JSON protocols SHOULD support
8+
* document types and they SHOULD serialize document types inline as normal
9+
* JSON values.
10+
*/
11+
export type DocumentType = null | boolean | number | string | DocumentType[] | { [prop: string]: DocumentType };
12+
13+
/**
14+
* A structure shape with the error trait.
15+
* https://awslabs.github.io/smithy/spec/core.html#retryable-trait
16+
*/
17+
export interface RetryableTrait {
18+
/**
19+
* Indicates that the error is a retryable throttling error.
20+
*/
21+
readonly throttling?: boolean;
22+
}
23+
24+
/**
25+
* Type that is implemented by all Smithy shapes marked with the
26+
* error trait.
27+
*/
28+
export interface SmithyException {
29+
/**
30+
* The shape ID name of the exception.
31+
*/
32+
readonly name: string;
33+
34+
/**
35+
* Whether the client or server are at fault.
36+
*/
37+
readonly $fault: "client" | "server";
38+
39+
/**
40+
* The service that encountered the exception.
41+
*/
42+
readonly $service?: string;
43+
44+
/**
45+
* Indicates that an error MAY be retried by the client.
46+
*/
47+
readonly $retryable?: RetryableTrait;
48+
}
49+
50+
export type SdkError = Error & Partial<SmithyException> & Partial<MetadataBearer>;

0 commit comments

Comments
 (0)