|
18 | 18 | import static software.amazon.smithy.typescript.codegen.integration.RuntimeClientPlugin.Convention.HAS_CONFIG;
|
19 | 19 | import static software.amazon.smithy.typescript.codegen.integration.RuntimeClientPlugin.Convention.HAS_MIDDLEWARE;
|
20 | 20 |
|
| 21 | +import java.util.Collections; |
21 | 22 | import java.util.List;
|
| 23 | +import java.util.Map; |
22 | 24 | import java.util.Optional;
|
| 25 | +import java.util.function.Consumer; |
| 26 | + |
23 | 27 | import software.amazon.smithy.aws.traits.ServiceTrait;
|
| 28 | +import software.amazon.smithy.codegen.core.SymbolProvider; |
24 | 29 | import software.amazon.smithy.model.Model;
|
25 | 30 | import software.amazon.smithy.model.shapes.MemberShape;
|
26 | 31 | import software.amazon.smithy.model.shapes.OperationShape;
|
27 | 32 | import software.amazon.smithy.model.shapes.ServiceShape;
|
28 | 33 | import software.amazon.smithy.model.shapes.Shape;
|
29 | 34 | import software.amazon.smithy.model.traits.RequiredTrait;
|
30 | 35 | import software.amazon.smithy.model.transform.ModelTransformer;
|
| 36 | +import software.amazon.smithy.typescript.codegen.LanguageTarget; |
31 | 37 | import software.amazon.smithy.typescript.codegen.TypeScriptSettings;
|
| 38 | +import software.amazon.smithy.typescript.codegen.TypeScriptWriter; |
32 | 39 | import software.amazon.smithy.typescript.codegen.integration.RuntimeClientPlugin;
|
33 | 40 | import software.amazon.smithy.typescript.codegen.integration.TypeScriptIntegration;
|
34 | 41 | import software.amazon.smithy.utils.ListUtils;
|
| 42 | +import software.amazon.smithy.utils.MapUtils; |
35 | 43 | import software.amazon.smithy.utils.SmithyInternalApi;
|
36 | 44 |
|
37 | 45 | /**
|
@@ -81,6 +89,25 @@ public Model preprocessModel(Model model, TypeScriptSettings settings) {
|
81 | 89 | });
|
82 | 90 | }
|
83 | 91 |
|
| 92 | + @Override |
| 93 | + public Map<String, Consumer<TypeScriptWriter>> getRuntimeConfigWriters( |
| 94 | + TypeScriptSettings settings, Model model, |
| 95 | + SymbolProvider symbolProvider, LanguageTarget target |
| 96 | + ) { |
| 97 | + if (!isS3Control(settings.getService(model))) { |
| 98 | + return Collections.emptyMap(); |
| 99 | + } |
| 100 | + switch (target) { |
| 101 | + case SHARED: |
| 102 | + return MapUtils.of("signingEscapePath", writer -> { |
| 103 | + writer.write("false"); |
| 104 | + }); |
| 105 | + case NODE: |
| 106 | + default: |
| 107 | + return Collections.emptyMap(); |
| 108 | + } |
| 109 | + } |
| 110 | + |
84 | 111 | private static boolean isS3Control(ServiceShape service) {
|
85 | 112 | String serviceId = service.getTrait(ServiceTrait.class).map(ServiceTrait::getSdkId).orElse("");
|
86 | 113 | return serviceId.equals("S3 Control");
|
|
0 commit comments