nephele
Version:
Highly customizable and extensible WebDAV server for Node.js and Express.
299 lines (298 loc) • 11 kB
TypeScript
import type { Request } from 'express';
import type { Method } from '../Methods/Method.js';
import type { AuthResponse } from './Authenticator.js';
import type { Adapter } from './Adapter.js';
import type { Properties } from './Properties.js';
import type { Resource } from './Resource.js';
import type { Lock } from './Lock.js';
export type PluginEvent = Exclude<keyof Plugin, 'baseUrl'>;
export interface Plugin {
baseUrl?: URL;
prepareAdapter?: (request: Request, response: AuthResponse, adapter: Adapter) => Promise<Adapter | undefined>;
prepare?: (request: Request, response: AuthResponse) => Promise<false | void>;
beforeAuth?: (request: Request, response: AuthResponse) => Promise<false | void>;
afterAuth?: (request: Request, response: AuthResponse) => Promise<false | void>;
begin?: (request: Request, response: AuthResponse) => Promise<false | void>;
close?: (request: Request, response: AuthResponse) => Promise<void>;
beforeCheckAuthorization?: (request: Request, response: AuthResponse, data: {
method: Method;
methodName: string;
url: URL;
}) => Promise<void>;
afterCheckAuthorization?: (request: Request, response: AuthResponse, data: {
method: Method;
methodName: string;
url: URL;
}) => Promise<void>;
beginGet?: (request: Request, response: AuthResponse, data: {
method: Method;
url: URL;
}) => Promise<false | void>;
preGet?: (request: Request, response: AuthResponse, data: {
method: Method;
resource: Resource;
properties: Properties;
}) => Promise<false | void>;
beforeGet?: (request: Request, response: AuthResponse, data: {
method: Method;
resource: Resource;
properties: Properties;
}) => Promise<false | void>;
afterGet?: (request: Request, response: AuthResponse, data: {
method: Method;
resource: Resource;
properties: Properties;
}) => Promise<void>;
beginHead?: (request: Request, response: AuthResponse, data: {
method: Method;
url: URL;
}) => Promise<false | void>;
preHead?: (request: Request, response: AuthResponse, data: {
method: Method;
resource: Resource;
properties: Properties;
}) => Promise<false | void>;
beforeHead?: (request: Request, response: AuthResponse, data: {
method: Method;
resource: Resource;
properties: Properties;
}) => Promise<false | void>;
afterHead?: (request: Request, response: AuthResponse, data: {
method: Method;
resource: Resource;
properties: Properties;
}) => Promise<void>;
beginCopy?: (request: Request, response: AuthResponse, data: {
method: Method;
url: URL;
}) => Promise<false | void>;
preCopy?: (request: Request, response: AuthResponse, data: {
method: Method;
resource: Resource;
destination: URL | undefined;
depth: string;
overwrite: string | undefined;
}) => Promise<false | void>;
beforeCopy?: (request: Request, response: AuthResponse, data: {
method: Method;
resource: Resource;
destination: Resource;
exists: boolean;
depth: string;
overwrite: string | undefined;
}) => Promise<false | void>;
afterCopy?: (request: Request, response: AuthResponse, data: {
method: Method;
resource: Resource;
destination: Resource;
exists: boolean;
depth: string;
overwrite: string | undefined;
}) => Promise<void>;
beginDelete?: (request: Request, response: AuthResponse, data: {
method: Method;
url: URL;
}) => Promise<false | void>;
preDelete?: (request: Request, response: AuthResponse, data: {
method: Method;
resource: Resource;
}) => Promise<false | void>;
beforeDelete?: (request: Request, response: AuthResponse, data: {
method: Method;
resource: Resource;
}) => Promise<false | void>;
afterDelete?: (request: Request, response: AuthResponse, data: {
method: Method;
resource: Resource;
}) => Promise<void>;
beginLock?: (request: Request, response: AuthResponse, data: {
method: Method;
url: URL;
}) => Promise<false | void>;
preLock?: (request: Request, response: AuthResponse, data: {
method: Method;
resource: Resource;
}) => Promise<false | void>;
preLockRefresh?: (request: Request, response: AuthResponse, data: {
method: Method;
resource: Resource;
}) => Promise<false | void>;
beforeLockRefresh?: (request: Request, response: AuthResponse, data: {
method: Method;
resource: Resource;
lock: Lock;
}) => Promise<false | void>;
beforeLockProvisional?: (request: Request, response: AuthResponse, data: {
method: Method;
resource: Resource;
}) => Promise<false | void>;
beforeLock?: (request: Request, response: AuthResponse, data: {
method: Method;
resource: Resource;
lock: Lock;
}) => Promise<false | void>;
afterLock?: (request: Request, response: AuthResponse, data: {
method: Method;
resource: Resource;
lock: Lock;
}) => Promise<void>;
beginMkcol?: (request: Request, response: AuthResponse, data: {
method: Method;
url: URL;
}) => Promise<false | void>;
preMkcol?: (request: Request, response: AuthResponse, data: {
method: Method;
resource: Resource;
}) => Promise<false | void>;
beforeMkcol?: (request: Request, response: AuthResponse, data: {
method: Method;
resource: Resource;
}) => Promise<false | void>;
afterMkcol?: (request: Request, response: AuthResponse, data: {
method: Method;
resource: Resource;
}) => Promise<void>;
beginMove?: (request: Request, response: AuthResponse, data: {
method: Method;
url: URL;
}) => Promise<false | void>;
preMove?: (request: Request, response: AuthResponse, data: {
method: Method;
resource: Resource;
destination: URL | undefined;
overwrite: string | undefined;
}) => Promise<false | void>;
beforeMove?: (request: Request, response: AuthResponse, data: {
method: Method;
resource: Resource;
destination: Resource;
exists: boolean;
overwrite: string | undefined;
}) => Promise<false | void>;
afterMove?: (request: Request, response: AuthResponse, data: {
method: Method;
resource: Resource;
destination: Resource;
exists: boolean;
overwrite: string | undefined;
}) => Promise<void>;
beginOptions?: (request: Request, response: AuthResponse, data: {
method: Method;
url: URL;
}) => Promise<false | void>;
preOptions?: (request: Request, response: AuthResponse, data: {
method: Method;
url: URL;
complianceClasses: string[];
allowedMethods: string[];
cacheControl: string;
}) => Promise<false | void>;
beforeOptions?: (request: Request, response: AuthResponse, data: {
method: Method;
url: URL;
complianceClasses: string[];
allowedMethods: string[];
cacheControl: string;
}) => Promise<false | void>;
afterOptions?: (request: Request, response: AuthResponse, data: {
method: Method;
url: URL;
complianceClasses: string[];
allowedMethods: string[];
cacheControl: string;
}) => Promise<void>;
beginPropfind?: (request: Request, response: AuthResponse, data: {
method: Method;
url: URL;
}) => Promise<false | void>;
prePropfind?: (request: Request, response: AuthResponse, data: {
method: Method;
resource: Resource;
depth: string;
}) => Promise<false | void>;
beforePropfind?: (request: Request, response: AuthResponse, data: {
method: Method;
resource: Resource;
depth: string;
}) => Promise<false | void>;
afterPropfind?: (request: Request, response: AuthResponse, data: {
method: Method;
resource: Resource;
depth: string;
}) => Promise<void>;
beginProppatch?: (request: Request, response: AuthResponse, data: {
method: Method;
url: URL;
}) => Promise<false | void>;
preProppatch?: (request: Request, response: AuthResponse, data: {
method: Method;
resource: Resource;
depth: string;
}) => Promise<false | void>;
beforeProppatch?: (request: Request, response: AuthResponse, data: {
method: Method;
resource: Resource;
depth: string;
}) => Promise<false | void>;
afterProppatch?: (request: Request, response: AuthResponse, data: {
method: Method;
resource: Resource;
depth: string;
}) => Promise<void>;
beginPut?: (request: Request, response: AuthResponse, data: {
method: Method;
url: URL;
}) => Promise<false | void>;
prePut?: (request: Request, response: AuthResponse, data: {
method: Method;
resource: Resource;
newResource: boolean;
}) => Promise<false | void>;
beforePut?: (request: Request, response: AuthResponse, data: {
method: Method;
resource: Resource;
newResource: boolean;
}) => Promise<false | void>;
afterPut?: (request: Request, response: AuthResponse, data: {
method: Method;
resource: Resource;
newResource: boolean;
}) => Promise<void>;
beginUnlock?: (request: Request, response: AuthResponse, data: {
method: Method;
url: URL;
}) => Promise<false | void>;
preUnlock?: (request: Request, response: AuthResponse, data: {
method: Method;
resource: Resource;
lockTokenHeader: string | undefined;
}) => Promise<false | void>;
beforeUnlock?: (request: Request, response: AuthResponse, data: {
method: Method;
resource: Resource;
token: string;
lock: Lock | undefined;
}) => Promise<false | void>;
afterUnlock?: (request: Request, response: AuthResponse, data: {
method: Method;
resource: Resource;
token: string;
lock: Lock | undefined;
}) => Promise<void>;
beginMethod?: (request: Request, response: AuthResponse, data: {
method: Method;
url: URL;
}) => Promise<false | void>;
preMethod?: (request: Request, response: AuthResponse, data: {
method: string;
url: URL;
}) => Promise<false | void>;
beforeMethod?: (request: Request, response: AuthResponse, data: {
method: Method;
url: URL;
}) => Promise<false | void>;
afterMethod?: (request: Request, response: AuthResponse, data: {
method: Method;
url: URL;
}) => Promise<void>;
}