TypeScript Types
All TypeScript interfaces and types used across the NaaP plugin ecosystem.
Core Types#
AuthUser#
Represents the authenticated user.
TypeScript
| 1 | interface AuthUser { |
| 2 | id: string; |
| 3 | email?: string | null; |
| 4 | displayName?: string | null; |
| 5 | avatarUrl?: string | null; |
| 6 | roles: string[]; |
| 7 | permissions: Array<{ |
| 8 | resource: string; |
| 9 | action: string; |
| 10 | }>; |
| 11 | } |
ShellContext#
The context object passed to plugins at mount time.
TypeScript
| 1 | interface ShellContext { |
| 2 | auth: IAuthService; |
| 3 | navigate: (path: string) => void; |
| 4 | eventBus: IEventBus; |
| 5 | theme: IThemeService; |
| 6 | notifications: INotificationService; |
| 7 | integrations: IIntegrationService; |
| 8 | logger: ILoggerService; |
| 9 | permissions: IPermissionService; |
| 10 | tenant?: ITenantService; |
| 11 | team?: ITeamContext; |
| 12 | capabilities?: ICapabilityService; |
| 13 | version: string; |
| 14 | } |
Plugin Types#
PluginManifest#
The runtime representation of a plugin's configuration.
TypeScript
| 1 | interface PluginManifest { |
| 2 | name: string; |
| 3 | displayName: string; |
| 4 | version: string; |
| 5 | description?: string; |
| 6 | category: PluginCategory; |
| 7 | enabled: boolean; |
| 8 | order: number; |
| 9 | routes?: string[]; |
| 10 | entryUrl?: string; |
| 11 | metadata?: Record<string, unknown>; |
| 12 | } |
PluginCategory#
Valid plugin category values.
TypeScript
| 1 | type PluginCategory = |
| 2 | | 'analytics' |
| 3 | | 'communication' |
| 4 | | 'developer-tools' |
| 5 | | 'finance' |
| 6 | | 'infrastructure' |
| 7 | | 'integration' |
| 8 | | 'monitoring' |
| 9 | | 'networking' |
| 10 | | 'security' |
| 11 | | 'storage' |
| 12 | | 'other'; |
PluginFrontend#
Frontend configuration in the manifest.
TypeScript
| 1 | interface PluginFrontend { |
| 2 | entry: string; |
| 3 | devPort?: number; |
| 4 | routes: string[]; |
| 5 | navigation?: { |
| 6 | label: string; |
| 7 | icon: string; |
| 8 | section?: 'main' | 'network'; |
| 9 | order?: number; |
| 10 | }; |
| 11 | } |
PluginBackend#
Backend configuration in the manifest.
TypeScript
| 1 | interface PluginBackend { |
| 2 | entry: string; |
| 3 | port: number; |
| 4 | apiPrefix: string; |
| 5 | healthCheck?: string; |
| 6 | } |
PluginDatabase#
Database configuration in the manifest.
TypeScript
| 1 | interface PluginDatabase { |
| 2 | type: 'postgresql'; |
| 3 | schema: string; |
| 4 | } |
Service Interfaces#
IAuthService#
TypeScript
| 1 | interface IAuthService { |
| 2 | getUser(): AuthUser | null; |
| 3 | getToken(): Promise<string>; |
| 4 | hasRole(role: string): boolean; |
| 5 | hasPermission(resource: string, action: string): boolean; |
| 6 | isAuthenticated(): boolean; |
| 7 | } |
IEventBus#
TypeScript
| 1 | interface IEventBus { |
| 2 | emit(event: string, data?: unknown): void; |
| 3 | on(event: string, callback: (data: unknown) => void): () => void; |
| 4 | request<TReq, TRes>( |
| 5 | event: string, |
| 6 | data?: TReq, |
| 7 | options?: { timeout?: number } |
| 8 | ): Promise<TRes>; |
| 9 | handleRequest<TReq, TRes>( |
| 10 | event: string, |
| 11 | handler: (data: TReq) => Promise<TRes> |
| 12 | ): () => void; |
| 13 | } |
INotificationService#
TypeScript
| 1 | interface INotificationService { |
| 2 | success(message: string, options?: NotificationOptions): void; |
| 3 | error(message: string, options?: NotificationOptions): void; |
| 4 | warning(message: string, options?: NotificationOptions): void; |
| 5 | info(message: string, options?: NotificationOptions): void; |
| 6 | } |
| 7 | |
| 8 | interface NotificationOptions { |
| 9 | duration?: number; |
| 10 | action?: { |
| 11 | label: string; |
| 12 | onClick: () => void; |
| 13 | }; |
| 14 | } |
IThemeService#
TypeScript
| 1 | interface IThemeService { |
| 2 | mode: 'light' | 'dark'; |
| 3 | toggle(): void; |
| 4 | setMode(mode: 'light' | 'dark'): void; |
| 5 | } |
ILoggerService#
TypeScript
| 1 | interface ILoggerService { |
| 2 | info(message: string, meta?: Record<string, unknown>): void; |
| 3 | warn(message: string, meta?: Record<string, unknown>): void; |
| 4 | error(message: string, meta?: Record<string, unknown>): void; |
| 5 | debug(message: string, meta?: Record<string, unknown>): void; |
| 6 | } |
IIntegrationService#
TypeScript
| 1 | interface IIntegrationService { |
| 2 | ai: IAIService; |
| 3 | storage: IStorageService; |
| 4 | email: IEmailService; |
| 5 | } |
| 6 | |
| 7 | interface IAIService { |
| 8 | complete(options: { |
| 9 | prompt: string; |
| 10 | model?: string; |
| 11 | maxTokens?: number; |
| 12 | }): Promise<{ text: string }>; |
| 13 | } |
| 14 | |
| 15 | interface IStorageService { |
| 16 | upload(file: File, options?: { path?: string }): Promise<string>; |
| 17 | delete(path: string): Promise<void>; |
| 18 | getUrl(path: string): string; |
| 19 | } |
| 20 | |
| 21 | interface IEmailService { |
| 22 | send(options: { |
| 23 | to: string; |
| 24 | subject: string; |
| 25 | body: string; |
| 26 | }): Promise<void>; |
| 27 | } |
ITeamContext#
TypeScript
| 1 | interface ITeamContext { |
| 2 | id: string | null; |
| 3 | name: string | null; |
| 4 | role: string | null; |
| 5 | config: Record<string, unknown>; |
| 6 | } |