import { JSONObject } from "kuzzle-sdk"; import { EmbeddedSDK } from "../shared/sdk/embeddedSdk"; import { EventDefinition } from "../../../index"; import { BackendCluster, BackendConfig, BackendController, BackendHook, BackendImport, BackendPipe, BackendPlugin, BackendStorage, BackendVault, BackendOpenApi, BackendErrors, BackendSubscription } from "./index"; import { Logger } from "../../kuzzle/Logger"; export declare class Backend { private _kuzzle; private _name; private _sdk; private _started; protected _pipes: {}; protected _hooks: {}; protected _controllers: {}; protected _plugins: {}; protected _import: { mappings: {}; onExistingUsers: string; profiles: {}; roles: {}; userMappings: {}; users: {}; }; protected _vaultKey?: string; protected _secretsFile?: string; protected _installationsWaitingList: Array<{ id: string; description?: string; handler: () => void; }>; /** * Requiring the PluginObject on module top level creates cyclic dependency */ protected PluginObject: any; /** * Application version */ version: string; /** * Current Git commit (if available) */ commit: string | null; /** * Errors manager */ kerror: any; /** * Pipe definition manager * * @method register - Registers a new pipe on an event */ pipe: BackendPipe; /** * Hook definition manager * * @method register - Registers a new hook on an event */ hook: BackendHook; /** * BackendVault * * By default Kuzzle will try to load the following locations: * - local path: ./config/secrets.enc.json * - environment variable: KUZZLE_SECRETS_FILE * * By default Kuzzle will try to load the decryption key from the following * environment variable: * - KUZZLE_VAULT_KEY */ vault: BackendVault; /** * Configuration definition manager * * @method set - Sets a configuration value * @method merge - Merges a configuration object into the current configuration */ config: BackendConfig; /** * Controller manager * * @method add - Adds a new controller definition * @method use - Uses a controller instance */ controller: BackendController; /** * Plugin manager * * @method use - Uses a plugin instance */ plugin: BackendPlugin; /** * InternalLogger * * @method debug * @method info * @method warn * @method error * @method verbose */ log: Logger; /** * Storage manager */ storage: BackendStorage; /** * Cluster manager */ cluster: BackendCluster; /** * Import manager * * @method mappings - Import mappings * @method profiles - Import profiles * @method roles - Import roles * @method users - Import users * @method userMappings - Import user mappings */ import: BackendImport; /** * OpenApi manager */ openApi: BackendOpenApi; /** * Standard errors */ errors: BackendErrors; subscription: BackendSubscription; /** * @deprecated * * Use the app.import.xxx() feature instead. * * Support for old features available before Kuzzle as a framework * to avoid breaking existing deployments. * */ _support: JSONObject; private readonly nodeId; /** * Instantiates a new Kuzzle application * * @param name - Your application name */ constructor(name: string); /** * Starts the Kuzzle application with the defined features */ start(): Promise; /** * Triggers an event * * @param - Event name * @param - Event payload * * @returns {Promise} */ trigger(event: TEventDefinition["name"], ...payload: TEventDefinition["args"]): Promise; /** * Register a method that will be executed only once on any given environment. * If this method throws, the app won't start. * * @param {string} id - Unique id needed to differenciate each installation * @param {Function} handler - Method to execute only once * @param {string | undefined} description - Optional: Describe the purpose of this installation * */ install(id: string, handler: () => Promise, description?: string): void; /** * Application Name */ get name(): string; /** * EmbeddedSDK instance */ get sdk(): EmbeddedSDK; private get _instanceProxy(); get started(): boolean; protected set started(started: boolean); /** * Try to read the current commit hash. */ private _readCommit; }