Files
openclaw/extensions/feishu/src/approval-auth.ts
Peter Steinberger 83bf0379c9 refactor(channels): share plugin contract scaffolds (#105838)
* refactor(channels): share plugin contract scaffolds

* fix: preserve channel config hint metadata

* chore: refresh Plugin SDK API baseline

* ci: refresh plugin SDK surface budget

* fix(ci): allow read-only state database boundary

* fix(ci): dedupe read-only state database boundary
2026-07-13 01:51:32 -07:00

21 lines
930 B
TypeScript

// Feishu plugin module implements approval auth behavior.
import { createChannelApprovalAuth } from "openclaw/plugin-sdk/approval-auth-runtime";
import { normalizeOptionalLowercaseString } from "openclaw/plugin-sdk/string-coerce-runtime";
import { resolveFeishuAccount } from "./accounts.js";
import { normalizeFeishuTarget } from "./targets.js";
function normalizeFeishuApproverId(value: string | number): string | undefined {
const normalized = normalizeFeishuTarget(String(value));
const trimmed = normalizeOptionalLowercaseString(normalized);
return trimmed?.startsWith("ou_") ? trimmed : undefined;
}
export const feishuApprovalAuth = createChannelApprovalAuth({
channelLabel: "Feishu",
resolveInputs: ({ cfg, accountId }) => {
const account = resolveFeishuAccount({ cfg, accountId }).config;
return { allowFrom: account.allowFrom };
},
normalizeApprover: normalizeFeishuApproverId,
}).approvalAuth;