New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

webmention-handler

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

webmention-handler - npm Package Compare versions

Comparing version 0.0.5 to 0.0.6

dist/classes/web-mention-handler.class.test.d.ts

8

dist/classes/local-web-mention-storage.class.d.ts
import { IWebMentionStorage } from "../interfaces/web-mention-storage.interface";
import { Mention } from "../types/mention.type";
import { QueuedMention } from "../types/queued-mention.type";
import { SimpleMention } from "../types/simple-mention.type";
export declare class LocalWebMentionStorage implements IWebMentionStorage {

@@ -8,7 +8,7 @@ private queue;

constructor();
addPendingMention(mention: QueuedMention): Promise<QueuedMention>;
getNextPendingMentions(): Promise<QueuedMention[]>;
addPendingMention(mention: SimpleMention): Promise<SimpleMention>;
getNextPendingMentions(): Promise<SimpleMention[]>;
getMentionsForPage(page: string, type?: string | undefined): Promise<Mention[]>;
storeMentionForPage(page: string, mention: Mention): Promise<Mention>;
deleteMention(mention: QueuedMention): Promise<null>;
deleteMention(mention: SimpleMention): Promise<null>;
}
import { IWebMentionHandler } from "../interfaces/web-mention-handler.interface";
import { IWebMentionStorage } from "../interfaces/web-mention-storage.interface";
import { Mention } from "../types/mention.type";
import { QueuedMention } from "../types/queued-mention.type";
import { SimpleMention } from "../types/simple-mention.type";
import { SuggestedResponse } from "../types/suggested-response.type";

@@ -23,3 +23,3 @@ import { WebMentionOptions } from "../types/web-mention-options.type";

