Skip to content

Commit

Permalink
chore(codegen): use TypeScriptDependency in addImport calls (#5607)
Browse files Browse the repository at this point in the history
  • Loading branch information
trivikr authored Dec 20, 2023
1 parent e54099b commit f1fe6dc
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public Map<String, Consumer<TypeScriptWriter>> getRuntimeConfigWriters(
writer.addDependency(AwsDependency.MIDDLEWARE_ENDPOINT_DISCOVERY);
writer.addImport("NODE_ENDPOINT_DISCOVERY_CONFIG_OPTIONS",
"NODE_ENDPOINT_DISCOVERY_CONFIG_OPTIONS",
AwsDependency.MIDDLEWARE_ENDPOINT_DISCOVERY.packageName);
AwsDependency.MIDDLEWARE_ENDPOINT_DISCOVERY);
writer.write("loadNodeConfig(NODE_ENDPOINT_DISCOVERY_CONFIG_OPTIONS)");
}
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public Map<String, Consumer<TypeScriptWriter>> getRuntimeConfigWriters(TypeScrip
return MapUtils.of("signerConstructor", writer -> {
writer.addDependency(AwsDependency.SIGNATURE_V4_MULTIREGION)
.addImport("SignatureV4MultiRegion", "SignatureV4MultiRegion",
AwsDependency.SIGNATURE_V4_MULTIREGION.packageName)
AwsDependency.SIGNATURE_V4_MULTIREGION)
.write("SignatureV4MultiRegion");
});
default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,7 @@ public Map<String, Consumer<TypeScriptWriter>> getRuntimeConfigWriters(
},
"sha1", writer -> {
writer.addDependency(AwsDependency.AWS_CRYPTO_SHA1_BROWSER);
writer.addImport("Sha1",
"Sha1", AwsDependency.AWS_CRYPTO_SHA1_BROWSER.packageName);
writer.addImport("Sha1", "Sha1", AwsDependency.AWS_CRYPTO_SHA1_BROWSER);
writer.write("Sha1");
}
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,29 +146,29 @@ public Map<String, Consumer<TypeScriptWriter>> getRuntimeConfigWriters(
}, "signerConstructor", writer -> {
writer.addDependency(AwsDependency.SIGNATURE_V4_MULTIREGION)
.addImport("SignatureV4MultiRegion", "SignatureV4MultiRegion",
AwsDependency.SIGNATURE_V4_MULTIREGION.packageName)
AwsDependency.SIGNATURE_V4_MULTIREGION)
.write("SignatureV4MultiRegion");
});
case NODE:
return MapUtils.of(
"useArnRegion", writer -> {
writer.addDependency(TypeScriptDependency.NODE_CONFIG_PROVIDER)
.addImport("loadConfig", "loadNodeConfig",
TypeScriptDependency.NODE_CONFIG_PROVIDER.packageName)
TypeScriptDependency.NODE_CONFIG_PROVIDER)
.addDependency(AwsDependency.BUCKET_ENDPOINT_MIDDLEWARE)
.addImport("NODE_USE_ARN_REGION_CONFIG_OPTIONS", "NODE_USE_ARN_REGION_CONFIG_OPTIONS",
AwsDependency.BUCKET_ENDPOINT_MIDDLEWARE.packageName)
AwsDependency.BUCKET_ENDPOINT_MIDDLEWARE)
.write("loadNodeConfig(NODE_USE_ARN_REGION_CONFIG_OPTIONS)");
},
"disableS3ExpressSessionAuth", writer -> {
writer.addDependency(TypeScriptDependency.NODE_CONFIG_PROVIDER)
.addImport("loadConfig", "loadNodeConfig",
TypeScriptDependency.NODE_CONFIG_PROVIDER.packageName)
TypeScriptDependency.NODE_CONFIG_PROVIDER)
.addDependency(AwsDependency.S3_MIDDLEWARE)
.addImport(
"NODE_DISABLE_S3_EXPRESS_SESSION_AUTH_OPTIONS",
"NODE_DISABLE_S3_EXPRESS_SESSION_AUTH_OPTIONS",
AwsDependency.S3_MIDDLEWARE.packageName
AwsDependency.S3_MIDDLEWARE
)
.write("loadNodeConfig(NODE_DISABLE_S3_EXPRESS_SESSION_AUTH_OPTIONS)");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public Map<String, Consumer<TypeScriptWriter>> getRuntimeConfigWriters(
"eventStreamPayloadHandlerProvider", writer -> {
writer.addDependency(AwsDependency.TRANSCRIBE_STREAMING_MIDDLEWARE);
writer.addImport("eventStreamPayloadHandler", "eventStreamPayloadHandler",
AwsDependency.TRANSCRIBE_STREAMING_MIDDLEWARE.packageName);
AwsDependency.TRANSCRIBE_STREAMING_MIDDLEWARE);
writer.write("(() => eventStreamPayloadHandler)");
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public Map<String, Consumer<TypeScriptWriter>> getRuntimeConfigWriters(
"defaultUserAgentProvider", writer -> {
writer.addDependency(AwsDependency.AWS_SDK_UTIL_USER_AGENT_NODE.dependency);
writer.addImport("defaultUserAgent", "defaultUserAgent",
AwsDependency.AWS_SDK_UTIL_USER_AGENT_NODE.packageName);
AwsDependency.AWS_SDK_UTIL_USER_AGENT_NODE);
writer.addIgnoredDefaultImport("packageInfo", "./package.json",
"package.json will be imported from dist folders");
writeDefaultUserAgentProvider(writer, settings, model);
Expand All @@ -83,7 +83,7 @@ public Map<String, Consumer<TypeScriptWriter>> getRuntimeConfigWriters(
"defaultUserAgentProvider", writer -> {
writer.addDependency(AwsDependency.AWS_SDK_UTIL_USER_AGENT_BROWSER.dependency);
writer.addImport("defaultUserAgent", "defaultUserAgent",
AwsDependency.AWS_SDK_UTIL_USER_AGENT_BROWSER.packageName);
AwsDependency.AWS_SDK_UTIL_USER_AGENT_BROWSER);
writer.addIgnoredDefaultImport("packageInfo", "./package.json",
"package.json will be imported from dist folders");
writeDefaultUserAgentProvider(writer, settings, model);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,15 @@ public Map<String, Consumer<TypeScriptWriter>> getRuntimeConfigWriters(
"eventStreamPayloadHandlerProvider", writer -> {
writer.addDependency(AwsDependency.MIDDLEWARE_WEBSOCKET);
writer.addImport("eventStreamPayloadHandlerProvider", "eventStreamPayloadHandlerProvider",
AwsDependency.MIDDLEWARE_WEBSOCKET.packageName);
AwsDependency.MIDDLEWARE_WEBSOCKET);
writer.write("eventStreamPayloadHandlerProvider");
},
"requestHandler", writer -> {
writer.addImport("FetchHttpHandler", "HttpRequestHandler",
TypeScriptDependency.AWS_SDK_FETCH_HTTP_HANDLER.packageName);
TypeScriptDependency.AWS_SDK_FETCH_HTTP_HANDLER);
writer.addDependency(TypeScriptDependency.AWS_SDK_FETCH_HTTP_HANDLER);
writer.addImport("WebSocketFetchHandler", "WebSocketRequestHandler",
AwsDependency.MIDDLEWARE_WEBSOCKET.packageName);
AwsDependency.MIDDLEWARE_WEBSOCKET);
writer.addDependency(AwsDependency.MIDDLEWARE_WEBSOCKET);
writer.write("new WebSocketRequestHandler(defaultConfigProvider, "
+ "new HttpRequestHandler(defaultConfigProvider))");
Expand Down

0 comments on commit f1fe6dc

Please sign in to comment.