multi registry support v2
This commit is contained in:
36
ts/core/classes.baseregistry.ts
Normal file
36
ts/core/classes.baseregistry.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
import { IRequestContext, IResponse, IAuthToken } from './interfaces.core.js';
|
||||
|
||||
/**
|
||||
* Abstract base class for all registry protocol implementations
|
||||
*/
|
||||
export abstract class BaseRegistry {
|
||||
/**
|
||||
* Initialize the registry
|
||||
*/
|
||||
abstract init(): Promise<void>;
|
||||
|
||||
/**
|
||||
* Handle an incoming HTTP request
|
||||
* @param context - Request context
|
||||
* @returns Response object
|
||||
*/
|
||||
abstract handleRequest(context: IRequestContext): Promise<IResponse>;
|
||||
|
||||
/**
|
||||
* Get the base path for this registry protocol
|
||||
*/
|
||||
abstract getBasePath(): string;
|
||||
|
||||
/**
|
||||
* Validate that a token has the required permissions
|
||||
* @param token - Authentication token
|
||||
* @param resource - Resource being accessed
|
||||
* @param action - Action being performed
|
||||
* @returns true if authorized
|
||||
*/
|
||||
protected abstract checkPermission(
|
||||
token: IAuthToken | null,
|
||||
resource: string,
|
||||
action: string
|
||||
): Promise<boolean>;
|
||||
}
|
||||
Reference in New Issue
Block a user