*/
processMention(mention: QueuedMention): Promise<Mention[] | null>;
processMention(mention: SimpleMention): Promise<Mention[] | null>;
/**

@@ -26,0 +26,0 @@ * Calls processMention on a collection of pending webmentions

export * from "./classes/web-mention-handler.class";
export * from "./interfaces/web-mention-storage.interface";
export * from "./types/mention.type";
export * from "./types/queued-mention.type";
export * from "./types/simple-mention.type";
export * from "./types/web-mention-options.type";

@@ -13,7 +13,2 @@ 'use strict';

function isOnlyOneEmoji(s) {
var EmojiPattern = /^(?:\uD83D(?:\uDD73\uFE0F?|\uDC41(?:(?:\uFE0F(?:\u200D\uD83D\uDDE8\uFE0F?)?|\u200D\uD83D\uDDE8\uFE0F?))?|[\uDDE8\uDDEF]\uFE0F?|\uDC4B(?:\uD83C[\uDFFB-\uDFFF])?|\uDD90(?:(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F))?|[\uDD96\uDC4C\uDC48\uDC49\uDC46\uDD95\uDC47\uDC4D\uDC4E\uDC4A\uDC4F\uDE4C\uDC50\uDE4F\uDC85\uDCAA\uDC42\uDC43\uDC76\uDC66\uDC67](?:\uD83C[\uDFFB-\uDFFF])?|\uDC71(?:(?:\uD83C(?:[\uDFFB-\uDFFF](?:\u200D(?:[\u2640\u2642]\uFE0F?))?)|\u200D(?:[\u2640\u2642]\uFE0F?)))?|\uDC68(?:(?:\uD83C(?:\uDFFB(?:\u200D(?:\uD83E(?:\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF]|[\uDDB0\uDDB1\uDDB3\uDDB2\uDDAF\uDDBC\uDDBD])|\u2695\uFE0F?|\uD83C[\uDF93\uDFEB\uDF3E\uDF73\uDFED\uDFA4\uDFA8]|\u2696\uFE0F?|\uD83D[\uDD27\uDCBC\uDD2C\uDCBB\uDE80\uDE92]|\u2708\uFE0F?))?|\uDFFC(?:\u200D(?:\uD83E(?:\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF]|[\uDDB0\uDDB1\uDDB3\uDDB2\uDDAF\uDDBC\uDDBD])|\u2695\uFE0F?|\uD83C[\uDF93\uDFEB\uDF3E\uDF73\uDFED\uDFA4\uDFA8]|\u2696\uFE0F?|\uD83D[\uDD27\uDCBC\uDD2C\uDCBB\uDE80\uDE92]|\u2708\uFE0F?))?|\uDFFD(?:\u200D(?:\uD83E(?:\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|[\uDDB0\uDDB1\uDDB3\uDDB2\uDDAF\uDDBC\uDDBD])|\u2695\uFE0F?|\uD83C[\uDF93\uDFEB\uDF3E\uDF73\uDFED\uDFA4\uDFA8]|\u2696\uFE0F?|\uD83D[\uDD27\uDCBC\uDD2C\uDCBB\uDE80\uDE92]|\u2708\uFE0F?))?|\uDFFE(?:\u200D(?:\uD83E(?:\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF]|[\uDDB0\uDDB1\uDDB3\uDDB2\uDDAF\uDDBC\uDDBD])|\u2695\uFE0F?|\uD83C[\uDF93\uDFEB\uDF3E\uDF73\uDFED\uDFA4\uDFA8]|\u2696\uFE0F?|\uD83D[\uDD27\uDCBC\uDD2C\uDCBB\uDE80\uDE92]|\u2708\uFE0F?))?|\uDFFF(?:\u200D(?:\uD83E(?:\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE]|[\uDDB0\uDDB1\uDDB3\uDDB2\uDDAF\uDDBC\uDDBD])|\u2695\uFE0F?|\uD83C[\uDF93\uDFEB\uDF3E\uDF73\uDFED\uDFA4\uDFA8]|\u2696\uFE0F?|\uD83D[\uDD27\uDCBC\uDD2C\uDCBB\uDE80\uDE92]|\u2708\uFE0F?))?)|\u200D(?:\uD83E[\uDDB0\uDDB1\uDDB3\uDDB2\uDDAF\uDDBC\uDDBD]|\u2695\uFE0F?|\uD83C[\uDF93\uDFEB\uDF3E\uDF73\uDFED\uDFA4\uDFA8]|\u2696\uFE0F?|\uD83D(?:\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uDC68\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|[\uDD27\uDCBC\uDD2C\uDCBB\uDE80\uDE92])|\u2708\uFE0F?|\u2764(?:\uFE0F\u200D\uD83D(?:\uDC8B\u200D\uD83D\uDC68|\uDC68)|\u200D\uD83D(?:\uDC8B\u200D\uD83D\uDC68|\uDC68)))))?|\uDC69(?:(?:\uD83C(?:\uDFFB(?:\u200D(?:\uD83E(?:\uDD1D\u200D\uD83D(?:\uDC69\uD83C[\uDFFC-\uDFFF]|\uDC68\uD83C[\uDFFC-\uDFFF])|[\uDDB0\uDDB1\uDDB3\uDDB2\uDDAF\uDDBC\uDDBD])|\u2695\uFE0F?|\uD83C[\uDF93\uDFEB\uDF3E\uDF73\uDFED\uDFA4\uDFA8]|\u2696\uFE0F?|\uD83D[\uDD27\uDCBC\uDD2C\uDCBB\uDE80\uDE92]|\u2708\uFE0F?))?|\uDFFC(?:\u200D(?:\uD83E(?:\uDD1D\u200D\uD83D(?:\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF]|\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])|[\uDDB0\uDDB1\uDDB3\uDDB2\uDDAF\uDDBC\uDDBD])|\u2695\uFE0F?|\uD83C[\uDF93\uDFEB\uDF3E\uDF73\uDFED\uDFA4\uDFA8]|\u2696\uFE0F?|\uD83D[\uDD27\uDCBC\uDD2C\uDCBB\uDE80\uDE92]|\u2708\uFE0F?))?|\uDFFD(?:\u200D(?:\uD83E(?:\uDD1D\u200D\uD83D(?:\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|[\uDDB0\uDDB1\uDDB3\uDDB2\uDDAF\uDDBC\uDDBD])|\u2695\uFE0F?|\uD83C[\uDF93\uDFEB\uDF3E\uDF73\uDFED\uDFA4\uDFA8]|\u2696\uFE0F?|\uD83D[\uDD27\uDCBC\uDD2C\uDCBB\uDE80\uDE92]|\u2708\uFE0F?))?|\uDFFE(?:\u200D(?:\uD83E(?:\uDD1D\u200D\uD83D(?:\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF]|\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])|[\uDDB0\uDDB1\uDDB3\uDDB2\uDDAF\uDDBC\uDDBD])|\u2695\uFE0F?|\uD83C[\uDF93\uDFEB\uDF3E\uDF73\uDFED\uDFA4\uDFA8]|\u2696\uFE0F?|\uD83D[\uDD27\uDCBC\uDD2C\uDCBB\uDE80\uDE92]|\u2708\uFE0F?))?|\uDFFF(?:\u200D(?:\uD83E(?:\uDD1D\u200D\uD83D(?:\uDC69\uD83C[\uDFFB-\uDFFE]|\uDC68\uD83C[\uDFFB-\uDFFE])|[\uDDB0\uDDB1\uDDB3\uDDB2\uDDAF\uDDBC\uDDBD])|\u2695\uFE0F?|\uD83C[\uDF93\uDFEB\uDF3E\uDF73\uDFED\uDFA4\uDFA8]|\u2696\uFE0F?|\uD83D[\uDD27\uDCBC\uDD2C\uDCBB\uDE80\uDE92]|\u2708\uFE0F?))?)|\u200D(?:\uD83E[\uDDB0\uDDB1\uDDB3\uDDB2\uDDAF\uDDBC\uDDBD]|\u2695\uFE0F?|\uD83C[\uDF93\uDFEB\uDF3E\uDF73\uDFED\uDFA4\uDFA8]|\u2696\uFE0F?|\uD83D(?:\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|[\uDD27\uDCBC\uDD2C\uDCBB\uDE80\uDE92])|\u2708\uFE0F?|\u2764(?:\uFE0F\u200D\uD83D(?:\uDC8B\u200D\uD83D[\uDC68\uDC69]|[\uDC68\uDC69])|\u200D\uD83D(?:\uDC8B\u200D\uD83D[\uDC68\uDC69]|[\uDC68\uDC69])))))?|[\uDC74\uDC75](?:\uD83C[\uDFFB-\uDFFF])?|[\uDE4D\uDE4E\uDE45\uDE46\uDC81\uDE4B\uDE47\uDC6E](?:(?:\uD83C(?:[\uDFFB-\uDFFF](?:\u200D(?:[\u2642\u2640]\uFE0F?))?)|\u200D(?:[\u2642\u2640]\uFE0F?)))?|\uDD75(?:(?:\uFE0F(?:\u200D(?:[\u2642\u2640]\uFE0F?))?|\uD83C(?:[\uDFFB-\uDFFF](?:\u200D(?:[\u2642\u2640]\uFE0F?))?)|\u200D(?:[\u2642\u2640]\uFE0F?)))?|[\uDC82\uDC77](?:(?:\uD83C(?:[\uDFFB-\uDFFF](?:\u200D(?:[\u2642\u2640]\uFE0F?))?)|\u200D(?:[\u2642\u2640]\uFE0F?)))?|\uDC78(?:\uD83C[\uDFFB-\uDFFF])?|\uDC73(?:(?:\uD83C(?:[\uDFFB-\uDFFF](?:\u200D(?:[\u2642\u2640]\uFE0F?))?)|\u200D(?:[\u2642\u2640]\uFE0F?)))?|[\uDC72\uDC70\uDC7C](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC86\uDC87\uDEB6](?:(?:\uD83C(?:[\uDFFB-\uDFFF](?:\u200D(?:[\u2642\u2640]\uFE0F?))?)|\u200D(?:[\u2642\u2640]\uFE0F?)))?|[\uDC83\uDD7A](?:\uD83C[\uDFFB-\uDFFF])?|\uDD74(?:(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F))?|\uDC6F(?:\u200D(?:[\u2642\u2640]\uFE0F?))?|[\uDEA3\uDEB4\uDEB5](?:(?:\uD83C(?:[\uDFFB-\uDFFF](?:\u200D(?:[\u2642\u2640]\uFE0F?))?)|\u200D(?:[\u2642\u2640]\uFE0F?)))?|[\uDEC0\uDECC\uDC6D\uDC6B\uDC6C](?:\uD83C[\uDFFB-\uDFFF])?|\uDDE3\uFE0F?|\uDC15(?:\u200D\uD83E\uDDBA)?|[\uDC3F\uDD4A\uDD77\uDD78\uDDFA\uDEE3\uDEE4\uDEE2\uDEF3\uDEE5\uDEE9\uDEF0\uDECE\uDD70\uDD79\uDDBC\uDD76\uDECD\uDDA5\uDDA8\uDDB1\uDDB2\uDCFD\uDD6F\uDDDE\uDDF3\uDD8B\uDD8A\uDD8C\uD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FF](?:\u200D(?:[\u2642\u2640]\uFE0F?))?)|\u200D(?:[\u2642\u2640]\uFE0F?)))?|[\uDDDE\uDDDF](?:\u200D(?:[\u2642\u2640]\uFE0F?))?|[\uDDCD\uDDCE\uDDD6\uDDD7\uDD38](?:(?:\uD83C(?:[\uDFFB-\uDFFF](?:\u200D(?:[\u2642\u2640]\uFE0F?))?)|\u200D(?:[\u2642\u2640]\uFE0F?)))?|\uDD3C(?:\u200D(?:[\u2642\u2640]\uFE0F?))?|[\uDD3D\uDD3E\uDD39\uDDD8](?:(?:\uD83C(?:[\uDFFB-\uDFFF](?:\u200D(?:[\u2642\u2640]\uFE0F?))?)|\u200D(?:[\u2642\u2640]\uFE0F?)))?|[\uDD23\uDD70\uDD29\uDD2A\uDD11\uDD17\uDD2D\uDD2B\uDD14\uDD10\uDD28\uDD25\uDD24\uDD12\uDD15\uDD22\uDD2E\uDD27\uDD75\uDD76\uDD74\uDD2F\uDD20\uDD73\uDD13\uDDD0\uDD7A\uDD71\uDD2C\uDD21\uDD16\uDDE1\uDD0E\uDD0D\uDD1D\uDDBE\uDDBF\uDDE0\uDDB7\uDDB4\uDD3A\uDDB0\uDDB1\uDDB3\uDDB2\uDD8D\uDDA7\uDDAE\uDD8A\uDD9D\uDD81\uDD84\uDD93\uDD8C\uDD99\uDD92\uDD8F\uDD9B\uDD94\uDD87\uDDA5\uDDA6\uDDA8\uDD98\uDDA1\uDD83\uDD85\uDD86\uDDA2\uDD89\uDDA9\uDD9A\uDD9C\uDD8E\uDD95\uDD96\uDD88\uDD8B\uDD97\uDD82\uDD9F\uDDA0\uDD40\uDD6D\uDD5D\uDD65\uDD51\uDD54\uDD55\uDD52\uDD6C\uDD66\uDDC4\uDDC5\uDD5C\uDD50\uDD56\uDD68\uDD6F\uDD5E\uDDC7\uDDC0\uDD69\uDD53\uDD6A\uDD59\uDDC6\uDD5A\uDD58\uDD63\uDD57\uDDC8\uDDC2\uDD6B\uDD6E\uDD5F-\uDD61\uDD80\uDD9E\uDD90\uDD91\uDDAA\uDDC1\uDD67\uDD5B\uDD42\uDD43\uDD64\uDDC3\uDDC9\uDDCA\uDD62\uDD44\uDDED\uDDF1\uDDBD\uDDBC\uDE82\uDDF3\uDE90\uDDE8\uDDE7\uDD47-\uDD49\uDD4E\uDD4F\uDD4D\uDD4A\uDD4B\uDD45\uDD3F\uDD4C\uDE80\uDE81\uDDFF\uDDE9\uDDF8\uDDF5\uDDF6\uDD7D\uDD7C\uDDBA\uDDE3-\uDDE6\uDD7B\uDE71-\uDE73\uDD7E\uDD7F\uDE70\uDDE2\uDE95\uDD41\uDDEE\uDE94\uDDFE\uDE93\uDDAF\uDDF0\uDDF2\uDDEA-\uDDEC\uDE78-\uDE7A\uDE91\uDE92\uDDF4\uDDF7\uDDF9-\uDDFD\uDDEF])|[\u263A\u2639\u2620\u2763\u2764]\uFE0F?|\u270B(?:\uD83C[\uDFFB-\uDFFF])?|[\u270C\u261D](?:(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F))?|\u270A(?:\uD83C[\uDFFB-\uDFFF])?|\u270D(?:(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F))?|\uD83C(?:\uDF85(?:\uD83C[\uDFFB-\uDFFF])?|\uDFC3(?:(?:\uD83C(?:[\uDFFB-\uDFFF](?:\u200D(?:[\u2642\u2640]\uFE0F?))?)|\u200D(?:[\u2642\u2640]\uFE0F?)))?|[\uDFC7\uDFC2](?:\uD83C[\uDFFB-\uDFFF])?|\uDFCC(?:(?:\uFE0F(?:\u200D(?:[\u2642\u2640]\uFE0F?))?|\uD83C(?:[\uDFFB-\uDFFF](?:\u200D(?:[\u2642\u2640]\uFE0F?))?)|\u200D(?:[\u2642\u2640]\uFE0F?)))?|[\uDFC4\uDFCA](?:(?:\uD83C(?:[\uDFFB-\uDFFF](?:\u200D(?:[\u2642\u2640]\uFE0F?))?)|\u200D(?:[\u2642\u2640]\uFE0F?)))?|\uDFCB(?:(?:\uFE0F(?:\u200D(?:[\u2642\u2640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\uDF72\uDF7F\uDF71\uDF58-\uDF5D\uDF60\uDF62-\uDF65\uDF61\uDF66-\uDF6A\uDF82\uDF70\uDF6B-\uDF6F\uDF7C\uDF75\uDF76\uDF7E\uDF77-\uDF7B\uDF74\uDFFA\uDF0D-\uDF10\uDF0B\uDFE0-\uDFE6\uDFE8-\uDFED\uDFEF\uDFF0\uDF01\uDF03-\uDF07\uDF09\uDFA0-\uDFA2\uDFAA\uDF11-\uDF20\uDF0C\uDF00\uDF08\uDF02\uDF0A\uDF83\uDF84\uDF86-\uDF8B\uDF8D-\uDF91\uDF80\uDF81\uDFAB\uDFC6\uDFC5\uDFC0\uDFD0\uDFC8\uDFC9\uDFBE\uDFB3\uDFCF\uDFD1-\uDFD3\uDFF8\uDFA3\uDFBD\uDFBF\uDFAF\uDFB1\uDFAE\uDFB0\uDFB2\uDCCF\uDC04\uDFB4\uDFAD\uDFA8\uDF92\uDFA9\uDF93\uDFBC\uDFB5\uDFB6\uDFA4\uDFA7\uDFB7-\uDFBB\uDFA5\uDFAC\uDFEE\uDFF9\uDFE7\uDFA6\uDD8E\uDD91-\uDD9A\uDE01\uDE36\uDE2F\uDE50\uDE39\uDE1A\uDE32\uDE51\uDE38\uDE34\uDE33\uDE3A\uDE35\uDFC1\uDF8C])|\u26F7\uFE0F?|\u26F9(?:(?:\uFE0F(?:\u200D(?:[\u2642\u2640]\uFE0F?))?|\uD83C(?:[\uDFFB-\uDFFF](?:\u200D(?:[\u2642\u2640]\uFE0F?))?)|\u200D(?:[\u2642\u2640]\uFE0F?)))?|[\u2618\u26F0\u26E9\u2668\u26F4\u2708\u23F1\u23F2\u2600\u2601\u26C8\u2602\u26F1\u2744\u2603\u2604\u26F8\u2660\u2665\u2666\u2663\u265F\u26D1\u260E\u2328\u2709\u270F\u2712\u2702\u26CF\u2692\u2694\u2699\u2696\u26D3\u2697\u26B0\u26B1\u26A0\u2622\u2623\u2B06\u2197\u27A1\u2198\u2B07\u2199\u2B05\u2196\u2195\u2194\u21A9\u21AA\u2934\u2935\u269B\u2721\u2638\u262F\u271D\u2626\u262A\u262E\u25B6\u23ED\u23EF\u25C0\u23EE\u23F8-\u23FA\u23CF\u2640\u2642\u2695\u267E\u267B\u269C\u2611\u2714\u2716\u303D\u2733\u2734\u2747\u203C\u2049\u3030\u00A9\u00AE\u2122]\uFE0F?|[\u0023\u002A\u0030-\u0039](?:\uFE0F\u20E3|\u20E3)|[\u2139\u24C2\u3297\u3299\u25FC\u25FB\u25AA\u25AB]\uFE0F?|[\u2615\u26EA\u26F2\u26FA\u26FD\u2693\u26F5\u231B\u23F3\u231A\u23F0\u2B50\u26C5\u2614\u26A1\u26C4\u2728\u26BD\u26BE\u26F3\u267F\u26D4\u2648-\u2653\u26CE\u23E9-\u23EC\u2B55\u2705\u274C\u274E\u2795-\u2797\u27B0\u27BF\u2753-\u2755\u2757\u26AB\u26AA\u2B1B\u2B1C\u25FE\u25FD])$/;
return EmojiPattern.test(s);
}
function convertHEntryToMention(entry, source, target) {

@@ -37,5 +32,3 @@ const mention = Object.assign({

mention.type = 'rsvp';
else if (mention.type === 'reply' && isOnlyOneEmoji(mention.content.value))
mention.type = 'reaction';
if (mention.type === 'mention-of')
if (mention.type === 'mention-of' || !mention.type)
return { ...mention, type: 'mention' };

@@ -93,3 +86,3 @@ return mention;

function flattenEntry(entry) {
function normalizeEntry(entry) {
for (let key of Object.keys(entry)) {

@@ -100,3 +93,3 @@ if (Array.isArray(entry[key]) && entry[key].length === 1) {

if (typeof entry[key] === 'object' && !Array.isArray(entry[key])) {
entry[key] = flattenEntry(entry[key]);
entry[key] = normalizeEntry(entry[key]);
}

@@ -131,3 +124,3 @@ if (key === 'properties') {

// Return a more readable format
return items.map(flattenEntry);
return items.map(normalizeEntry);
}

@@ -249,4 +242,8 @@

let mentions = hEntries.map(h => convertHEntryToMention(h, mention.source, mention.target));
if (mentions.length > 1)
// if there are only basic mentions, use the first (most complete mention)
// otherwsise, get rid of any basic mentions as we have a better type
if (mentions.find(m => m.type !== 'mention'))
mentions = mentions.filter(m => m.type !== 'mention');
else
mentions = [mentions.find(m => m.type === 'mention')];
const storedMentions = mentions.map(m => this.storageHandler.storeMentionForPage(m.target, m));

@@ -253,0 +250,0 @@ return Promise.all(storedMentions);

import { Mention } from "../types/mention.type";
import { QueuedMention } from "../types/queued-mention.type";
import { SimpleMention } from "../types/simple-mention.type";
import { SuggestedResponse } from "../types/suggested-response.type";
import { WebMentionOptions } from "../types/web-mention-options.type";
export interface IWebMentionHandler extends WebMentionOptions {
processMention(mention: QueuedMention): Promise<Mention[] | null>;
processMention(mention: SimpleMention): Promise<Mention[] | null>;
processPendingMentions(): Promise<Mention[]>;

@@ -8,0 +8,0 @@ addPendingMention(source: string, target: string): Promise<SuggestedResponse>;

import { Mention } from "../types/mention.type";
import { QueuedMention } from "../types/queued-mention.type";
import { SimpleMention } from "../types/simple-mention.type";
export interface IWebMentionStorage {
addPendingMention(mention: QueuedMention): Promise<QueuedMention>;
getNextPendingMentions(): Promise<QueuedMention[]>;
addPendingMention(mention: SimpleMention): Promise<SimpleMention>;
getNextPendingMentions(): Promise<SimpleMention[]>;
getMentionsForPage(page: string, type?: string): Promise<Mention[]>;
storeMentionForPage(page: string, mention: Mention): Promise<Mention>;
deleteMention(mention: QueuedMention): Promise<null>;
deleteMention(mention: SimpleMention): Promise<null>;
}
{
"name": "webmention-handler",
"version": "0.0.5",
"version": "0.0.6",
"description": "A handler for web mentions",

@@ -11,3 +11,3 @@ "main": "dist/index.js",

"test": "jest",
"test:coverage": "jest --coverage",
"test:coverage": "jest --coverage --collectCoverageFrom='[\"src/**/*.{js,ts}\"]'",
"setup:hooks": "husky install",

