UNPKG

@noony-serverless/core

Version:

A Middy base framework compatible with Firebase and GCP Cloud Functions with TypeScript

109 lines 4.78 kB
/** * Noony Guards - High-Performance Permission System * * A comprehensive permission and authentication system designed for serverless * environments with sub-millisecond cached permission checks. * * Features: * - Multi-layer caching (L1 memory + L2 distributed) * - Three distinct permission resolution strategies * - Conservative cache invalidation for security * - NestJS-inspired guard decorators and middleware * - Framework-agnostic middleware integration * - Comprehensive monitoring and audit trails * * @author Noony Framework Team * @version 1.0.0 */ export { RouteGuards, RouteGuardOptions, GuardSystemStats, AnyTokenValidator, } from './RouteGuards'; export { GuardConfiguration, GuardEnvironmentProfile, PermissionResolutionStrategy, GuardSecurityConfig, GuardCacheConfig, GuardMonitoringConfig, } from './config/GuardConfiguration'; export { CacheAdapter, CacheStats, CacheKeyBuilder, } from './cache/CacheAdapter'; export { MemoryCacheAdapter } from './cache/MemoryCacheAdapter'; export { NoopCacheAdapter } from './cache/NoopCacheAdapter'; export { ConservativeCacheInvalidation, CacheInvalidationEvent, InvalidationType, InvalidationScope, } from './cache/ConservativeCacheInvalidation'; export { PermissionResolver, PermissionResolverType, PermissionCheckResult, PermissionExpression, PermissionUtils, PerformanceCharacteristics, } from './resolvers/PermissionResolver'; export { PlainPermissionResolver } from './resolvers/PlainPermissionResolver'; export { WildcardPermissionResolver } from './resolvers/WildcardPermissionResolver'; export { ExpressionPermissionResolver } from './resolvers/ExpressionPermissionResolver'; export { PermissionRegistry } from './registry/PermissionRegistry'; export { FastUserContextService, UserContext, UserPermissionSource, PermissionCheckOptions, } from './services/FastUserContextService'; export { FastAuthGuard, AuthenticationResult, AuthGuardConfig, TokenValidator, } from './guards/FastAuthGuard'; export { PermissionGuardFactory, GuardConfig, } from './guards/PermissionGuardFactory'; export { CustomTokenVerificationPortAdapter, TokenVerificationAdapterFactory, AdapterConfig, } from './adapters/CustomTokenVerificationPortAdapter'; export declare const GUARD_DEFAULTS: { readonly CACHE_TTL_MS: number; readonly AUTH_TOKEN_TTL_MS: number; readonly MAX_CACHE_ENTRIES: 1000; readonly MAX_EXPRESSION_COMPLEXITY: 100; readonly MAX_PATTERN_DEPTH: 3; readonly MAX_NESTING_DEPTH: 2; }; export declare const PERMISSION_PATTERNS: { readonly VALID_PERMISSION: RegExp; readonly WILDCARD_SUFFIX: RegExp; readonly PERMISSION_PARTS: RegExp; }; import { GuardEnvironmentProfile } from './config/GuardConfiguration'; /** * Quick setup helper for common configurations */ export declare class GuardSetup { /** * Development environment setup * * Note: Caching is disabled by default unless NOONY_GUARD_CACHE_ENABLE=true is set. * Even with cacheType: 'memory', the environment variable takes precedence. * * @example * ```bash * # Caching disabled (default) * npm run dev * * # Caching enabled * NOONY_GUARD_CACHE_ENABLE=true npm run dev * ``` */ static development(): GuardEnvironmentProfile; /** * Production environment setup * * Note: Caching is disabled by default unless NOONY_GUARD_CACHE_ENABLE=true is set. * This provides a security-first approach where caching must be explicitly enabled. * * @example * ```bash * # Production with caching enabled (recommended) * NOONY_GUARD_CACHE_ENABLE=true node dist/index.js * * # Production with caching disabled (debugging/troubleshooting) * node dist/index.js * ``` */ static production(): GuardEnvironmentProfile; /** * Serverless environment setup (optimized for cold starts) * * Note: Caching is disabled by default unless NOONY_GUARD_CACHE_ENABLE=true is set. * For serverless environments, consider enabling caching to improve performance * across warm invocations. * * @example * ```bash * # Serverless with caching enabled (recommended for warm starts) * NOONY_GUARD_CACHE_ENABLE=true serverless deploy * * # Serverless with caching disabled (cold start optimization) * serverless deploy * ``` */ static serverless(): GuardEnvironmentProfile; /** * Testing environment setup * * Note: Uses cacheType: 'none' explicitly, so caching is always disabled * regardless of NOONY_GUARD_CACHE_ENABLE environment variable. * This ensures predictable test behavior. */ static testing(): GuardEnvironmentProfile; } //# sourceMappingURL=index.d.ts.map