Skip to content

Commit 6161a04

Browse files
authored
feat(codegen): generate well-formatted TypeScript (#1780)
1 parent 990a9e4 commit 6161a04

File tree

63 files changed

+2908
-2280
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+2908
-2280
lines changed

.changeset/famous-planes-vanish.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
---

Makefile

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@ generate-protocol-tests:
1818
cp -r ./smithy-typescript-protocol-test-codegen/build/smithyprojections/smithy-typescript-protocol-test-codegen/my-local-model/typescript-client-codegen/ ./private/my-local-model
1919
cp -r ./smithy-typescript-protocol-test-codegen/build/smithyprojections/smithy-typescript-protocol-test-codegen/my-local-model-schema/typescript-client-codegen/ ./private/my-local-model-schema
2020
node ./scripts/post-protocol-test-codegen
21-
npx prettier --write ./private/smithy-rpcv2-cbor
22-
npx prettier --write ./private/smithy-rpcv2-cbor-schema
23-
npx prettier --write ./private/my-local-model
24-
npx prettier --write ./private/my-local-model-schema
2521
yarn
2622
yarn turbo run build -F="./private/*" --only
2723

private/my-local-model-schema/src/XYZService.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,14 @@ export interface XYZService {
2424
* @see {@link GetNumbersCommand}
2525
*/
2626
getNumbers(): Promise<GetNumbersCommandOutput>;
27-
getNumbers(args: GetNumbersCommandInput, options?: __HttpHandlerOptions): Promise<GetNumbersCommandOutput>;
28-
getNumbers(args: GetNumbersCommandInput, cb: (err: any, data?: GetNumbersCommandOutput) => void): void;
27+
getNumbers(
28+
args: GetNumbersCommandInput,
29+
options?: __HttpHandlerOptions
30+
): Promise<GetNumbersCommandOutput>;
31+
getNumbers(
32+
args: GetNumbersCommandInput,
33+
cb: (err: any, data?: GetNumbersCommandOutput) => void
34+
): void;
2935
getNumbers(
3036
args: GetNumbersCommandInput,
3137
options: __HttpHandlerOptions,

private/my-local-model-schema/src/XYZServiceClient.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,16 @@ export { __Client };
7272
/**
7373
* @public
7474
*/
75-
export type ServiceInputTypes = GetNumbersCommandInput | TradeEventStreamCommandInput;
75+
export type ServiceInputTypes =
76+
| GetNumbersCommandInput
77+
| TradeEventStreamCommandInput;
7678

7779
/**
7880
* @public
7981
*/
80-
export type ServiceOutputTypes = GetNumbersCommandOutput | TradeEventStreamCommandOutput;
82+
export type ServiceOutputTypes =
83+
| GetNumbersCommandOutput
84+
| TradeEventStreamCommandOutput;
8185

8286
/**
8387
* @public

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ export interface GetNumbersResponse {
4343
/**
4444
* @public
4545
*/
46-
export interface Unit {}
46+
export interface Unit {
47+
}
4748

4849
/**
4950
* @public

private/my-local-model-schema/src/schemas/schemas_0.ts

Lines changed: 52 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -39,104 +39,77 @@ import {
3939
RetryableError as __RetryableError,
4040
XYZServiceServiceException as __XYZServiceServiceException,
4141
} from "../models/errors";
42-
import { XYZServiceSyntheticServiceException as __XYZServiceSyntheticServiceException } from "../models/XYZServiceSyntheticServiceException";
42+
import {
43+
XYZServiceSyntheticServiceException as __XYZServiceSyntheticServiceException,
44+
} from "../models/XYZServiceSyntheticServiceException";
4345

4446
/* eslint no-var: 0 */
45-
46-
export var Alpha: StaticStructureSchema = [3, n0, _A, 0, [_i, _t], [0, 4]];
47-
export var CodedThrottlingError: StaticErrorSchema = [
48-
-3,
49-
n0,
50-
_CTE,
51-
{
52-
[_e]: _c,
53-
[_hE]: 429,
54-
},
55-
[],
47+
export var Alpha: StaticStructureSchema = [3, n0, _A,
48+
0,
49+
[_i, _t],
50+
[0, 4]
51+
];
52+
export var CodedThrottlingError: StaticErrorSchema = [-3, n0, _CTE,
53+
{ [_e]: _c, [_hE]: 429 },
5654
[],
55+
[]
5756
];
5857
TypeRegistry.for(n0).registerError(CodedThrottlingError, __CodedThrottlingError);
59-
60-
export var GetNumbersRequest: StaticStructureSchema = [3, n0, _GNR, 0, [_bD, _bI, _fWM, _fWMi], [17, 19, 0, 0]];
61-
export var GetNumbersResponse: StaticStructureSchema = [3, n0, _GNRe, 0, [_bD, _bI], [17, 19]];
62-
export var HaltError: StaticErrorSchema = [
63-
-3,
64-
n0,
65-
_HE,
66-
{
67-
[_e]: _c,
68-
},
69-
[],
58+
export var GetNumbersRequest: StaticStructureSchema = [3, n0, _GNR,
59+
0,
60+
[_bD, _bI, _fWM, _fWMi],
61+
[17, 19, 0, 0]
62+
];
63+
export var GetNumbersResponse: StaticStructureSchema = [3, n0, _GNRe,
64+
0,
65+
[_bD, _bI],
66+
[17, 19]
67+
];
68+
export var HaltError: StaticErrorSchema = [-3, n0, _HE,
69+
{ [_e]: _c },
7070
[],
71+
[]
7172
];
7273
TypeRegistry.for(n0).registerError(HaltError, __HaltError);
73-
74-
export var MysteryThrottlingError: StaticErrorSchema = [
75-
-3,
76-
n0,
77-
_MTE,
78-
{
79-
[_e]: _c,
80-
},
81-
[],
74+
export var MysteryThrottlingError: StaticErrorSchema = [-3, n0, _MTE,
75+
{ [_e]: _c },
8276
[],
77+
[]
8378
];
8479
TypeRegistry.for(n0).registerError(MysteryThrottlingError, __MysteryThrottlingError);
85-
86-
export var RetryableError: StaticErrorSchema = [
87-
-3,
88-
n0,
89-
_RE,
90-
{
91-
[_e]: _c,
92-
},
93-
[],
80+
export var RetryableError: StaticErrorSchema = [-3, n0, _RE,
81+
{ [_e]: _c },
9482
[],
83+
[]
9584
];
9685
TypeRegistry.for(n0).registerError(RetryableError, __RetryableError);
97-
98-
export var TradeEventStreamRequest: StaticStructureSchema = [3, n0, _TESR, 0, [_eS], [[() => TradeEvents, 0]]];
99-
export var TradeEventStreamResponse: StaticStructureSchema = [3, n0, _TESRr, 0, [_eS], [[() => TradeEvents, 0]]];
100-
export var XYZServiceServiceException: StaticErrorSchema = [
101-
-3,
102-
n0,
103-
_XYZSSE,
104-
{
105-
[_e]: _c,
106-
},
107-
[],
108-
[],
86+
export var TradeEventStreamRequest: StaticStructureSchema = [3, n0, _TESR,
87+
0,
88+
[_eS],
89+
[[() => TradeEvents, 0]]
10990
];
110-
TypeRegistry.for(n0).registerError(XYZServiceServiceException, __XYZServiceServiceException);
111-
112-
export var __Unit = "unit" as const;
113-
114-
export var XYZServiceSyntheticServiceException: StaticErrorSchema = [
115-
-3,
116-
_s,
117-
"XYZServiceSyntheticServiceException",
91+
export var TradeEventStreamResponse: StaticStructureSchema = [3, n0, _TESRr,
11892
0,
93+
[_eS],
94+
[[() => TradeEvents, 0]]
95+
];
96+
export var XYZServiceServiceException: StaticErrorSchema = [-3, n0, _XYZSSE,
97+
{ [_e]: _c },
11998
[],
120-
[],
99+
[]
121100
];
101+
TypeRegistry.for(n0).registerError(XYZServiceServiceException, __XYZServiceServiceException);
102+
export var __Unit = "unit" as const;
103+
export var XYZServiceSyntheticServiceException: StaticErrorSchema = [-3, _s, "XYZServiceSyntheticServiceException", 0, [], []];
122104
TypeRegistry.for(_s).registerError(XYZServiceSyntheticServiceException, __XYZServiceSyntheticServiceException);
123-
124-
export var TradeEvents: StaticStructureSchema = [
125-
3,
126-
n0,
127-
_TE,
128-
{
129-
[_st]: 1,
130-
},
105+
export var TradeEvents: StaticStructureSchema = [3, n0, _TE,
106+
{ [_st]: 1 },
131107
[_a, _b, _g],
132-
[() => Alpha, () => __Unit, () => __Unit],
108+
[() => Alpha, () => __Unit, () => __Unit]
133109
];
134-
export var GetNumbers: StaticOperationSchema = [9, n0, _GN, 0, () => GetNumbersRequest, () => GetNumbersResponse];
135-
export var TradeEventStream: StaticOperationSchema = [
136-
9,
137-
n0,
138-
_TES,
139-
0,
140-
() => TradeEventStreamRequest,
141-
() => TradeEventStreamResponse,
110+
export var GetNumbers: StaticOperationSchema = [9, n0, _GN,
111+
0, () => GetNumbersRequest, () => GetNumbersResponse
112+
];
113+
export var TradeEventStream: StaticOperationSchema = [9, n0, _TES,
114+
0, () => TradeEventStreamRequest, () => TradeEventStreamResponse
142115
];

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,14 @@ export interface XYZService {
2020
* @see {@link GetNumbersCommand}
2121
*/
2222
getNumbers(): Promise<GetNumbersCommandOutput>;
23-
getNumbers(args: GetNumbersCommandInput, options?: __HttpHandlerOptions): Promise<GetNumbersCommandOutput>;
24-
getNumbers(args: GetNumbersCommandInput, cb: (err: any, data?: GetNumbersCommandOutput) => void): void;
23+
getNumbers(
24+
args: GetNumbersCommandInput,
25+
options?: __HttpHandlerOptions
26+
): Promise<GetNumbersCommandOutput>;
27+
getNumbers(
28+
args: GetNumbersCommandInput,
29+
cb: (err: any, data?: GetNumbersCommandOutput) => void
30+
): void;
2531
getNumbers(
2632
args: GetNumbersCommandInput,
2733
options: __HttpHandlerOptions,

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,16 @@ export { __Client };
6868
/**
6969
* @public
7070
*/
71-
export type ServiceInputTypes = GetNumbersCommandInput | TradeEventStreamCommandInput;
71+
export type ServiceInputTypes =
72+
| GetNumbersCommandInput
73+
| TradeEventStreamCommandInput;
7274

7375
/**
7476
* @public
7577
*/
76-
export type ServiceOutputTypes = GetNumbersCommandOutput | TradeEventStreamCommandOutput;
78+
export type ServiceOutputTypes =
79+
| GetNumbersCommandOutput
80+
| TradeEventStreamCommandOutput;
7781

7882
/**
7983
* @public

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

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ export interface GetNumbersResponse {
4343
/**
4444
* @public
4545
*/
46-
export interface Unit {}
46+
export interface Unit {
47+
}
4748

4849
/**
4950
* @public
@@ -107,11 +108,23 @@ export namespace TradeEvents {
107108
* @internal
108109
*/
109110
export const TradeEventsFilterSensitiveLog = (obj: TradeEvents): any => {
110-
if (obj.alpha !== undefined) return { alpha: obj.alpha };
111-
if (obj.beta !== undefined) return { beta: obj.beta };
112-
if (obj.gamma !== undefined) return { gamma: obj.gamma };
111+
if (obj.alpha !== undefined) {
112+
return {
113+
alpha: obj.alpha
114+
};
115+
}
116+
if (obj.beta !== undefined) {
117+
return {
118+
beta: obj.beta
119+
};
120+
}
121+
if (obj.gamma !== undefined) {
122+
return {
123+
gamma: obj.gamma
124+
};
125+
}
113126
if (obj.$unknown !== undefined) return { [obj.$unknown[0]]: "UNKNOWN" };
114-
};
127+
}
115128

116129
/**
117130
* @public
@@ -125,8 +138,10 @@ export interface TradeEventStreamRequest {
125138
*/
126139
export const TradeEventStreamRequestFilterSensitiveLog = (obj: TradeEventStreamRequest): any => ({
127140
...obj,
128-
...(obj.eventStream && { eventStream: "STREAMING_CONTENT" }),
129-
});
141+
...(obj.eventStream && { eventStream:
142+
'STREAMING_CONTENT'
143+
}),
144+
})
130145

131146
/**
132147
* @public
@@ -140,5 +155,7 @@ export interface TradeEventStreamResponse {
140155
*/
141156
export const TradeEventStreamResponseFilterSensitiveLog = (obj: TradeEventStreamResponse): any => ({
142157
...obj,
143-
...(obj.eventStream && { eventStream: "STREAMING_CONTENT" }),
144-
});
158+
...(obj.eventStream && { eventStream:
159+
'STREAMING_CONTENT'
160+
}),
161+
})

0 commit comments

Comments
 (0)