harperdb
Version:
HarperDB is a distributed database, caching service, streaming broker, and application development platform focused on performance and ease of use.
37 lines (36 loc) • 1.65 kB
TypeScript
import { Resource } from './Resource.ts';
interface ResourceEntry {
Resource: typeof Resource;
path: string;
exportTypes: any;
hasSubPaths: boolean;
relativeURL: string;
}
/**
* This is the global set of all resources that have been registered on this server.
*/
export declare class Resources extends Map<string, ResourceEntry> {
isWorker: boolean;
loginPath?: (request: any) => string;
allTypes: Map<any, any>;
set(path: any, resource: any, exportTypes?: {
[key: string]: boolean;
}, force?: boolean): void;
/**
* Find the best (longest) match resource path that matches the (beginning of the) provided path, in order to find
* the correct Resource to handle this URL path.
* @param path The URL Path
* @param exportType Optional request content or protocol type, allows control of which protocols can access a resource
* and future layering of resources (for defining HTML handlers
* that can further transform data from the main structured object resources).
* @return The matched Resource class. Note that the remaining path is "returned" by setting the relativeURL property
*/
getMatch(url: string, exportType?: string): ResourceEntry | undefined;
getResource(path: string, resourceInfo: any): Resource<any> | Promise<Resource<any>>;
call(path: string, request: any, callback: Function): Promise<any>;
setRepresentation(path: any, type: any, representation: any): void;
}
export declare let resources: Resources;
export declare function resetResources(): Resources;
export declare function keyArrayToString(key: any): any;
export {};