mirror of
https://github.com/moltbot/moltbot.git
synced 2026-03-08 06:54:24 +00:00
Plugins/synology-chat: migrate to scoped plugin-sdk imports
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import type { OpenClawPluginApi } from "openclaw/plugin-sdk/core";
|
||||
import { emptyPluginConfigSchema } from "openclaw/plugin-sdk/core";
|
||||
import type { OpenClawPluginApi } from "openclaw/plugin-sdk/synology-chat";
|
||||
import { emptyPluginConfigSchema } from "openclaw/plugin-sdk/synology-chat";
|
||||
import { createSynologyChatPlugin } from "./src/channel.js";
|
||||
import { setSynologyRuntime } from "./src/runtime.js";
|
||||
|
||||
|
||||
@@ -11,8 +11,8 @@ type RegisteredRoute = {
|
||||
const registerPluginHttpRouteMock = vi.fn<(params: RegisteredRoute) => () => void>(() => vi.fn());
|
||||
const dispatchReplyWithBufferedBlockDispatcher = vi.fn().mockResolvedValue({ counts: {} });
|
||||
|
||||
vi.mock("openclaw/plugin-sdk/compat", async (importOriginal) => {
|
||||
const actual = await importOriginal<typeof import("openclaw/plugin-sdk/compat")>();
|
||||
vi.mock("openclaw/plugin-sdk/synology-chat", async (importOriginal) => {
|
||||
const actual = await importOriginal<typeof import("openclaw/plugin-sdk/synology-chat")>();
|
||||
return {
|
||||
...actual,
|
||||
DEFAULT_ACCOUNT_ID: "default",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { describe, it, expect, vi, beforeEach } from "vitest";
|
||||
|
||||
// Mock external dependencies
|
||||
vi.mock("openclaw/plugin-sdk/compat", () => ({
|
||||
vi.mock("openclaw/plugin-sdk/synology-chat", () => ({
|
||||
DEFAULT_ACCOUNT_ID: "default",
|
||||
setAccountEnabledInConfigSection: vi.fn((_opts: any) => ({})),
|
||||
registerPluginHttpRoute: vi.fn(() => vi.fn()),
|
||||
@@ -44,7 +44,7 @@ vi.mock("zod", () => ({
|
||||
}));
|
||||
|
||||
const { createSynologyChatPlugin } = await import("./channel.js");
|
||||
const { registerPluginHttpRoute } = await import("openclaw/plugin-sdk/compat");
|
||||
const { registerPluginHttpRoute } = await import("openclaw/plugin-sdk/synology-chat");
|
||||
|
||||
describe("createSynologyChatPlugin", () => {
|
||||
it("returns a plugin object with all required sections", () => {
|
||||
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
setAccountEnabledInConfigSection,
|
||||
registerPluginHttpRoute,
|
||||
buildChannelConfigSchema,
|
||||
} from "openclaw/plugin-sdk/compat";
|
||||
} from "openclaw/plugin-sdk/synology-chat";
|
||||
import { z } from "zod";
|
||||
import { listAccountIds, resolveAccount } from "./accounts.js";
|
||||
import { sendMessage, sendFileUrl } from "./client.js";
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* Used by channel.ts to access dispatch functions.
|
||||
*/
|
||||
|
||||
import type { PluginRuntime } from "openclaw/plugin-sdk/compat";
|
||||
import type { PluginRuntime } from "openclaw/plugin-sdk/synology-chat";
|
||||
|
||||
let runtime: PluginRuntime | null = null;
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import * as crypto from "node:crypto";
|
||||
import {
|
||||
createFixedWindowRateLimiter,
|
||||
type FixedWindowRateLimiter,
|
||||
} from "openclaw/plugin-sdk/compat";
|
||||
} from "openclaw/plugin-sdk/synology-chat";
|
||||
|
||||
export type DmAuthorizationResult =
|
||||
| { allowed: true }
|
||||
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
isRequestBodyLimitError,
|
||||
readRequestBodyWithLimit,
|
||||
requestBodyErrorToText,
|
||||
} from "openclaw/plugin-sdk/compat";
|
||||
} from "openclaw/plugin-sdk/synology-chat";
|
||||
import { sendMessage, resolveChatUserId } from "./client.js";
|
||||
import { validateToken, authorizeUserForDm, sanitizeInput, RateLimiter } from "./security.js";
|
||||
import type { SynologyWebhookPayload, ResolvedSynologyChatAccount } from "./types.js";
|
||||
|
||||
Reference in New Issue
Block a user