UNPKG

@graperank/protocols-nostr

Version:

The Nostr Protocols plugin for GrapeRank allows the Interpreter to fetch and normalize ratings data from any kind[s] of Nostr event.

44 lines (43 loc) 1.62 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.NostrProtocolFactory = void 0; const classes_1 = require("./classes"); exports.NostrProtocolFactory = new Map(); exports.NostrProtocolFactory.set('nostr-follows', () => new classes_1.NostrProtocol({ kinds: [3], params: { score: 1, confidence: .5 }, validate: classes_1.validateEachEventHasAuthor, interpret: (instance, fetchedIndex) => { return (0, classes_1.applyRatingsByTag)(instance, fetchedIndex); } })); exports.NostrProtocolFactory.set('nostr-mutes', () => new classes_1.NostrProtocol({ kinds: [10000], params: { score: 0, confidence: .5 }, interpret: (instance, fetchedIndex) => { return (0, classes_1.applyRatingsByTag)(instance, fetchedIndex); } })); exports.NostrProtocolFactory.set('nostr-reports', () => new classes_1.NostrProtocol({ kinds: [1984], params: { score: 0, confidence: .5, nudity: 0, // depictions of nudity, porn, etc. malware: 0, // virus, trojan horse, worm, robot, spyware, adware, back door, ransomware, rootkit, kidnapper, etc. profanity: 0, // profanity, hateful speech, etc. illegal: 0, // something which may be illegal in some jurisdiction spam: 0, // spam impersonation: 0, // someone pretending to be someone else other: 0, // for reports that don't fit in the above categories }, interpret: (instance, fetchedIndex) => { return (0, classes_1.applyRatingsByTag)(instance, fetchedIndex, 'p', 1, 2); } }));