Skip to content

Commit 324f89d

Browse files
committed
chore: generate explicit type exports for structural interfaces
1 parent be88a58 commit 324f89d

File tree

26 files changed

+519
-424
lines changed

26 files changed

+519
-424
lines changed

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ generate-protocol-tests:
2020
npx prettier --write ./private/smithy-rpcv2-cbor-schema
2121
npx prettier --write ./private/my-local-model
2222
yarn
23+
(cd ./private/smithy-rpcv2-cbor && npm run build)
24+
(cd ./private/smithy-rpcv2-cbor-schema && npm run build)
25+
(cd ./private/my-local-model && npm run build)
2326

2427
test-protocols:
2528
(cd ./private/smithy-rpcv2-cbor && npx vitest run --globals)

private/my-local-model/src/index.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,15 @@ export { ClientInputEndpointParameters } from "./endpoint/EndpointParameters";
1111
export type { RuntimeExtension } from "./runtimeExtensions";
1212
export type { XYZServiceExtensionConfiguration } from "./extensionConfiguration";
1313
export * from "./commands";
14-
export * from "./models";
14+
15+
export * from "./models/errors";
16+
export type {
17+
Alpha,
18+
GetNumbersRequest,
19+
GetNumbersResponse,
20+
TradeEventStreamRequest,
21+
TradeEventStreamResponse,
22+
Unit,
23+
} from "./models/models_0";
1524

1625
export { XYZServiceSyntheticServiceException } from "./models/XYZServiceSyntheticServiceException";
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
// smithy-typescript generated code
2+
import { XYZServiceSyntheticServiceException as __BaseException } from "./XYZServiceSyntheticServiceException";
3+
import { ExceptionOptionType as __ExceptionOptionType } from "@smithy/smithy-client";
4+
5+
/**
6+
* @public
7+
*/
8+
export class CodedThrottlingError extends __BaseException {
9+
readonly name = "CodedThrottlingError" as const;
10+
readonly $fault = "client" as const;
11+
$retryable = {
12+
throttling: true,
13+
};
14+
/**
15+
* @internal
16+
*/
17+
constructor(opts: __ExceptionOptionType<CodedThrottlingError, __BaseException>) {
18+
super({
19+
name: "CodedThrottlingError",
20+
$fault: "client",
21+
...opts,
22+
});
23+
Object.setPrototypeOf(this, CodedThrottlingError.prototype);
24+
}
25+
}
26+
27+
/**
28+
* @public
29+
*/
30+
export class HaltError extends __BaseException {
31+
readonly name = "HaltError" as const;
32+
readonly $fault = "client" as const;
33+
/**
34+
* @internal
35+
*/
36+
constructor(opts: __ExceptionOptionType<HaltError, __BaseException>) {
37+
super({
38+
name: "HaltError",
39+
$fault: "client",
40+
...opts,
41+
});
42+
Object.setPrototypeOf(this, HaltError.prototype);
43+
}
44+
}
45+
46+
/**
47+
* @public
48+
*/
49+
export class MysteryThrottlingError extends __BaseException {
50+
readonly name = "MysteryThrottlingError" as const;
51+
readonly $fault = "client" as const;
52+
$retryable = {
53+
throttling: true,
54+
};
55+
/**
56+
* @internal
57+
*/
58+
constructor(opts: __ExceptionOptionType<MysteryThrottlingError, __BaseException>) {
59+
super({
60+
name: "MysteryThrottlingError",
61+
$fault: "client",
62+
...opts,
63+
});
64+
Object.setPrototypeOf(this, MysteryThrottlingError.prototype);
65+
}
66+
}
67+
68+
/**
69+
* @public
70+
*/
71+
export class RetryableError extends __BaseException {
72+
readonly name = "RetryableError" as const;
73+
readonly $fault = "client" as const;
74+
$retryable = {};
75+
/**
76+
* @internal
77+
*/
78+
constructor(opts: __ExceptionOptionType<RetryableError, __BaseException>) {
79+
super({
80+
name: "RetryableError",
81+
$fault: "client",
82+
...opts,
83+
});
84+
Object.setPrototypeOf(this, RetryableError.prototype);
85+
}
86+
}
87+
88+
/**
89+
* @public
90+
*/
91+
export class XYZServiceServiceException extends __BaseException {
92+
readonly name = "XYZServiceServiceException" as const;
93+
readonly $fault = "client" as const;
94+
/**
95+
* @internal
96+
*/
97+
constructor(opts: __ExceptionOptionType<XYZServiceServiceException, __BaseException>) {
98+
super({
99+
name: "XYZServiceServiceException",
100+
$fault: "client",
101+
...opts,
102+
});
103+
Object.setPrototypeOf(this, XYZServiceServiceException.prototype);
104+
}
105+
}

