pups-client 0.3.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,91 @@
1
+ /**
2
+ * Handles in text (bigwide.net RFC-11 "Handles"): `@` followed by a host name with at least two labels, e.g.
3
+ * `@tim.example.com`. Not e-mail addresses (`tim@tim.example.com`), fediverse addresses (`@tim@social.example`),
4
+ * names without a dot (`@foobar`) or paths (`@x.example/path`). A `/` directly between handles separates them:
5
+ * `@a.example/@b.example` names both.
6
+ */
7
+ const LABEL = '[\\p{L}\\p{N}](?:[\\p{L}\\p{M}\\p{N}-]*[\\p{L}\\p{M}\\p{N}])?';
8
+ const HOST = `(?:${LABEL}\\.)+\\p{L}(?:[\\p{L}\\p{M}\\p{N}-]*[\\p{L}\\p{M}\\p{N}])?`;
9
+ /** A handle, or several separated by `/`, with RFC-11's rules for the characters before and after. */
10
+ const HANDLES_RE = new RegExp(`(?:^|(?<=[\\s\\p{P}\\p{S}]))(?<![._\\-+/@])@${HOST}(?:/@${HOST})*(?![\\p{L}\\p{M}\\p{N}_\\-/@]|\\.[\\p{L}\\p{N}])`, 'gu');
11
+ /** Elements whose content is never shown. */
12
+ const HIDDEN_TAGS = new Set(['script', 'style', 'template', 'noscript', 'iframe', 'object', 'embed', 'svg', 'math', 'head', 'title', 'select', 'textarea', 'button']);
13
+ /** Elements whose content doesn't count for handles. */
14
+ const CODE_TAGS = new Set(['code', 'pre']);
15
+ const BLOCK_TAGS = new Set(['address', 'article', 'aside', 'blockquote', 'br', 'dd', 'div', 'dl', 'dt', 'figcaption', 'figure', 'footer',
16
+ 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'header', 'hr', 'li', 'main', 'nav', 'ol', 'p', 'pre', 'section', 'table', 'td', 'th', 'tr', 'ul']);
17
+ const VOID_TAGS = new Set(['area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'link', 'meta', 'source', 'track', 'wbr']);
18
+ const ENTITIES = { amp: '&', lt: '<', gt: '>', quot: '"', apos: '\'', nbsp: ' ', commat: '@', sol: '/', period: '.' };
19
+ /** A host name as handles are compared: lowercase ASCII (IDNA). Undefined if it isn't a valid host. */
20
+ export function asciiHost(host) {
21
+ try {
22
+ const url = new URL(`https://${host}/`);
23
+ return url.hostname && url.pathname == '/' && !url.port ? url.hostname.toLowerCase() : undefined;
24
+ }
25
+ catch {
26
+ return undefined;
27
+ }
28
+ }
29
+ /** The host of an account like `@alice.example.com`, in comparable form, or undefined. */
30
+ export function accountHost(account) {
31
+ const match = typeof account == 'string' ? /^@([^@\s/]+)$/u.exec(account.trim()) : null;
32
+ return match ? asciiHost(match[1]) : undefined;
33
+ }
34
+ /** The hosts of all handles in a plain text, in comparable form and in order, each once. */
35
+ export function findHandles(text) {
36
+ const hosts = [...text.matchAll(HANDLES_RE)].flatMap(m => m[0].split('/').map(h => asciiHost(h.slice(1))));
37
+ return [...new Set(hosts.filter((h) => !!h))];
38
+ }
39
+ const decode = (text) => text.replace(/&(#x[0-9a-f]+|#\d+|[a-z]+);/gi, (entity, name) => {
40
+ if (name[0] != '#')
41
+ return ENTITIES[name.toLowerCase()] ?? entity;
42
+ const code = name[1] == 'x' || name[1] == 'X' ? parseInt(name.slice(2), 16) : parseInt(name.slice(1), 10);
43
+ return code > 0 && code <= 0x10ffff ? String.fromCodePoint(code) : entity;
44
+ });
45
+ /**
46
+ * The visible text of an HTML fragment, with whitespace collapsed: without attribute values, comments and the
47
+ * content of elements that are never shown. With `skipCode`, the content of `code` and `pre` is left out as well.
48
+ * A small tokenizer, so that it works without a DOM; good enough for finding handles, not a sanitizer.
49
+ */
50
+ export function visibleText(html, skipCode = false) {
51
+ let out = '';
52
+ const hidden = [];
53
+ const tokens = /<!--[\s\S]*?(?:-->|$)|<!\[CDATA\[[\s\S]*?(?:\]\]>|$)|<[!?][^>]*>?|<\/?([a-zA-Z][a-zA-Z0-9-]*)((?:[^>"']|"[^"]*"|'[^']*')*)>|[^<]+|</g;
54
+ for (const [token, rawTag, attributes] of html.matchAll(tokens)) {
55
+ if (!rawTag) {
56
+ if (token[0] != '<' || token == '<') {
57
+ if (!hidden.length)
58
+ out += decode(token);
59
+ }
60
+ continue;
61
+ }
62
+ const tag = rawTag.toLowerCase();
63
+ const closing = token[1] == '/';
64
+ if (BLOCK_TAGS.has(tag))
65
+ out += ' ';
66
+ const hides = HIDDEN_TAGS.has(tag) || (skipCode && CODE_TAGS.has(tag));
67
+ if (!hides)
68
+ continue;
69
+ if (closing) {
70
+ const at = hidden.lastIndexOf(tag);
71
+ if (at >= 0)
72
+ hidden.length = at;
73
+ out += ' ';
74
+ }
75
+ else if (!VOID_TAGS.has(tag) && !attributes?.trimEnd().endsWith('/'))
76
+ hidden.push(tag);
77
+ }
78
+ return out.replace(/\s+/g, ' ').trim();
79
+ }
80
+ /**
81
+ * The text of an item in which handles are found: the title, and the visible text of its HTML without code, or its
82
+ * plain text (for a `PostInput`, its Markdown).
83
+ */
84
+ export function handleText(item) {
85
+ const text = typeof item.content_text == 'string' ? item.content_text : typeof item.markdown == 'string' ? item.markdown : undefined;
86
+ const body = typeof item.content_html == 'string' ? visibleText(item.content_html, true) : text?.replace(/\s+/g, ' ').trim() ?? '';
87
+ return `${typeof item.title == 'string' ? item.title : ''} ${body}`.trim();
88
+ }
89
+ /** The hosts of the handles in an item (RFC-11 "Finding handles in text"). */
90
+ export const itemHandles = (item) => findHandles(handleText(item));
91
+ //# sourceMappingURL=handles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handles.js","sourceRoot":"","sources":["../src/handles.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,KAAK,GAAG,+DAA+D,CAAA;AAC7E,MAAM,IAAI,GAAG,MAAM,KAAK,4DAA4D,CAAA;AACpF,sGAAsG;AACtG,MAAM,UAAU,GAAG,IAAI,MAAM,CAC3B,+CAA+C,IAAI,QAAQ,IAAI,oDAAoD,EAAE,IAAI,CAAC,CAAA;AAE5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C,CAAC,CAAC,WAAW,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,CAAA;IAClI,OAAO,GAAG,OAAO,IAAI,CAAC,KAAK,IAAI,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,IAAI,IAAI,EAAE,CAAC,IAAI,EAAE,CAAA;AAC5E,CAAC;AAED,8EAA8E;AAC9E,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,IAAkB,EAAE,EAAE,CAAC,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAA"}
package/dist/index.d.ts CHANGED
@@ -8,9 +8,13 @@ export { PupsClient, clientMetadataProblems } from './client.js';
8
8
  export type { AuthorizationCode, ClientMetadataReport, LoginOptions, PendingAuthorization, PopupLoginOptions, PupsClientOptions, RedirectResult, } from './client.js';
9
9
  export { PupsSession } from './session.js';
10
10
  export type { Body, JsonBody, SessionChangeEvent, StoredFile, WriteOptions, WriteResult } from './session.js';
11
- export { FEED_REL, PUPS_FEED_SPEC, PupsFeed, feedScopes, itemIndex } from './feed.js';
12
- export type { FeedAttachment, FeedAuthor, FeedDocument, FeedItem, FeedLink, FeedOptions, FeedSettings, FeedSettingsChanges, FeedSetup, FeedState, ItemMarker, MediaInput, MediaResult, PostChanges, PostInput, PostResult, PupsMarker, } from './feed.js';
11
+ export { FEED_REL, POST_URL_TEMPLATE, PUPS_FEED_SPEC, PupsFeed, feedScopes, itemIndex } from './feed.js';
12
+ export type { CommentPolicy, CommentsState, FeedAttachment, FeedAuthor, FeedDocument, FeedItem, FeedLink, FeedOptions, FeedSettings, FeedSettingsChanges, FeedSetup, FeedState, ItemMarker, MentionChoice, MediaInput, MediaResult, PostChanges, PostInput, PostResult, PupsMarker, } from './feed.js';
13
13
  export { HostMetaEditor } from './host-meta.js';
14
+ export { MENTION_REL, Mentions } from './mentions.js';
15
+ export type { Delivery, DeliveryStatus, FoundItem, MentionReport, MentionSource, MentionsOptions, PlannedMention, PostChange, PostMentions, Submission, SubmissionStatus } from './mentions.js';
16
+ export { accountHost, findHandles, handleText, itemHandles, visibleText } from './handles.js';
17
+ export type { HandleSource } from './handles.js';
14
18
  export type { HostMetaDocument, HostMetaLink } from './host-meta.js';
15
19
  export { PupsError, isPupsError } from './errors.js';
16
20
  export type { PupsErrorCode } from './errors.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,UAAU,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAChE,YAAY,EACV,iBAAiB,EACjB,oBAAoB,EACpB,YAAY,EACZ,oBAAoB,EACpB,iBAAiB,EACjB,iBAAiB,EACjB,cAAc,GACf,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC1C,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,kBAAkB,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC7G,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AACrF,YAAY,EACV,cAAc,EACd,UAAU,EACV,YAAY,EACZ,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,YAAY,EACZ,mBAAmB,EACnB,SAAS,EACT,SAAS,EACT,UAAU,EACV,UAAU,EACV,WAAW,EACX,WAAW,EACX,SAAS,EACT,UAAU,EACV,UAAU,GACX,MAAM,WAAW,CAAA;AAClB,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAC/C,YAAY,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AACpE,OAAO,EAAE,SAAS,EA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ist/index.js CHANGED
@@ -6,8 +6,10 @@
6
6
  */
7
7
  export { PupsClient, clientMetadataProblems } from './client.js';
8
8
  export { PupsSession } from './session.js';
9
- export { FEED_REL, PUPS_FEED_SPEC, PupsFeed, feedScopes, itemIndex } from './feed.js';
9
+ export { FEED_REL, POST_URL_TEMPLATE, PUPS_FEED_SPEC, PupsFeed, feedScopes, itemIndex } from './feed.js';
10
10
  export { HostMetaEditor } from './host-meta.js';
11
+ export { MENTION_REL, Mentions } from './mentions.js';
12
+ export { accountHost, findHandles, handleText, itemHandles, visibleText } from './handles.js';
11
13
  export { PupsError, isPupsError } from './errors.js';
12
14
  export { PUPS_REL, SUPPORTED_SPEC_VERSIONS, normalizeDomain } from './discovery.js';
13
15
  export { fileTypes, blockedExtensions } from './file-types.js';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,UAAU,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAUhE,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAE1C,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAoBrF,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAE/C,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAEpD,OAAO,EAAE,QAAQ,EAAE,uBAAuB,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAGnF,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAA;AAEhE,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,UAAU,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAUhE,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAE1C,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAE,cAAc,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAuBxG,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAC/C,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAErD,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAG7F,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAEpD,OAAO,EAAE,QAAQ,EAAE,uBAAuB,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAGnF,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAA;AAEhE,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA"}
@@ -0,0 +1,222 @@
1
+ import type { FeedItem } from './feed.js';
2
+ import { type HandleSource } from './handles.js';
3
+ /** The link relation of the mention endpoint in `host-meta.json` (RFC-11 "Discovery"). A placeholder in RFC-11. */
4
+ export declare const MENTION_REL = "https://bigwide.net/ns/mention";
5
+ export interface MentionsOptions {
6
+ fetch?: typeof fetch;
7
+ /**
8
+ * The waits before the retries of a webmention after a network error, a `5xx` or a `429` (RFC-11 "When").
9
+ * A longer `Retry-After` is respected, up to 10 minutes. Default: 10 seconds, 1 minute, 5 minutes.
10
+ */
11
+ retryDelays?: number[];
12
+ /**
13
+ * The waits between the checks whether a new or changed post is visible at its public URL, before the mentions
14
+ * are sent (RFC-11 "When"). Default: 1, 2, 4, 8 and 15 seconds, so about half a minute.
15
+ */
16
+ visibilityDelays?: number[];
17
+ /** Timeout of each request, in milliseconds. Default 15 seconds. */
18
+ timeoutMs?: number;
19
+ /** The publisher's identity, e.g. `https://tim.example.com/`: never notified. `session.mentions` sets it. */
20
+ me?: string;
21
+ }
22
+ /**
23
+ * The result of sending a webmention:
24
+ * - `accepted`: the endpoint answered `2xx`.
25
+ * - `unknown`: sent, but the endpoint doesn't allow a browser to read its answer (no CORS headers).
26
+ * - `rejected`: the endpoint answered `4xx` (other than `429`); not retried.
27
+ * - `failed`: a network error, `5xx` or `429`, also after the retries.
28
+ */
29
+ export type DeliveryStatus = 'accepted' | 'unknown' | 'rejected' | 'failed';
30
+ export interface Delivery {
31
+ status: DeliveryStatus;
32
+ /** The HTTP status, if there was a readable answer. */
33
+ httpStatus?: number;
34
+ /** The `message` of a JSON error body, or what went wrong. */
35
+ message?: string;
36
+ /** The `error` of a JSON error body, e.g. an RFC-4 failure code such as `comments-disabled`. */
37
+ code?: string;
38
+ /** The `Location` header of the answer, e.g. an RFC-4 status page. */
39
+ location?: string;
40
+ }
41
+ /** An account a post would notify, from `plan()`: e.g. to ask the author before anything is sent. */
42
+ export interface PlannedMention {
43
+ /** The account, e.g. `@tim.example.com`. */
44
+ account: string;
45
+ /** `reply` if the post answers an item of the account, `mention` if it names it. */
46
+ kind: 'mention' | 'reply';
47
+ /** The webmention's target: the domain's root URL, or the answered item. */
48
+ target: string;
49
+ /** The mention endpoint; set by `plan()` with `discover`, and on reports of accounts that have one. */
50
+ endpoint?: string;
51
+ }
52
+ /** One account notified by `notifyAll()` or `sendPlanned()`, or skipped because its domain doesn't accept mentions. */
53
+ export interface MentionReport extends PlannedMention {
54
+ /** `no-endpoint` if the domain doesn't accept mentions (no link in `host-meta.json`, or it can't be read). */
55
+ status: DeliveryStatus | 'no-endpoint';
56
+ httpStatus?: number;
57
+ message?: string;
58
+ }
59
+ /** The answer to an RFC-4 submission. */
60
+ export interface Submission extends Delivery {
61
+ /** The endpoint from the target feed's `_submissions.url`. */
62
+ endpoint: string;
63
+ /** The status page (RFC-4 "Response and status"), from `Location`; poll it with `submissionStatus()`. */
64
+ statusUrl?: string;
65
+ /** The guid the item will have when it is republished. */
66
+ guid?: string;
67
+ }
68
+ /** An RFC-4 status page. */
69
+ export type SubmissionStatus = {
70
+ status: 'waiting';
71
+ } | {
72
+ status: 'success';
73
+ pubDate?: string;
74
+ pubUrl?: string;
75
+ } | {
76
+ status: 'deleted';
77
+ } | {
78
+ status: 'failure';
79
+ code?: string;
80
+ text?: string;
81
+ };
82
+ /** An item found in a feed, with what decides about mentions and submissions. */
83
+ export interface FoundItem {
84
+ /** The URL of the feed or archive that was fetched first. */
85
+ feedUrl: string;
86
+ /** The RFC-4 `_submissions` that apply: the feed's, or for an RFC-7 archive, those of its feed file. */
87
+ submissions?: Record<string, unknown>;
88
+ /** The item, if it was found. */
89
+ item?: FeedItem;
90
+ /** The host of the item's author (RFC-11 "Replies"): its own socialspec account, else the feed's if the feed has no `_submissions`. */
91
+ author?: string;
92
+ }
93
+ /** What decides about the mentions of a post: its title, content and `_source.inReplyTo`. A `FeedItem` or a `PostInput`. */
94
+ export type MentionSource = HandleSource & {
95
+ _source?: unknown;
96
+ };
97
+ /** The input of `plan()`: a post to be added (`item`), changed (`item` and `previous`) or deleted (`previous`). */
98
+ export interface PostChange {
99
+ /** The post as it will be published; undefined for a delete. */
100
+ item?: MentionSource;
101
+ /** The post before an edit or delete. */
102
+ previous?: MentionSource;
103
+ /** The publisher's identity; never notified. Default: the `me` of the options. */
104
+ me?: string;
105
+ }
106
+ /** The input of `notifyAll()`: a post that was added, changed or deleted, and its `source`. */
107
+ export interface PostMentions extends PostChange {
108
+ /** The post's `source`: its feed or archive URL plus `#<id>`. */
109
+ source: string;
110
+ }
111
+ /**
112
+ * Sends webmentions: RFC-11 mentions to the domains a post names or answers, found through their `host-meta.json`,
113
+ * and RFC-4 submissions to the endpoint a target feed names in `_submissions`. Plain Webmention, form-encoded.
114
+ *
115
+ * Use `session.mentions`, which shares the discovery cache of the session, or create one for use without a session.
116
+ * In a browser, it can only read feeds and `host-meta.json` files that allow CORS, as RFC-4 and RFC-6 require;
117
+ * domains whose `host-meta.json` doesn't count as having no endpoint (RFC-11 "CORS").
118
+ */
119
+ export declare class Mentions {
120
+ #private;
121
+ constructor(options?: MentionsOptions);
122
+ /**
123
+ * The mention endpoint of a domain (RFC-11 "Discovery"): the first link with the relation `MENTION_REL` in its
124
+ * `host-meta.json`, if it is an https URL. Undefined if the domain has none, or its `host-meta.json` can't be
125
+ * read. Cached for 24 hours (less if the file's `max-age` says so), failures for an hour.
126
+ * @param domain `tim.example.com`, `@tim.example.com` or `https://tim.example.com/`.
127
+ */
128
+ discover(domain: string, options?: {
129
+ signal?: AbortSignal;
130
+ }): Promise<string | undefined>;
131
+ /**
132
+ * Sends a webmention: a form-encoded `POST` with `source` and `target`. Retries after network errors, `5xx` and
133
+ * `429` with the `retryDelays` (unless `retry` is false), never after other answers. Never throws, except
134
+ * `aborted`.
135
+ */
136
+ send(endpoint: string, source: string, target: string, options?: {
137
+ signal?: AbortSignal;
138
+ retry?: boolean;
139
+ }): Promise<Delivery>;
140
+ /**
141
+ * Tells a domain that `source` names it (RFC-11 "Mentions by name"), or answers its item `target`. Discovers
142
+ * the endpoint and sends the webmention.
143
+ * @param account `@tim.example.com` (or the bare host).
144
+ * @param target Default: the domain's root URL, `https://tim.example.com/`.
145
+ */
146
+ notify(source: string, account: string, options?: {
147
+ target?: string;
148
+ signal?: AbortSignal;
149
+ retry?: boolean;
150
+ }): Promise<MentionReport>;
151
+ /**
152
+ * Tells the author of the item `target` (a feed URL plus `#<id>`) that `source` answers it (RFC-11 "Replies").
153
+ * @returns undefined if the item has no author to notify, can't be read, or its feed takes RFC-4 submissions:
154
+ * then the answer is a submission, and the RFC-4 server sends the mentions.
155
+ */
156
+ reply(source: string, target: string, options?: {
157
+ signal?: AbortSignal;
158
+ retry?: boolean;
159
+ }): Promise<MentionReport | undefined>;
160
+ /**
161
+ * Submits a comment or post to an RFC-4 feed (RFC-4 "Submitting"): `source` is the item in the author feed,
162
+ * `target` the answered item (feed URL plus `#<id>`), or the group feed for a new post. The endpoint is the
163
+ * target feed's `_submissions.url`, unless given. The app must have shown the target's terms of service and what
164
+ * `republish` means before the first submission (RFC-4 "Republishing").
165
+ * @throws {PupsError} `unsupported` if the target feed takes no submissions.
166
+ */
167
+ submit(source: string, target: string, options?: {
168
+ endpoint?: string;
169
+ signal?: AbortSignal;
170
+ }): Promise<Submission>;
171
+ /** Reads an RFC-4 status page. */
172
+ submissionStatus(statusUrl: string, options?: {
173
+ signal?: AbortSignal;
174
+ }): Promise<SubmissionStatus>;
175
+ /**
176
+ * The accounts a post that is added, changed or deleted would notify (RFC-11 "Who is mentioned"), without sending
177
+ * anything, e.g. to list them in a confirmation dialog before posting: every domain its title and text name
178
+ * (RFC-11 "Handles"), and the author of the item it answers, with a reply. After an edit or delete, every account
179
+ * the old or the new version mentions. Each account once, replies first, never `me`, at most 20.
180
+ *
181
+ * Empty if the post answers an item of a feed with RFC-4 `_submissions`: such a post is a submission, and the
182
+ * RFC-4 server sends the mentions once it republishes it (RFC-11 "Who sends").
183
+ *
184
+ * Finding the author of an answered item reads its feed. With `discover`, it also looks up each domain's endpoint,
185
+ * and leaves out the domains that don't accept mentions; that tells them that a post names them, before the post
186
+ * is published (RFC-11 "Privacy considerations").
187
+ */
188
+ plan(post: PostChange, options?: {
189
+ signal?: AbortSignal;
190
+ discover?: boolean;
191
+ }): Promise<PlannedMention[]>;
192
+ /**
193
+ * Sends mentions as `plan()` returned them, e.g. those the author confirmed, with `source` as the post: the
194
+ * post's feed or archive URL plus `#<id>`, once it is published.
195
+ */
196
+ sendPlanned(source: string, planned: PlannedMention[], options?: {
197
+ signal?: AbortSignal;
198
+ retry?: boolean;
199
+ }): Promise<MentionReport[]>;
200
+ /** `plan()` and `sendPlanned()` in one: sends the RFC-11 mentions of a post that was added, changed or deleted. */
201
+ notifyAll(post: PostMentions, options?: {
202
+ signal?: AbortSignal;
203
+ }): Promise<MentionReport[]>;
204
+ /**
205
+ * Finds an item, given as feed URL plus `#<id>`, as RFC-4 does: in the feed, then along `next_url` (or RFC-7's
206
+ * `_pups.archive_url`) on the same host, at most 10 pages. JSON Feed only.
207
+ * @throws {PupsError} `network`, `not_found` or `invalid_feed` if the first feed can't be read.
208
+ */
209
+ findItem(ref: string, options?: {
210
+ signal?: AbortSignal;
211
+ item?: boolean;
212
+ }): Promise<FoundItem>;
213
+ /**
214
+ * Waits until the item `id` at the public URL `feedUrl` is in the state `ready` wants, e.g. present after a post,
215
+ * so that a receiver that fetches it right away doesn't get an older copy from a cache (RFC-11 "When"). Gives up
216
+ * after the `visibilityDelays`, or at once if the feed can't be read.
217
+ */
218
+ waitForItem(feedUrl: string, id: string, ready: (item: FeedItem | undefined) => boolean, options?: {
219
+ signal?: AbortSignal;
220
+ }): Promise<boolean>;
221
+ }
222
+ //# sourceMappingURL=mentions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mentions.d.ts","sourceRoot":"","sources":["../src/mentions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AACzC,OAAO,EAAuC,KAAK,YAAY,EAAE,MAAM,cAAc,CAAA;AAIrF,mHAAmH;AACnH,eAAO,MAAM,WAAW,mCAAmC,CAAA;AAU3D,MAAM,WAAW,eAAe;IAC9B,KAAK,CAAC,EAAE,OAAO,KAAK,CAAA;IACpB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,EAAE,CAAA;IACtB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAA;IAC3B,oEAAoE;IACpE,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,6GAA6G;IAC7G,EAAE,CAAC,EAAE,MAAM,CAAA;CACZ;AAED;;;;;;GAMG;AACH,MAAM,MAAM,cAAc,GAAG,UAAU,GAAG,SAAS,GA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