import { EventSpecMetadata, PropertyValidationResult } from "./eventSpec/AvoEventSpecFetchTypes"; export interface BaseBody { apiKey: string; appName: string; appVersion: string | null; libVersion: string; env: string; libPlatform: "node"; messageId: string; streamId: string; anonymousId: string; createdAt: string; samplingRate: number; publicEncryptionKey?: string; } export interface ResolvedGatewayFields { appVersion: string | null; outputReference?: string; originHint?: string; /** True when the caller supplied at least one non-blank gateway option. */ gatewayScoped: boolean; } export interface CallStamp { createdAt: string; samplingRate: number; } export interface EventPropertyEncrypted { propertyName: string; propertyType: string; encryptedPropertyValue: string; children?: any; } export interface EventPropertyPlain { propertyName: string; propertyType: string; children?: any; } export interface EventPropertyValidation { failedEventIds?: string[]; } export type EventProperty = (EventPropertyEncrypted | EventPropertyPlain) & EventPropertyValidation; export interface EventSchemaBody extends BaseBody { type: "event"; eventName: string; eventProperties: Array; avoFunction: boolean; eventId: string | null; eventHash: string | null; outputReference?: string; originHint?: string; eventSpecMetadata?: EventSpecMetadata; } export type InspectorBody = EventSchemaBody; export declare class AvoNetworkCallsHandler { private apiKey; private envName; private appName; private appVersion; private libVersion; private samplingRate; private publicEncryptionKey?; private inFlightRequests; private aborted; /** The valid mock-endpoint override in effect for this instance, read once, or null. */ readonly mockEndpoint: string | null; private static trackingEndpoint; private static mockEndpointEnvVar; private static requestTimeoutMs; private static gzipThresholdBytes; constructor(apiKey: string, envName: string, appName: string, appVersion: string, libVersion: string, publicEncryptionKey?: string); /** * The test-only endpoint override. Fail-closed: a prod instance never honors it, * whatever the surrounding process environment says. A value that is not an http(s) * URL is ignored (with a one-time warning), so callers only ever see a valid URL. */ static mockEndpointFor(envName: string): string | null; private static warnRedirect; private static warnedMockEndpoint; private static warnOnce; /** The sampling rate last returned by the Inspector API (1 until a response sets it). */ getSamplingRate(): number; /** Aborts every request still in flight (used by AvoInspector.destroy). */ abortInFlight(): void; /** * POSTs one batch. Resolves with the HTTP status code (the batch is never retried); * rejects with "Request failed" / "Request timed out" on transport failures, or when * a header value cannot be transmitted safely. */ callInspectorWithBatchBody(inEvents: Array): Promise; private static gzipAsync; private post; /** Builds the wire body for one event, encrypting property values when configured. */ bodyForEventSchemaCall(anonymousId: string, eventName: string, eventProperties: Array<{ propertyName: string; propertyType: string; children?: any; }>, eventId: string | null, eventHash: string | null, rawEventProperties?: { [propName: string]: any; }, gatewayFields?: ResolvedGatewayFields, stamp?: CallStamp): EventSchemaBody; /** Returns the event properties, with values encrypted when encryption applies. */ buildEventProperties(eventProperties: Array<{ propertyName: string; propertyType: string; children?: any; }>, rawEventProperties?: { [propName: string]: any; }): Array; /** Builds the wire body for one event, including its event-spec validation results. */ bodyForValidatedEventSchemaCall(anonymousId: string, eventName: string, eventProperties: Array, eventId: string | null, eventHash: string | null, eventSpecMetadata: EventSpecMetadata, propertyResults: PropertyValidationResult[], gatewayFields?: ResolvedGatewayFields, stamp?: CallStamp): EventSchemaBody; /** * A property with its failed event IDs, and those of its object properties merged into its * children. A list's children are its element schemas; each object element gets the * results of the properties it has (a list of objects is validated across all its items). */ private static withValidation; private static applyAvoFunctionFields; private encryptProperties; private createBaseCallBody; }