///
import Piscina from '@posthog/piscina';
import { PluginEvent } from '@posthog/plugin-scaffold';
import Redis from 'ioredis';
import { DateTime } from 'luxon';
import { Pool } from 'pg';
import { Readable } from 'stream';
import { LogLevel, Plugin, PluginConfigId, PluginsServerConfig, TimestampFormat } from '../types';
export declare function killGracefully(): void;
export declare function bufferToStream(binary: Buffer): Readable;
export declare function getFileFromArchive(archive: Buffer, file: string): Promise;
export declare function getFileFromTGZ(archive: Buffer, file: string): Promise;
export declare function getFileFromZip(archive: Buffer, file: string): string | null;
export declare function setLogLevel(logLevel: LogLevel): void;
export declare function cloneObject(obj: T): T;
export declare class UUID {
static validateString(candidate: any, throwOnInvalid?: boolean): boolean;
array: Uint8Array;
constructor(candidate: string | Uint8Array | Buffer);
valueOf(): BigInt;
toString(): string;
}
export declare class UUIDT extends UUID {
static currentSeriesPerMs: Map;
static getSeries(unixTimeMs: number): number;
constructor(unixTimeMs?: number);
}
export declare function castTimestampOrNow(timestamp?: DateTime | string | null, timestampFormat?: TimestampFormat): string;
export declare function castTimestampToClickhouseFormat(timestamp: DateTime, timestampFormat?: TimestampFormat): string;
export declare function clickHouseTimestampToISO(timestamp: string): string;
export declare function delay(ms: number): Promise;
export declare function sanitizeSqlIdentifier(unquotedIdentifier: string): string;
export declare function escapeClickHouseString(string: string): string;
export declare function groupIntoBatches(array: T[], batchSize: number): T[][];
export declare function code(strings: TemplateStringsArray): string;
export declare function tryTwice(callback: () => Promise, errorMessage: string, timeoutMs?: number): Promise;
export declare function createRedis(serverConfig: PluginsServerConfig): Promise;
export declare function pluginDigest(plugin: Plugin, teamId?: number): string;
export declare function createPostgresPool(configOrDatabaseUrl: PluginsServerConfig | string, onError?: (error: Error) => any): Pool;
export declare function sanitizeEvent(event: PluginEvent): PluginEvent;
export declare enum NodeEnv {
Development = "dev",
Production = "prod",
Test = "test"
}
export declare function stringToBoolean(value: unknown, strict?: false): boolean;
export declare function stringToBoolean(value: unknown, strict: true): boolean | null;
export declare function determineNodeEnv(): NodeEnv;
export declare function getPiscinaStats(piscina: Piscina): Record;
export declare function pluginConfigIdFromStack(stack: string, pluginConfigSecretLookup: Map): PluginConfigId | void;
export declare function logOrThrowJobQueueError(server: PluginsServerConfig, error: Error, message: string): void;
export declare function groupBy, K extends keyof T>(objects: T[], key: K, flat?: false): Record;
export declare function groupBy, K extends keyof T>(objects: T[], key: K, flat: true): Record;
export declare function clamp(value: number, min: number, max: number): number;
export declare function stringClamp(value: string, def: number, min: number, max: number): number;
export declare function stringify(value: any): string;
export declare class IllegalOperationError extends Error {
name: string;
constructor(operation: string);
}
export declare function getByAge(cache: Map, key: K, maxAgeMs?: number): V | undefined;
export declare function getAsciiLetters(): string;
export declare function getAllDigits(): string;
export declare function generateRandomToken(nBytes: number): string;
export declare function intToBase(num: number, base: number): string;
export declare class RaceConditionError extends Error {
name: string;
}