index.ts
Language TypeScript1.4 KB45 lines
export {BitrixClient,BitrixError,BitrixRateLimitError,BitrixOperationTimeError,type BitrixOptions,type BitrixResponse,} from './http.js'export { LeadsResource, normalizeLead, isLikelyNoise, type Lead, type RawLead , type StageSemantic } from './leads.js'export {TasksResource,normalizeTask,isJunkTask,partitionTasks,type Task,type RawTask,} from './tasks.js'/*** Tariff limits, for reference. We throttle well below these.** Standard: 2 req/sec drain, burst 50* Enterprise: 5 req/sec drain, burst 250** Same-IP applications share the quota, so the cron and the MCP connector are* not independent even though their token buckets are.*/export const BITRIX_TARIFF_LIMITS = {standard: { drainPerSecond: 2, burst: 50 },enterprise: { drainPerSecond: 5, burst: 250 },} as constexport function clientFromEnv(env: Record<string, string | undefined>) {const url = env.BITRIX_WEBHOOK_URLif (!url) {throw new Error('BITRIX_WEBHOOK_URL is not set. Create an inbound webhook in Bitrix ' +'(Developer resources > Other > Inbound webhook) with crm read scope, and put the ' +'full URL in your shell profile. This repo has no .env reader; see ' +'credentials.example.sh. Grant read scope only: a read-only credential is a ' +'stronger guarantee than read-only code.',)}return { url }}