UNPKG

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.

16 lines (15 loc) 784 B
import { normalizeProvider } from "@smithy/util-middleware"; import { DEFAULT_ACCOUNT_ID_ENDPOINT_MODE, validateAccountIdEndpointMode, } from "./AccountIdEndpointModeConstants"; export const resolveAccountIdEndpointModeConfig = (input) => { const accountIdEndpointModeProvider = normalizeProvider(input.accountIdEndpointMode ?? DEFAULT_ACCOUNT_ID_ENDPOINT_MODE); return { ...input, accountIdEndpointMode: async () => { const accIdMode = await accountIdEndpointModeProvider(); if (!validateAccountIdEndpointMode(accIdMode)) { throw new Error(`Invalid value for accountIdEndpointMode: ${accIdMode}. Valid values are: "required", "preferred", "disabled".`); } return accIdMode; }, }; };