/// <reference types="node" />
import Stripe from "stripe";
import { EventEmitter } from "events";
import { Changes } from "./changefeed";
import { Client } from "pg";
export declare type QuerySelect = object;
export declare type QueryWhere = {
    [field: string]: any;
} | {
    [field: string]: any;
}[] | string | string[];
export interface QueryOptions {
    select?: string | string[];
    table?: string;
    where?: QueryWhere;
    query?: string;
    set?: {
        [key: string]: any;
    };
    params?: any[];
    values?: {
        [key: string]: any;
    };
    jsonb_set?: object;
    jsonb_merge?: object;
    cache?: boolean;
    retry_until_success?: any;
    offset?: number;
    limit?: number;
    timeout_s?: number;
    cb?: Function;
}
export interface AsyncQueryOptions extends Omit<QueryOptions, "cb"> {
}
export declare type QueryResult = {
    [key: string]: any;
};
declare type CB = (err: string | Error, result: any) => any;
export interface ChangefeedOptions {
    table: string;
    select: {
        [field: string]: any;
    };
    where: QueryWhere;
    watch: string[];
    cb: CB;
}
export interface PostgreSQL extends EventEmitter {
    _dbg(desc: string): Function;
    _stop_listening(table: string, select: QuerySelect, watch: string[]): any;
    _query(opts: QueryOptions): void;
    _client(): Client | undefined;
    _clients: Client[] | undefined;
    is_standby: boolean;
    get_site_settings(opts: {
        cb: CB;
    }): void;
    async_query(opts: AsyncQueryOptions): Promise<any>;
    _listen(table: string, select: QuerySelect, watch: string[], cb: CB): void;
    changefeed(opts: ChangefeedOptions): Changes;
    account_ids_to_usernames(opts: {
        account_ids: string[];
        cb: CB;
    }): void;
    get_project(opts: {
        project_id: string;
        columns?: string[];
        cb: CB;
    }): void;
    get_account(opts: {
        account_id: string;
        columns?: string[];
        cb: CB;
    }): void;
    add_user_to_project(opts: {
        account_id: string;
        project_id: string;
        group?: string;
        cb: CB;
    }): void;
    user_is_in_project_group(opts: {
        account_id: string;
        project_id: string;
        group?: string[];
        cache?: boolean;
        cb: CB;
    }): void;
    user_is_collaborator(opts: {
        account_id: string;
        project_id: string;
        cb: CB;
    }): any;
    get_user_column(column: string, account_id: string, cb: CB): any;
    _get_project_column(column: string, project_id: string, cb: CB): any;
    do_account_creation_actions(opts: {
        email_address: string;
        account_id: string;
        cb: CB;
    }): void;
    mark_account_deleted(opts: {
        email_address: string;
        account_id: string;
        cb: CB;
    }): void;
    count_accounts_created_by(opts: {
        ip_address: string;
        age_s: number;
        cb: CB;
    }): void;
    account_exists(opts: {
        email_address: string;
        cb: CB;
    }): void;
    is_banned_user(opts: {
        email_address?: string;
        account_id?: string;
        cb: CB;
    }): void;
    get_server_setting(opts: {
        name: string;
        cb: CB;
    }): void;
    get_server_settings_cached(opts: {
        cb: CB;
    }): void;
    server_settings_synctable(): any;
    create_account(opts: {
        first_name: string;
        last_name: string;
        created_by?: string;
        email_address?: string;
        password_hash?: string;
        passport_strategy?: any;
        passport_id?: string;
        passport_profile?: any;
        usage_intent?: string;
        cb: CB;
    }): void;
    log(opts: {
        event: string;
        value: any;
        cb?: Function;
    }): void;
    user_is_in_group(opts: {
        account_id: string;
        group: string;
        cb: CB;
    }): void;
    sha1(...args: any[]): string;
    get_project_ids_with_user(opts: {
        account_id: string;
        is_owner?: boolean;
        cb: CB;
    }): void;
    get_remember_me(opts: {
        hash: string;
        cb: CB;
    }): any;
    save_remember_me(opts: {
        account_id: string;
        hash: string;
        value: string;
        ttl: number;
        cb: CB;
    }): any;
    passport_exists(opts: {
        strategy: string;
        id: string;
        cb: CB;
    }): any;
    create_passport(opts: {
        account_id: string;
        strategy: string;
        id: string;
        profile: any;
        email_address?: string;
        first_name?: string;
        last_name?: string;
        cb: CB;
    }): any;
    get_passport_settings(opts: {
        strategy: string;
        cb: CB;
    }): any;
    get_all_passport_settings(opts: {
        cb: CB;
    }): any;
    get_all_passport_settings_cached(opts: {
        cb: CB;
    }): any;
    change_password(opts: {
        account_id: string;
        password_hash: string;
        invalidate_remember_me?: boolean;
        cb: CB;
    }): any;
    verify_email_check_token(opts: {
        email_address: string;
        token: string;
    }): any;
    reset_server_settings_cache(): void;
    stripe_update_customer(opts: {
        account_id: string;
        customer_id: string;
        stripe: Stripe;
        cb: CB;
    }): void;
    sync_site_license_subscriptions(account_id?: string): Promise<number>;
    get_stripe_customer_id(opts: {
        account_id: string;
        cb: CB;
    }): void;
    set_stripe_customer_id(opts: {
        account_id: string;
        customer_id: string;
        cb: CB;
    }): void;
    update_coupon_history(opts: {
        account_id: string;
        coupon_history: any;
        cb: CB;
    }): void;
    get_coupon_history(opts: {
        account_id: string;
        cb: CB;
    }): void;
    get_user_project_upgrades(opts: {
        account_id: string;
        cb: CB;
    }): void;
    remove_all_user_project_upgrades(opts: {
        account_id: string;
        projects: string[];
        cb: CB;
    }): void;
    _concurrent_warn: number;
    concurrent(): number;
    register_hub(opts: {
        host: string;
        port: number;
        clients: number;
        ttl: number;
        cb: CB;
    }): void;
}
export {};
