UNPKG

glin-profanity

Version:

Glin-Profanity is a lightweight and efficient npm package designed to detect and filter profane language in text inputs across multiple languages. Whether you’re building a chat application, a comment section, or any platform where user-generated content

49 lines (45 loc) • 2.29 kB
import { V as Vault, S as ScanResult, a as ScanDecision } from '../pii-B2TdijR_.cjs'; export { I as INJECTION_PATTERNS, b as InjectionCategory, c as InjectionPattern, P as PII_PATTERNS, d as PatternSeverity, e as PiiOptions, f as PiiPattern, g as PiiScanner, h as PiiType, i as PromptInjectionOptions, j as PromptInjectionScanner, R as RestoreStrategy, k as SECRET_PATTERNS, l as ScanContext, m as ScanMatch, n as Scanner, o as SecretPattern, p as SecretSeverity, q as SecretsOptions, r as SecretsScanner, s as allowResult, t as blockResult, u as checkPromptInjection, v as defaultPromptInjectionScanner, w as ibanCheck, x as luhnCheck, y as scanPii, z as scanSecrets } from '../pii-B2TdijR_.cjs'; /** * Composite scanner — runs multiple scanners over a single input in one call. * * Mirrors packages/py/glin_profanity/scanners/composite.py. * * @module scanners/composite */ /** Scanner names supported by scanAll. */ type CompositeScanner = 'prompt_injection' | 'secrets' | 'pii'; /** Options for scanAll. */ interface ScanAllOptions { /** * Subset of scanners to run. Defaults to all three when omitted. * Order in the returned array follows the canonical order: * prompt_injection → secrets → pii. */ scanners?: CompositeScanner[]; /** * Optional shared Vault instance. When provided, secrets and PII scanners * will redact matched values into it (enabling later restoration). */ vault?: Vault; } /** * Run multiple scanners on text, returning one {@link ScanResult} per scanner. * * @param text - The text to scan. * @param options - Optional configuration (scanner subset + shared vault). * @returns Array of ScanResult objects in canonical order: * prompt_injection, secrets, pii. */ declare function scanAll(text: string, options?: ScanAllOptions): ScanResult[]; /** * Return the most severe {@link ScanDecision} across a list of results. * * Order: BLOCK > HITL > ALLOW. * * @param results - List of scan results (may be empty). * @returns The worst decision found, or `'ALLOW'` for an empty list. */ declare function worstDecision(results: ScanResult[]): ScanDecision; export { ScanDecision, ScanResult, Vault, scanAll, worstDecision }; export type { CompositeScanner, ScanAllOptions };