Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): update dependency prettier to v3 #1078

Merged
merged 3 commits into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
18 changes: 9 additions & 9 deletions src/__tests__/apiGateway.it.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ beforeAll(async () => {
new AssumeRoleCommand({
RoleArn: clientRoleArn,
RoleSessionName: "integration-tests",
})
}),
);

clientCredentials = {
Expand Down Expand Up @@ -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,
},
});
}
},
);
});

Expand All @@ -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 }),
);
});

Expand Down Expand Up @@ -228,7 +228,7 @@ describe("signQuery", () => {
service,
signQuery: true,
},
})
}),
);

const result = await client.request({
Expand All @@ -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(() => {
Expand All @@ -260,7 +260,7 @@ describe("with role to assume", () => {
aws4Interceptor({
options: { region, service, assumeRoleArn: assumedClientRoleArn },
instance: client,
})
}),
);
});

Expand All @@ -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 + "/");
}
},
);
});
10 changes: 5 additions & 5 deletions src/__tests__/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions src/axiosInterceptor.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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" };
Expand Down Expand Up @@ -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" };
Expand Down
11 changes: 7 additions & 4 deletions src/credentials/assumeRoleCredentialsProvider.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,16 +113,19 @@ export const mockSend = <
HandlerOptions,
ClientInput extends object, // eslint-disable-line @typescript-eslint/ban-types
ClientOutput extends MetadataBearer,
ResolvedClientConfiguration extends SmithyResolvedConfiguration<HandlerOptions>,
ResolvedClientConfiguration extends
SmithyResolvedConfiguration<HandlerOptions>,
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<InputType, OutputType, ResolvedClientConfiguration>]
Expand Down
2 changes: 1 addition & 1 deletion src/credentials/assumeRoleCredentialsProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export class AssumeRoleCredentialsProvider implements CredentialsProvider {
new AssumeRoleCommand({
RoleArn: this.options.roleArn,
RoleSessionName: this.options.roleSessionName,
})
}),
);

if (!res.Credentials) {
Expand Down
2 changes: 1 addition & 1 deletion src/credentials/isCredentialsProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
4 changes: 2 additions & 2 deletions src/getAuthErrorMessage.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe("getAuthErrorMessage", () => {
status: 403,
headers: {},
config: { headers: new AxiosHeaders() },
}
},
);

// Act
Expand All @@ -42,7 +42,7 @@ describe("getAuthErrorMessage", () => {
status: 200,
headers: {},
config: { headers: new AxiosHeaders() },
}
},
);

// Act
Expand Down
26 changes: 13 additions & 13 deletions src/interceptor.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ describe("interceptor", () => {
host: "example.com",
headers: {},
},
undefined
undefined,
);
});

Expand Down Expand Up @@ -103,7 +103,7 @@ describe("interceptor", () => {
host: "example.com",
headers: {},
},
undefined
undefined,
);
});

Expand Down Expand Up @@ -138,7 +138,7 @@ describe("interceptor", () => {
host: "example.com",
headers: {},
},
undefined
undefined,
);
});

Expand Down Expand Up @@ -176,7 +176,7 @@ describe("interceptor", () => {
body: '{"foo":"bar"}',
headers: { "Content-Type": "application/json" },
},
undefined
undefined,
);
});

Expand Down Expand Up @@ -213,7 +213,7 @@ describe("interceptor", () => {
body: "foobar",
headers: {},
},
undefined
undefined,
);
});

Expand Down Expand Up @@ -253,7 +253,7 @@ describe("interceptor", () => {
body: "foobar",
headers: { "Content-Type": "application/xml" },
},
undefined
undefined,
);
});

Expand Down Expand Up @@ -294,7 +294,7 @@ describe("interceptor", () => {
body: "foobar",
headers: { "Content-Type": "application/xml" },
},
undefined
undefined,
);
});

Expand Down Expand Up @@ -330,7 +330,7 @@ describe("interceptor", () => {
headers: {},
signQuery: true,
},
undefined
undefined,
);
});
});
Expand Down Expand Up @@ -375,7 +375,7 @@ describe("credentials", () => {
accessKeyId: "access-key-id",
secretAccessKey: "secret-access-key",
sessionToken: "session-token",
}
},
);
});

Expand Down Expand Up @@ -414,7 +414,7 @@ describe("credentials", () => {
accessKeyId: "assumed-access-key-id",
secretAccessKey: "assumed-secret-access-key",
sessionToken: "assumed-session-token",
}
},
);
});

Expand Down Expand Up @@ -454,7 +454,7 @@ describe("credentials", () => {
accessKeyId: "custom-provider-access-key-id",
secretAccessKey: "custom-provider-secret-access-key",
sessionToken: "custom-provider-session-token",
}
},
);
});

Expand Down Expand Up @@ -498,7 +498,7 @@ describe("credentials", () => {
accessKeyId: "access-key-id",
secretAccessKey: "secret-access-key",
sessionToken: "session-token",
}
},
);
});

Expand Down Expand Up @@ -545,7 +545,7 @@ describe("credentials", () => {
accessKeyId: "access-key-id",
secretAccessKey: "secret-access-key",
sessionToken: "session-token",
}
},
);
});
});
6 changes: 3 additions & 3 deletions src/interceptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export const aws4Interceptor = <D = any>({
options?: InterceptorOptions;
credentials?: Credentials | CredentialsProvider;
}): ((
config: InternalAxiosRequestConfig<D>
config: InternalAxiosRequestConfig<D>,
) => Promise<InternalAxiosRequestConfig<D>>) => {
let credentialsProvider: CredentialsProvider;

Expand All @@ -127,7 +127,7 @@ export const aws4Interceptor = <D = any>({

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",
);
}

Expand Down Expand Up @@ -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",
);
};