UNPKG

autosnippet

Version:

Extract code patterns into a knowledge base for AI coding assistants

31 lines (30 loc) 966 B
/** * GatewayActionRegistry - 将所有服务操作注册为 Gateway 路由 * * 这是连接 Gateway ↔ Service 的桥梁: * - 路由层格式化 Gateway 请求 {actor, action, resource, data} * - Gateway 执行权限/宪法/审计 * - GatewayActionRegistry 将 action 路由到正确的 Service 方法 */ import type { Gateway } from './Gateway.js'; /** 注册所有 Gateway actions */ export declare function registerGatewayActions(gateway: Gateway, container: { get(name: string): any; }): void; /** * 辅助函数: 创建 Gateway 请求对象 * 用于路由层格式化请求 */ export declare function buildGatewayRequest(req: { headers: Record<string, string | undefined>; ip?: string; }, action: string, resource: string, data?: Record<string, unknown>): { actor: string; action: string; resource: string; data: { _ip: string | undefined; _userAgent: string; }; session: string | undefined; };