diff --git a/package-lock.json b/package-lock.json index 10206d16..7e727f95 100644 --- a/package-lock.json +++ b/package-lock.json @@ -32,7 +32,7 @@ "lint-staged": "^15.0.0", "nock": "^13.3.0", "npm-run-all2": "^6.0.0", - "prettier": "^2.2.1", + "prettier": "^3.0.0", "semantic-release": "^23.0.0", "serverless": "^3.30.1", "ts-jest": "^29.0.0", @@ -57,7 +57,7 @@ "@types/aws-lambda": "^8.10.115", "@types/node": "^20.0.0", "aws-cdk": "2.132.1", - "aws-cdk-lib": "^2.132.1", + "aws-cdk-lib": "2.132.1", "constructs": "^10.0.0", "source-map-support": "^0.5.21", "ts-node": "^10.9.1" @@ -17592,15 +17592,15 @@ } }, "node_modules/prettier": { - "version": "2.8.8", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz", - "integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==", + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.2.5.tgz", + "integrity": "sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A==", "dev": true, "bin": { - "prettier": "bin-prettier.js" + "prettier": "bin/prettier.cjs" }, "engines": { - "node": ">=10.13.0" + "node": ">=14" }, "funding": { "url": "https://github.com/prettier/prettier?sponsor=1" @@ -33555,9 +33555,9 @@ "dev": true }, "prettier": { - "version": "2.8.8", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz", - "integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==", + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.2.5.tgz", + "integrity": "sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A==", "dev": true }, "pretty-format": { diff --git a/package.json b/package.json index 842eab1b..bd46416b 100644 --- a/package.json +++ b/package.json @@ -52,7 +52,7 @@ "lint-staged": "^15.0.0", "nock": "^13.3.0", "npm-run-all2": "^6.0.0", - "prettier": "^2.2.1", + "prettier": "^3.0.0", "semantic-release": "^23.0.0", "serverless": "^3.30.1", "ts-jest": "^29.0.0", diff --git a/src/__tests__/apiGateway.it.ts b/src/__tests__/apiGateway.it.ts index a3d28611..59085ac5 100644 --- a/src/__tests__/apiGateway.it.ts +++ b/src/__tests__/apiGateway.it.ts @@ -19,7 +19,7 @@ beforeAll(async () => { new AssumeRoleCommand({ RoleArn: clientRoleArn, RoleSessionName: "integration-tests", - }) + }), ); clientCredentials = { @@ -49,13 +49,13 @@ describe("check that API is actually protected", () => { "checks that HTTP %s is protected", async (method) => { await expect( - axios.request({ url: apiGateway, method }) + axios.request({ url: apiGateway, method }), ).rejects.toMatchObject({ response: { status: 403, }, }); - } + }, ); }); @@ -76,7 +76,7 @@ describe("with credentials from environment variables", () => { client = axios.create(); client.interceptors.request.use( - aws4Interceptor({ options: { region, service }, instance: client }) + aws4Interceptor({ options: { region, service }, instance: client }), ); }); @@ -228,7 +228,7 @@ describe("signQuery", () => { service, signQuery: true, }, - }) + }), ); const result = await client.request({ @@ -244,7 +244,7 @@ describe("signQuery", () => { describe("with role to assume", () => { let client: AxiosInstance; const assumedRoleName = assumedClientRoleArn?.substr( - assumedClientRoleArn.indexOf("/") + 1 + assumedClientRoleArn.indexOf("/") + 1, ); beforeAll(() => { @@ -260,7 +260,7 @@ describe("with role to assume", () => { aws4Interceptor({ options: { region, service, assumeRoleArn: assumedClientRoleArn }, instance: client, - }) + }), ); }); @@ -271,8 +271,8 @@ describe("with role to assume", () => { expect(result?.status).toEqual(200); expect( - result && result.data.requestContext.authorizer.iam.userArn + result && result.data.requestContext.authorizer.iam.userArn, ).toContain("/" + assumedRoleName + "/"); - } + }, ); }); diff --git a/src/__tests__/setup.ts b/src/__tests__/setup.ts index d3c3f2c6..4dd3da0b 100644 --- a/src/__tests__/setup.ts +++ b/src/__tests__/setup.ts @@ -12,24 +12,24 @@ module.exports = async () => { const stacks = await cf.send( new DescribeStacksCommand({ StackName: stackName, - }) + }), ); const stack = stacks.Stacks?.[0]; if (stack === undefined) { throw new Error( - `Couldn't find CloudFormation stack with name ${stackName}` + `Couldn't find CloudFormation stack with name ${stackName}`, ); } process.env.API_GATEWAY_URL = stack.Outputs?.find( - (o) => o.OutputKey === "HttpApiUrl" + (o) => o.OutputKey === "HttpApiUrl", )?.OutputValue?.replace(/\/$/, ""); process.env.CLIENT_ROLE_ARN = stack.Outputs?.find( - (o) => o.OutputKey === "ClientRoleArn" + (o) => o.OutputKey === "ClientRoleArn", )?.OutputValue; process.env.ASSUMED_CLIENT_ROLE_ARN = stack.Outputs?.find( - (o) => o.OutputKey === "AssumedClientRoleArn" + (o) => o.OutputKey === "AssumedClientRoleArn", )?.OutputValue; process.env.AWS_REGION = region; diff --git a/src/axiosInterceptor.test.ts b/src/axiosInterceptor.test.ts index c8dfa32f..0c18fab0 100644 --- a/src/axiosInterceptor.test.ts +++ b/src/axiosInterceptor.test.ts @@ -21,7 +21,7 @@ describe("axios interceptor", () => { const client = axios.create(); client.interceptors.request.use( - aws4Interceptor({ options: { region: "local" }, instance: axios }) + aws4Interceptor({ options: { region: "local" }, instance: axios }), ); const url = "http://localhost/foo"; @@ -45,7 +45,7 @@ describe("axios interceptor", () => { const client = axios.create(); client.interceptors.request.use( - aws4Interceptor({ options: { region: "local" }, instance: axios }) + aws4Interceptor({ options: { region: "local" }, instance: axios }), ); const data = { foo: "bar" }; @@ -93,7 +93,7 @@ describe("axios interceptor", () => { const client = axios.create(); client.interceptors.request.use( - aws4Interceptor({ options: { region: "local" }, instance: axios }) + aws4Interceptor({ options: { region: "local" }, instance: axios }), ); const data = { foo: "bar" }; diff --git a/src/credentials/assumeRoleCredentialsProvider.test.ts b/src/credentials/assumeRoleCredentialsProvider.test.ts index 8253208c..4011e29b 100644 --- a/src/credentials/assumeRoleCredentialsProvider.test.ts +++ b/src/credentials/assumeRoleCredentialsProvider.test.ts @@ -113,16 +113,19 @@ export const mockSend = < HandlerOptions, ClientInput extends object, // eslint-disable-line @typescript-eslint/ban-types ClientOutput extends MetadataBearer, - ResolvedClientConfiguration extends SmithyResolvedConfiguration, + ResolvedClientConfiguration extends + SmithyResolvedConfiguration, InputType extends ClientInput, - OutputType extends ClientOutput + OutputType extends ClientOutput, >( - client: new (config: never) => Client< + client: new ( + config: never, + ) => Client< HandlerOptions, ClientInput, ClientOutput, ResolvedClientConfiguration - > + >, ): jest.Mock< unknown, [Command] diff --git a/src/credentials/assumeRoleCredentialsProvider.ts b/src/credentials/assumeRoleCredentialsProvider.ts index 975caa6e..f6868a03 100644 --- a/src/credentials/assumeRoleCredentialsProvider.ts +++ b/src/credentials/assumeRoleCredentialsProvider.ts @@ -50,7 +50,7 @@ export class AssumeRoleCredentialsProvider implements CredentialsProvider { new AssumeRoleCommand({ RoleArn: this.options.roleArn, RoleSessionName: this.options.roleSessionName, - }) + }), ); if (!res.Credentials) { diff --git a/src/credentials/isCredentialsProvider.ts b/src/credentials/isCredentialsProvider.ts index f0ce0b3b..eb173787 100644 --- a/src/credentials/isCredentialsProvider.ts +++ b/src/credentials/isCredentialsProvider.ts @@ -2,6 +2,6 @@ import { CredentialsProvider } from "./credentialsProvider"; // type guard export const isCredentialsProvider = ( - variableToCheck: unknown + variableToCheck: unknown, ): variableToCheck is CredentialsProvider => (variableToCheck as CredentialsProvider)?.getCredentials !== undefined; diff --git a/src/getAuthErrorMessage.test.ts b/src/getAuthErrorMessage.test.ts index 7e1a6f8d..d2430de8 100644 --- a/src/getAuthErrorMessage.test.ts +++ b/src/getAuthErrorMessage.test.ts @@ -19,7 +19,7 @@ describe("getAuthErrorMessage", () => { status: 403, headers: {}, config: { headers: new AxiosHeaders() }, - } + }, ); // Act @@ -42,7 +42,7 @@ describe("getAuthErrorMessage", () => { status: 200, headers: {}, config: { headers: new AxiosHeaders() }, - } + }, ); // Act diff --git a/src/interceptor.test.ts b/src/interceptor.test.ts index 178109a2..ed6a4d8b 100644 --- a/src/interceptor.test.ts +++ b/src/interceptor.test.ts @@ -69,7 +69,7 @@ describe("interceptor", () => { host: "example.com", headers: {}, }, - undefined + undefined, ); }); @@ -103,7 +103,7 @@ describe("interceptor", () => { host: "example.com", headers: {}, }, - undefined + undefined, ); }); @@ -138,7 +138,7 @@ describe("interceptor", () => { host: "example.com", headers: {}, }, - undefined + undefined, ); }); @@ -176,7 +176,7 @@ describe("interceptor", () => { body: '{"foo":"bar"}', headers: { "Content-Type": "application/json" }, }, - undefined + undefined, ); }); @@ -213,7 +213,7 @@ describe("interceptor", () => { body: "foobar", headers: {}, }, - undefined + undefined, ); }); @@ -253,7 +253,7 @@ describe("interceptor", () => { body: "foobar", headers: { "Content-Type": "application/xml" }, }, - undefined + undefined, ); }); @@ -294,7 +294,7 @@ describe("interceptor", () => { body: "foobar", headers: { "Content-Type": "application/xml" }, }, - undefined + undefined, ); }); @@ -330,7 +330,7 @@ describe("interceptor", () => { headers: {}, signQuery: true, }, - undefined + undefined, ); }); }); @@ -375,7 +375,7 @@ describe("credentials", () => { accessKeyId: "access-key-id", secretAccessKey: "secret-access-key", sessionToken: "session-token", - } + }, ); }); @@ -414,7 +414,7 @@ describe("credentials", () => { accessKeyId: "assumed-access-key-id", secretAccessKey: "assumed-secret-access-key", sessionToken: "assumed-session-token", - } + }, ); }); @@ -454,7 +454,7 @@ describe("credentials", () => { accessKeyId: "custom-provider-access-key-id", secretAccessKey: "custom-provider-secret-access-key", sessionToken: "custom-provider-session-token", - } + }, ); }); @@ -498,7 +498,7 @@ describe("credentials", () => { accessKeyId: "access-key-id", secretAccessKey: "secret-access-key", sessionToken: "session-token", - } + }, ); }); @@ -545,7 +545,7 @@ describe("credentials", () => { accessKeyId: "access-key-id", secretAccessKey: "secret-access-key", sessionToken: "session-token", - } + }, ); }); }); diff --git a/src/interceptor.ts b/src/interceptor.ts index 1c57256e..64b69f90 100644 --- a/src/interceptor.ts +++ b/src/interceptor.ts @@ -105,7 +105,7 @@ export const aws4Interceptor = ({ options?: InterceptorOptions; credentials?: Credentials | CredentialsProvider; }): (( - config: InternalAxiosRequestConfig + config: InternalAxiosRequestConfig, ) => Promise>) => { let credentialsProvider: CredentialsProvider; @@ -127,7 +127,7 @@ export const aws4Interceptor = ({ if (!url) { throw new Error( - "No URL present in request config, unable to sign request" + "No URL present in request config, unable to sign request", ); } @@ -200,6 +200,6 @@ const getTransformer = (config: AxiosRequestConfig) => { } throw new Error( - "Could not get default transformRequest function from Axios defaults" + "Could not get default transformRequest function from Axios defaults", ); };