Skip to content

Commit

Permalink
feat(experimentalIdentityAndAuth): add event streaming input integrat…
Browse files Browse the repository at this point in the history
…ions relative to auth (#5578)

* feat(experimentalIdentityAndAuth): remove `AddEventStreamHandlingDependency` experimental branch

* feat(experimentalIdentityAndAuth): add order for `AddWebsocketPlugin`
  • Loading branch information
Steven Yuan authored Dec 13, 2023
1 parent 7759481 commit a12b2eb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import software.amazon.smithy.typescript.codegen.TypeScriptDependency;
import software.amazon.smithy.typescript.codegen.TypeScriptSettings;
import software.amazon.smithy.typescript.codegen.TypeScriptWriter;
import software.amazon.smithy.typescript.codegen.auth.http.integration.AddHttpAuthSchemePlugin;
import software.amazon.smithy.typescript.codegen.integration.RuntimeClientPlugin;
import software.amazon.smithy.typescript.codegen.integration.TypeScriptIntegration;
import software.amazon.smithy.utils.ListUtils;
Expand All @@ -45,20 +46,24 @@
*/
@SmithyInternalApi
public class AddEventStreamHandlingDependency implements TypeScriptIntegration {

@Override
public List<String> runAfter() {
return List.of(AddHttpAuthSchemePlugin.class.getCanonicalName());
}

@Override
public List<RuntimeClientPlugin> getClientPlugins() {
return ListUtils.of(
RuntimeClientPlugin.builder()
.withConventions(AwsDependency.MIDDLEWARE_EVENTSTREAM.dependency,
"EventStream", HAS_CONFIG)
.servicePredicate(AddEventStreamHandlingDependency::hasEventStreamInput)
.settingsPredicate((m, s, settings) -> !settings.getExperimentalIdentityAndAuth())
.build(),
RuntimeClientPlugin.builder()
.withConventions(AwsDependency.MIDDLEWARE_EVENTSTREAM.dependency,
"EventStream", HAS_MIDDLEWARE)
.operationPredicate(AddEventStreamHandlingDependency::hasEventStreamInput)
.settingsPredicate((m, s, settings) -> !settings.getExperimentalIdentityAndAuth())
.build()
);
}
Expand All @@ -70,10 +75,6 @@ public void addConfigInterfaceFields(
SymbolProvider symbolProvider,
TypeScriptWriter writer
) {
if (settings.getExperimentalIdentityAndAuth()) {
return;
}
// feat(experimentalIdentityAndAuth): control branch for event stream handler interface fields
if (hasEventStreamInput(model, settings.getService(model))) {
writer.addImport("EventStreamPayloadHandlerProvider", "__EventStreamPayloadHandlerProvider",
TypeScriptDependency.AWS_SDK_TYPES);
Expand All @@ -94,11 +95,6 @@ public Map<String, Consumer<TypeScriptWriter>> getRuntimeConfigWriters(
if (!hasEventStreamInput(model, service)) {
return Collections.emptyMap();
}

if (settings.getExperimentalIdentityAndAuth()) {
return Collections.emptyMap();
}
// feat(experimentalIdentityAndAuth): control branch for event stream handler runtime config
switch (target) {
case NODE:
return MapUtils.of("eventStreamPayloadHandlerProvider", writer -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import software.amazon.smithy.typescript.codegen.TypeScriptDependency;
import software.amazon.smithy.typescript.codegen.TypeScriptSettings;
import software.amazon.smithy.typescript.codegen.TypeScriptWriter;
import software.amazon.smithy.typescript.codegen.auth.http.integration.AddHttpAuthSchemePlugin;
import software.amazon.smithy.typescript.codegen.integration.RuntimeClientPlugin;
import software.amazon.smithy.typescript.codegen.integration.TypeScriptIntegration;
import software.amazon.smithy.utils.ListUtils;
Expand All @@ -44,6 +45,12 @@
**/
@SmithyInternalApi
public class AddWebsocketPlugin implements TypeScriptIntegration {

@Override
public List<String> runAfter() {
return List.of(AddHttpAuthSchemePlugin.class.getCanonicalName());
}

@Override
public List<RuntimeClientPlugin> getClientPlugins() {
return ListUtils.of(
Expand Down

0 comments on commit a12b2eb

Please sign in to comment.