private/my-local-model/src/models/index.ts

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

private/my-local-model/src/models/models_0.ts

Lines changed: 0 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
// smithy-typescript generated code
2-
import { XYZServiceSyntheticServiceException as __BaseException } from "./XYZServiceSyntheticServiceException";
32
import { NumericValue } from "@smithy/core/serde";
4-
import { ExceptionOptionType as __ExceptionOptionType } from "@smithy/smithy-client";
53

64
/**
75
* @public
@@ -11,28 +9,6 @@ export interface Alpha {
119
timestamp?: Date | undefined;
1210
}
1311

14-
/**
15-
* @public
16-
*/
17-
export class CodedThrottlingError extends __BaseException {
18-
readonly name: "CodedThrottlingError" = "CodedThrottlingError";
19-
readonly $fault: "client" = "client";
20-
$retryable = {
21-
throttling: true,
22-
};
23-
/**
24-
* @internal
25-
*/
26-
constructor(opts: __ExceptionOptionType<CodedThrottlingError, __BaseException>) {
27-
super({
28-
name: "CodedThrottlingError",
29-
$fault: "client",
30-
...opts,
31-
});
32-
Object.setPrototypeOf(this, CodedThrottlingError.prototype);
33-
}
34-
}
35-
3612
/**
3713
* @public
3814
*/
@@ -64,86 +40,6 @@ export interface GetNumbersResponse {
6440
bigInteger?: bigint | undefined;
6541
}
6642

67-
/**
68-
* @public
69-
*/
70-
export class HaltError extends __BaseException {
71-
readonly name: "HaltError" = "HaltError";
72-
readonly $fault: "client" = "client";
73-
/**
74-
* @internal
75-
*/
76-
constructor(opts: __ExceptionOptionType<HaltError, __BaseException>) {
77-
super({
78-
name: "HaltError",
79-
$fault: "client",
80-
...opts,
81-
});
82-
Object.setPrototypeOf(this, HaltError.prototype);
83-
}
84-
}
85-
86-
/**
87-
* @public
88-
*/
89-
export class MysteryThrottlingError extends __BaseException {
90-
readonly name: "MysteryThrottlingError" = "MysteryThrottlingError";
91-
readonly $fault: "client" = "client";
92-
$retryable = {
93-
throttling: true,
94-
};
95-
/**
96-
* @internal
97-
*/
98-
constructor(opts: __ExceptionOptionType<MysteryThrottlingError, __BaseException>) {
99-
super({
100-
name: "MysteryThrottlingError",
101-
$fault: "client",
102-
...opts,
103-
});
104-
Object.setPrototypeOf(this, MysteryThrottlingError.prototype);
105-
}
106-
}
107-
108-
/**
109-
* @public
110-
*/
111-
export class RetryableError extends __BaseException {
112-
readonly name: "RetryableError" = "RetryableError";
113-
readonly $fault: "client" = "client";
114-
$retryable = {};
115-
/**
116-
* @internal
117-
*/
118-
constructor(opts: __ExceptionOptionType<RetryableError, __BaseException>) {
119-
super({
120-
name: "RetryableError",
121-
$fault: "client",
122-
...opts,
123-
});
124-
Object.setPrototypeOf(this, RetryableError.prototype);
125-
}
126-
}
127-
128-
/**
129-
* @public
130-
*/
131-
export class XYZServiceServiceException extends __BaseException {
132-
readonly name: "XYZServiceServiceException" = "XYZServiceServiceException";
133-
readonly $fault: "client" = "client";
134-
/**
135-
* @internal
136-
*/
137-
constructor(opts: __ExceptionOptionType<XYZServiceServiceException, __BaseException>) {
138-
super({
139-
name: "XYZServiceServiceException",
140-
$fault: "client",
141-
...opts,
142-
});
143-
Object.setPrototypeOf(this, XYZServiceServiceException.prototype);
144-
}
145-
}
146-
14743
/**
14844
* @public
14945
*/

