Skip to content

Commit b4f86d9

Browse files
committed
chore(signature-v4-multi-region): cleanups and docstrings
1 parent c4f2e54 commit b4f86d9

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

Diff for: packages/signature-v4-multi-region/package.json

-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
"@aws-sdk/types": "*",
2525
"@smithy/protocol-http": "^4.0.3",
2626
"@smithy/signature-v4": "^3.1.2",
27-
"@smithy/signature-v4a": "*",
2827
"@smithy/types": "^3.3.0",
2928
"tslib": "^2.6.2"
3029
},

Diff for: packages/signature-v4-multi-region/src/SignatureV4MultiRegion.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export class SignatureV4MultiRegion implements RequestPresigner, RequestSigner {
7979
private getSigv4aSigner(): InstanceType<OptionalCrtSignerV4> | InstanceType<OptionalSigV4aSigner> {
8080
if (!this.sigv4aSigner) {
8181
let CrtSignerV4: OptionalCrtSignerV4 | null = null;
82-
let JsSigV4a: OptionalSigV4aSigner | null = null;
82+
let JsSigV4aSigner: OptionalSigV4aSigner | null = null;
8383

8484
if (signatureV4CrtContainer.CrtSignerV4) {
8585
try {
@@ -102,8 +102,8 @@ export class SignatureV4MultiRegion implements RequestPresigner, RequestSigner {
102102
});
103103
} else if (signatureV4aContainer.SignatureV4a) {
104104
try {
105-
JsSigV4a = signatureV4aContainer.SignatureV4a;
106-
if (typeof JsSigV4a !== "function") throw new Error();
105+
JsSigV4aSigner = signatureV4aContainer.SignatureV4a;
106+
if (typeof JsSigV4aSigner !== "function") throw new Error();
107107
} catch (e) {
108108
e.message =
109109
`${e.message}\n` +
@@ -113,13 +113,13 @@ export class SignatureV4MultiRegion implements RequestPresigner, RequestSigner {
113113
throw e;
114114
}
115115

116-
this.sigv4aSigner = new JsSigV4a({
116+
this.sigv4aSigner = new JsSigV4aSigner({
117117
...this.signerOptions,
118118
});
119119
} else {
120120
throw new Error(
121121
"Neither CRT nor JS SigV4a implementation is available. " +
122-
"Please load either @aws-sdk/signature-v4-crt or @smithy/signature-v4a."
122+
"Please load either @aws-sdk/signature-v4-crt or @smithy/signature-v4a."
123123
);
124124
}
125125
}

Diff for: packages/signature-v4-multi-region/src/signature-v4a-container.ts

+11
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ import type { HttpRequest, RequestPresigner, RequestSigner, RequestSigningArgume
55
* @public
66
*/
77
export type OptionalSigV4aSigner = {
8+
/**
9+
* This constructor is not typed so as not to require a type import
10+
* from the signature-v4a package.
11+
*
12+
* The true type is SignatureV4a from @smithy/signature-v4a.
13+
*/
814
new (options: any): RequestPresigner &
915
RequestSigner & {
1016
signWithCredentials(
@@ -17,6 +23,11 @@ export type OptionalSigV4aSigner = {
1723

1824
/**
1925
* @public
26+
*
27+
* \@smithy/signature-v4a will install the constructor in this
28+
* container if it is installed.
29+
*
30+
* This avoids a runtime-require being interpreted statically by bundlers.
2031
*/
2132
export const signatureV4aContainer: {
2233
SignatureV4a: null | OptionalSigV4aSigner;

0 commit comments

Comments
 (0)