Skip to content

Commit cffb837

Browse files
committed
add eventstream-serde-browser dependency
1 parent d8342c3 commit cffb837

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,15 @@ public enum TypeScriptDependency implements SymbolDependencyContainer {
6767
AWS_SDK_FETCH_HTTP_HANDLER("dependencies", "@aws-sdk/fetch-http-handler", "^1.0.0-alpha.1", false),
6868
AWS_SDK_NODE_HTTP_HANDLER("dependencies", "@aws-sdk/node-http-handler", "^1.0.0-alpha.1", false),
6969

70-
// Conditionally added if a big decimal shape is found in a model.
71-
BIG_JS("dependencies", "big.js", "^5.2.2", false),
72-
TYPES_BIG_JS("devDependencies", "@types/big.js", "^4.0.5", false),
73-
7470
// Conditionally added if a event stream shape is found anywhere in the model
7571
AWS_SDK_EVENTSTREAM_SERDE_CONFIG_RESOLVER("dependencies", "@aws-sdk/eventstream-serde-config-resolver",
7672
"^1.0.0-alpha.0", false),
77-
AWS_SDK_EVENTSTREAM_SERDE_NODE("dependencies", "@aws-sdk/eventstream-serde-node", "^1.0.0-alpha.0", false);
73+
AWS_SDK_EVENTSTREAM_SERDE_NODE("dependencies", "@aws-sdk/eventstream-serde-node", "^1.0.0-alpha.0", false),
74+
AWS_SDK_EVENTSTREAM_SERDE_BROWSER("dependencies", "@aws-sdk/eventstream-serde-browser", "^1.0.0-alpha.0", false),
75+
76+
// Conditionally added if a big decimal shape is found in a model.
77+
BIG_JS("dependencies", "big.js", "^5.2.2", false),
78+
TYPES_BIG_JS("devDependencies", "@types/big.js", "^4.0.5", false);
7879

7980
public static final String NORMAL_DEPENDENCY = "dependencies";
8081
public static final String DEV_DEPENDENCY = "devDependencies";

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

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public List<RuntimeClientPlugin> getClientPlugins() {
4242
RuntimeClientPlugin.builder()
4343
.withConventions(
4444
TypeScriptDependency.AWS_SDK_EVENTSTREAM_SERDE_CONFIG_RESOLVER.dependency,
45-
"EventStream",
45+
"EventStreamSerde",
4646
RuntimeClientPlugin.Convention.HAS_CONFIG
4747
)
4848
.servicePredicate(EventStreamGenerator::hasEventStream)
@@ -92,14 +92,13 @@ public void addRuntimeConfigValues(
9292
writer.write("eventStreamSerdeProvider");
9393
break;
9494
case BROWSER:
95+
writer.addDependency(TypeScriptDependency.AWS_SDK_EVENTSTREAM_SERDE_BROWSER);
9596
writer.addImport(
96-
"invalidFunction",
97-
"invalidFunction",
98-
TypeScriptDependency.INVALID_DEPENDENCY.packageName
97+
"eventStreamSerdeProvider",
98+
"eventStreamSerdeProvider",
99+
TypeScriptDependency.AWS_SDK_EVENTSTREAM_SERDE_BROWSER.packageName
99100
);
100-
writer.openBlock("eventStreamSerdeProvider: invalidFunction(", ")", () -> {
101-
writer.write("\"event stream serde for browser is not available\"");
102-
});
101+
writer.write("eventStreamSerdeProvider");
103102
break;
104103
default:
105104
// do nothing
@@ -155,6 +154,9 @@ public static final boolean operationHasEventStreamOutput(
155154

156155
/**
157156
* The value of event header 'type' property of given shape.
157+
*
158+
* @param shape shape bond to event header
159+
* @return string literal for the event message header type
158160
*/
159161
public static String getEventHeaderType(Shape shape) {
160162
switch (shape.getType()) {

0 commit comments

Comments
 (0)