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.
- package/README.md +37 -1
- package/dist/discovery.d.ts +5 -0
- package/dist/discovery.d.ts.map +1 -1
- package/dist/discovery.js +2 -0
- package/dist/discovery.js.map +1 -1
- package/dist/feed.d.ts +111 -5
- package/dist/feed.d.ts.map +1 -1
- package/dist/feed.js +186 -15
- package/dist/feed.js.map +1 -1
- package/dist/handles.d.ts +34 -0
- package/dist/handles.d.ts.map +1 -0
- package/dist/handles.js +91 -0
- package/dist/handles.js.map +1 -0
- package/dist/index.d.ts +6 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/mentions.d.ts +222 -0
- package/dist/mentions.d.ts.map +1 -0
- package/dist/mentions.js +341 -0
- package/dist/mentions.js.map +1 -0
- package/dist/session.d.ts +6 -0
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js +9 -0
- package/dist/session.js.map +1 -1
- package/dist/util.d.ts +2 -0
- package/dist/util.d.ts.map +1 -1
- package/dist/util.js +2 -0
- package/dist/util.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/src/discovery.ts +7 -0
- package/src/feed.ts +238 -19
- package/src/handles.ts +101 -0
- package/src/index.ts +8 -1
- package/src/mentions.ts +443 -0
- package/src/session.ts +10 -0
- package/src/util.ts +4 -0
- package/src/version.ts +1 -1
package/README.md
CHANGED
|
@@ -141,9 +141,12 @@ else if (state.status == 'foreign')
|
|
|
141
141
|
const photo = await feed.uploadMedia(photoFile) // → https://…/feed/images/2026/….jpg
|
|
142
142
|
const post = await feed.addPost({ title: 'Hello', content_html: `<p>Hi!</p><img src="${photo.url}" alt="">` })
|
|
143
143
|
await feed.addPost({ markdown: 'Written in *Markdown*' }) // _source.markdown, with content_text as fallback
|
|
144
|
+
console.log(post.item.url) // the post's page on the homepage, if the site declares one
|
|
144
145
|
await feed.editPost(post.id, { title: 'Hello, world' }) // wherever the post is now, sets date_modified
|
|
145
146
|
await feed.deletePost(post.id, { deleteMedia: true }) // also deletes media no other post uses
|
|
146
147
|
await feed.updateSettings({ description: 'Longer notes', _podcast: { explicit: false } })
|
|
148
|
+
if (feed.commentsAvailable && feed.comments(state.feed) == 'off')
|
|
149
|
+
await feed.enableComments({ policy: { maxLength: 1000 } }) // comments go into the owner's inbox
|
|
147
150
|
|
|
148
151
|
for await (const item of feed.posts()) console.log(item.id) // newest first, through all archives
|
|
149
152
|
const feeds = await session.listFeeds() // the feeds registered in host-meta.json
|
|
@@ -151,10 +154,43 @@ const feeds = await session.listFeeds() // the feeds r
|
|
|
151
154
|
|
|
152
155
|
- **Archives.** Every post goes into the newest archive, `feed.000000.json`, `feed.000001.json`, … in the feed directory, 20 posts each, linked with `next_url`; posts never move. The feed file holds a copy of the newest 30 posts and points to the newest archive with `_pups.archive_url`; archives point back with `_pups.updates_url`. `session.feed(name, { maxItems, archiveSize, maxBytes })` changes the sizes. Archives are optional in RFC-7: with `{ startArchives: false }`, a feed without archives stays a plain feed file with the newest posts; a feed that has archives always keeps them.
|
|
153
156
|
- **Concurrency.** Every change is a read-modify-write with ETags, repeated when another app or the owner wrote in between. The archive is always written before the feed file, so no post is ever lost, and the next post repairs a feed file that an interrupted post didn't reach.
|
|
154
|
-
- **Post URLs.** `addPost()` returns `url`, the post's archive URL plus `#<id>`. It never changes, so it can be the `source` of an RFC-4 webmention.
|
|
157
|
+
- **Post URLs.** `addPost()` returns `url`, the post's archive URL plus `#<id>`. It never changes, so it can be the `source` of an RFC-4 webmention. If the site has a homepage that shows single posts, such as webpup, `host-meta.json` declares their URLs with the property `https://bigwide.net/ns/post-url-template` (`POST_URL_TEMPLATE`), e.g. `https://tim.example/p/{feed}/post/{index}`. Posts of a feed with archives then get the URL of their page as `url`, unless the app sets one; `editPost()` adds it to older posts that have none. Show `post.item.url` as the post's link; `session.feed(name, { postUrls: false })` turns this off.
|
|
158
|
+
- **Comments on your feed.** If the server has a `comment_endpoint` (RFC-6 "Built-in receiver"), `feed.enableComments({ policy, tos })` opens the feed for RFC-4 comments: it writes `_submissions` into the feed file, with the endpoint as `url`, a `comments` policy and `republish: "no"`, and the server puts the comments into the owner's inbox. `feed.disableComments()` removes it, `feed.comments(doc)` tells whether comments go to this server (`pups`), another service (`other`) or nowhere (`off`). Archives don't copy `_submissions`: the feed file alone decides. Single posts are closed with `_commenting: { allowComments: false }`.
|
|
155
159
|
- **Indexes.** Every post gets an index, `_pups.index` (also `PostResult.index`, or `itemIndex(item)`): 0 for the first post, then counting up, never changed and never given out again, with the counter `_pups.next_index` in the newest archive. Readers can number the posts and load only the archives they need. A feed written before indexes existed is indexed on its next post, or with `feed.assignIndexes()`; posts of apps that don't know indexes get theirs on the next post.
|
|
156
160
|
- Errors: `not_pups_controlled` for feeds without the marker, `invalid_feed` for files that aren't JSON Feeds, `not_found` for a missing feed or post.
|
|
157
161
|
|
|
162
|
+
### Mentions and submissions
|
|
163
|
+
|
|
164
|
+
A feed can tell the people a post names or answers ([RFC-11](https://github.com/bigwide-net/RFCs/blob/main/RFC-11-Mentions.md)), and submit comments to other feeds ([RFC-4](https://github.com/bigwide-net/RFCs/blob/main/RFC-4-Feed-Submissions.md)):
|
|
165
|
+
|
|
166
|
+
```ts
|
|
167
|
+
const feed = session.feed(undefined, { mentions: true })
|
|
168
|
+
const post = await feed.addPost({ content_html: '<p>Great talk by <a href="https://alice.example/">@alice.example</a></p>' })
|
|
169
|
+
for (const r of await post.mentions ?? []) console.log(r.account, r.status) // @alice.example accepted
|
|
170
|
+
|
|
171
|
+
const comment = await feed.addPost({ content_text: 'Agreed!', _source: { inReplyTo: 'https://rm.example/groups/g/posts.json#a8Kd03' } })
|
|
172
|
+
const submission = await feed.submit(comment.id) // to the target feed's _submissions.url
|
|
173
|
+
await session.mentions.submissionStatus(submission.statusUrl!) // { status: 'success', pubUrl: … }
|
|
174
|
+
|
|
175
|
+
await session.mentions.notify(source, '@alice.example') // the generic interface: any source, any account
|
|
176
|
+
await session.mentions.reply(source, 'https://bob.example/feed.json#p-12')
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
- **Asking first.** `feed.planMentions(input)` lists the accounts a post would notify, without sending anything, so the app can ask before posting. Each write takes `{ mentions }`: `true`, `false` (post without mentions), or the confirmed list:
|
|
180
|
+
|
|
181
|
+
```ts
|
|
182
|
+
const planned = await feed.planMentions(input) // [{ account: '@alice.example', kind: 'mention', target }]
|
|
183
|
+
const confirmed = planned.length && await confirmDialog(planned) ? planned : false
|
|
184
|
+
await feed.addPost(input, { mentions: confirmed })
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
For an edit, plan with the new version and `{ previous: oldItem }`; for a delete, `planMentions(undefined, { previous: oldItem })`. `{ discover: true }` leaves out the domains without an endpoint, but looks them up before the post is published, which tells them that it names them.
|
|
188
|
+
- **Automatic mentions.** With `{ mentions: true }`, `addPost()`, `editPost()` and `deletePost()` find the handles in the post's title and visible text, e.g. `@alice.example`, also lists like `@alice.example/@bob.example`, but not e-mail addresses, fediverse addresses, names without a dot or paths. The author of the item a post answers (`_source.inReplyTo`) gets a reply mention. Each account is notified once, never the owner, at most 20 per post; after an edit or delete, everyone the old or the new version named.
|
|
189
|
+
- **After the upload.** The mentions are sent in the background, once the post is visible at its public URL (so that a CDN doesn't hand the receiver an old copy), with the archive URL plus `#<id>` as `source`. `post.mentions` resolves to one report per account (`accepted`, `rejected`, `failed`, `unknown` or `no-endpoint`) and never rejects; a failed mention never fails the post. Network errors, `5xx` and `429` are retried a few times; `feed.sendMentions(id)` sends again later.
|
|
190
|
+
- **Discovery.** The endpoint is the link `https://bigwide.net/ns/mention` in the domain's `host-meta.json`, cached for a day, failures for an hour. A domain without one, or whose `host-meta.json` doesn't allow CORS, gets nothing. An endpoint without CORS headers still receives the mention; its report says `unknown`.
|
|
191
|
+
- **Replies to RFC-4 feeds** are submissions, not mentions: if the answered feed has `_submissions`, no mentions are sent (the RFC-4 server sends them once it republishes the comment). Submitting is never automatic, because the app must first show the target's terms of service and what `republish` means: call `feed.submit(id)` after `addPost()`, and again after `editPost()` or `deletePost()`.
|
|
192
|
+
- `new Mentions({ fetch })` works without a session. `findHandles()`, `itemHandles()` and `visibleText()` are exported too.
|
|
193
|
+
|
|
158
194
|
### What the library does for you
|
|
159
195
|
|
|
160
196
|
- **Discovery** through `/.well-known/host-meta.json` and the configuration document.
|
package/dist/discovery.d.ts
CHANGED
|
@@ -35,6 +35,11 @@ export interface PupsServer {
|
|
|
35
35
|
hostMetaEndpoint?: string;
|
|
36
36
|
/** Present only if the server can't accept `PUT` and `DELETE`; all writes then go here. */
|
|
37
37
|
postEndpoint?: string;
|
|
38
|
+
/**
|
|
39
|
+
* Present if the server accepts RFC-4 comments on posts of the owner's feeds and writes them into the owner's inbox
|
|
40
|
+
* (RFC-6 "Built-in receiver"). Feeds opt in with `feed.enableComments()`.
|
|
41
|
+
*/
|
|
42
|
+
commentEndpoint?: string;
|
|
38
43
|
maxUploadBytes: number;
|
|
39
44
|
specVersion: string;
|
|
40
45
|
/** The configuration document as fetched, including fields this library doesn't know. */
|
package/dist/discovery.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discovery.d.ts","sourceRoot":"","sources":["../src/discovery.ts"],"names":[],"mappings":"AAGA,wHAAwH;AACxH,eAAO,MAAM,QAAQ,4CAA4C,CAAA;AAEjE,yDAAyD;AACzD,eAAO,MAAM,uBAAuB,EAAE,SAAS,MAAM,EAAY,CAAA;AAIjE,iEAAiE;AACjE,MAAM,WAAW,aAAa;IAC5B,qDAAqD;IACrD,IAAI,EAAE,MAAM,CAAA;IACZ,wFAAwF;IACxF,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,4EAA4E;IAC5E,IAAI,EAAE,MAAM,EAAE,CAAA;IACd,0EAA0E;IAC1E,UAAU,EAAE,MAAM,EAAE,CAAA;IACpB,uFAA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,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC,CAmB/G;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,GAAG,UAAU,CAkE9F"}
|
package/dist/discovery.js
CHANGED
|
@@ -118,6 +118,7 @@ export function parseConfig(json, domain, identityHosts) {
|
|
|
118
118
|
});
|
|
119
119
|
const hostMetaEndpoint = optionalHttps('host_meta_endpoint');
|
|
120
120
|
const postEndpoint = optionalHttps('post_endpoint');
|
|
121
|
+
const commentEndpoint = optionalHttps('comment_endpoint');
|
|
121
122
|
return {
|
|
122
123
|
domain,
|
|
123
124
|
identityHosts,
|
|
@@ -131,6 +132,7 @@ export function parseConfig(json, domain, identityHosts) {
|
|
|
131
132
|
wellKnownPaths,
|
|
132
133
|
...hostMetaEndpoint ? { hostMetaEndpoint } : {},
|
|
133
134
|
...postEndpoint ? { postEndpoint } : {},
|
|
135
|
+
...commentEndpoint ? { commentEndpoint } : {},
|
|
134
136
|
maxUploadBytes: maxUploadBytes,
|
|
135
137
|
specVersion,
|
|
136
138
|
raw,
|
package/dist/discovery.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discovery.js","sourceRoot":"","sources":["../src/discovery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AAEtD,wHAAwH;AACxH,MAAM,CAAC,MAAM,QAAQ,GAAG,yCAAyC,CAAA;AAEjE,yDAAyD;AACzD,MAAM,CAAC,MAAM,uBAAuB,GAAsB,CAAC,KAAK,CAAC,CAAA;AAEjE,MAAM,kBAAkB,GAAG,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"discovery.js","sourceRoot":"","sources":["../src/discovery.ts"],"names":[],"mappings":"AA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;QACN,aAAa;QACb,MAAM;QACN,qBAAqB,EAAE,KAAK,CAAC,wBAAwB,CAAC;QACtD,aAAa,EAAE,KAAK,CAAC,gBAAgB,CAAC;QACtC,kBAAkB,EAAE,KAAK,CAAC,qBAAqB,CAAC;QAChD,WAAW,EAAE,IAAI,CAAC,cAAc,CAAC;QACjC,UAAU,EAAE,IAAI,CAAC,aAAa,CAAC;QAC/B,eAAe,EAAE,OAAO,CAAC,kBAAkB,EAAE,GAAG,CAAC,gBAAgB,CAAC;QAClE,cAAc;QACd,GAAG,gBAAgB,CAAC,CAAC,CAAC,EAAE,gBAAgB,EAAE,CAAC,CAAC,CAAC,EAAE;QAC/C,GAAG,YAAY,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE;QACvC,GAAG,eAAe,CAAC,CAAC,CAAC,EAAE,eAAe,EAAE,CAAC,CAAC,CAAC,EAAE;QAC7C,cAAc,EAAE,cAAwB;QACxC,WAAW;QACX,GAAG;KACJ,CAAA;AACH,CAAC"}
|
package/dist/feed.d.ts
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
|
+
import type { Mentions, MentionReport, MentionSource, PlannedMention, Submission } from './mentions.js';
|
|
1
2
|
import type { Scope } from './scopes.js';
|
|
2
3
|
import type { Body, PupsSession } from './session.js';
|
|
3
4
|
/** The link relation that registers a feed in `host-meta.json` (RFC-7). A placeholder in RFC-7. */
|
|
4
5
|
export declare const FEED_REL = "https://bigwide.net/ns/feed";
|
|
6
|
+
/**
|
|
7
|
+
* The site property in `host-meta.json` with the URL template of the pages that show single posts, e.g.
|
|
8
|
+
* `https://tim.example/p/{feed}/post/{index}` (RFC-6 "Post URLs", RFC-7 "Post URLs").
|
|
9
|
+
*/
|
|
10
|
+
export declare const POST_URL_TEMPLATE = "https://bigwide.net/ns/post-url-template";
|
|
5
11
|
/** The `about` of the `_pups` object: RFC-7. Not its final location; readers must not rely on it. */
|
|
6
12
|
export declare const PUPS_FEED_SPEC = "https://github.com/bigwide-net/RFCs/blob/main/RFC-7-Feed-Publishing-with-PUPS.md";
|
|
7
13
|
export interface FeedAuthor {
|
|
@@ -91,6 +97,24 @@ export interface FeedSettings {
|
|
|
91
97
|
expired?: boolean;
|
|
92
98
|
[extension: `_${string}`]: unknown;
|
|
93
99
|
}
|
|
100
|
+
/**
|
|
101
|
+
* The rules for comments of RFC-4 "Policies". Missing rules have RFC-4's defaults; servers may add others. The PUPS
|
|
102
|
+
* server's receiver enforces `title`, `minLength`, `maxLength`, `requireSocialSpec`, `allowEdit` and `allowDelete`.
|
|
103
|
+
*/
|
|
104
|
+
export interface CommentPolicy {
|
|
105
|
+
title?: 'required' | 'allowed' | 'none';
|
|
106
|
+
minLength?: number;
|
|
107
|
+
maxLength?: number;
|
|
108
|
+
requireSocialSpec?: boolean;
|
|
109
|
+
allowEdit?: boolean;
|
|
110
|
+
allowDelete?: boolean;
|
|
111
|
+
[rule: string]: unknown;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Whether a feed accepts comments (RFC-4 `_submissions`): `pups` through the PUPS server's receiver, `other`
|
|
115
|
+
* through another service, such as an rssmention server, or `off`.
|
|
116
|
+
*/
|
|
117
|
+
export type CommentsState = 'pups' | 'other' | 'off';
|
|
94
118
|
/** Changes to the settings: a value sets the field, `null` removes it, `undefined` leaves it unchanged. */
|
|
95
119
|
export type FeedSettingsChanges = {
|
|
96
120
|
[K in keyof FeedSettings]?: FeedSettings[K] | null;
|
|
@@ -152,6 +176,11 @@ export interface PostResult {
|
|
|
152
176
|
* as the `source` of an RFC-4 webmention. In a feed without archives, the feed file's URL plus `#<id>`.
|
|
153
177
|
*/
|
|
154
178
|
url: string;
|
|
179
|
+
/**
|
|
180
|
+
* With the option `mentions`: the RFC-11 mentions, sent once the post is visible at its public URL. Never
|
|
181
|
+
* rejects. Missing if the post names and answers no one.
|
|
182
|
+
*/
|
|
183
|
+
mentions?: Promise<MentionReport[]>;
|
|
155
184
|
}
|
|
156
185
|
export interface MediaResult {
|
|
157
186
|
path: string;
|
|
@@ -199,6 +228,17 @@ export interface FeedOptions {
|
|
|
199
228
|
maxBytes?: number;
|
|
200
229
|
/** How often an operation is repeated when another client changed the feed in between. Default 8. */
|
|
201
230
|
maxAttempts?: number;
|
|
231
|
+
/**
|
|
232
|
+
* Whether posts of a feed with archives get a `url` from the site's post URL template, if `host-meta.json`
|
|
233
|
+
* declares one and the post has no `url` (RFC-7 "Post URLs"). Default true.
|
|
234
|
+
*/
|
|
235
|
+
postUrls?: boolean;
|
|
236
|
+
/**
|
|
237
|
+
* Whether to send RFC-11 mentions after `addPost()`, `editPost()` and `deletePost()`: to the domains a post names
|
|
238
|
+
* (`@tim.example.com`) and to the author of the item it answers. `true` uses `session.mentions`. Default false.
|
|
239
|
+
* Each write can decide otherwise with its own option `mentions`, e.g. with the accounts the author confirmed.
|
|
240
|
+
*/
|
|
241
|
+
mentions?: boolean | Mentions;
|
|
202
242
|
}
|
|
203
243
|
/** A feed registered in `host-meta.json`. */
|
|
204
244
|
export interface FeedLink {
|
|
@@ -211,6 +251,14 @@ export interface FeedLink {
|
|
|
211
251
|
type Signal = {
|
|
212
252
|
signal?: AbortSignal;
|
|
213
253
|
};
|
|
254
|
+
/**
|
|
255
|
+
* Which RFC-11 mentions a write sends: `true` all of them, `false` none, or a list from `planMentions()`, e.g. the
|
|
256
|
+
* accounts the author confirmed. Default: the feed's option `mentions`.
|
|
257
|
+
*/
|
|
258
|
+
export type MentionChoice = boolean | PlannedMention[];
|
|
259
|
+
type WithMentions = Signal & {
|
|
260
|
+
mentions?: MentionChoice;
|
|
261
|
+
};
|
|
214
262
|
/** The scopes an app needs to write a feed: the feed file and the feed directory (RFC-7 "Server requirements"). */
|
|
215
263
|
export declare function feedScopes(name?: string): Scope[];
|
|
216
264
|
/** The index of an item (RFC-7 "Indexes"), or undefined if it has none. */
|
|
@@ -274,6 +322,24 @@ export declare class PupsFeed {
|
|
|
274
322
|
setIcon(media: MediaInput | null, options?: Signal): Promise<FeedDocument>;
|
|
275
323
|
/** Uploads a new favicon (64 × 64) to the icons directory, like `setIcon()`, or removes it with `null`. */
|
|
276
324
|
setFavicon(media: MediaInput | null, options?: Signal): Promise<FeedDocument>;
|
|
325
|
+
/** Whether the PUPS server can receive comments on the feed's posts (`comment_endpoint`, RFC-6 "Built-in receiver"). */
|
|
326
|
+
get commentsAvailable(): boolean;
|
|
327
|
+
/** Whether the feed accepts comments, and through whom; `doc` is the feed file, e.g. from `load()`. */
|
|
328
|
+
comments(doc: FeedDocument): CommentsState;
|
|
329
|
+
/**
|
|
330
|
+
* Lets readers comment on the feed's posts through the PUPS server, which puts the comments into the owner's inbox
|
|
331
|
+
* (RFC-6 "Built-in receiver"): writes RFC-4 `_submissions` into the feed file, with `comment_endpoint` as `url`,
|
|
332
|
+
* the comments policy (RFC-4's defaults for `title`, `minLength` and `maxLength`, overridden by `policy`) and
|
|
333
|
+
* `republish: "no"`. Replaces the `_submissions` of another service; check `comments()` first and ask the owner.
|
|
334
|
+
* Single posts are closed with `_commenting: { allowComments: false }` (RFC-4).
|
|
335
|
+
* @throws {PupsError} `unsupported` if the server has no `comment_endpoint`.
|
|
336
|
+
*/
|
|
337
|
+
enableComments(settings?: {
|
|
338
|
+
policy?: CommentPolicy;
|
|
339
|
+
tos?: string;
|
|
340
|
+
}, options?: Signal): Promise<FeedDocument>;
|
|
341
|
+
/** Closes the feed for comments: removes `_submissions` from the feed file, whichever service it names. */
|
|
342
|
+
disableComments(options?: Signal): Promise<FeedDocument>;
|
|
277
343
|
/**
|
|
278
344
|
* Uploads an image, audio or video file into the feed directory under a new, unique name, by default
|
|
279
345
|
* `images/<year>/…` for images and `media/<year>/…` for everything else. Reference it from a post by its `url`.
|
|
@@ -287,10 +353,15 @@ export declare class PupsFeed {
|
|
|
287
353
|
* holds `archiveSize` items, then to the top of the feed file, which keeps the newest `maxItems`. A feed without
|
|
288
354
|
* archives gets them now, unless `startArchives` is false; then the post only goes into the feed file. Upload
|
|
289
355
|
* media with `uploadMedia()` before posting.
|
|
356
|
+
* In a feed with archives, a post without `url` gets one from the site's post URL template, if `host-meta.json`
|
|
357
|
+
* has one and `postUrls` isn't false: the page that shows the post (RFC-7 "Post URLs").
|
|
358
|
+
* With the option `mentions`, the domains the post names and the author of the item it answers are notified
|
|
359
|
+
* (RFC-11) once the post is visible; see `PostResult.mentions`.
|
|
290
360
|
* @returns the post, with `url`: its archive's URL plus `#<id>`, which never changes; for a feed without
|
|
291
|
-
* archives, the feed file's URL plus `#<id>`, valid while the post is among the newest.
|
|
361
|
+
* archives, the feed file's URL plus `#<id>`, valid while the post is among the newest. The post's page, if it
|
|
362
|
+
* has one, is `item.url`.
|
|
292
363
|
*/
|
|
293
|
-
addPost(input: PostInput, options?:
|
|
364
|
+
addPost(input: PostInput, options?: WithMentions): Promise<PostResult>;
|
|
294
365
|
/**
|
|
295
366
|
* Gives every item of the feed without an index one (RFC-7 "Indexing an existing feed"), and sets the counter.
|
|
296
367
|
* `addPost()` does this by itself before the first post to a feed that hasn't been indexed yet; call it to
|
|
@@ -313,10 +384,12 @@ export declare class PupsFeed {
|
|
|
313
384
|
* a function that gets a copy of the item and returns the new item, or `undefined` to leave it unchanged. The
|
|
314
385
|
* function may run more than once.
|
|
315
386
|
*
|
|
316
|
-
* Apps should edit posts only when the owner asks them to, whichever app created them.
|
|
387
|
+
* Apps should edit posts only when the owner asks them to, whichever app created them. With the option
|
|
388
|
+
* `mentions`, everyone the old or the new version mentions is notified. A post of a feed with
|
|
389
|
+
* archives that has no `url`, and had none before, gets one from the post URL template, as in `addPost()`.
|
|
317
390
|
* @throws {PupsError} `not_found`
|
|
318
391
|
*/
|
|
319
|
-
editPost(id: string, changes: PostChanges | ((item: FeedItem) => FeedItem | undefined | Promise<FeedItem | undefined>), options?:
|
|
392
|
+
editPost(id: string, changes: PostChanges | ((item: FeedItem) => FeedItem | undefined | Promise<FeedItem | undefined>), options?: WithMentions): Promise<PostResult>;
|
|
320
393
|
/**
|
|
321
394
|
* Deletes a post from its archive and from the feed file, which is then filled up again with the newest items
|
|
322
395
|
* from the archives. With `deleteMedia`, it also deletes the files in the feed directory that the post references
|
|
@@ -324,12 +397,45 @@ export declare class PupsFeed {
|
|
|
324
397
|
* @returns the deleted item, and the public URLs of the deleted media files.
|
|
325
398
|
* @throws {PupsError} `not_found`
|
|
326
399
|
*/
|
|
327
|
-
deletePost(id: string, options?:
|
|
400
|
+
deletePost(id: string, options?: WithMentions & {
|
|
328
401
|
deleteMedia?: boolean;
|
|
329
402
|
}): Promise<{
|
|
330
403
|
item: FeedItem;
|
|
331
404
|
deletedMedia: string[];
|
|
405
|
+
mentions?: Promise<MentionReport[]>;
|
|
332
406
|
}>;
|
|
407
|
+
/**
|
|
408
|
+
* Sends the RFC-11 mentions of a post now, e.g. to try again those that failed (see `Mentions.notifyAll()`). With
|
|
409
|
+
* `previous`, the version before an edit, also to the accounts that one mentioned.
|
|
410
|
+
* @throws {PupsError} `not_found`
|
|
411
|
+
*/
|
|
412
|
+
sendMentions(id: string, options?: Signal & {
|
|
413
|
+
previous?: FeedItem;
|
|
414
|
+
}): Promise<MentionReport[]>;
|
|
415
|
+
/**
|
|
416
|
+
* Submits a post that answers an item of an RFC-4 feed, e.g. a comment, to that feed's `_submissions.url`
|
|
417
|
+
* (RFC-4 "Submitting"): `source` is the post's archive URL plus `#<id>`, `target` its `_source.inReplyTo`. Call it
|
|
418
|
+
* after `addPost()` or `editPost()`, also to submit an edit or a delete again. Show the target's terms of service
|
|
419
|
+
* and what its `republish` means before the first submission.
|
|
420
|
+
* @throws {PupsError} `not_found`; `invalid_request` if the post answers nothing; `unsupported` if the target
|
|
421
|
+
* feed takes no submissions.
|
|
422
|
+
*/
|
|
423
|
+
submit(id: string, options?: Signal): Promise<Submission>;
|
|
424
|
+
/**
|
|
425
|
+
* The RFC-11 mentions a post would send (see `Mentions.plan()`), e.g. to ask the author before posting:
|
|
426
|
+
*
|
|
427
|
+
* ```ts
|
|
428
|
+
* const planned = await feed.planMentions(input)
|
|
429
|
+
* const confirmed = planned.length && await askToNotify(planned) ? planned : false // the app's dialog
|
|
430
|
+
* await feed.addPost(input, { mentions: confirmed })
|
|
431
|
+
* ```
|
|
432
|
+
*
|
|
433
|
+
* For an edit, pass the post as it will be and the current version as `previous`; for a delete, only `previous`.
|
|
434
|
+
*/
|
|
435
|
+
planMentions(post: MentionSource | undefined, options?: Signal & {
|
|
436
|
+
previous?: MentionSource;
|
|
437
|
+
discover?: boolean;
|
|
438
|
+
}): Promise<PlannedMention[]>;
|
|
333
439
|
}
|
|
334
440
|
/** The feeds registered in the owner's `host-meta.json` (RFC-7 "Registering feeds"). */
|
|
335
441
|
export declare function listFeeds(session: PupsSession, options?: Signal & FeedOptions): Promise<FeedLink[]>;
|
package/dist/feed.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feed.d.ts","sourceRoot":"","sources":["../src/feed.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"feed.d.ts","sourceRoot":"","sources":["../src/feed.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,aAAa,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AACvG,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAGrD,mGAAmG;AACnG,eAAO,MAAM,QAAQ,gCAAgC,CAAA;AAErD;;;GAGG;AACH,eAAO,MAAM,iBAAiB,6CAA6C,CAAA;AAE3E,qGAAqG;AACrG,eAAO,MAAM,cAAc,qFAAqF,CAAA;AAuBhH,MAAM,WAAW,UAAU;IACzB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,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