openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
30 lines (29 loc) • 1.48 kB
JavaScript
import { a as normalizeLowercaseStringOrEmpty } from "./string-coerce-mnp54Vah.js";
import "./string-coerce-runtime-CEGJWkQ_.js";
import { t as resolveApprovalApprovers } from "./approval-approvers-CM-4zRvR.js";
import { t as createResolvedApproverActionAuthAdapter } from "./approval-auth-helpers-DU3OxkhL.js";
import { i as resolveGoogleChatAccount } from "./accounts-BedKEwKe.js";
import { n as isGoogleChatUserTarget, r as normalizeGoogleChatTarget } from "./targets-BIe3h2UJ.js";
//#region extensions/googlechat/src/approval-auth.ts
function normalizeGoogleChatApproverId(value) {
const normalized = normalizeGoogleChatTarget(String(value));
if (!normalized || !isGoogleChatUserTarget(normalized)) return;
const suffix = normalizeLowercaseStringOrEmpty(normalized.slice(6));
if (!suffix || suffix.includes("@")) return;
return `users/${suffix}`;
}
function getGoogleChatApprovalApprovers(params) {
const account = resolveGoogleChatAccount(params).config;
return resolveApprovalApprovers({
allowFrom: account.dm?.allowFrom,
defaultTo: account.defaultTo,
normalizeApprover: normalizeGoogleChatApproverId
});
}
const googleChatApprovalAuth = createResolvedApproverActionAuthAdapter({
channelLabel: "Google Chat",
resolveApprovers: getGoogleChatApprovalApprovers,
normalizeSenderId: (value) => normalizeGoogleChatApproverId(value)
});
//#endregion
export { googleChatApprovalAuth as n, normalizeGoogleChatApproverId as r, getGoogleChatApprovalApprovers as t };