fix(gateway): accept legacy plugin registries · openclaw/openclaw@7c639d4
steipete
·
2026-05-15
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -3,6 +3,7 @@ import { ADMIN_SCOPE, READ_SCOPE, WRITE_SCOPE } from "../operator-scopes.js";
|
3 | 3 | import type { GatewayRequestHandler } from "../server-methods/types.js"; |
4 | 4 | import { |
5 | 5 | createGatewayMethodRegistry, |
| 6 | +createPluginGatewayMethodDescriptors, |
6 | 7 | createPluginGatewayMethodDescriptor, |
7 | 8 | resolveLegacyGatewayMethodScope, |
8 | 9 | } from "./registry.js"; |
@@ -70,6 +71,19 @@ describe("gateway method registry", () => {
|
70 | 71 | expect(registry.descriptors()[0]?.owner).toEqual({ kind: "plugin", pluginId: "demo" }); |
71 | 72 | }); |
72 | 73 | |
| 74 | +it("accepts legacy plugin registries without descriptor metadata", () => { |
| 75 | +const descriptors = createPluginGatewayMethodDescriptors({ |
| 76 | +gatewayHandlers: { "legacy.ping": handler }, |
| 77 | +gatewayMethodScopes: { "legacy.ping": READ_SCOPE }, |
| 78 | +}); |
| 79 | + |
| 80 | +const registry = createGatewayMethodRegistry(descriptors); |
| 81 | + |
| 82 | +expect(registry.listMethods()).toEqual(["legacy.ping"]); |
| 83 | +expect(registry.getHandler("legacy.ping")).toBe(handler); |
| 84 | +expect(registry.getScope("legacy.ping")).toBe(READ_SCOPE); |
| 85 | +}); |
| 86 | + |
73 | 87 | it("keeps legacy scope metadata available during migration", () => { |
74 | 88 | expect(resolveLegacyGatewayMethodScope("health")).toBe(READ_SCOPE); |
75 | 89 | expect(resolveLegacyGatewayMethodScope("config.apply")).toBe(ADMIN_SCOPE); |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。