harperdb
Version:
HarperDB is a distributed database, caching service, streaming broker, and application development platform focused on performance and ease of use.
52 lines (51 loc) • 2.1 kB
TypeScript
import { EventEmitter } from 'node:events';
import { databaseEventsEmitter } from '../resources/databases.ts';
import { type Server } from '../server/Server.ts';
import { EntryHandler, type onEntryEventHandler } from './EntryHandler.ts';
import type { Logger } from './Logger.ts';
import { OptionsWatcher } from './OptionsWatcher.ts';
import type { Resources } from '../resources/Resources.ts';
import type { FileAndURLPathConfig } from './Component.ts';
import { FilesOption } from './deriveGlobOptions.ts';
export declare class MissingDefaultFilesOptionError extends Error {
constructor();
}
export type ScopeEventsMap = {
all: [...args: unknown[]];
close: [];
error: [error: unknown];
ready: [];
[record: string]: [...args: unknown[]];
};
/**
* This class is what is passed to the `handleApplication` function of an extension.
*
* It is imperative that the instance is "ready" before it's passed to the `handleApplication` function
* so that the developer can immediately start using `scope.options`, etc.
*
*/
export declare class Scope extends EventEmitter<ScopeEventsMap> {
#private;
options: OptionsWatcher;
resources: Resources;
server: Server;
ready: Promise<any[]>;
databaseEvents: typeof databaseEventsEmitter;
constructor(appName: string, pluginName: string, directory: string, configFilePath: string, resources: Resources, server: Server, logger?: Logger);
get logger(): Logger;
get appName(): string;
get pluginName(): string;
get directory(): string;
get configFilePath(): string;
close(): this;
handleEntry(files: FilesOption | FileAndURLPathConfig, handler: onEntryEventHandler): EntryHandler;
handleEntry(handler: onEntryEventHandler): EntryHandler;
handleEntry(): EntryHandler;
requestRestart(): void;
/**
* Wait for all entry handlers' initial loads to complete.
* This includes waiting for any async operations in entry handler callbacks.
* Called by the component loader after handleApplication completes.
*/
waitForInitialLoads(): Promise<void>;
}