Skip to content

Commit a1893e6

Browse files
AllanZhengYPsrchase
authored andcommitted
move types from smithy-client package to types package (smithy-lang#373)
* move types from smithy-client package to types package * smithy exception import from types package * revert change in ssdk lib and ping dependencies
1 parent 403bdc4 commit a1893e6

File tree

9 files changed

+25
-11
lines changed

9 files changed

+25
-11
lines changed

smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/HttpProtocolTestGenerator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@ private void writeServerResponseTest(OperationShape operation, HttpResponseTestC
610610
writer.write("const request = new HttpRequest({method: 'POST', hostname: 'example.com'});");
611611

612612
// Create a new serializer factory that always returns our test serializer.
613-
writer.addImport("SmithyException", "__SmithyException", "@aws-sdk/smithy-client");
613+
writer.addImport("SmithyException", "__SmithyException", "@aws-sdk/types");
614614
writer.addImport("OperationSerializer", "__OperationSerializer", "@aws-smithy/server-common");
615615
writer.openBlock("const serFn: (op: $1T) => __OperationSerializer<$2T<{}>, $1T, __SmithyException> = (op) =>"
616616
+ " { return new TestSerializer(); };", serviceOperationsSymbol, serviceSymbol);

smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/ServerGenerator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ private static void addCommonHandlerImports(TypeScriptWriter writer) {
209209
writer.addImport("SmithyFrameworkException", "__SmithyFrameworkException", "@aws-smithy/server-common");
210210
writer.addImport("HttpRequest", "__HttpRequest", "@aws-sdk/protocol-http");
211211
writer.addImport("HttpResponse", "__HttpResponse", "@aws-sdk/protocol-http");
212-
writer.addImport("SmithyException", "__SmithyException", "@aws-sdk/smithy-client");
212+
writer.addImport("SmithyException", "__SmithyException", "@aws-sdk/types");
213213
writer.addImport("ValidationCustomizer", "__ValidationCustomizer", "@aws-smithy/server-common");
214214
}
215215

smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/StructureGenerator.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ private void renderNonErrorStructure() {
161161
* <pre>{@code
162162
* import {
163163
* SmithyException as __SmithyException
164-
* } from "@aws-sdk/smithy-client";
164+
* } from "@aws-sdk/types";
165165
*
166166
* export interface NoSuchResource extends __SmithyException, $MetadataBearer {
167167
* name: "NoSuchResource";
@@ -180,7 +180,7 @@ private void renderErrorStructure() {
180180
writer.writeShapeDocs(shape);
181181

182182
// Find symbol references with the "extends" property, and add SmithyException.
183-
writer.addImport("SmithyException", "__SmithyException", "@aws-sdk/smithy-client");
183+
writer.addImport("SmithyException", "__SmithyException", "@aws-sdk/types");
184184
String extendsFrom = Stream.concat(
185185
Stream.of("__SmithyException"),
186186
symbol.getReferences().stream()

smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/SymbolVisitor.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,8 +241,17 @@ private Symbol createBigJsSymbol(Shape shape) {
241241

242242
@Override
243243
public Symbol documentShape(DocumentShape shape) {
244-
Symbol.Builder builder = createSymbolBuilder(shape, "__DocumentType.Value");
245-
return addSmithyUseImport(builder, "DocumentType", "__DocumentType").build();
244+
Symbol.Builder builder = createSymbolBuilder(shape, "__DocumentType");
245+
Symbol importSymbol = Symbol.builder()
246+
.name("DocumentType")
247+
.namespace(TypeScriptDependency.AWS_SDK_TYPES.packageName, "/")
248+
.build();
249+
SymbolReference reference = SymbolReference.builder()
250+
.symbol(importSymbol)
251+
.alias("__DocumentType")
252+
.options(SymbolReference.ContextOption.USE)
253+
.build();
254+
return builder.addReference(reference).build();
246255
}
247256

248257
@Override

smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/integration/HttpBindingProtocolGenerator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ public void generateServiceHandlerFactory(GenerationContext context) {
358358
writer.indent();
359359

360360
generateServiceMux(context);
361-
writer.addImport("SmithyException", "__SmithyException", "@aws-sdk/smithy-client");
361+
writer.addImport("SmithyException", "__SmithyException", "@aws-sdk/types");
362362
writer.openBlock("const serFn: (op: $1T) => __OperationSerializer<$2T<Context>, $1T, __SmithyException> = "
363363
+ "(op) => {", "};", operationsSymbol, serviceSymbol, () -> {
364364
writer.openBlock("switch (op) {", "}", () -> {

smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/integration/HttpProtocolGeneratorUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ static Set<StructureShape> generateErrorDispatcher(
334334

335335
// Error responses must be at least SmithyException and MetadataBearer implementations.
336336
writer.addImport("SmithyException", "__SmithyException",
337-
TypeScriptDependency.AWS_SMITHY_CLIENT.packageName);
337+
TypeScriptDependency.AWS_SDK_TYPES.packageName);
338338
writer.addImport("MetadataBearer", "__MetadataBearer",
339339
TypeScriptDependency.AWS_SDK_TYPES.packageName);
340340
// These responses will also have additional properties, so enable that on the interface.

smithy-typescript-ssdk-libs/server-apigateway/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"license": "Apache-2.0",
2121
"dependencies": {
2222
"@aws-sdk/protocol-http": "^3.5.0",
23-
"@aws-sdk/types": "^3.4.1",
23+
"@aws-sdk/types": "3.20.0",
2424
"@types/aws-lambda": "^8.10.72",
2525
"tslib": "^1.8.0"
2626
},

smithy-typescript-ssdk-libs/server-common/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"dependencies": {
2222
"@aws-sdk/protocol-http": "^3.5.0",
2323
"@aws-sdk/smithy-client": "3.6.1",
24-
"@aws-sdk/types": "^3.4.1",
24+
"@aws-sdk/types": "3.20.0",
2525
"tslib": "^1.8.0"
2626
},
2727
"devDependencies": {

smithy-typescript-ssdk-libs/yarn.lock

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,16 @@
2626
"@aws-sdk/types" "3.6.1"
2727
tslib "^1.8.0"
2828

29-
"@aws-sdk/[email protected]", "@aws-sdk/types@^3.4.1":
29+
"@aws-sdk/[email protected]":
3030
version "3.13.1"
3131
resolved "https://registry.yarnpkg.com/@aws-sdk/types/-/types-3.13.1.tgz#f69efe2053b0fa5dfd4046cb80dc176ad645c016"
3232
integrity sha512-4eHboRz3I8f0C85Ta1dJ1v1Y9T1zH9xpC4/DufSIfQcD1Imc2U2LM22Qgbz8/PoP4kyhp2nJpQpW0APD91ILfw==
3333

34+
"@aws-sdk/[email protected]":
35+
version "3.20.0"
36+
resolved "https://registry.yarnpkg.com/@aws-sdk/types/-/types-3.20.0.tgz#f14a13970ffc9096ec28fb60c5b40b5ddaaecea9"
37+
integrity sha512-ztrHBTJM0wU4rrt51Kff8DjGT5ReoEdY1IUu6T0lN7aH9113235WnBE44y+z/Y+nMC+t5+r74CkldkLf/vngNg==
38+
3439
"@aws-sdk/[email protected]":
3540
version "3.6.1"
3641
resolved "https://registry.yarnpkg.com/@aws-sdk/types/-/types-3.6.1.tgz#00686db69e998b521fcd4a5f81ef0960980f80c4"

0 commit comments

Comments
 (0)