import { u as FlagContext, a8 as RolleaseConfig } from './types-DdEZ8iqq.mjs'; import './core/metrics.mjs'; import './core/flag-types.mjs'; type Type = new (...args: unknown[]) => T; interface ModuleMetadata { imports?: unknown[]; providers?: unknown[]; exports?: unknown[]; controllers?: unknown[]; } interface DynamicModule extends ModuleMetadata { module: Type; global?: boolean; } interface AsyncModuleOptions { useFactory: (...args: unknown[]) => RolleaseConfig | Promise; inject?: unknown[]; imports?: unknown[]; isGlobal?: boolean; } declare const ROLLEASE_CLIENT: unique symbol; declare const ROLLEASE_CONFIG: unique symbol; /** * NestJS dynamic module for Rollease. * * ```ts * @Module({ * imports: [ * RolleaseModule.forRoot({ * db: createMemoryAdapter(), * secret: process.env.ROLLEASE_SECRET!, * }), * ], * }) * export class AppModule {} * ``` */ declare class RolleaseModule { /** * Register Rollease with a static configuration. */ static forRoot(config: RolleaseConfig): DynamicModule; /** * Register Rollease with an async factory (e.g. using ConfigService). * * ```ts * RolleaseModule.forRootAsync({ * inject: [ConfigService], * useFactory: (config: ConfigService) => ({ * db: createSequelizeAdapter(config.get('DB')), * secret: config.get('ROLLEASE_SECRET'), * }), * }) * ``` */ static forRootAsync(options: AsyncModuleOptions): DynamicModule; } /** * Parameter decorator to inject the RolleaseClient. * * ```ts * @Injectable() * export class FlagService { * constructor(@InjectRollease() private rl: RolleaseClient) {} * } * ``` */ declare function InjectRollease(): ParameterDecorator; interface FeatureGuardOptions { /** Flag key to check. */ flag: string; /** Extract context from the request. */ contextExtractor?: (request: unknown) => FlagContext; /** HTTP status code when flag is disabled. @default 404 */ disabledStatusCode?: number; /** Response body when flag is disabled. */ disabledResponse?: unknown; } /** * Create a NestJS route guard that gates access by flag value. * * ```ts * @Controller('checkout') * @UseGuards(createFeatureGuard({ flag: 'checkout-v2' })) * export class CheckoutController { ... } * ``` */ declare function createFeatureGuard(options: FeatureGuardOptions): { canActivate: (context: { switchToHttp: () => { getRequest: () => { user?: { id?: string; }; headers?: Record; }; }; }) => Promise; }; /** * Create a health check function compatible with @nestjs/terminus. * * ```ts * @Injectable() * export class RolleaseHealthIndicator { * constructor(@InjectRollease() private rl: RolleaseClient) {} * * async check() { * const health = await this.rl.health() * return { rollease: { status: health.status } } * } * } * ``` */ declare function createHealthIndicator(client: { health: () => Promise<{ status: string; }>; }): () => Promise<{ rollease: { status: string; }; }>; export { type FeatureGuardOptions, InjectRollease, ROLLEASE_CLIENT, ROLLEASE_CONFIG, RolleaseModule, createFeatureGuard, createHealthIndicator };