private/my-local-model/src/protocols/Rpcv2cbor.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,13 @@ import { GetNumbersCommandInput, GetNumbersCommandOutput } from "../commands/Get
33
import { TradeEventStreamCommandInput, TradeEventStreamCommandOutput } from "../commands/TradeEventStreamCommand";
44
import { XYZServiceSyntheticServiceException as __BaseException } from "../models/XYZServiceSyntheticServiceException";
55
import {
6-
Alpha,
76
CodedThrottlingError,
8-
GetNumbersRequest,
9-
GetNumbersResponse,
107
HaltError,
118
MysteryThrottlingError,
129
RetryableError,
13-
TradeEvents,
14-
Unit,
1510
XYZServiceServiceException,
16-
} from "../models/models_0";
11+
} from "../models/errors";
12+
import { Alpha, GetNumbersRequest, GetNumbersResponse, TradeEvents, Unit } from "../models/models_0";
1713
import {
1814
dateToTag as __dateToTag,
1915
buildHttpRpcRequest,

private/smithy-rpcv2-cbor-schema/src/index.ts

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,31 @@ export { ClientInputEndpointParameters } from "./endpoint/EndpointParameters";
66
export type { RuntimeExtension } from "./runtimeExtensions";
77
export type { RpcV2ProtocolExtensionConfiguration } from "./extensionConfiguration";
88
export * from "./commands";
9-
export * from "./models";
9+
10+
export * from "./models/enums";
11+
export * from "./models/errors";
12+
export type {
13+
ClientOptionalDefaults,
14+
ComplexNestedErrorData,
15+
Defaults,
16+
EmptyStructure,
17+
Float16Output,
18+
FractionalSecondsOutput,
19+
GreetingStruct,
20+
GreetingWithErrorsOutput,
21+
OperationWithDefaultsInput,
22+
OperationWithDefaultsOutput,
23+
RecursiveShapesInputOutput,
24+
RecursiveShapesInputOutputNested1,
25+
RecursiveShapesInputOutputNested2,
26+
RpcV2CborDenseMapsInputOutput,
27+
RpcV2CborListInputOutput,
28+
RpcV2CborSparseMapsInputOutput,
29+
SimpleScalarStructure,
30+
SimpleStructure,
31+
SparseNullsOperationInputOutput,
32+
StructureListMember,
33+
ValidationExceptionField,
34+
} from "./models/models_0";
1035

1136
export { RpcV2ProtocolServiceException } from "./models/RpcV2ProtocolServiceException";
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// smithy-typescript generated code
2+
/**
3+
* @public
4+
* @enum
5+
*/
6+
export const TestEnum = {
7+
BAR: "BAR",
8+
BAZ: "BAZ",
9+
FOO: "FOO",
10+
} as const;
11+
/**
12+
* @public
13+
*/
14+
export type TestEnum = (typeof TestEnum)[keyof typeof TestEnum];
15+
16+
export enum TestIntEnum {
17+
ONE = 1,
18+
TWO = 2,
19+
}
20+
21+
/**
22+
* @public
23+
* @enum
24+
*/
25+
export const FooEnum = {
26+
BAR: "Bar",
27+
BAZ: "Baz",
28+
FOO: "Foo",
29+
ONE: "1",
30+
ZERO: "0",
31+
} as const;
32+
/**
33+
* @public
34+
*/
35+
export type FooEnum = (typeof FooEnum)[keyof typeof FooEnum];
36+
37+
export enum IntegerEnum {
38+
A = 1,
39+
B = 2,
40+
C = 3,
41+
}

0 commit comments

Comments
 (0)