UNPKG

cdk-insights

Version:

AWS CDK security and cost analysis tool with AI-powered insights

53 lines (52 loc) 1.94 kB
import { type LicenseInfo } from './featureFlags'; export interface FeatureCheck { feature: string; allowed: boolean; reason?: string; quota?: { current: number; limit: number; remaining: number; }; upgrade?: { required: boolean; tier: string; path: string; }; } export interface FeatureUsage { feature: string; quantity: number; timestamp: number; context?: Record<string, unknown>; } export interface FeatureGatingDependencies { licenseKey?: string; authToken?: string; userId?: string; featureServiceUrl?: string; cacheTTL?: number; fetch: typeof fetch; licenseInfo?: LicenseInfo; } export declare const createFeatureGating: (dependencies: FeatureGatingDependencies) => { checkFeature: (feature: string, quantity?: number, context?: Record<string, unknown>) => Promise<FeatureCheck>; recordUsage: (feature: string, quantity?: number, context?: Record<string, unknown>) => Promise<void>; requireFeature: (feature: string, quantity?: number, context?: Record<string, unknown>) => Promise<void>; getFeatureQuota: (feature: string) => Promise<{ current: number; limit: number; remaining: number; } | null>; getUpgradePath: (feature: string) => Promise<{ required: boolean; tier: string; path: string; } | null>; clearCache: () => void; isFeatureEnabled: (feature: string) => Promise<boolean>; getAvailableFeatures: () => Promise<string[]>; }; export declare const getFeatureGating: () => ReturnType<typeof createFeatureGating>; export declare const withFeatureCheck: (feature: string, quantity?: number) => (argv: any, next: () => Promise<void>) => Promise<void>; export declare const requireFeature: (feature: string, quantity?: number) => (target: any, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;