@peacockproject/core
Version:
Type definitions for Peacock's core.
53 lines (52 loc) • 1.77 kB
TypeScript
import { NextFunction, Response } from "express";
import { GameVersion, RequestWithJwt } from "../types/types";
import { SyncBailHook, SyncHook } from "../hooksImpl";
/**
* Router triggered before {@link menuSystemRouter}.
*/
declare const menuSystemPreRouter: import("express-serve-static-core").Router;
declare const menuSystemRouter: import("express-serve-static-core").Router;
/**
* A class for managing the menu system's fetched JSON data.
*/
export declare class MenuSystemDatabase {
/**
* The hooks.
*/
hooks: {
/**
* A hook for getting a list of configurations which the game should
* fetch from the server.
*
* Params:
* - configs: The configurations list (mutable). These should be full paths,
* for instance, `/menusystem/data/testing.json`.
* - gameVersion: The game's version.
*/
getDatabaseDiff: SyncHook<[configs: string[], gameVersion: GameVersion]>;
/**
* A hook for getting the requested configuration.
*
* Params:
* - configName: The requested file's name.
* - gameVersion: The game's version.
*
* Returns: The file as an object.
*/
getConfig: SyncBailHook<[
configName: string,
gameVersion: GameVersion
], unknown>;
};
constructor();
/**
* Express middleware for fetching configurations.
*
* @param req The request.
* @param res The response.
* @param next The next function.
*/
static configMiddleware(req: RequestWithJwt, res: Response, next: NextFunction): void;
}
export declare const menuSystemDatabase: MenuSystemDatabase;
export { menuSystemRouter, menuSystemPreRouter };