UNPKG

@juspay/neurolink

Version:

Universal AI Development Platform with working MCP integration, multi-provider support, voice (TTS/STT/realtime), and professional CLI. 58+ external MCP servers discoverable, multimodal file processing, RAG pipelines. Build, test, and deploy AI applicatio

50 lines (49 loc) 2.23 kB
/** * Shared log-sanitization helpers. * * Centralises truncate + secret-redaction patterns so every provider stays * consistent and any regex improvements only need one change. * * Coverage: * - `Authorization: Bearer <token>` (with required whitespace) * - `Authorization: Token <token>` (Replicate uses this, not Bearer) * - `Authorization: Basic <base64>` (D-ID and similar) * - Bare tokens by known provider prefix: * sk-/pk- (OpenAI, Anthropic, Stability), * r8_ (Replicate), gsk_ (Groq), xai- (xAI), tgp_ (Together), * fw_ (Fireworks), pplx- (Perplexity), pa- (Voyage), * jina_ (Jina), fish- (Fish Audio) * - Generic key=value pairs: api_key=…, access_token: …, secret_key=… */ /** * Truncate `text` to `maxLen` chars then replace embedded secrets with `***`. * * Use this for free-form text logged from response/request bodies. For * structured data (records, headers) prefer {@link sanitizeRecord} and * {@link sanitizeHeaders} which know to redact by key name as well. * * @param text - Raw text to sanitize (typically an HTTP response body). * @param maxLen - Maximum number of characters to keep (default 500). */ export declare function sanitizeForLog(text: string, maxLen?: number): string; /** * Recursively sanitize a record/array, returning a structurally identical * value with sensitive keys redacted and string values run through * {@link sanitizeForLog}. * * Safe to call on any JSON-shaped data. Cycles are detected and replaced * with the string `"[Circular]"` to avoid infinite recursion when logging * mid-stream objects that reference themselves. * * @param value - The value to sanitize. * @param maxStringLen - Per-string truncation cap (default 1000). */ export declare function sanitizeRecord<T>(value: T, maxStringLen?: number): T; /** * Sanitize an HTTP headers object — redacts sensitive header names entirely * (`***`) and applies {@link sanitizeForLog} to remaining values. * * Accepts both `Headers` instances and plain-object header maps so providers * can log either shape uniformly. */ export declare function sanitizeHeaders(headers: Headers | Record<string, string | undefined> | undefined): Record<string, string>;