@@ -14,0 +14,0 @@ "prepublish": "npm run build"

@@ -83,6 +83,6 @@ # webmention-handler

| -------- | --------- | ------- | ----------- |
| `addPendingMention` | mention: [QueuedMention](./src/types/queued-mention.type.ts) | Promise<[QueuedMention](./src/types/queued-mention.type.ts)> | Allows the web mention handler to add a new pending mention that needs to be handled |
| `getNextPendingMentions` | N/A | Promise<[QueuedMention](./src/types/queued-mention.type.ts)[]> | Fetches a number of pending mentions to be bulk processed. Any configured limits on the number of pending mentions to fetch should be set in the constructor via an options object rather than passed in to this function directly. |
| `addPendingMention` | mention: [SimpleMention](./src/types/simple-mention.type.ts) | Promise<[SimpleMention](./src/types/simple-mention.type.ts)> | Allows the web mention handler to add a new pending mention that needs to be handled |
| `getNextPendingMentions` | N/A | Promise<[SimpleMention](./src/types/simple-mention.type.ts)[]> | Fetches a number of pending mentions to be bulk processed. Any configured limits on the number of pending mentions to fetch should be set in the constructor via an options object rather than passed in to this function directly. |
| `getMentionsForPage` | page: `string`, type?: `string` | Promise<[Mention](./src/types/mention.type.ts)[]> | Gets mentions based on a given target. Has an optional `type` parameter that allows mentions to be filtered on type. eg. Only Comments or Likes` |
| `storeMentionForPage` | page: `string`, mention: [Mention](./src/types/mention.type.ts) | Promise<[Mention](./src/types/mention.type.ts)> | This function will store a mention on the given target. If you need to access the type of the mention, you can find that on the `mention.type` property. |
| `deleteMention` | mention: [QueuedMention](./src/types/queued-mention.type.ts) | Promise<`null`> | This function should delete any processed mentions for a given target from a given source. It should always return `null` and should not error in the event that no mentions are found. |
| `deleteMention` | mention: [SimpleMention](./src/types/simple-mention.type.ts) | Promise<`null`> | This function should delete any processed mentions for a given target from a given source. It should always return `null` and should not error in the event that no mentions are found. |
import { IWebMentionStorage } from "../interfaces/web-mention-storage.interface";
import { Mention } from "../types/mention.type";
import { QueuedMention } from "../types/queued-mention.type";
import { SimpleMention } from "../types/simple-mention.type";
export class LocalWebMentionStorage implements IWebMentionStorage {
private queue: Set<QueuedMention>;
private queue: Set<SimpleMention>;
private pages: {[page: string]: Mention[]}
constructor() {
this.queue = new Set<QueuedMention>();
this.queue = new Set<SimpleMention>();
this.pages = {};
}
async addPendingMention(mention: QueuedMention): Promise<QueuedMention> {
async addPendingMention(mention: SimpleMention): Promise<SimpleMention> {
this.queue.add(mention);

@@ -39,3 +39,3 @@ return mention;

async deleteMention(mention: QueuedMention): Promise<null> {
async deleteMention(mention: SimpleMention): Promise<null> {
this.pages[mention.target] = this.pages[mention.source].filter(({source}) => source !== mention.source);

@@ -42,0 +42,0 @@ return null;

@@ -8,3 +8,3 @@ import { convertHEntryToMention } from "../functions/convert-h-entry-to-mention";

import { Mention } from "../types/mention.type";
import { QueuedMention } from "../types/queued-mention.type";
import { SimpleMention } from "../types/simple-mention.type";
import { SuggestedResponse } from "../types/suggested-response.type";

@@ -86,3 +86,3 @@ import { WebMentionOptions } from "../types/web-mention-options.type";

*/
async processMention(mention: QueuedMention): Promise<Mention[] | null> {
async processMention(mention: SimpleMention): Promise<Mention[] | null> {
const {html, status, error} = await fetchHtml(mention.source);

@@ -103,3 +103,6 @@ // Delete exisiting webmentions with the current source and target to avoid duplication

let mentions = hEntries.map(h => convertHEntryToMention(h, mention.source, mention.target));
if(mentions.length > 1) mentions = mentions.filter(m => m.type !== 'mention');
// if there are only basic mentions, use the first (most complete mention)
// otherwsise, get rid of any basic mentions as we have a better type
if(mentions.find(m => m.type !== 'mention')) mentions = mentions.filter(m => m.type !== 'mention');
else mentions = [mentions.find(m => m.type === 'mention')!];
const storedMentions = mentions.map(m => this.storageHandler.storeMentionForPage(m.target, m));

@@ -106,0 +109,0 @@ return Promise.all(storedMentions);

@@ -102,2 +102,14 @@ import path from 'path';

})
it('correctly creates a mention', () => {
const testHtml = fs.readFileSync(path.join(__dirname, '../test-data/html-mention.html'), 'utf8');
const hEntries = parseHtml(testHtml, 'http://example.com', 'http://example.com/note123');
const repost = convertHEntryToMention(hEntries[0], 'http://example.com', 'http://example.com/note123');
expect(repost).toEqual(expect.objectContaining({
...hEntries[0],
type: 'mention',
source: 'http://example.com',
target: 'http://example.com/note123'
}));
});
})
import { Mention } from "../types/mention.type";
import { isOnlyOneEmoji } from "./is-single-emoji.function";

@@ -17,7 +16,6 @@ export function convertHEntryToMention(entry: any, source: string, target: string): Mention {

if(mention.type === 'reply' && mention.rsvp) mention.type = 'rsvp';
else if(mention.type === 'reply' && isOnlyOneEmoji(mention.content.value)) mention.type = 'reaction';
if(mention.type === 'mention-of') return { ...mention, type: 'mention' };
if(mention.type === 'mention-of' || !mention.type) return { ...mention, type: 'mention' };
return mention;
}

@@ -5,3 +5,3 @@ import { parse as htmlParser } from 'node-html-parser';

import { getHtmlLinks } from "./get-html-links.function";
import { flattenEntry } from './flatten-entry.function';
import { normalizeEntry } from './normalize-entry.function';

@@ -22,3 +22,3 @@ export function parseHtml(html: string, source: string, target: string): MicroformatRoot[] {

// Return a more readable format
return items.map(flattenEntry)
return items.map(normalizeEntry)
}
describe('example',() => {
it('works', () => expect(1).toEqual(1));
it('contains the expected exports', () => {
const exports = require('./index');
expect(Object.keys(exports)).toEqual(['WebMentionHandler'])
})
})
export * from "./classes/web-mention-handler.class";
export * from "./interfaces/web-mention-storage.interface";
export * from "./types/mention.type";
export * from "./types/queued-mention.type";
export * from "./types/simple-mention.type";
export * from "./types/web-mention-options.type";
import { Mention } from "../types/mention.type";
import { QueuedMention } from "../types/queued-mention.type";
import { SimpleMention } from "../types/simple-mention.type";
import { SuggestedResponse } from "../types/suggested-response.type";

@@ -7,3 +7,3 @@ import { WebMentionOptions } from "../types/web-mention-options.type";

export interface IWebMentionHandler extends WebMentionOptions{
processMention(mention: QueuedMention): Promise<Mention[] | null>;
processMention(mention: SimpleMention): Promise<Mention[] | null>;
processPendingMentions(): Promise<Mention[]>;

@@ -10,0 +10,0 @@ addPendingMention(source: string, target: string): Promise<SuggestedResponse>;

import { Mention } from "../types/mention.type";
import { QueuedMention } from "../types/queued-mention.type";
import { SimpleMention } from "../types/simple-mention.type";
export interface IWebMentionStorage {
addPendingMention(mention: QueuedMention): Promise<QueuedMention>;
getNextPendingMentions(): Promise<QueuedMention[]>;
addPendingMention(mention: SimpleMention): Promise<SimpleMention>;
getNextPendingMentions(): Promise<SimpleMention[]>;
getMentionsForPage(page: string, type?: string): Promise<Mention[]>;
storeMentionForPage(page: string, mention: Mention): Promise<Mention>;
deleteMention(mention: QueuedMention): Promise<null>;
deleteMention(mention: SimpleMention): Promise<null>;
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc