mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-06 14:51:08 +00:00
fix(types): align rebased main helper contracts
This commit is contained in:
@@ -77,7 +77,7 @@ export const bluebubblesMessageActions: ChannelMessageActionAdapter = {
|
||||
if (!account.enabled || !account.configured) {
|
||||
return null;
|
||||
}
|
||||
const gate = createActionGate(account.config.actions);
|
||||
const gate = createActionGate(cfg.channels?.bluebubbles?.actions);
|
||||
const actions = new Set<ChannelMessageActionName>();
|
||||
const macOS26 = isMacOS26OrHigher(account.accountId);
|
||||
const privateApiStatus = getCachedBlueBubblesPrivateApiStatus(account.accountId);
|
||||
|
||||
@@ -4,7 +4,6 @@ import {
|
||||
formatDocsLink,
|
||||
hasConfiguredSecretInput,
|
||||
mergeAllowFromEntries,
|
||||
patchChannelConfigForAccount,
|
||||
patchTopLevelChannelConfigSection,
|
||||
promptSingleChannelSecretInput,
|
||||
splitSetupEntries,
|
||||
@@ -33,11 +32,10 @@ function normalizeString(value: unknown): string | undefined {
|
||||
return trimmed || undefined;
|
||||
}
|
||||
|
||||
function getScopedFeishuConfig(
|
||||
cfg: OpenClawConfig,
|
||||
accountId: string,
|
||||
): FeishuConfig | FeishuAccountConfig {
|
||||
const feishuCfg = ((cfg.channels?.feishu as FeishuConfig | undefined) ?? {}) as FeishuConfig;
|
||||
type ScopedFeishuConfig = Partial<FeishuConfig> & Partial<FeishuAccountConfig>;
|
||||
|
||||
function getScopedFeishuConfig(cfg: OpenClawConfig, accountId: string): ScopedFeishuConfig {
|
||||
const feishuCfg = cfg.channels?.feishu as FeishuConfig | undefined;
|
||||
if (accountId === DEFAULT_ACCOUNT_ID) {
|
||||
return feishuCfg;
|
||||
}
|
||||
@@ -49,11 +47,30 @@ function patchFeishuConfig(
|
||||
accountId: string,
|
||||
patch: Record<string, unknown>,
|
||||
): OpenClawConfig {
|
||||
return patchChannelConfigForAccount({
|
||||
const feishuCfg = cfg.channels?.feishu as FeishuConfig | undefined;
|
||||
if (accountId === DEFAULT_ACCOUNT_ID) {
|
||||
return patchTopLevelChannelConfigSection({
|
||||
cfg,
|
||||
channel,
|
||||
enabled: true,
|
||||
patch,
|
||||
});
|
||||
}
|
||||
const nextAccountPatch = {
|
||||
...((feishuCfg?.accounts?.[accountId] as Record<string, unknown> | undefined) ?? {}),
|
||||
enabled: true,
|
||||
...patch,
|
||||
};
|
||||
return patchTopLevelChannelConfigSection({
|
||||
cfg,
|
||||
channel,
|
||||
accountId,
|
||||
patch,
|
||||
enabled: true,
|
||||
patch: {
|
||||
accounts: {
|
||||
...(feishuCfg?.accounts ?? {}),
|
||||
[accountId]: nextAccountPatch,
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,22 @@
|
||||
import { vi } from "vitest";
|
||||
import { vi, type Mock } from "vitest";
|
||||
import type { OpenClawConfig } from "../../config/types.openclaw.js";
|
||||
import type { GatewayRequestHandlerOptions } from "./types.js";
|
||||
|
||||
function createGatewayLog() {
|
||||
type UnknownMock = Mock<(...args: unknown[]) => unknown>;
|
||||
type GatewayLogMocks = {
|
||||
error: UnknownMock;
|
||||
warn: UnknownMock;
|
||||
info: UnknownMock;
|
||||
debug: UnknownMock;
|
||||
};
|
||||
type ConfigHandlerHarness = {
|
||||
options: GatewayRequestHandlerOptions;
|
||||
respond: UnknownMock;
|
||||
logGateway: GatewayLogMocks;
|
||||
disconnectClientsUsingSharedGatewayAuth: UnknownMock;
|
||||
};
|
||||
|
||||
function createGatewayLog(): GatewayLogMocks {
|
||||
return {
|
||||
error: vi.fn(),
|
||||
warn: vi.fn(),
|
||||
@@ -37,7 +51,7 @@ export function createConfigHandlerHarness(args?: {
|
||||
params?: unknown;
|
||||
overrides?: Partial<GatewayRequestHandlerOptions>;
|
||||
contextOverrides?: Partial<GatewayRequestHandlerOptions["context"]>;
|
||||
}) {
|
||||
}): ConfigHandlerHarness {
|
||||
const logGateway = createGatewayLog();
|
||||
const disconnectClientsUsingSharedGatewayAuth = vi.fn();
|
||||
const respond = vi.fn();
|
||||
|
||||
Reference in New Issue
Block a user