UNPKG

nephele

Version:

Highly customizable and extensible WebDAV server for Node.js and Express.

57 lines (56 loc) 1.95 kB
import { Request } from 'express'; import type { Adapter, Authenticator, AuthResponse, Plugin } from './Interfaces/index.js'; export type AdapterConfig = Adapter | { [k: string]: Adapter; }; type DefinedAdapter = { adapter: AdapterConfig; }; type DynamicAdapter = { adapter: (request: Request, response: AuthResponse) => Promise<AdapterConfig>; }; export type AuthenticatorConfig = Authenticator | { [k: string]: Authenticator; }; type DefinedAuthenticator = { authenticator: AuthenticatorConfig; }; type DynamicAuthenticator = { authenticator: (request: Request, response: AuthResponse) => Promise<AuthenticatorConfig>; }; type Plugins = Plugin[]; export type PluginsConfig = Plugins | { [k: string]: Plugins; } | undefined; type DefinedPlugins = { plugins?: PluginsConfig; }; type DynamicPlugins = { plugins?: (request: Request, response: AuthResponse) => Promise<PluginsConfig>; }; export type Config = (DefinedAdapter | DynamicAdapter) & (DefinedAuthenticator | DynamicAuthenticator) & (DefinedPlugins | DynamicPlugins); export interface Options { compression: boolean; minLockTimeout: number; maxLockTimeout: number; errorHandler: (code: number, message: string, request: Request, response: AuthResponse, error?: Error) => Promise<void>; } export declare const defaults: Options; export declare function _getAdapter(unencodedPath: string, config: AdapterConfig): { adapter: Adapter; baseUrl: string; }; export declare function getAdapter(unencodedPath: string, config: AdapterConfig, environment: { request: Request; response: AuthResponse; plugins?: Plugins; }): Promise<{ adapter: Adapter; baseUrl: string; }>; export declare function getAuthenticator(unencodedPath: string, config: AuthenticatorConfig): Authenticator; export declare function getPlugins(unencodedPath: string, config: PluginsConfig): { plugins: Plugins; baseUrl: string; }; export {};