index.ts 850 B

123456789101112131415161718192021222324252627
  1. // Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. import type {
  3. TwoFactorConfigurationOptions,
  4. TwoFactorConfigurationPlugin,
  5. } from '#shared/entities/two-factor/types.ts'
  6. const pluginsModules = import.meta.glob<TwoFactorConfigurationPlugin>(
  7. ['./**/*.ts', '!./**/index.ts', '!./__tests__/**/*.ts'],
  8. {
  9. eager: true,
  10. import: 'default',
  11. },
  12. )
  13. export const twoFactorConfigurationPlugins = Object.values(pluginsModules)
  14. export const twoFactorConfigurationPluginLookup =
  15. twoFactorConfigurationPlugins.reduce(
  16. (lookup: Record<string, TwoFactorConfigurationOptions>, plugin) => {
  17. // eslint-disable-next-line @typescript-eslint/no-unused-vars
  18. const { name, ...options } = plugin // remove not needed name from options.
  19. lookup[plugin.name] = options
  20. return lookup
  21. },
  22. {},
  23. )