/// <reference types="node" />
import express from 'express';
import type { DeepReadonly } from 'ts-essentials';
import type { Replicator, ServerReplicant } from './replicant';
import { Logger } from './logger';
import * as ncgUtils from './util';
import type { RootNS } from '../types/socket-protocol';
import type { NodeCG } from '../types/nodecg';
import type { ExtensionEventMap } from './server/extensions';
declare const _default: (io: RootNS, replicator: Replicator, extensions: Record<string, unknown>, mount: NodeCG.Middleware) => {
    new <C extends Record<string, any> = NodeCG.Bundle.UnknownConfig>(bundle: NodeCG.Bundle): {
        readonly Logger: new (name: string) => NodeCG.Logger;
        readonly log: NodeCG.Logger;
        /**
         * The full NodeCG server config, including potentially sensitive keys.
         */
        readonly config: {
            readonly host: string;
            readonly port: number;
            readonly baseURL: string;
            readonly logging: {
                readonly console: {
                    readonly enabled: boolean;
                    readonly level: NodeCG.LogLevel;
                    readonly timestamps: boolean;
                    readonly replicants: boolean;
                };
                readonly file: {
                    readonly enabled: boolean;
                    readonly level: NodeCG.LogLevel;
                    readonly path: string;
                    readonly timestamps: boolean;
                    readonly replicants: boolean;
                };
            };
            readonly bundles: {
                readonly enabled: readonly string[] | null;
                readonly disabled: readonly string[] | null;
                readonly paths: readonly string[];
            };
            readonly sentry: {
                readonly enabled: boolean;
                readonly dsn: string;
            };
            readonly login: {
                readonly enabled: boolean;
                readonly sessionSecret: string;
                readonly forceHttpsReturn: boolean;
                readonly steam?: {
                    readonly enabled: boolean;
                    readonly apiKey: string;
                    readonly allowedIds: readonly string[];
                } | undefined;
                readonly twitch?: {
                    readonly enabled: boolean;
                    readonly clientID: string;
                    readonly clientSecret: string;
                    readonly scope: string;
                    readonly allowedUsernames: readonly string[];
                    readonly allowedIds: readonly string[];
                } | undefined;
                readonly local?: {
                    readonly enabled: boolean;
                    readonly allowedUsers: readonly {
                        readonly username: string;
                        readonly password: string;
                    }[];
                } | undefined;
                readonly discord?: {
                    readonly enabled: boolean;
                    readonly clientID: string;
                    readonly clientSecret: string;
                    readonly scope: string;
                    readonly allowedUserIDs: readonly string[];
                    readonly allowedGuilds: readonly {
                        readonly guildID: string;
                        readonly allowedRoleIDs: readonly string[];
                        readonly guildBotToken: string;
                    }[];
                } | undefined;
            };
            readonly ssl?: {
                readonly enabled: boolean;
                readonly allowHTTP: boolean;
                readonly keyPath: string;
                readonly certificatePath: string;
                readonly passphrase?: string | undefined;
            } | undefined;
        };
        /**
         * _Extension only_<br/>
         * Creates a new express router.
         * See the [express docs](http://expressjs.com/en/api.html#express.router) for usage.
         * @function
         */
        readonly Router: typeof express.Router;
        util: {
            /**
             * _Extension only_<br/>
             * Checks if a session is authorized. Intended to be used in express routes.
             * @param {object} req - A HTTP request.
             * @param {object} res - A HTTP response.
             * @param {function} next - The next middleware in the control flow.
             */
            authCheck: typeof ncgUtils.authCheck;
        };
        /**
         * _Extension only_<br/>
         * Object containing references to all other loaded extensions. To access another bundle's extension,
         * it _must_ be declared as a `bundleDependency` in your bundle's [`package.json`]{@tutorial manifest}.
         * @name NodeCG#extensions
         *
         * @example
         * // bundles/my-bundle/package.json
         * {
         *     "name": "my-bundle"
         *     ...
         *     "bundleDependencies": {
         *         "other-bundle": "^1.0.0"
         *     }
         * }
         *
         * // bundles/my-bundle/extension.js
         * module.exports = function (nodecg) {
         *     const otherBundle = nodecg.extensions['other-bundle'];
         *     // Now I can use `otherBundle`!
         * }
         */
        readonly extensions: Record<string, unknown>;
        /**
         * _Extension only_<br/>
         * Mounts Express middleware to the main server Express app.
         * Middleware mounted using this method comes _after_ all the middlware that NodeCG
         * uses internally.
         * See the [Express docs](http://expressjs.com/en/api.html#app.use) for usage.
         * @function
         */
        mount: NodeCG.Middleware;
        _memoizedLogger?: NodeCG.Logger | undefined;
        /**
         * _Extension only_<br/>
         * Gets the server Socket.IO context.
         * @function
         */
        readonly getSocketIOServer: () => RootNS;
        /**
         * Sends a message to a specific bundle. Also available as a static method.
         * See {@link NodeCG#sendMessage} for usage details.
         * @param {string} messageName - The name of the message.
         * @param {string} bundleName - The name of the target bundle.
         * @param {mixed} [data] - The data to send.
         * @param {function} [cb] - _Browser only_ The error-first callback to handle the server's
         * [acknowledgement](http://socket.io/docs/#sending-and-getting-data-%28acknowledgements%29) message, if any.
         * @return {Promise|undefined} - _Browser only_ A Promise that is rejected if the first argument provided to the
         * acknowledgement is an `Error`, otherwise it is resolved with the remaining arguments provided to the acknowledgement.
         * But, if a callback was provided, this return value will be `undefined`, and there will be no Promise.
         */
        sendMessageToBundle(messageName: string, bundleName: string, data?: unknown): void;
        /**
         * Sends a message with optional data within the current bundle.
         * Messages can be sent from client to server, server to client, or client to client.
         *
         * Messages are namespaced by bundle. To send a message in another bundle's namespace,
         * use {@link NodeCG#sendMessageToBundle}.
         *
         * When a `sendMessage` is used from a client context (i.e., graphic or dashboard panel),
         * it returns a `Promise` called an "acknowledgement". Your server-side code (i.e., extension)
         * can invoke this acknowledgement with whatever data (or error) it wants. Errors sent to acknowledgements
         * from the server will be properly serialized and intact when received on the client.
         *
         * Alternatively, if you do not wish to use a `Promise`, you can provide a standard error-first
         * callback as the last argument to `sendMessage`.
         *
         * If your server-side code has multiple listenFor handlers for your message,
         * you must first check if the acknowledgement has already been handled before
         * attempting to call it. You may so do by checking the `.handled` boolean
         * property of the `ack` function passed to your listenFor handler.
         *
         * See [Socket.IO's docs](http://socket.io/docs/#sending-and-getting-data-%28acknowledgements%29)
         * for more information on how acknowledgements work under the hood.
         *
         * @param {string} messageName - The name of the message.
         * @param {mixed} [data] - The data to send.
         * @param {function} [cb] - _Browser only_ The error-first callback to handle the server's
         * [acknowledgement](http://socket.io/docs/#sending-and-getting-data-%28acknowledgements%29) message, if any.
         * @return {Promise} - _Browser only_ A Promise that is rejected if the first argument provided to the
         * acknowledgement is an `Error`, otherwise it is resolved with the remaining arguments provided to the acknowledgement.
         *
         * @example <caption>Sending a normal message:</caption>
         * nodecg.sendMessage('printMessage', 'dope.');
         *
         * @example <caption>Sending a message and replying with an acknowledgement:</caption>
         * // bundles/my-bundle/extension.js
         * module.exports = function (nodecg) {
         *     nodecg.listenFor('multiplyByTwo', (value, ack) => {
         *         if (value === 4) {
         *             ack(new Error('I don\'t like multiplying the number 4!');
         *             return;
         *         }
         *
         *         // acknowledgements should always be error-first callbacks.
         *         // If you do not wish to send an error, send "null"
         *         if (ack && !ack.handled) {
         *             ack(null, value * 2);
         *         }
         *     });
         * }
         *
         * // bundles/my-bundle/graphics/script.js
         * // Both of these examples are functionally identical.
         *
         * // Promise acknowledgement
         * nodecg.sendMessage('multiplyByTwo', 2)
         *     .then(result => {
         *         console.log(result); // Will eventually print '4'
         *     .catch(error => {
         *         console.error(error);
         *     });
         *
         * // Error-first callback acknowledgement
         * nodecg.sendMessage('multiplyByTwo', 2, (error, result) => {
         *     if (error) {
         *         console.error(error);
         *         return;
         *     }
         *
         *     console.log(result); // Will eventually print '4'
         * });
         */
        sendMessage(messageName: string, data?: unknown): void;
        /**
         * Reads the value of a replicant once, and doesn't create a subscription to it. Also available as a static method.
         * @param {string} name - The name of the replicant.
         * @param {string} [bundle=CURR_BNDL] - The bundle namespace to in which to look for this replicant.
         * @param {function} cb - _Browser only_ The callback that handles the server's response which contains the value.
         * @example <caption>From an extension:</caption>
         * // Extensions have immediate access to the database of Replicants.
         * // For this reason, they can use readReplicant synchronously, without a callback.
         * module.exports = function (nodecg) {
         *     var myVal = nodecg.readReplicant('myVar', 'some-bundle');
         * }
         * @example <caption>From a graphic or dashboard panel:</caption>
         * // Graphics and dashboard panels must query the server to retrieve the value,
         * // and therefore must provide a callback.
         * nodecg.readReplicant('myRep', 'some-bundle', value => {
         *     // I can use 'value' now!
         *     console.log('myRep has the value '+ value +'!');
         * });
         */
        readReplicant<T = unknown>(name: string, param2?: string | NodeCG.Bundle): T | undefined;
        _replicantFactory: <V, O extends NodeCG.Replicant.Options<V> = NodeCG.Replicant.Options<V>>(name: string, namespace: string, opts: O) => ServerReplicant<V, O>;
        readonly bundleName: string;
        readonly bundleConfig: DeepReadonly<C>;
        readonly bundleVersion: string;
        readonly bundleGit: Readonly<NodeCG.Bundle.GitData>;
        _messageHandlers: {
            messageName: string;
            bundleName: string;
            func: NodeCG.ListenHandler;
        }[];
        listenFor(messageName: string, handlerFunc: NodeCG.ListenHandler): void;
        listenFor(messageName: string, bundleName: string, handlerFunc: NodeCG.ListenHandler): void;
        unlisten(messageName: string, handlerFunc: NodeCG.ListenHandler): boolean;
        unlisten(messageName: string, bundleName: string, handlerFunc: NodeCG.ListenHandler): boolean;
        Replicant<V_1, O_1 extends NodeCG.Replicant.OptionsNoDefault = NodeCG.Replicant.OptionsNoDefault>(name: string, namespace: string, opts?: O_1 | undefined): import("../shared/replicants.shared").AbstractReplicant<"server", V_1, O_1, false>;
        Replicant<V_2, O_2 extends NodeCG.Replicant.OptionsNoDefault = NodeCG.Replicant.OptionsNoDefault>(name: string, opts?: O_2 | undefined): import("../shared/replicants.shared").AbstractReplicant<"server", V_2, O_2, false>;
        Replicant<V_3, O_3 extends NodeCG.Replicant.OptionsNoDefault = NodeCG.Replicant.OptionsNoDefault>(name: string, namespaceOrOpts?: string | O_3 | undefined, opts?: O_3 | undefined): import("../shared/replicants.shared").AbstractReplicant<"server", V_3, O_3, false>;
        Replicant<V_4, O_4 extends NodeCG.Replicant.OptionsWithDefault<V_4> = NodeCG.Replicant.OptionsWithDefault<V_4>>(name: string, namespace: string, opts?: O_4 | undefined): import("../shared/replicants.shared").AbstractReplicant<"server", V_4, O_4, false>;
        Replicant<V_5, O_5 extends NodeCG.Replicant.OptionsWithDefault<V_5> = NodeCG.Replicant.OptionsWithDefault<V_5>>(name: string, opts?: O_5 | undefined): import("../shared/replicants.shared").AbstractReplicant<"server", V_5, O_5, false>;
        Replicant<V_6, O_6 extends NodeCG.Replicant.OptionsWithDefault<V_6> = NodeCG.Replicant.OptionsWithDefault<V_6>>(name: string, namespaceOrOpts?: string | O_6 | undefined, opts?: O_6 | undefined): import("../shared/replicants.shared").AbstractReplicant<"server", V_6, O_6, false>;
        Replicant<V_7, O_7 extends NodeCG.Replicant.Options<V_7> = NodeCG.Replicant.Options<V_7>>(name: string, namespace: string, opts?: O_7 | undefined): import("../shared/replicants.shared").AbstractReplicant<"server", V_7, O_7, false>;
        Replicant<V_8, O_8 extends NodeCG.Replicant.Options<V_8> = NodeCG.Replicant.Options<V_8>>(name: string, opts?: O_8 | undefined): import("../shared/replicants.shared").AbstractReplicant<"server", V_8, O_8, false>;
        readonly _emitter: import("events");
        addListener<K extends import("../shared/typed-emitter").EventKey<ExtensionEventMap & {
            newListener(event: string, listener: import("../shared/typed-emitter").EventReceiver<unknown>): void;
        }>>(eventName: K, fn: (ExtensionEventMap & {
            newListener(event: string, listener: import("../shared/typed-emitter").EventReceiver<unknown>): void;
        })[K]): void;
        on<K_1 extends import("../shared/typed-emitter").EventKey<ExtensionEventMap & {
            newListener(event: string, listener: import("../shared/typed-emitter").EventReceiver<unknown>): void;
        }>>(eventName: K_1, fn: (ExtensionEventMap & {
            newListener(event: string, listener: import("../shared/typed-emitter").EventReceiver<unknown>): void;
        })[K_1]): void;
        off<K_2 extends import("../shared/typed-emitter").EventKey<ExtensionEventMap & {
            newListener(event: string, listener: import("../shared/typed-emitter").EventReceiver<unknown>): void;
        }>>(eventName: K_2, fn: (ExtensionEventMap & {
            newListener(event: string, listener: import("../shared/typed-emitter").EventReceiver<unknown>): void;
        })[K_2]): void;
        removeListener<K_3 extends import("../shared/typed-emitter").EventKey<ExtensionEventMap & {
            newListener(event: string, listener: import("../shared/typed-emitter").EventReceiver<unknown>): void;
        }>>(eventName: K_3, fn: (ExtensionEventMap & {
            newListener(event: string, listener: import("../shared/typed-emitter").EventReceiver<unknown>): void;
        })[K_3]): void;
        emit<K_4 extends import("../shared/typed-emitter").EventKey<ExtensionEventMap & {
            newListener(event: string, listener: import("../shared/typed-emitter").EventReceiver<unknown>): void;
        }>>(eventName: K_4, ...params: Parameters<(ExtensionEventMap & {
            newListener(event: string, listener: import("../shared/typed-emitter").EventReceiver<unknown>): void;
        })[K_4]>): void;
        once<K_5 extends import("../shared/typed-emitter").EventKey<ExtensionEventMap & {
            newListener(event: string, listener: import("../shared/typed-emitter").EventReceiver<unknown>): void;
        }>>(eventName: K_5, fn: (ExtensionEventMap & {
            newListener(event: string, listener: import("../shared/typed-emitter").EventReceiver<unknown>): void;
        })[K_5]): void;
        setMaxListeners(max: number): void;
        listenerCount(eventName: string): number;
        listeners<K_6 extends import("../shared/typed-emitter").EventKey<ExtensionEventMap & {
            newListener(event: string, listener: import("../shared/typed-emitter").EventReceiver<unknown>): void;
        }>>(eventName: K_6): (ExtensionEventMap & {
            newListener(event: string, listener: import("../shared/typed-emitter").EventReceiver<unknown>): void;
        })[K_6][];
    };
    sendMessageToBundle(messageName: string, bundleName: string, data?: unknown): void;
    readReplicant<T_1 = unknown>(name: string, namespace: string): T_1 | undefined;
    Replicant<V_9, O_9 extends NodeCG.Replicant.Options<V_9> = NodeCG.Replicant.Options<V_9>>(name: string, namespace: string, opts: O_9): ServerReplicant<V_9, O_9>;
    version: any;
    declaredReplicants: Map<string, Map<string, import("../shared/replicants.shared").AbstractReplicant<"client", any, NodeCG.Replicant.Options<any>, false>>>;
    waitForReplicants(...replicants: import("../shared/replicants.shared").AbstractReplicant<"client", any, NodeCG.Replicant.Options<any>, false>[]): Promise<void>;
};
export default _default;
//# sourceMappingURL=api.server.d.ts.map