Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

pipeline

import { pipeline } from "https://gitlab.com/soapbox-pub/strfry-policies/-/raw/develop/mod.ts";

Processes messages through multiple policies.

If any policy returns a reject or shadowReject action, the pipeline will stop and return the rejected message.

@example
const result = await pipeline(msg, [
 noopPolicy,
 [filterPolicy, { kinds: [0, 1, 3, 5, 7, 1984, 9734, 9735, 10002] }],
 [keywordPolicy, ['https://t.me/']],
 [regexPolicy, /(🟠|🔥|😳)ChtaGPT/i],
 [pubkeyBanPolicy, ['e810fafa1e89cdf80cced8e013938e87e21b699b24c8570537be92aec4b12c18']],
 [hellthreadPolicy, { limit: 100 }],
 [rateLimitPolicy, { whitelist: ['127.0.0.1'] }],
 [antiDuplicationPolicy, { ttl: 60000, minLength: 50 }],
]);
async function pipeline<T extends unknown[]>(msg: InputMessage, policies: [...Policies<T>]): Promise<OutputMessage>;
§
pipeline<T extends unknown[]>(msg: InputMessage, policies: [...Policies<T>]): Promise<OutputMessage>
[src]

§Type Parameters

§
T extends unknown[]
[src]

§Parameters

§
policies: [...Policies<T>]
[src]

§Return Type