mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 07:10:43 +00:00
refactor: trim nextcloud talk helper exports
This commit is contained in:
@@ -10,7 +10,7 @@ import { requireChannelOpenAllowFrom } from "openclaw/plugin-sdk/extension-share
|
||||
import { z } from "openclaw/plugin-sdk/zod";
|
||||
import { buildSecretInputSchema } from "./secret-input.js";
|
||||
|
||||
export const NextcloudTalkRoomSchema = z
|
||||
const NextcloudTalkRoomSchema = z
|
||||
.object({
|
||||
requireMention: z.boolean().optional(),
|
||||
tools: ToolPolicySchema,
|
||||
@@ -29,7 +29,7 @@ const NextcloudTalkNetworkSchema = z
|
||||
.strict()
|
||||
.optional();
|
||||
|
||||
export const NextcloudTalkAccountSchemaBase = z
|
||||
const NextcloudTalkAccountSchemaBase = z
|
||||
.object({
|
||||
name: z.string().optional(),
|
||||
enabled: z.boolean().optional(),
|
||||
@@ -55,17 +55,15 @@ export const NextcloudTalkAccountSchemaBase = z
|
||||
})
|
||||
.strict();
|
||||
|
||||
export const NextcloudTalkAccountSchema = NextcloudTalkAccountSchemaBase.superRefine(
|
||||
(value, ctx) => {
|
||||
requireChannelOpenAllowFrom({
|
||||
channel: "nextcloud-talk",
|
||||
policy: value.dmPolicy,
|
||||
allowFrom: value.allowFrom,
|
||||
ctx,
|
||||
requireOpenAllowFrom,
|
||||
});
|
||||
},
|
||||
);
|
||||
const NextcloudTalkAccountSchema = NextcloudTalkAccountSchemaBase.superRefine((value, ctx) => {
|
||||
requireChannelOpenAllowFrom({
|
||||
channel: "nextcloud-talk",
|
||||
policy: value.dmPolicy,
|
||||
allowFrom: value.allowFrom,
|
||||
ctx,
|
||||
requireOpenAllowFrom,
|
||||
});
|
||||
});
|
||||
|
||||
export const NextcloudTalkConfigSchema = NextcloudTalkAccountSchemaBase.extend({
|
||||
accounts: z.record(z.string(), NextcloudTalkAccountSchema.optional()).optional(),
|
||||
|
||||
@@ -24,7 +24,7 @@ function normalizeOrigin(value: string): string | null {
|
||||
}
|
||||
}
|
||||
|
||||
export type NextcloudTalkMonitorOptions = {
|
||||
type NextcloudTalkMonitorOptions = {
|
||||
accountId?: string;
|
||||
config?: CoreConfig;
|
||||
runtime?: RuntimeEnv;
|
||||
|
||||
@@ -3,7 +3,7 @@ import { afterEach } from "vitest";
|
||||
import { createNextcloudTalkWebhookServer } from "./monitor.js";
|
||||
import type { NextcloudTalkWebhookServerOptions } from "./types.js";
|
||||
|
||||
export type WebhookHarness = {
|
||||
type WebhookHarness = {
|
||||
webhookUrl: string;
|
||||
stop: () => Promise<void>;
|
||||
};
|
||||
@@ -19,7 +19,7 @@ afterEach(async () => {
|
||||
}
|
||||
});
|
||||
|
||||
export type StartWebhookServerParams = Omit<
|
||||
type StartWebhookServerParams = Omit<
|
||||
NextcloudTalkWebhookServerOptions,
|
||||
"port" | "host" | "path" | "secret"
|
||||
> & {
|
||||
|
||||
@@ -44,7 +44,7 @@ export function resolveNextcloudTalkAllowlistMatch(params: {
|
||||
return { allowed: false };
|
||||
}
|
||||
|
||||
export type NextcloudTalkRoomMatch = {
|
||||
type NextcloudTalkRoomMatch = {
|
||||
roomConfig?: NextcloudTalkRoomConfig;
|
||||
wildcardConfig?: NextcloudTalkRoomConfig;
|
||||
roomKey?: string;
|
||||
|
||||
@@ -22,7 +22,7 @@ function buildReplayKey(params: { roomToken: string; messageId: string }): strin
|
||||
return `${roomToken}:${messageId}`;
|
||||
}
|
||||
|
||||
export type NextcloudTalkReplayGuardOptions = {
|
||||
type NextcloudTalkReplayGuardOptions = {
|
||||
stateDir?: string;
|
||||
ttlMs?: number;
|
||||
memoryMaxSize?: number;
|
||||
|
||||
@@ -11,7 +11,6 @@ import { resolveNextcloudTalkAccount } from "./accounts.js";
|
||||
import {
|
||||
clearNextcloudTalkAccountFields,
|
||||
nextcloudTalkDmPolicy,
|
||||
nextcloudTalkSetupAdapter,
|
||||
normalizeNextcloudTalkBaseUrl,
|
||||
setNextcloudTalkAccountConfig,
|
||||
validateNextcloudTalkBaseUrl,
|
||||
@@ -189,5 +188,3 @@ export const nextcloudTalkSetupWizard: ChannelSetupWizard = {
|
||||
dmPolicy: nextcloudTalkDmPolicy,
|
||||
disable: (cfg) => setSetupChannelEnabled(cfg, channel, false),
|
||||
};
|
||||
|
||||
export { nextcloudTalkSetupAdapter };
|
||||
|
||||
@@ -6,8 +6,6 @@ import type {
|
||||
SecretInput,
|
||||
} from "../runtime-api.js";
|
||||
|
||||
export type { DmPolicy, GroupPolicy };
|
||||
|
||||
export type NextcloudTalkRoomConfig = {
|
||||
requireMention?: boolean;
|
||||
/** Optional tool policy overrides for this room. */
|
||||
@@ -22,7 +20,7 @@ export type NextcloudTalkRoomConfig = {
|
||||
systemPrompt?: string;
|
||||
};
|
||||
|
||||
export type NextcloudTalkNetworkConfig = {
|
||||
type NextcloudTalkNetworkConfig = {
|
||||
/** Dangerous opt-in for self-hosted Nextcloud Talk on trusted private/internal hosts. */
|
||||
dangerouslyAllowPrivateNetwork?: boolean;
|
||||
};
|
||||
@@ -84,7 +82,7 @@ export type NextcloudTalkAccountConfig = {
|
||||
network?: NextcloudTalkNetworkConfig;
|
||||
};
|
||||
|
||||
export type NextcloudTalkConfig = {
|
||||
type NextcloudTalkConfig = {
|
||||
/** Optional per-account Nextcloud Talk configuration (multi-account). */
|
||||
accounts?: Record<string, NextcloudTalkAccountConfig>;
|
||||
/** Optional default account id when multiple accounts are configured. */
|
||||
@@ -104,7 +102,7 @@ export type CoreConfig = {
|
||||
*/
|
||||
|
||||
/** Actor in the activity (the message sender). */
|
||||
export type NextcloudTalkActor = {
|
||||
type NextcloudTalkActor = {
|
||||
type: "Person";
|
||||
/** User ID in Nextcloud. */
|
||||
id: string;
|
||||
@@ -113,7 +111,7 @@ export type NextcloudTalkActor = {
|
||||
};
|
||||
|
||||
/** The message object in the activity. */
|
||||
export type NextcloudTalkObject = {
|
||||
type NextcloudTalkObject = {
|
||||
type: "Note";
|
||||
/** Message ID. */
|
||||
id: string;
|
||||
@@ -126,7 +124,7 @@ export type NextcloudTalkObject = {
|
||||
};
|
||||
|
||||
/** Target conversation/room. */
|
||||
export type NextcloudTalkTarget = {
|
||||
type NextcloudTalkTarget = {
|
||||
type: "Collection";
|
||||
/** Room token. */
|
||||
id: string;
|
||||
|
||||
Reference in New Issue
Block a user