Skip to content

Commit f2a78d5

Browse files
committed
Add codegen for http component in runtime extension
1 parent d3daa89 commit f2a78d5

File tree

6 files changed

+62
-53
lines changed

6 files changed

+62
-53
lines changed

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

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -40,25 +40,25 @@ public enum TypeScriptDependency implements Dependency {
4040

4141
AWS_SDK_CLIENT_DOCGEN("devDependencies", "@smithy/service-client-documentation-generator", "^2.0.0", true),
4242
AWS_SDK_TYPES("dependencies", "@aws-sdk/types", true),
43-
SMITHY_TYPES("dependencies", "@smithy/types", "^2.2.2", true),
44-
AWS_SMITHY_CLIENT("dependencies", "@smithy/smithy-client", "^2.0.5", true),
45-
INVALID_DEPENDENCY("dependencies", "@smithy/invalid-dependency", "^2.0.5", true),
46-
CONFIG_RESOLVER("dependencies", "@smithy/config-resolver", "^2.0.5", true),
43+
SMITHY_TYPES("dependencies", "@smithy/types", "^2.3.0", true),
44+
AWS_SMITHY_CLIENT("dependencies", "@smithy/smithy-client", "^2.1.1", true),
45+
INVALID_DEPENDENCY("dependencies", "@smithy/invalid-dependency", "^2.0.6", true),
46+
CONFIG_RESOLVER("dependencies", "@smithy/config-resolver", "^2.0.6", true),
4747
TYPES_NODE("devDependencies", "@types/node", "^14.14.31", true),
4848

49-
MIDDLEWARE_CONTENT_LENGTH("dependencies", "@smithy/middleware-content-length", "^2.0.5", true),
50-
MIDDLEWARE_SERDE("dependencies", "@smithy/middleware-serde", "^2.0.5", true),
51-
MIDDLEWARE_RETRY("dependencies", "@smithy/middleware-retry", "^2.0.5", true),
49+
MIDDLEWARE_CONTENT_LENGTH("dependencies", "@smithy/middleware-content-length", "^2.0.7", true),
50+
MIDDLEWARE_SERDE("dependencies", "@smithy/middleware-serde", "^2.0.6", true),
51+
MIDDLEWARE_RETRY("dependencies", "@smithy/middleware-retry", "^2.0.7", true),
5252
UTIL_RETRY("dependencies", "@smithy/util-retry", "^2.0.0", false),
5353
MIDDLEWARE_STACK("dependencies", "@smithy/middleware-stack", "^2.0.0", true),
54-
MIDDLEWARE_ENDPOINTS_V2("dependencies", "@smithy/middleware-endpoint", "^2.0.5", false),
54+
MIDDLEWARE_ENDPOINTS_V2("dependencies", "@smithy/middleware-endpoint", "^2.0.6", false),
5555
AWS_SDK_UTIL_ENDPOINTS("dependencies", "@aws-sdk/util-endpoints", false),
5656

5757
AWS_CRYPTO_SHA256_BROWSER("dependencies", "@aws-crypto/sha256-browser", "3.0.0", true),
5858
AWS_CRYPTO_SHA256_JS("dependencies", "@aws-crypto/sha256-js", "3.0.0", true),
59-
AWS_SDK_HASH_NODE("dependencies", "@smithy/hash-node", "^2.0.5", true),
59+
AWS_SDK_HASH_NODE("dependencies", "@smithy/hash-node", "^2.0.6", true),
6060

61-
AWS_SDK_URL_PARSER("dependencies", "@smithy/url-parser", "^2.0.5", true),
61+
AWS_SDK_URL_PARSER("dependencies", "@smithy/url-parser", "^2.0.6", true),
6262

6363
@Deprecated AWS_SDK_UTIL_BASE64_BROWSER("dependencies", "@smithy/util-base64-browser", "^1.0.1", false),
6464
@Deprecated AWS_SDK_UTIL_BASE64_NODE("dependencies", "@smithy/util-base64-node", "^1.0.1", false),
@@ -69,54 +69,54 @@ public enum TypeScriptDependency implements Dependency {
6969

7070
AWS_SDK_UTIL_UTF8("dependencies", "@smithy/util-utf8", "^2.0.0", true),
7171

72-
AWS_SDK_UTIL_WAITERS("dependencies", "@smithy/util-waiter", "^2.0.5", false),
72+
AWS_SDK_UTIL_WAITERS("dependencies", "@smithy/util-waiter", "^2.0.6", false),
7373

74-
AWS_SDK_UTIL_DEFAULTS_MODE_NODE("dependencies", "@smithy/util-defaults-mode-node", "^2.0.6", true),
75-
AWS_SDK_UTIL_DEFAULTS_MODE_BROWSER("dependencies", "@smithy/util-defaults-mode-browser", "^2.0.6", true),
74+
AWS_SDK_UTIL_DEFAULTS_MODE_NODE("dependencies", "@smithy/util-defaults-mode-node", "^2.0.8", true),
75+
AWS_SDK_UTIL_DEFAULTS_MODE_BROWSER("dependencies", "@smithy/util-defaults-mode-browser", "^2.0.7", true),
7676

77-
NODE_CONFIG_PROVIDER("dependencies", "@smithy/node-config-provider", "^2.0.6", false),
77+
NODE_CONFIG_PROVIDER("dependencies", "@smithy/node-config-provider", "^2.0.8", false),
7878

7979
UUID("dependencies", "uuid", "^8.3.2", false),
8080

8181
// Conditionally added when httpChecksumRequired trait exists
82-
MD5_BROWSER("dependencies", "@smithy/md5-js", "^2.0.5", false),
83-
STREAM_HASHER_NODE("dependencies", "@smithy/hash-stream-node", "^2.0.5", false),
84-
STREAM_HASHER_BROWSER("dependencies", "@smithy/hash-blob-browser", "^2.0.5", false),
85-
BODY_CHECKSUM("dependencies", "@smithy/middleware-apply-body-checksum", "^2.0.5", false),
82+
MD5_BROWSER("dependencies", "@smithy/md5-js", "^2.0.6", false),
83+
STREAM_HASHER_NODE("dependencies", "@smithy/hash-stream-node", "^2.0.6", false),
84+
STREAM_HASHER_BROWSER("dependencies", "@smithy/hash-blob-browser", "^2.0.6", false),
85+
BODY_CHECKSUM("dependencies", "@smithy/middleware-apply-body-checksum", "^2.0.7", false),
8686

8787
// Conditionally added when using an HTTP application protocol.
88-
PROTOCOL_HTTP("dependencies", "@smithy/protocol-http", "^2.0.5", false),
89-
AWS_SDK_FETCH_HTTP_HANDLER("dependencies", "@smithy/fetch-http-handler", "^2.0.5", false),
90-
AWS_SDK_NODE_HTTP_HANDLER("dependencies", "@smithy/node-http-handler", "^2.0.5", false),
88+
PROTOCOL_HTTP("dependencies", "@smithy/protocol-http", "^3.0.1", false),
89+
AWS_SDK_FETCH_HTTP_HANDLER("dependencies", "@smithy/fetch-http-handler", "^2.1.1", false),
90+
AWS_SDK_NODE_HTTP_HANDLER("dependencies", "@smithy/node-http-handler", "^2.1.1", false),
9191

9292
// Conditionally added when setting the auth middleware.
9393
UTIL_MIDDLEWARE("dependencies", "@smithy/util-middleware", "^2.0.0", false),
9494
@Deprecated AWS_SDK_UTIL_MIDDLEWARE("dependencies", "@smithy/util-middleware", "^2.0.0", false),
9595

9696
// Conditionally added if a event stream shape is found anywhere in the model
9797
AWS_SDK_EVENTSTREAM_SERDE_CONFIG_RESOLVER(
98-
"dependencies", "@smithy/eventstream-serde-config-resolver", "^2.0.5", false),
99-
AWS_SDK_EVENTSTREAM_SERDE_NODE("dependencies", "@smithy/eventstream-serde-node", "^2.0.5", false),
100-
AWS_SDK_EVENTSTREAM_SERDE_BROWSER("dependencies", "@smithy/eventstream-serde-browser", "^2.0.5", false),
98+
"dependencies", "@smithy/eventstream-serde-config-resolver", "^2.0.6", false),
99+
AWS_SDK_EVENTSTREAM_SERDE_NODE("dependencies", "@smithy/eventstream-serde-node", "^2.0.6", false),
100+
AWS_SDK_EVENTSTREAM_SERDE_BROWSER("dependencies", "@smithy/eventstream-serde-browser", "^2.0.6", false),
101101

102102
// Conditionally added if a big decimal shape is found in a model.
103103
BIG_JS("dependencies", "big.js", "^6.0.0", false),
104104
TYPES_BIG_JS("devDependencies", "@types/big.js", "^6.0.0", false),
105105

106106
// Conditionally added when interacting with specific protocol test bodyMediaType values.
107-
AWS_SDK_QUERYSTRING_BUILDER("dependencies", "@smithy/querystring-builder", "^2.0.5", false),
107+
AWS_SDK_QUERYSTRING_BUILDER("dependencies", "@smithy/querystring-builder", "^2.0.6", false),
108108

109109
// Conditionally added when XML parser needs to be used.
110110
XML_PARSER("dependencies", "fast-xml-parser", "4.2.5", false),
111111
HTML_ENTITIES("dependencies", "entities", "2.2.0", false),
112112

113113
// Conditionally added when streaming blob response payload exists.
114-
@Deprecated UTIL_STREAM_NODE("dependencies", "@smithy/util-stream-node", "^2.0.5", false),
115-
@Deprecated UTIL_STREAM_BROWSER("dependencies", "@smithy/util-stream-browser", "^2.0.5", false),
116-
UTIL_STREAM("dependencies", "@smithy/util-stream", "^2.0.5", false),
114+
@Deprecated UTIL_STREAM_NODE("dependencies", "@smithy/util-stream-node", "^2.0.7", false),
115+
@Deprecated UTIL_STREAM_BROWSER("dependencies", "@smithy/util-stream-browser", "^2.0.7", false),
116+
UTIL_STREAM("dependencies", "@smithy/util-stream", "^2.0.7", false),
117117

118118
// Conditionally added when @aws.auth#sigv4 is used
119-
SIGNATURE_V4("dependencies", "@smithy/signature-v4", "^2.0.4", false),
119+
SIGNATURE_V4("dependencies", "@smithy/signature-v4", "^2.0.6", false),
120120

121121
// feat(experimentalIdentityAndAuth): Conditionally added dependencies for `experimentalIdentityAndAuth`.
122122
// This package should never have a major version, and should only use minor and patch versions in development.

smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/extensions/DefaultExtensionConfigurationInterface.java

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,6 @@
11
/*
22
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3-
*
4-
* Licensed under the Apache License, Version 2.0 (the "License").
5-
* You may not use this file except in compliance with the License.
6-
* A copy of the License is located at
7-
*
8-
* http://aws.amazon.com/apache2.0
9-
*
10-
* or in the "license" file accompanying this file. This file is distributed
11-
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12-
* express or implied. See the License for the specific language governing
13-
* permissions and limitations under the License.
3+
* SPDX-License-Identifier: Apache-2.0
144
*/
155

166
package software.amazon.smithy.typescript.codegen.extensions;

smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/extensions/ExtensionConfigurationInterface.java

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,6 @@
11
/*
22
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3-
*
4-
* Licensed under the Apache License, Version 2.0 (the "License").
5-
* You may not use this file except in compliance with the License.
6-
* A copy of the License is located at
7-
*
8-
* http://aws.amazon.com/apache2.0
9-
*
10-
* or in the "license" file accompanying this file. This file is distributed
11-
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12-
* express or implied. See the License for the specific language governing
13-
* permissions and limitations under the License.
3+
* SPDX-License-Identifier: Apache-2.0
144
*/
155

166
package software.amazon.smithy.typescript.codegen.extensions;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/*
2+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
package software.amazon.smithy.typescript.codegen.extensions;
7+
8+
import software.amazon.smithy.typescript.codegen.Dependency;
9+
import software.amazon.smithy.typescript.codegen.TypeScriptDependency;
10+
import software.amazon.smithy.utils.Pair;
11+
12+
public class HttpHandlerExtensionConfigurationInterface implements ExtensionConfigurationInterface {
13+
14+
@Override
15+
public Pair<String, Dependency> name() {
16+
return Pair.of("HttpHandlerExtensionConfiguration", TypeScriptDependency.PROTOCOL_HTTP);
17+
}
18+
19+
@Override
20+
public Pair<String, Dependency> getExtensionConfigurationFn() {
21+
return Pair.of("getHttpHandlerExtensionConfiguration", TypeScriptDependency.PROTOCOL_HTTP);
22+
}
23+
24+
@Override
25+
public Pair<String, Dependency> resolveRuntimeConfigFn() {
26+
return Pair.of("resolveHttpHandlerRuntimeConfig", TypeScriptDependency.PROTOCOL_HTTP);
27+
}
28+
}

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import software.amazon.smithy.typescript.codegen.TypeScriptWriter;
2020
import software.amazon.smithy.typescript.codegen.extensions.DefaultExtensionConfigurationInterface;
2121
import software.amazon.smithy.typescript.codegen.extensions.ExtensionConfigurationInterface;
22+
import software.amazon.smithy.typescript.codegen.extensions.HttpHandlerExtensionConfigurationInterface;
2223
import software.amazon.smithy.utils.MapUtils;
2324
import software.amazon.smithy.utils.SmithyInternalApi;
2425

@@ -138,6 +139,6 @@ public Map<String, Consumer<TypeScriptWriter>> getRuntimeConfigWriters(
138139

139140
@Override
140141
public List<ExtensionConfigurationInterface> getExtensionConfigurationInterfaces() {
141-
return List.of(new DefaultExtensionConfigurationInterface());
142+
return List.of(new DefaultExtensionConfigurationInterface(), new HttpHandlerExtensionConfigurationInterface());
142143
}
143144
}

smithy-typescript-codegen/src/main/resources/software/amazon/smithy/typescript/codegen/resolveRuntimeExtensions1.template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { ${extensionConfigName} } from "./extensionConfiguration";
44
* @public
55
*/
66
export interface RuntimeExtension {
7-
configure(clientConfiguration: ${extensionConfigName}): void;
7+
configure(extensionConfiguration: ${extensionConfigName}): void;
88
}
99

1010
/**

0 commit comments

Comments
 (0)