Skip to content

Commit 74a4554

Browse files
authored
Bump prettier to 3.2.5 (#1265)
1 parent 0ee4d33 commit 74a4554

File tree

78 files changed

+847
-1658
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+847
-1658
lines changed

.changeset/fuzzy-coats-rush.md

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
---

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
"karma-sourcemap-loader": "0.3.8",
6060
"karma-typescript": "5.5.3",
6161
"karma-webpack": "5.0.0",
62-
"prettier": "2.2.1",
62+
"prettier": "3.2.5",
6363
"puppeteer": "^19.2.0",
6464
"ts-jest": "28.0.5",
6565
"turbo": "latest",

packages/config-resolver/src/regionInfo/getResolvedHostname.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ export const getResolvedHostname = (
1616
regionHostname
1717
? regionHostname
1818
: partitionHostname
19-
? partitionHostname.replace("{region}", resolvedRegion)
20-
: undefined;
19+
? partitionHostname.replace("{region}", resolvedRegion)
20+
: undefined;

packages/core/src/middleware-http-auth-scheme/getHttpAuthSchemeEndpointRuleSetPlugin.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ interface HttpAuthSchemeEndpointRuleSetPluginOptions<
3030
TConfig extends object,
3131
TContext extends HandlerExecutionContext,
3232
TParameters extends HttpAuthSchemeParameters,
33-
TInput extends object
33+
TInput extends object,
3434
> {
3535
httpAuthSchemeParametersProvider: HttpAuthSchemeParametersProvider<TConfig, TContext, TParameters, TInput>;
3636
identityProviderConfigProvider: (config: TConfig) => Promise<IdentityProviderConfig>;
@@ -43,7 +43,7 @@ export const getHttpAuthSchemeEndpointRuleSetPlugin = <
4343
TConfig extends object,
4444
TContext extends HandlerExecutionContext,
4545
TParameters extends HttpAuthSchemeParameters,
46-
TInput extends object
46+
TInput extends object,
4747
>(
4848
config: TConfig & PreviouslyResolved<TParameters>,
4949
{

packages/core/src/middleware-http-auth-scheme/getHttpAuthSchemePlugin.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ interface HttpAuthSchemePluginOptions<
3030
TConfig extends object,
3131
TContext extends HandlerExecutionContext,
3232
TParameters extends HttpAuthSchemeParameters,
33-
TInput extends object
33+
TInput extends object,
3434
> {
3535
httpAuthSchemeParametersProvider: HttpAuthSchemeParametersProvider<TConfig, TContext, TParameters, TInput>;
3636
identityProviderConfigProvider: (config: TConfig) => Promise<IdentityProviderConfig>;
@@ -43,7 +43,7 @@ export const getHttpAuthSchemePlugin = <
4343
TConfig extends object,
4444
TContext extends HandlerExecutionContext,
4545
TParameters extends HttpAuthSchemeParameters,
46-
TInput extends object
46+
TInput extends object,
4747
>(
4848
config: TConfig & PreviouslyResolved<TParameters>,
4949
{

packages/core/src/middleware-http-auth-scheme/httpAuthSchemeMiddleware.ts

+47-46
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ interface HttpAuthSchemeMiddlewareOptions<
3030
TConfig extends object,
3131
TContext extends HandlerExecutionContext,
3232
TParameters extends HttpAuthSchemeParameters,
33-
TInput extends object
33+
TInput extends object,
3434
> {
3535
httpAuthSchemeParametersProvider: HttpAuthSchemeParametersProvider<TConfig, TContext, TParameters, TInput>;
3636
identityProviderConfigProvider: (config: TConfig) => Promise<IdentityProviderConfig>;
@@ -65,50 +65,51 @@ function convertHttpAuthSchemesToMap(httpAuthSchemes: HttpAuthScheme[]): Map<Htt
6565
/**
6666
* @internal
6767
*/
68-
export const httpAuthSchemeMiddleware = <
69-
TInput extends object,
70-
Output extends object,
71-
TConfig extends object,
72-
TContext extends HttpAuthSchemeMiddlewareHandlerExecutionContext,
73-
TParameters extends HttpAuthSchemeParameters
74-
>(
75-
config: TConfig & PreviouslyResolved<TParameters>,
76-
mwOptions: HttpAuthSchemeMiddlewareOptions<TConfig, TContext, TParameters, TInput>
77-
): SerializeMiddleware<TInput, Output> => (
78-
next: SerializeHandler<TInput, Output>,
79-
context: HttpAuthSchemeMiddlewareHandlerExecutionContext
80-
): SerializeHandler<TInput, Output> => async (
81-
args: SerializeHandlerArguments<TInput>
82-
): Promise<SerializeHandlerOutput<Output>> => {
83-
const options = config.httpAuthSchemeProvider(
84-
await mwOptions.httpAuthSchemeParametersProvider(config, context as TContext, args.input)
85-
);
86-
const authSchemes = convertHttpAuthSchemesToMap(config.httpAuthSchemes);
87-
const smithyContext: HttpAuthSchemeMiddlewareSmithyContext = getSmithyContext(context);
88-
const failureReasons = [];
89-
for (const option of options) {
90-
const scheme = authSchemes.get(option.schemeId);
91-
if (!scheme) {
92-
failureReasons.push(`HttpAuthScheme \`${option.schemeId}\` was not enabled for this service.`);
93-
continue;
68+
export const httpAuthSchemeMiddleware =
69+
<
70+
TInput extends object,
71+
Output extends object,
72+
TConfig extends object,
73+
TContext extends HttpAuthSchemeMiddlewareHandlerExecutionContext,
74+
TParameters extends HttpAuthSchemeParameters,
75+
>(
76+
config: TConfig & PreviouslyResolved<TParameters>,
77+
mwOptions: HttpAuthSchemeMiddlewareOptions<TConfig, TContext, TParameters, TInput>
78+
): SerializeMiddleware<TInput, Output> =>
79+
(
80+
next: SerializeHandler<TInput, Output>,
81+
context: HttpAuthSchemeMiddlewareHandlerExecutionContext
82+
): SerializeHandler<TInput, Output> =>
83+
async (args: SerializeHandlerArguments<TInput>): Promise<SerializeHandlerOutput<Output>> => {
84+
const options = config.httpAuthSchemeProvider(
85+
await mwOptions.httpAuthSchemeParametersProvider(config, context as TContext, args.input)
86+
);
87+
const authSchemes = convertHttpAuthSchemesToMap(config.httpAuthSchemes);
88+
const smithyContext: HttpAuthSchemeMiddlewareSmithyContext = getSmithyContext(context);
89+
const failureReasons = [];
90+
for (const option of options) {
91+
const scheme = authSchemes.get(option.schemeId);
92+
if (!scheme) {
93+
failureReasons.push(`HttpAuthScheme \`${option.schemeId}\` was not enabled for this service.`);
94+
continue;
95+
}
96+
const identityProvider = scheme.identityProvider(await mwOptions.identityProviderConfigProvider(config));
97+
if (!identityProvider) {
98+
failureReasons.push(`HttpAuthScheme \`${option.schemeId}\` did not have an IdentityProvider configured.`);
99+
continue;
100+
}
101+
const { identityProperties = {}, signingProperties = {} } = option.propertiesExtractor?.(config, context) || {};
102+
option.identityProperties = Object.assign(option.identityProperties || {}, identityProperties);
103+
option.signingProperties = Object.assign(option.signingProperties || {}, signingProperties);
104+
smithyContext.selectedHttpAuthScheme = {
105+
httpAuthOption: option,
106+
identity: await identityProvider(option.identityProperties),
107+
signer: scheme.signer,
108+
};
109+
break;
94110
}
95-
const identityProvider = scheme.identityProvider(await mwOptions.identityProviderConfigProvider(config));
96-
if (!identityProvider) {
97-
failureReasons.push(`HttpAuthScheme \`${option.schemeId}\` did not have an IdentityProvider configured.`);
98-
continue;
111+
if (!smithyContext.selectedHttpAuthScheme) {
112+
throw new Error(failureReasons.join("\n"));
99113
}
100-
const { identityProperties = {}, signingProperties = {} } = option.propertiesExtractor?.(config, context) || {};
101-
option.identityProperties = Object.assign(option.identityProperties || {}, identityProperties);
102-
option.signingProperties = Object.assign(option.signingProperties || {}, signingProperties);
103-
smithyContext.selectedHttpAuthScheme = {
104-
httpAuthOption: option,
105-
identity: await identityProvider(option.identityProperties),
106-
signer: scheme.signer,
107-
};
108-
break;
109-
}
110-
if (!smithyContext.selectedHttpAuthScheme) {
111-
throw new Error(failureReasons.join("\n"));
112-
}
113-
return next(args);
114-
};
114+
return next(args);
115+
};

packages/core/src/middleware-http-signing/httpSigningMiddleware.ts

+27-28
Original file line numberDiff line numberDiff line change
@@ -38,32 +38,31 @@ const defaultSuccessHandler: SuccessHandler = (
3838
/**
3939
* @internal
4040
*/
41-
export const httpSigningMiddleware = <Input extends object, Output extends object>(
42-
config: object
43-
): FinalizeRequestMiddleware<Input, Output> => (
44-
next: FinalizeHandler<Input, Output>,
45-
context: HttpSigningMiddlewareHandlerExecutionContext
46-
): FinalizeHandler<Input, Output> => async (
47-
args: FinalizeHandlerArguments<Input>
48-
): Promise<FinalizeHandlerOutput<Output>> => {
49-
if (!HttpRequest.isInstance(args.request)) {
50-
return next(args);
51-
}
41+
export const httpSigningMiddleware =
42+
<Input extends object, Output extends object>(config: object): FinalizeRequestMiddleware<Input, Output> =>
43+
(
44+
next: FinalizeHandler<Input, Output>,
45+
context: HttpSigningMiddlewareHandlerExecutionContext
46+
): FinalizeHandler<Input, Output> =>
47+
async (args: FinalizeHandlerArguments<Input>): Promise<FinalizeHandlerOutput<Output>> => {
48+
if (!HttpRequest.isInstance(args.request)) {
49+
return next(args);
50+
}
5251

53-
const smithyContext: HttpSigningMiddlewareSmithyContext = getSmithyContext(context);
54-
const scheme = smithyContext.selectedHttpAuthScheme;
55-
if (!scheme) {
56-
throw new Error(`No HttpAuthScheme was selected: unable to sign request`);
57-
}
58-
const {
59-
httpAuthOption: { signingProperties = {} },
60-
identity,
61-
signer,
62-
} = scheme;
63-
const output = await next({
64-
...args,
65-
request: await signer.sign(args.request, identity, signingProperties),
66-
}).catch((signer.errorHandler || defaultErrorHandler)(signingProperties));
67-
(signer.successHandler || defaultSuccessHandler)(output.response, signingProperties);
68-
return output;
69-
};
52+
const smithyContext: HttpSigningMiddlewareSmithyContext = getSmithyContext(context);
53+
const scheme = smithyContext.selectedHttpAuthScheme;
54+
if (!scheme) {
55+
throw new Error(`No HttpAuthScheme was selected: unable to sign request`);
56+
}
57+
const {
58+
httpAuthOption: { signingProperties = {} },
59+
identity,
60+
signer,
61+
} = scheme;
62+
const output = await next({
63+
...args,
64+
request: await signer.sign(args.request, identity, signingProperties),
65+
}).catch((signer.errorHandler || defaultErrorHandler)(signingProperties));
66+
(signer.successHandler || defaultSuccessHandler)(output.response, signingProperties);
67+
return output;
68+
};

packages/core/src/pagination/createPaginator.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const makePagedClientRequest = async <ClientType extends Client<any, any, any>,
2020
export function createPaginator<
2121
PaginationConfigType extends PaginationConfiguration,
2222
InputType extends object,
23-
OutputType extends object
23+
OutputType extends object,
2424
>(
2525
ClientCtor: any,
2626
CommandCtor: any,

packages/core/src/protocols/requestBuilder.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@ export class RequestBuilder {
2323

2424
private resolvePathStack: Array<(path: string) => void> = [];
2525

26-
public constructor(private input: any, private context: SerdeContext) {}
26+
public constructor(
27+
private input: any,
28+
private context: SerdeContext
29+
) {}
2730

2831
public async build() {
2932
const { hostname, protocol = "https", port, path: basePath } = await this.context.endpoint();

packages/credential-provider-imds/src/error/InstanceMetadataV1FallbackError.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ import { CredentialsProviderError } from "@smithy/property-provider";
99
export class InstanceMetadataV1FallbackError extends CredentialsProviderError {
1010
public name = "InstanceMetadataV1FallbackError";
1111

12-
constructor(message: string, public readonly tryNextLink: boolean = true) {
12+
constructor(
13+
message: string,
14+
public readonly tryNextLink: boolean = true
15+
) {
1316
super(message, tryNextLink);
1417
Object.setPrototypeOf(this, InstanceMetadataV1FallbackError.prototype);
1518
}

packages/credential-provider-imds/src/fromInstanceMetadata.spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ describe("fromInstanceMetadata", () => {
6060
beforeEach(() => {
6161
(staticStabilityProvider as jest.Mock).mockImplementation((input) => input);
6262
(getInstanceMetadataEndpoint as jest.Mock).mockResolvedValue({ hostname });
63-
((isImdsCredentials as unknown) as jest.Mock).mockReturnValue(true);
63+
(isImdsCredentials as unknown as jest.Mock).mockReturnValue(true);
6464
(providerConfigFromInit as jest.Mock).mockReturnValue({
6565
timeout: mockTimeout,
6666
maxRetries: mockMaxRetries,
@@ -139,7 +139,7 @@ describe("fromInstanceMetadata", () => {
139139
.mockResolvedValueOnce(JSON.stringify(mockImdsCreds));
140140

141141
(retry as jest.Mock).mockImplementation((fn: any) => fn());
142-
((isImdsCredentials as unknown) as jest.Mock).mockReturnValueOnce(false);
142+
(isImdsCredentials as unknown as jest.Mock).mockReturnValueOnce(false);
143143

144144
await expect(fromInstanceMetadata()()).rejects.toEqual(
145145
new CredentialsProviderError("Invalid response received from instance metadata service.")

packages/credential-provider-imds/src/utils/getExtendedInstanceMetadataCredentials.spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ describe("getExtendedInstanceMetadataCredentials()", () => {
2222
});
2323

2424
it("should extend the expiration random time(5~10 mins) from now", () => {
25-
const anyDate: Date = ("any date" as unknown) as Date;
25+
const anyDate: Date = "any date" as unknown as Date;
2626
(Math.random as jest.Mock).mockReturnValue(0.5);
2727
expect(getExtendedInstanceMetadataCredentials({ ...staticSecret, expiration: anyDate }, logger)).toEqual({
2828
...staticSecret,
@@ -33,7 +33,7 @@ describe("getExtendedInstanceMetadataCredentials()", () => {
3333
});
3434

3535
it("should print warning message when extending the credentials", () => {
36-
const anyDate: Date = ("any date" as unknown) as Date;
36+
const anyDate: Date = "any date" as unknown as Date;
3737
getExtendedInstanceMetadataCredentials({ ...staticSecret, expiration: anyDate }, logger);
3838
expect(logger.warn).toBeCalledWith(expect.stringContaining("Attempting credential expiration extension"));
3939
});

packages/credential-provider-imds/src/utils/staticStabilityProvider.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ describe("staticStabilityProvider", () => {
8989

9090
it("should allow custom logger to print warning messages", async () => {
9191
const provider = jest.fn().mockResolvedValueOnce(mockCreds).mockRejectedValue("Error");
92-
const logger = ({ warn: jest.fn() } as unknown) as Logger;
92+
const logger = { warn: jest.fn() } as unknown as Logger;
9393
const stableProvider = staticStabilityProvider(provider, { logger });
9494
expect(await stableProvider()).toEqual(mockCreds); // load initial creds
9595
await stableProvider();

packages/eventstream-codec/src/HeaderMarshaller.spec.ts

+3-39
Original file line numberDiff line numberDiff line change
@@ -182,45 +182,9 @@ describe("HeaderMarshaller", () => {
182182
[
183183
"a sequence of headers",
184184
Uint8Array.from([
185-
0x04,
186-
0xf0,
187-
0x9f,
188-
0xa6,
189-
0x84,
190-
0x06,
191-
0x00,
192-
0x04,
193-
0xde,
194-
0xad,
195-
0xbe,
196-
0xef,
197-
0x04,
198-
0xf0,
199-
0x9f,
200-
0x8f,
201-
0x87,
202-
0x00,
203-
0x04,
204-
0xf0,
205-
0x9f,
206-
0x90,
207-
0x8e,
208-
0x07,
209-
0x00,
210-
0x07,
211-
0xe2,
212-
0x98,
213-
0x83,
214-
0xf0,
215-
0x9f,
216-
0x92,
217-
0xa9,
218-
0x04,
219-
0xf0,
220-
0x9f,
221-
0x90,
222-
0xb4,
223-
0x01,
185+
0x04, 0xf0, 0x9f, 0xa6, 0x84, 0x06, 0x00, 0x04, 0xde, 0xad, 0xbe, 0xef, 0x04, 0xf0, 0x9f, 0x8f, 0x87, 0x00,
186+
0x04, 0xf0, 0x9f, 0x90, 0x8e, 0x07, 0x00, 0x07, 0xe2, 0x98, 0x83, 0xf0, 0x9f, 0x92, 0xa9, 0x04, 0xf0, 0x9f,
187+
0x90, 0xb4, 0x01,
224188
]),
225189
{
226190
"🦄": {

packages/eventstream-codec/src/HeaderMarshaller.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ import { Int64 } from "./Int64";
77
* @internal
88
*/
99
export class HeaderMarshaller {
10-
constructor(private readonly toUtf8: Encoder, private readonly fromUtf8: Decoder) {}
10+
constructor(
11+
private readonly toUtf8: Encoder,
12+
private readonly fromUtf8: Decoder
13+
) {}
1114

1215
format(headers: MessageHeaders): Uint8Array {
1316
const chunks: Array<Uint8Array> = [];

0 commit comments

Comments
 (0)