serverless-spy
Version:
CDK-based library for writing elegant integration tests on AWS serverless architecture and an additional web console to monitor events in real time.
14 lines (13 loc) • 469 B
JavaScript
export const getCacheKey = async (commandName, config, options) => {
const { accessKeyId } = await config.credentials();
const { identifiers } = options;
return JSON.stringify({
...(accessKeyId && { accessKeyId }),
...(identifiers && {
commandName,
identifiers: Object.entries(identifiers)
.sort()
.reduce((acc, [key, value]) => ({ ...acc, [key]: value }), {}),
}),
});
};