import { ExecuteResult, ICloudScriptService } from "./ICloudScriptService";
import * as mongoDB from "mongodb";
import { GNServerSettingsOptions } from "@xmobitea/gn-typescript-client";
import { GNServer } from "../../GNServer";
interface DbConnection {
    url: string;
    dbName: string;
    options?: {
        [k: string]: any;
    };
}
export declare class CloudScriptService implements ICloudScriptService {
    private static readonly ExecuteTimeoutInMs;
    private cloudScriptWorkerDict;
    private cloudScriptWaitingResponseCallbackDict;
    private latestVersion;
    private liveLatestVersion;
    private cloudScriptFunctionCollection;
    private cloudScriptFunctionLogCollection;
    private gnServer;
    private gnServerSettingsOptions;
    private dbConnection;
    private gameId;
    private cloudScriptFunctions;
    constructor();
    init(gameId: string, gnServerSettingsOptions: GNServerSettingsOptions, dbConnection: DbConnection, gnServer: GNServer): void;
    setCloudScriptFunctionCollection(cloudScriptFunctionCollection: mongoDB.Collection<mongoDB.Document>): void;
    setCloudScriptFunctionLogCollection(cloudScriptFunctionLogCollection: mongoDB.Collection<mongoDB.Document>): void;
    run(): void;
    private loadVersion;
    executeCloudScriptFunction(userId: string, functionName: string, functionParameters: object, version: string, customTags: {
        [k: string]: any;
    }): Promise<ExecuteResult>;
    addCloudScriptFunction(script: string, isLive: boolean, canExecute: boolean): Promise<{
        success: boolean;
        errorMessage?: string;
        version?: string;
    }>;
    private remoteAddCloudScriptFunction;
    private remoteEditCloudScriptFunction;
    editCloudScriptFunction(version: string, isLive: boolean, canExecute: boolean): Promise<{
        success: boolean;
        errorMessage?: string;
    }>;
    getCloudScriptFunctions(): Array<{
        version: string;
        canExecute: boolean;
    }>;
    getCloudScriptFunction(version: string): Promise<{
        script: string;
        canExecute: boolean;
        isLive: boolean;
        tsCreate: number;
    }>;
    getLatestVersion(): string;
    getLiveLatestVersion(): string;
    private loadCloudScriptFunctionWorkerFromCache;
    private loadCloudScriptFunctionWorker;
    private loadCloudScriptWorker;
}
export {};
