Repository: hashicorp/vault
File: ui/app/utils/all-engines-metadata.ts (TypeScript)

Code before:
 */

/**
 * These are all the secret and auth methods, including enterprise.
 */

export interface EngineDisplayData {
  category?: string;
  displayName: string;
  glyph?: string;
  mountGroup: string[];
  requiresEnterprise?: boolean;
  type: string;
  value?: string;
}

/**
 * @param mountGroup - Given mount group to filter by, e.g., 'auth' or 'secret'.
 * @param isEnterprise - Optional boolean to indicate if enterprise engines should be included in the results.
 * @returns Filtered array of engines that match the given mount type
 */
export function filterEnginesByMountType(mountGroup: 'auth' | 'secret', isEnterprise?: boolean) {
  return isEnterprise
    ? ALL_ENGINES.filter((engine) => engine.mountGroup.includes(mountGroup))
    : ALL_ENGINES.filter((engine) => engine.mountGroup.includes(mountGroup) && !engine.requiresEnterprise);
}

export const ALL_ENGINES: EngineDisplayData[] = [
  {
    category: 'cloud',
    displayName: 'AliCloud',
    glyph: 'alibaba-color',
    mountGroup: ['auth', 'secret'],
    type: 'alicloud',
  },
  {
    category: 'generic',
    displayName: 'AppRole',
    glyph: 'cpu',
    mountGroup: ['auth'],
    type: 'approle',
    value: 'approle',
  },
  {
    category: 'cloud',
    displayName: 'AWS',
    glyph: 'aws-color',
    mountGroup: ['auth', 'secret'],
    type: 'aws',
  },
  {

Review comment (security):
Made it so this function requires named params
```suggestion
export function filterEnginesByMountType({
  mountGroup,
  isEnterprise = false,
}: {
  mountGroup: 'auth' | 'secret';
  isEnterprise: boolean;
}) {
  return isEnterprise
    ? ALL_ENGINES.filter((engine) => engine.mountGroup.includes(mountGroup))
    : ALL_ENGINES.filter(
        (engine) => engine.mountGroup.includes(mountGroup) && !engine.requiresEnterprise
      );
}
```

Code after:
 */

/**
 * These are all the secret and auth methods, including enterprise.
 */

export interface EngineDisplayData {
  category?: string;
  displayName: string;
  glyph?: string;
  mountCategory: string[];
  requiresEnterprise?: boolean;
  type: string;
  value?: string;
}

/**
 * @param mountCategory - Given mount category to filter by, e.g., 'auth' or 'secret'.
 * @param isEnterprise - Optional boolean to indicate if enterprise engines should be included in the results.
 * @returns Filtered array of engines that match the given mount category
 */
export function filterEnginesByMountCategory({
  mountCategory,
  isEnterprise = false,
}: {
  mountCategory: 'auth' | 'secret';
  isEnterprise: boolean;
}) {
  return isEnterprise
    ? ALL_ENGINES.filter((engine) => engine.mountCategory.includes(mountCategory))
    : ALL_ENGINES.filter(
        (engine) => engine.mountCategory.includes(mountCategory) && !engine.requiresEnterprise
      );
}

export const ALL_ENGINES: EngineDisplayData[] = [
  {
    category: 'cloud',
    displayName: 'AliCloud',
    glyph: 'alibaba-color',
    mountCategory: ['auth', 'secret'],
    type: 'alicloud',
  },
  {
    category: 'generic',
    displayName: 'AppRole',
    glyph: 'cpu',
    mountCategory: ['auth'],
    type: 'approle',
    value: 'approle',
  },