PortalAPI
Interface: PortalAPI
The Portal API interface. Provides namespace-based access to handlers and controllers.
Extends
Properties
| Property | Modifier | Type | Description |
|---|---|---|---|
isInitialized | readonly | boolean | Whether the portal has been initialized |
mode | readonly | string | Current runtime mode |
Methods
all()
all(): HandlerRecord<unknown, Record<string, unknown>>[]Get all handler records across all namespaces
Returns
HandlerRecord<unknown, Record<string, unknown>>[]
clearCache()
clearCache(): voidClear all cached data
Returns
void
ensureRoute()
ensureRoute(namespace, route): Promise<void>Ensure a route's manifest is loaded
Parameters
| Parameter | Type |
|---|---|
namespace | string |
route | string |
Returns
Promise<void>
getByType()
getByType(type): Record<string,
| HandlerRecord<unknown, Record<string, unknown>>
| HandlerRecord<unknown, Record<string, unknown>>[]>Get handlers by type string (e.g., 'discord:commands')
Parameters
| Parameter | Type |
|---|---|
type | string |
Returns
Record<string,
| HandlerRecord<unknown, Record<string, unknown>>
| HandlerRecord<unknown, Record<string, unknown>>[]>
getController()
getController<C>(
namespace,
route,
key): CGet controller for a handler
Type Parameters
| Type Parameter | Default type |
|---|---|
C | unknown |
Parameters
| Parameter | Type |
|---|---|
namespace | string |
route | string |
key | string |
Returns
C
getHandler()
getHandler<T>(
namespace,
route,
key): Promise<HandlerModule<T, Record<string, unknown>>>Get handler with auto-import
Type Parameters
| Type Parameter | Default type |
|---|---|
T | unknown |
Parameters
| Parameter | Type |
|---|---|
namespace | string |
route | string |
key | string |
Returns
Promise<HandlerModule<T, Record<string, unknown>>>
getRecord()
getRecord(
namespace,
route,
key): HandlerRecord<unknown, Record<string, unknown>>Get record without importing
Parameters
| Parameter | Type |
|---|---|
namespace | string |
route | string |
key | string |
Returns
HandlerRecord<unknown, Record<string, unknown>>
importHandler()
importHandler(
namespace,
route,
key): Promise<void>Import a handler lazily
Parameters
| Parameter | Type |
|---|---|
namespace | string |
route | string |
key | string |
Returns
Promise<void>
module()
module(name): ModuleControllerGet a module controller for cross-cutting enable/disable
Parameters
| Parameter | Type |
|---|---|
name | string |
Returns
registerController()
registerController(
namespace,
routeName,
factory): voidRegister a controller factory
Parameters
| Parameter | Type |
|---|---|
namespace | string |
routeName | string |
factory | ControllerFactory<unknown> |
Returns
void
registerNamespace()
registerNamespace(namespace, routes): voidRegister a namespace with its route names
Parameters
| Parameter | Type |
|---|---|
namespace | string |
routes | string[] |
Returns
void
registerPluginState()
registerPluginState(namespace, state): voidRegister plugin state for controller context
Parameters
| Parameter | Type |
|---|---|
namespace | string |
state | unknown |
Returns
void
registerRoute()
registerRoute(
namespace,
routeName,
handlers): voidRegister a route's handlers
Parameters
| Parameter | Type |
|---|---|
namespace | string |
routeName | string |
handlers | Record<string, | HandlerRecord<unknown, Record<string, unknown>> | HandlerRecord<unknown, Record<string, unknown>>[]> |
Returns
void
reloadHandler()
reloadHandler(
namespace,
route,
key): Promise<void>Reload a handler (for HMR)
Parameters
| Parameter | Type |
|---|---|
namespace | string |
route | string |
key | string |
Returns
Promise<void>
reloadRoute()
reloadRoute(namespace, route): Promise<void>Reload all handlers in a route (for HMR)
Parameters
| Parameter | Type |
|---|---|
namespace | string |
route | string |
Returns
Promise<void>
