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