openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
3 lines • 1.22 kB
JavaScript
import{r as asNullableRecord}from"./record-coerce-BTbqdJ3-.mjs";import{t as asBoolean}from"./boolean-Dt_JCqyW.mjs";
//!src/config/dangerous-name-matching.ts
function isDangerousNameMatchingEnabled(e){return e?.dangerouslyAllowNameMatching===true}function resolveDangerousNameMatchingEnabled(e){return asBoolean(e.accountConfig?.dangerouslyAllowNameMatching)??isDangerousNameMatchingEnabled(e.providerConfig)}function collectProviderDangerousNameMatchingScopes(e,t){const n=[];const r=asNullableRecord(asNullableRecord(e.channels)?.[t]);if(!r)return n;const i=`channels.${t}`;const a=`${i}.dangerouslyAllowNameMatching`;const o=isDangerousNameMatchingEnabled(r);n.push({prefix:i,account:r,dangerousNameMatchingEnabled:o,dangerousFlagPath:a});const s=asNullableRecord(r.accounts);if(!s)return n;for(const e of Object.keys(s)){const t=asNullableRecord(s[e]);if(!t)continue;const r=`${i}.accounts.${e}`;const c=asBoolean(t.dangerouslyAllowNameMatching);n.push({prefix:r,account:t,dangerousNameMatchingEnabled:c??o,dangerousFlagPath:c==null?a:`${r}.dangerouslyAllowNameMatching`})}return n}export{isDangerousNameMatchingEnabled as n,resolveDangerousNameMatchingEnabled as r,collectProviderDangerousNameMatchingScopes as t};