harperdb
Version:
HarperDB is a distributed database, caching service, streaming broker, and application development platform focused on performance and ease of use.
36 lines (35 loc) • 1.61 kB
TypeScript
import { Resource } from './Resource';
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;
set(path: any, resource: any, export_types?: {
[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 export_type 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, export_type?: string): ResourceEntry | undefined;
getResource(path: string, resource_info: any): Resource | Promise<Resource>;
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 {};