






















@@ -1,12 +1,13 @@
11import type { PluginRegistry } from "../../plugins/registry-types.js";
22import { normalizePluginGatewayMethodScope } from "../../shared/gateway-method-policy.js";
33import { ADMIN_SCOPE, type OperatorScope } from "../operator-scopes.js";
4-import type { GatewayRequestHandler, GatewayRequestHandlers } from "../server-methods/types.js";
54import {
65DYNAMIC_GATEWAY_METHOD_SCOPE,
76type GatewayMethodDescriptor,
7+type GatewayMethodHandler,
88type GatewayMethodDescriptorInput,
99type GatewayMethodOwner,
10+type GatewayMethodRegistryView,
1011type GatewayMethodScope,
1112NODE_GATEWAY_METHOD_SCOPE,
1213} from "./descriptor.js";
@@ -19,15 +20,7 @@ import {
1920STARTUP_UNAVAILABLE_GATEWAY_METHODS,
2021} from "./legacy-metadata.js";
212222-export type GatewayMethodRegistry = {
23-getHandler: (name: string) => GatewayRequestHandler | undefined;
24-listMethods: () => string[];
25-listAdvertisedMethods: () => string[];
26-getScope: (name: string) => GatewayMethodScope | undefined;
27-isStartupUnavailable: (name: string) => boolean;
28-isControlPlaneWrite: (name: string) => boolean;
29-descriptors: () => readonly GatewayMethodDescriptor[];
30-};
23+export type GatewayMethodRegistry = GatewayMethodRegistryView;
31243225function normalizeMethodName(name: string): string {
3326return name.trim();
@@ -93,7 +86,7 @@ export function createGatewayMethodRegistry(
9386}
94879588export function createGatewayMethodDescriptorsFromHandlers(params: {
96-handlers: GatewayRequestHandlers;
89+handlers: Record<string, GatewayMethodHandler>;
9790owner: GatewayMethodOwner;
9891defaultScope?: OperatorScope;
9992scopes?: Partial<Record<string, OperatorScope>>;
@@ -125,7 +118,7 @@ export function createGatewayMethodDescriptorsFromHandlers(params: {
125118}
126119127120export function createCoreGatewayMethodDescriptors(
128-handlers: GatewayRequestHandlers,
121+handlers: Record<string, GatewayMethodHandler>,
129122): GatewayMethodDescriptorInput[] {
130123return createGatewayMethodDescriptorsFromHandlers({
131124 handlers,
@@ -137,7 +130,7 @@ export function createCoreGatewayMethodDescriptors(
137130export function createPluginGatewayMethodDescriptor(params: {
138131pluginId: string;
139132name: string;
140-handler: GatewayRequestHandler;
133+handler: GatewayMethodHandler;
141134scope?: OperatorScope;
142135}): GatewayMethodDescriptorInput {
143136const normalizedScope = normalizePluginGatewayMethodScope(params.name, params.scope).scope;
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。