UNPKG

861 BTypeScriptView Raw
1import type { ConfigProvider } from '@adonisjs/core/types';
2import type { GuardConfigProvider, GuardFactory } from './types.js';
3/**
4 * Config resolved by the "defineConfig" method
5 */
6export type ResolvedAuthConfig<KnownGuards extends Record<string, GuardFactory | GuardConfigProvider<GuardFactory>>> = {
7 default: keyof KnownGuards;
8 guards: {
9 [K in keyof KnownGuards]: KnownGuards[K] extends GuardConfigProvider<infer A> ? A : KnownGuards[K];
10 };
11};
12/**
13 * Define configuration for the auth package. The function returns
14 * a config provider that is invoked inside the auth service
15 * provider
16 */
17export declare function defineConfig<KnownGuards extends Record<string, GuardFactory | GuardConfigProvider<GuardFactory>>>(config: {
18 default: keyof KnownGuards;
19 guards: KnownGuards;
20}): ConfigProvider<ResolvedAuthConfig<KnownGuards>>;