pups-client 0.1.0 → 0.2.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/src/index.ts CHANGED
@@ -16,6 +16,25 @@ export type {
16
16
  } from './client.js'
17
17
  export { PupsSession } from './session.js'
18
18
  export type { Body, JsonBody, SessionChangeEvent, StoredFile, WriteOptions, WriteResult } from './session.js'
19
+ export { FEED_REL, PUPS_FEED_SPEC, PupsFeed, feedScopes } from './feed.js'
20
+ export type {
21
+ FeedAttachment,
22
+ FeedAuthor,
23
+ FeedDocument,
24
+ FeedItem,
25
+ FeedLink,
26
+ FeedOptions,
27
+ FeedSettings,
28
+ FeedSettingsChanges,
29
+ FeedSetup,
30
+ FeedState,
31
+ MediaInput,
32
+ MediaResult,
33
+ PostChanges,
34
+ PostInput,
35
+ PostResult,
36
+ PupsMarker,
37
+ } from './feed.js'
19
38
  export { HostMetaEditor } from './host-meta.js'
20
39
  export type { HostMetaDocument, HostMetaLink } from './host-meta.js'
21
40
  export { PupsError, isPupsError } from './errors.js'
package/src/session.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { discover, type PupsServer } from './discovery.js'
2
2
  import { errorFromResponse, isPupsError, PupsError } from './errors.js'
3
+ import { listFeeds, PupsFeed, type FeedLink, type FeedOptions } from './feed.js'
3
4
  import { fileTypeOf, uploadContentType } from './file-types.js'
4
5
  import { HostMetaEditor } from './host-meta.js'
5
6
  import { revokeToken } from './oauth.js'
@@ -258,6 +259,20 @@ export class PupsSession {
258
259
  await this.#write('DELETE', absolute, options.ifMatch ? { 'If-Match': quoteEtag(options.ifMatch) } : {}, undefined, options.signal)
259
260
  }
260
261
 
262
+ /**
263
+ * A feed on the owner's domain, maintained according to RFC-7: the main feed `/feed.json` without a name, or the
264
+ * named feed `/feed/<name>.json`. The session needs the feed's scopes, see `feedScopes()`.
265
+ * @throws {PupsError} `invalid_request` for an invalid name.
266
+ */
267
+ feed(name?: string, options: FeedOptions = {}): PupsFeed {
268
+ return new PupsFeed(this, name, options)
269
+ }
270
+
271
+ /** The feeds registered in the owner's `host-meta.json`, e.g. to let the owner choose one to post to. */
272
+ listFeeds(options: { signal?: AbortSignal } & FeedOptions = {}): Promise<FeedLink[]> {
273
+ return listFeeds(this, options)
274
+ }
275
+
261
276
  /**
262
277
  * Fetches the configuration document again, e.g. after the owner changed allowed paths. Accepted only if the
263
278
  * issuer is unchanged; a different issuer means the user has to connect again.
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.1.0'
1
+ export const VERSION = '0.2.0'