INNER CODE UNIT · TypeScript
requireGroup
aws-devtools-labs/aws-blocks · packages/bb-auth-cognito/src/index.ts:315
const requireGroup = (group: string): string[] => {
const members = this.state.groups[group];
if (!members) {
throw new ApiError(`Group '${group}' not found`, 404, { name: AuthCognitoErrors.GroupNotFound });
}
return members;
};
const toAdminUser = (username: string, user: MockUserRecord): AdminUser => ({
username,
userSub: user.userSub,
enabled: !user.disabled,
attributes: { ...user.attributes },
groups: Object.keys(this.state.groups).filter((g) => this.state.groups[g].includes(username)),
});
// Apply a scan filter in memory, mirroring Cognito's ListUsers Filter.
const matchesFilter = (user: AdminUser, filter?: AdminUserFilter): boolean => {
if (!filter) return true;
const candidate =