import { IIntegrationEvent, IIntegrationEventMetadata } from './integration-event-interfaces'; /** * Maximum allowed JSON string size for deserialization (1 MB). * @internal */ export declare const MAX_DESERIALIZE_SIZE = 1048576; /** * Maximum recursion depth for `sanitizeObject` (REL-007 — prevents stack * overflow from maliciously deep JSON payloads). * @internal */ export declare const MAX_SANITIZE_DEPTH = 50; /** * Recursively strip dangerous prototype-pollution keys (`__proto__`, * `constructor`, `prototype`) from a parsed JSON object. Bounded by * `MAX_SANITIZE_DEPTH` to prevent stack overflow on adversarial payloads. * * REL-007 (2026-05-08): added `maxDepth` parameter — was unbounded. * * @internal * @throws Error if recursion exceeds `maxDepth` */ export declare function sanitizeIntegrationPayload(obj: T, maxDepth?: number, currentDepth?: number): T; /** * Safely parse + sanitize a JSON string for integration event deserialization. * Enforces 1 MB size cap and 50-level depth cap. * * @internal * @throws Error if size or depth limits exceeded, or JSON is invalid */ export declare function safeParseIntegrationJson(jsonString: string): T; /** * @public * @stable * @since 0.22.0 */ export declare abstract class IntegrationEvent implements IIntegrationEvent { /** * Unique identifier for the event */ readonly eventId: string; /** * When the event was created */ readonly timestamp: Date; /** * Name of the event, defaults to the class name */ readonly eventName: string; /** * Payload of the event */ readonly payload?: T | undefined; /** * Metadata of the event */ readonly metadata?: IIntegrationEventMetadata; /** * Creates a new integration event * * @param payload - The event data * @param metadata - Optional metadata for the event */ constructor(payload?: T, metadata?: IIntegrationEventMetadata); /** * Generates a unique identifier for the event * This is a simple implementation that can be replaced in production */ protected static generateId(): string; /** * Creates a copy of this event with additional metadata * * @param metadata - Metadata to merge with existing metadata * @returns A new event instance with combined metadata */ withMetadata(metadata: Partial): IntegrationEvent; /** * Serializes the event to JSON format * @returns Serialized event as JSON string */ serialize(): string; /** * Deserializes a JSON string to an event instance * @param EventClass Event class to instantiate * @param jsonString JSON string to deserialize * @returns Instance of the event class */ /** * @deprecated Use module-level `MAX_DESERIALIZE_SIZE`. Kept as a static * property for backward compatibility with consumers reading * `IntegrationEvent.MAX_DESERIALIZE_SIZE` directly. */ private static readonly MAX_DESERIALIZE_SIZE; /** * @deprecated Use module-level `sanitizeIntegrationPayload`. Kept as a * thin shim — REL-007 unified the implementation so the class-based * deserializer and the utility function share the same sanitizer * (with depth limit, size cap, and prototype-pollution protection). */ private static sanitizeObject; static deserialize(EventClass: new (payload?: P, metadata?: IIntegrationEventMetadata) => E, jsonString: string): E; }