@nephele/adapter-nymph
Version:
Nymph.js based deduping file adapter for the Nephele WebDAV server.
55 lines (54 loc) • 2.54 kB
TypeScript
import type { Request } from 'express';
import { Nymph } from '@nymphjs/nymph';
import type { Adapter as AdapterInterface, AuthResponse, Method, User } from 'nephele';
import { Lock as NymphLock } from './entities/Lock.js';
import { Resource as NymphResource, ResourceData as NymphResourceData } from './entities/Resource.js';
import Resource from './Resource.js';
export type AdapterConfig = {
root: string;
nymph?: Nymph;
getRootResource?: () => Promise<NymphResource & NymphResourceData>;
};
export default class Adapter implements AdapterInterface {
root: string;
nymph: Nymph;
getRootResource: () => Promise<NymphResource & NymphResourceData>;
NymphLock: typeof NymphLock;
NymphResource: typeof NymphResource;
_rootResource: (NymphResource & NymphResourceData) | null;
get tempRoot(): string;
get blobRoot(): string;
constructor({ nymph, root, getRootResource }: AdapterConfig);
urlToPathParts(url: URL, baseUrl: URL): string[] | null;
pathPartsToUrl(pathParts: string[], baseUrl: URL): URL;
getComplianceClasses(_url: URL, _request: Request, _response: AuthResponse): Promise<string[]>;
getAllowedMethods(_url: URL, _request: Request, _response: AuthResponse): Promise<never[]>;
getOptionsResponseCacheControl(_url: URL, _request: Request, _response: AuthResponse): Promise<string>;
isAuthorized(url: URL, method: string, baseUrl: URL, user: User): Promise<boolean>;
getNymphResource(pathParts: string[], rootResource: NymphResource & NymphResourceData): Promise<(NymphResource & {
name: string;
size: number;
contentType: string;
collection: boolean;
hash: string;
properties: {
[k: string]: string;
};
parent: (NymphResource & NymphResourceData) | null;
} & import("@nymphjs/tilmeld").AccessControlData) | null>;
getNymphParent(pathParts: string[], rootResource: NymphResource & NymphResourceData): Promise<false | (NymphResource & {
name: string;
size: number;
contentType: string;
collection: boolean;
hash: string;
properties: {
[k: string]: string;
};
parent: (NymphResource & NymphResourceData) | null;
} & import("@nymphjs/tilmeld").AccessControlData)>;
getResource(url: URL, baseUrl: URL): Promise<Resource>;
newResource(url: URL, baseUrl: URL): Promise<Resource>;
newCollection(url: URL, baseUrl: URL): Promise<Resource>;
getMethod(method: string): typeof Method;
}