notefeed 0.34.0 → 0.35.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 +1 -1
- package/dist/client.d.ts +9 -2
- package/dist/client.js +25 -4
- package/dist/generated/index.d.ts +2 -2
- package/dist/generated/index.js +1 -1
- package/dist/generated/sdk.gen.d.ts +8 -2
- package/dist/generated/sdk.gen.js +11 -1
- package/dist/generated/types.gen.d.ts +76 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# notefeed
|
|
2
2
|
|
|
3
|
-
Post and read markdown notes on a [notefeed](https://github.com/notefeed/notefeed) server from Node or the command line. No dependencies; Node
|
|
3
|
+
Post and read markdown notes on a [notefeed](https://github.com/notefeed/notefeed) server from Node or the command line. No dependencies; Node 22 or newer.
|
|
4
4
|
|
|
5
5
|
```sh
|
|
6
6
|
npm install notefeed
|
package/dist/client.d.ts
CHANGED
|
@@ -51,7 +51,8 @@ export declare class InvalidRequestError extends NotefeedError {
|
|
|
51
51
|
}
|
|
52
52
|
export declare class Client {
|
|
53
53
|
readonly url: string;
|
|
54
|
-
|
|
54
|
+
/** The feed calls use when they name none; a rename of it through updateFeed() (`name`) moves it to the new name. */
|
|
55
|
+
feed: string | null;
|
|
55
56
|
private readonly api;
|
|
56
57
|
private readonly timeoutMs;
|
|
57
58
|
private readonly feedPassword;
|
|
@@ -124,7 +125,7 @@ export declare class Client {
|
|
|
124
125
|
feed?: string;
|
|
125
126
|
feedPassword?: string;
|
|
126
127
|
}): Promise<Feed>;
|
|
127
|
-
/** Replace the feed's title and description (both; an empty string clears one), and set (`image`: a file name from uploadImage) or clear (`""`) the title image; leave `image` out to keep it. `read_id` gives the feed another read id (3 to 64 characters of `a-z`, `0-9`, `-`, `_`; `""` for a random one; left out keeps it); the old one is freed, and relative image links in notes follow while full URLs do not. The feed must already exist. Same options as post(). */
|
|
128
|
+
/** Replace the feed's title and description (both; an empty string clears one), and set (`image`: a file name from uploadImage) or clear (`""`) the title image; leave `image` out to keep it. `read_id` gives the feed another read id (3 to 64 characters of `a-z`, `0-9`, `-`, `_`; `""` for a random one; left out keeps it); the old one is freed, and relative image links in notes follow while full URLs do not. `name` renames the feed (1 to 64 characters of `a-z`, `0-9`, `-`, `_`): everything goes with it and the old name stops working at once; when it was this client's own feed, the client uses the new name for the rest of this run; change NOTEFEED_FEED (or wherever the name is configured) before the next one. The feed must already exist. Same options as post(). */
|
|
128
129
|
updateFeed(settings: FeedSettings, options?: {
|
|
129
130
|
feed?: string;
|
|
130
131
|
feedPassword?: string;
|
|
@@ -181,6 +182,12 @@ export declare class Client {
|
|
|
181
182
|
feed?: string;
|
|
182
183
|
feedPassword?: string;
|
|
183
184
|
}): Promise<Note>;
|
|
185
|
+
/** A note's file by its own name (a note's `file`, `<id>.<ext>`), as bytes: also a draft's or a scheduled note's, which the read link
|
|
186
|
+
* (`file_url`) does not serve until readers may see them, so a post's pictures can be checked before it goes out. */
|
|
187
|
+
file(name: string, options?: {
|
|
188
|
+
feed?: string;
|
|
189
|
+
feedPassword?: string;
|
|
190
|
+
}): Promise<Uint8Array>;
|
|
184
191
|
/** Like notes(), by the feed's read id: public, read-only, needs no password. */
|
|
185
192
|
readNotes(readId: string, options?: {
|
|
186
193
|
pageSize?: number;
|
package/dist/client.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* OpenAPI description (./generated, `npm run generate` in the repo). No runtime dependencies.
|
|
4
4
|
*/
|
|
5
5
|
import { createClient, createConfig } from "./generated/client/index.js";
|
|
6
|
-
import { changeFeedPassword, createFeed, deleteFeed, deleteFeedLicense, deleteNote, editNote, getFeed, getLicenses, getNote, getReadNote, listNotes, listReadNotes, patchNote, postNote, putFeedLicense, recoverFeedPassword, removeFeedImage, setFeedImage, updateFeed } from "./generated/sdk.gen.js";
|
|
6
|
+
import { changeFeedPassword, createFeed, deleteFeed, deleteFeedLicense, deleteNote, editNote, getFeed, getFile, getLicenses, getNote, getReadNote, listNotes, listReadNotes, patchNote, postNote, putFeedLicense, recoverFeedPassword, removeFeedImage, setFeedImage, updateFeed } from "./generated/sdk.gen.js";
|
|
7
7
|
/** Any failure talking to notefeed. `status` and `code` are null when there was no API answer. */
|
|
8
8
|
export class NotefeedError extends Error {
|
|
9
9
|
status;
|
|
@@ -81,6 +81,7 @@ function asFile(content, type) {
|
|
|
81
81
|
}
|
|
82
82
|
export class Client {
|
|
83
83
|
url;
|
|
84
|
+
/** The feed calls use when they name none; a rename of it through updateFeed() (`name`) moves it to the new name. */
|
|
84
85
|
feed;
|
|
85
86
|
api;
|
|
86
87
|
timeoutMs;
|
|
@@ -208,11 +209,22 @@ export class Client {
|
|
|
208
209
|
const feed = this.feedFor(options.feed);
|
|
209
210
|
return this.call(getFeed({ client: this.api, path: { feed }, ...this.opts(options.feedPassword) }));
|
|
210
211
|
}
|
|
211
|
-
/** Replace the feed's title and description (both; an empty string clears one), and set (`image`: a file name from uploadImage) or clear (`""`) the title image; leave `image` out to keep it. `read_id` gives the feed another read id (3 to 64 characters of `a-z`, `0-9`, `-`, `_`; `""` for a random one; left out keeps it); the old one is freed, and relative image links in notes follow while full URLs do not. The feed must already exist. Same options as post(). */
|
|
212
|
+
/** Replace the feed's title and description (both; an empty string clears one), and set (`image`: a file name from uploadImage) or clear (`""`) the title image; leave `image` out to keep it. `read_id` gives the feed another read id (3 to 64 characters of `a-z`, `0-9`, `-`, `_`; `""` for a random one; left out keeps it); the old one is freed, and relative image links in notes follow while full URLs do not. `name` renames the feed (1 to 64 characters of `a-z`, `0-9`, `-`, `_`): everything goes with it and the old name stops working at once; when it was this client's own feed, the client uses the new name for the rest of this run; change NOTEFEED_FEED (or wherever the name is configured) before the next one. The feed must already exist. Same options as post(). */
|
|
212
213
|
async updateFeed(settings, options = {}) {
|
|
213
214
|
const feed = this.feedFor(options.feed);
|
|
214
|
-
|
|
215
|
-
|
|
215
|
+
if (settings.name)
|
|
216
|
+
checkFeed(settings.name);
|
|
217
|
+
const body = {
|
|
218
|
+
title: settings.title,
|
|
219
|
+
description: settings.description,
|
|
220
|
+
...(settings.image === undefined ? {} : { image: settings.image }),
|
|
221
|
+
...(settings.read_id === undefined ? {} : { read_id: settings.read_id }),
|
|
222
|
+
...(settings.name === undefined ? {} : { name: settings.name }),
|
|
223
|
+
};
|
|
224
|
+
const updated = await this.call(updateFeed({ client: this.api, path: { feed }, body, ...this.opts(options.feedPassword) }));
|
|
225
|
+
if (feed === this.feed && typeof updated?.name === "string" && updated.name !== feed)
|
|
226
|
+
this.feed = updated.name;
|
|
227
|
+
return updated;
|
|
216
228
|
}
|
|
217
229
|
/** Put the license the key names on the feed, taking it off the feed it was on; a feed needs no password for it. Only on an instance that sells licenses. Same options as post(). */
|
|
218
230
|
async attachLicense(key, options = {}) {
|
|
@@ -265,6 +277,15 @@ export class Client {
|
|
|
265
277
|
const feed = this.feedFor(options.feed);
|
|
266
278
|
return this.call(getNote({ client: this.api, path: { feed, id }, ...this.opts(options.feedPassword) }));
|
|
267
279
|
}
|
|
280
|
+
/** A note's file by its own name (a note's `file`, `<id>.<ext>`), as bytes: also a draft's or a scheduled note's, which the read link
|
|
281
|
+
* (`file_url`) does not serve until readers may see them, so a post's pictures can be checked before it goes out. */
|
|
282
|
+
async file(name, options = {}) {
|
|
283
|
+
const feed = this.feedFor(options.feed);
|
|
284
|
+
const request = getFile({ client: this.api, path: { feed, file: name }, parseAs: "arrayBuffer", ...this.opts(options.feedPassword) });
|
|
285
|
+
// Asked for as an ArrayBuffer, whatever the generated type says; wrapped so call() checks it like any other answer.
|
|
286
|
+
const asBytes = request.then((r) => ({ ...r, data: r.data instanceof ArrayBuffer ? { bytes: new Uint8Array(r.data) } : undefined }));
|
|
287
|
+
return (await this.call(asBytes)).bytes;
|
|
288
|
+
}
|
|
268
289
|
/** Like notes(), by the feed's read id: public, read-only, needs no password. */
|
|
269
290
|
readNotes(readId, options = {}) {
|
|
270
291
|
return this.pages((before) => listReadNotes({ client: this.api, path: { readId }, query: { limit: options.pageSize, before, tag: options.tag }, ...this.opts() }));
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { changeFeedPassword, createFeed, deleteFeed, deleteFeedLicense, deleteNote, editNote, getFeed, getLicenses, getNote, getOpenApi, getReadFeed, getReadNote, listNotes, listReadNotes, type Options, patchNote, postNote, putFeedLicense, recoverFeedPassword, removeFeedImage, removeFeedPassword, setFeedImage, updateFeed } from './sdk.gen.js';
|
|
2
|
-
export type { ChangeFeedPasswordData, ChangeFeedPasswordError, ChangeFeedPasswordErrors, ChangeFeedPasswordResponse, ChangeFeedPasswordResponses, ClientOptions, Created, CreateFeedData, CreateFeedError, CreateFeedErrors, CreateFeedJson, CreateFeedResponse, CreateFeedResponses, DeleteFeedData, DeleteFeedError, DeleteFeedErrors, DeleteFeedLicenseData, DeleteFeedLicenseError, DeleteFeedLicenseErrors, DeleteFeedLicenseResponse, DeleteFeedLicenseResponses, DeleteFeedResponse, DeleteFeedResponses, DeleteNoteData, DeleteNoteError, DeleteNoteErrors, DeleteNoteResponse, DeleteNoteResponses, EditNoteData, EditNoteError, EditNoteErrors, EditNoteResponse, EditNoteResponses, Error, Feed, FeedSettings, FreeTier, GetFeedData, GetFeedError, GetFeedErrors, GetFeedResponse, GetFeedResponses, GetLicensesData, GetLicensesError, GetLicensesErrors, GetLicensesResponse, GetLicensesResponses, GetNoteData, GetNoteError, GetNoteErrors, GetNoteResponse, GetNoteResponses, GetOpenApiData, GetOpenApiResponse, GetOpenApiResponses, GetReadFeedData, GetReadFeedError, GetReadFeedErrors, GetReadFeedResponse, GetReadFeedResponses, GetReadNoteData, GetReadNoteError, GetReadNoteErrors, GetReadNoteResponse, GetReadNoteResponses, LicenseKey, Licenses, ListNotesData, ListNotesError, ListNotesErrors, ListNotesResponse, ListNotesResponses, ListReadNotesData, ListReadNotesError, ListReadNotesErrors, ListReadNotesResponse, ListReadNotesResponses, MultipartNote, Note, NoteEdited, NoteList, NoteMeta, PasswordJson, PatchNoteData, PatchNoteError, PatchNoteErrors, PatchNoteResponse, PatchNoteResponses, Posted, PostNoteData, PostNoteError, PostNoteErrors, PostNoteResponse, PostNoteResponses, PutFeedLicenseData, PutFeedLicenseError, PutFeedLicenseErrors, PutFeedLicenseResponse, PutFeedLicenseResponses, ReadFeed, RecoverFeedPasswordData, RecoverFeedPasswordError, RecoverFeedPasswordErrors, RecoverFeedPasswordResponse, RecoverFeedPasswordResponses, RecoveryJson, RemoveFeedImageData, RemoveFeedImageError, RemoveFeedImageErrors, RemoveFeedImageResponse, RemoveFeedImageResponses, RemoveFeedPasswordData, RemoveFeedPasswordError, RemoveFeedPasswordErrors, RemoveFeedPasswordResponse, RemoveFeedPasswordResponses, SetFeedImageData, SetFeedImageError, SetFeedImageErrors, SetFeedImageResponse, SetFeedImageResponses, UpdateFeedData, UpdateFeedError, UpdateFeedErrors, UpdateFeedResponse, UpdateFeedResponses } from './types.gen.js';
|
|
1
|
+
export { changeFeedPassword, createFeed, deleteFeed, deleteFeedLicense, deleteNote, editNote, getFeed, getFile, getLicenses, getNote, getOpenApi, getReadFeed, getReadNote, listNotes, listReadNotes, type Options, patchNote, postNote, putFeedLicense, recoverFeedPassword, removeFeedImage, removeFeedPassword, setFeedImage, updateFeed } from './sdk.gen.js';
|
|
2
|
+
export type { ChangeFeedPasswordData, ChangeFeedPasswordError, ChangeFeedPasswordErrors, ChangeFeedPasswordResponse, ChangeFeedPasswordResponses, ClientOptions, Created, CreateFeedData, CreateFeedError, CreateFeedErrors, CreateFeedJson, CreateFeedResponse, CreateFeedResponses, DeleteFeedData, DeleteFeedError, DeleteFeedErrors, DeleteFeedLicenseData, DeleteFeedLicenseError, DeleteFeedLicenseErrors, DeleteFeedLicenseResponse, DeleteFeedLicenseResponses, DeleteFeedResponse, DeleteFeedResponses, DeleteNoteData, DeleteNoteError, DeleteNoteErrors, DeleteNoteResponse, DeleteNoteResponses, EditNoteData, EditNoteError, EditNoteErrors, EditNoteResponse, EditNoteResponses, Error, Feed, FeedSettings, FreeTier, GetFeedData, GetFeedError, GetFeedErrors, GetFeedResponse, GetFeedResponses, GetFileData, GetFileError, GetFileErrors, GetFileResponse, GetFileResponses, GetLicensesData, GetLicensesError, GetLicensesErrors, GetLicensesResponse, GetLicensesResponses, GetNoteData, GetNoteError, GetNoteErrors, GetNoteResponse, GetNoteResponses, GetOpenApiData, GetOpenApiResponse, GetOpenApiResponses, GetReadFeedData, GetReadFeedError, GetReadFeedErrors, GetReadFeedResponse, GetReadFeedResponses, GetReadNoteData, GetReadNoteError, GetReadNoteErrors, GetReadNoteResponse, GetReadNoteResponses, LicenseKey, Licenses, ListNotesData, ListNotesError, ListNotesErrors, ListNotesResponse, ListNotesResponses, ListReadNotesData, ListReadNotesError, ListReadNotesErrors, ListReadNotesResponse, ListReadNotesResponses, MultipartNote, Note, NoteEdited, NoteList, NoteMeta, PasswordJson, PatchNoteData, PatchNoteError, PatchNoteErrors, PatchNoteResponse, PatchNoteResponses, Posted, PostNoteData, PostNoteError, PostNoteErrors, PostNoteResponse, PostNoteResponses, PutFeedLicenseData, PutFeedLicenseError, PutFeedLicenseErrors, PutFeedLicenseResponse, PutFeedLicenseResponses, ReadFeed, RecoverFeedPasswordData, RecoverFeedPasswordError, RecoverFeedPasswordErrors, RecoverFeedPasswordResponse, RecoverFeedPasswordResponses, RecoveryJson, RemoveFeedImageData, RemoveFeedImageError, RemoveFeedImageErrors, RemoveFeedImageResponse, RemoveFeedImageResponses, RemoveFeedPasswordData, RemoveFeedPasswordError, RemoveFeedPasswordErrors, RemoveFeedPasswordResponse, RemoveFeedPasswordResponses, SetFeedImageData, SetFeedImageError, SetFeedImageErrors, SetFeedImageResponse, SetFeedImageResponses, UpdateFeedData, UpdateFeedError, UpdateFeedErrors, UpdateFeedResponse, UpdateFeedResponses } from './types.gen.js';
|
package/dist/generated/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// This file is auto-generated by @hey-api/openapi-ts
|
|
2
|
-
export { changeFeedPassword, createFeed, deleteFeed, deleteFeedLicense, deleteNote, editNote, getFeed, getLicenses, getNote, getOpenApi, getReadFeed, getReadNote, listNotes, listReadNotes, patchNote, postNote, putFeedLicense, recoverFeedPassword, removeFeedImage, removeFeedPassword, setFeedImage, updateFeed } from './sdk.gen.js';
|
|
2
|
+
export { changeFeedPassword, createFeed, deleteFeed, deleteFeedLicense, deleteNote, editNote, getFeed, getFile, getLicenses, getNote, getOpenApi, getReadFeed, getReadNote, listNotes, listReadNotes, patchNote, postNote, putFeedLicense, recoverFeedPassword, removeFeedImage, removeFeedPassword, setFeedImage, updateFeed } from './sdk.gen.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Client, ClientMeta, Options as Options2, RequestResult, TDataShape } from './client/index.js';
|
|
2
|
-
import type { ChangeFeedPasswordData, ChangeFeedPasswordErrors, ChangeFeedPasswordResponses, CreateFeedData, CreateFeedErrors, CreateFeedResponses, DeleteFeedData, DeleteFeedErrors, DeleteFeedLicenseData, DeleteFeedLicenseErrors, DeleteFeedLicenseResponses, DeleteFeedResponses, DeleteNoteData, DeleteNoteErrors, DeleteNoteResponses, EditNoteData, EditNoteErrors, EditNoteResponses, GetFeedData, GetFeedErrors, GetFeedResponses, GetLicensesData, GetLicensesErrors, GetLicensesResponses, GetNoteData, GetNoteErrors, GetNoteResponses, GetOpenApiData, GetOpenApiResponses, GetReadFeedData, GetReadFeedErrors, GetReadFeedResponses, GetReadNoteData, GetReadNoteErrors, GetReadNoteResponses, ListNotesData, ListNotesErrors, ListNotesResponses, ListReadNotesData, ListReadNotesErrors, ListReadNotesResponses, PatchNoteData, PatchNoteErrors, PatchNoteResponses, PostNoteData, PostNoteErrors, PostNoteResponses, PutFeedLicenseData, PutFeedLicenseErrors, PutFeedLicenseResponses, RecoverFeedPasswordData, RecoverFeedPasswordErrors, RecoverFeedPasswordResponses, RemoveFeedImageData, RemoveFeedImageErrors, RemoveFeedImageResponses, RemoveFeedPasswordData, RemoveFeedPasswordErrors, RemoveFeedPasswordResponses, SetFeedImageData, SetFeedImageErrors, SetFeedImageResponses, UpdateFeedData, UpdateFeedErrors, UpdateFeedResponses } from './types.gen.js';
|
|
2
|
+
import type { ChangeFeedPasswordData, ChangeFeedPasswordErrors, ChangeFeedPasswordResponses, CreateFeedData, CreateFeedErrors, CreateFeedResponses, DeleteFeedData, DeleteFeedErrors, DeleteFeedLicenseData, DeleteFeedLicenseErrors, DeleteFeedLicenseResponses, DeleteFeedResponses, DeleteNoteData, DeleteNoteErrors, DeleteNoteResponses, EditNoteData, EditNoteErrors, EditNoteResponses, GetFeedData, GetFeedErrors, GetFeedResponses, GetFileData, GetFileErrors, GetFileResponses, GetLicensesData, GetLicensesErrors, GetLicensesResponses, GetNoteData, GetNoteErrors, GetNoteResponses, GetOpenApiData, GetOpenApiResponses, GetReadFeedData, GetReadFeedErrors, GetReadFeedResponses, GetReadNoteData, GetReadNoteErrors, GetReadNoteResponses, ListNotesData, ListNotesErrors, ListNotesResponses, ListReadNotesData, ListReadNotesErrors, ListReadNotesResponses, PatchNoteData, PatchNoteErrors, PatchNoteResponses, PostNoteData, PostNoteErrors, PostNoteResponses, PutFeedLicenseData, PutFeedLicenseErrors, PutFeedLicenseResponses, RecoverFeedPasswordData, RecoverFeedPasswordErrors, RecoverFeedPasswordResponses, RemoveFeedImageData, RemoveFeedImageErrors, RemoveFeedImageResponses, RemoveFeedPasswordData, RemoveFeedPasswordErrors, RemoveFeedPasswordResponses, SetFeedImageData, SetFeedImageErrors, SetFeedImageResponses, UpdateFeedData, UpdateFeedErrors, UpdateFeedResponses } from './types.gen.js';
|
|
3
3
|
export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean, TResponse = unknown> = Options2<TData, ThrowOnError, TResponse> & {
|
|
4
4
|
/**
|
|
5
5
|
* You can provide a client instance returned by `createClient()` instead of
|
|
@@ -47,6 +47,12 @@ export declare const patchNote: <ThrowOnError extends boolean = false>(options:
|
|
|
47
47
|
* The body is the new file, with the same rules as posting: a `Content-Type` that is one of the accepted types, a body that is what it declares. A note keeps its type, so the type must be the note's own (`415` otherwise). An image is stored processed, not as sent: turned the way its EXIF orientation says, scaled to at most 2560 px on its long side, encoded again in its own format (JPEG and WebP at quality 85, PNG lossless, an animated GIF or WebP keeps its frames), and without metadata (EXIF, GPS position, XMP, comments). Send it full size; one of more than 100 megapixels is `413`, and a body that does not decode as the image it declares is `415`. Id, creation time and metadata stay: the title of a markdown note without one set follows the new text. Change the title, alt text or tags with `PATCH`. Needs the feed's password if it has one, and counts against the post rate limit. Read links can't edit. A markdown note with its pictures is one `multipart/form-data` request: a `text` part (the markdown, a field or a file part; a file part keeps its line breaks, a field's are sent as CRLF), `file` parts (up to 10 pictures, each with its file name and image `Content-Type`) and `alt.<file name>` fields. The pictures are stored first, each as its own note named by its file name, then the text with its references to them (``, `[x]: chart.png`, as written or percent-decoded) swapped for the stored files; a picture it never refers to is appended as ``. Several pictures may have the same file name (a phone calls every photo `image.jpg`): each is stored, and they are appended, but a text that refers to such a name is 400. Everything is checked before the first write, and a failed write removes what the request stored: all or nothing. `X-Note-Alt` and `X-Note-Name` are 400. The answer has `attachments`, the stored pictures in the order of the `file` parts. On a `PUT` the `text` part is required and the note must be a markdown note; the note keeps its own title and tags, `X-Note-Tags` goes on the new pictures. A raw body ignores `X-Note-Tags`. The note is looked up first: a missing note is `404` and an image note `415` whatever the body holds.
|
|
48
48
|
*/
|
|
49
49
|
export declare const editNote: <ThrowOnError extends boolean = false>(options: Options<EditNoteData, ThrowOnError>) => RequestResult<EditNoteResponses, EditNoteErrors, ThrowOnError>;
|
|
50
|
+
/**
|
|
51
|
+
* Get one of the feed's files
|
|
52
|
+
*
|
|
53
|
+
* A note's file by its own name (`<id>.<ext>`, a note's `file`), for whoever may post to the feed: also a draft's or a scheduled note's, which the read link (`file_url`) does not serve until readers may see them, so a post with pictures can be checked before it goes out. The body is the file's bytes, with the `Content-Type` of its extension and an `ETag` (`If-None-Match` gives `304`). Files by any other name, as the read link has them, are not served here.
|
|
54
|
+
*/
|
|
55
|
+
export declare const getFile: <ThrowOnError extends boolean = false>(options: Options<GetFileData, ThrowOnError>) => RequestResult<GetFileResponses, GetFileErrors, ThrowOnError>;
|
|
50
56
|
/**
|
|
51
57
|
* Delete a feed
|
|
52
58
|
*
|
|
@@ -68,7 +74,7 @@ export declare const createFeed: <ThrowOnError extends boolean = false>(options:
|
|
|
68
74
|
/**
|
|
69
75
|
* Change a feed's settings
|
|
70
76
|
*
|
|
71
|
-
* Replaces both the title (at most 100 characters) and the description (at most 500); surrounding whitespace is trimmed and control and text-direction override characters are refused. `show_sender` (default true) shows who posted each note to readers; omitted leaves it as it is. `read_id` gives the feed another read link (3 to 64 characters: a-z, 0-9, - and _; empty for a random one): the old id is freed and answers like an unknown read id until another feed takes it, and the notes are not edited (a relative image link follows the new id, a full URL does not). A short readable read id is guessable, so protect the feed with a password if that matters. An instance can turn chosen read ids off (NOTEFEED_ALLOW_CUSTOM_IDS=0): then only an empty `read_id` is accepted. `image` is the file name `uploadImage` returned for this feed (title image), empty to remove it, or omitted to leave it as it is; any other value is a 400. Needs the feed's password if it has one, and counts against the post rate limit. Only on a feed that exists: it is created by its first note. Read links can't change settings.
|
|
77
|
+
* Replaces both the title (at most 100 characters) and the description (at most 500); surrounding whitespace is trimmed and control and text-direction override characters are refused. `show_sender` (default true) shows who posted each note to readers; omitted leaves it as it is. `read_id` gives the feed another read link (3 to 64 characters: a-z, 0-9, - and _; empty for a random one): the old id is freed and answers like an unknown read id until another feed takes it, and the notes are not edited (a relative image link follows the new id, a full URL does not). A short readable read id is guessable, so protect the feed with a password if that matters. An instance can turn chosen read ids off (NOTEFEED_ALLOW_CUSTOM_IDS=0): then only an empty `read_id` is accepted. `image` is the file name `uploadImage` returned for this feed (title image), empty to remove it, or omitted to leave it as it is; any other value is a 400. `name` renames the feed (#350), after everything else is saved: the answer is the feed under its new name, and the old name answers like any unused one from then on. Needs the feed's password if it has one, and counts against the post rate limit. Only on a feed that exists: it is created by its first note. Read links can't change settings.
|
|
72
78
|
*/
|
|
73
79
|
export declare const updateFeed: <ThrowOnError extends boolean = false>(options: Options<UpdateFeedData, ThrowOnError>) => RequestResult<UpdateFeedResponses, UpdateFeedErrors, ThrowOnError>;
|
|
74
80
|
/**
|
|
@@ -72,6 +72,16 @@ export const editNote = (options) => (options.client ?? client).put({
|
|
|
72
72
|
...options.headers
|
|
73
73
|
}
|
|
74
74
|
});
|
|
75
|
+
/**
|
|
76
|
+
* Get one of the feed's files
|
|
77
|
+
*
|
|
78
|
+
* A note's file by its own name (`<id>.<ext>`, a note's `file`), for whoever may post to the feed: also a draft's or a scheduled note's, which the read link (`file_url`) does not serve until readers may see them, so a post with pictures can be checked before it goes out. The body is the file's bytes, with the `Content-Type` of its extension and an `ETag` (`If-None-Match` gives `304`). Files by any other name, as the read link has them, are not served here.
|
|
79
|
+
*/
|
|
80
|
+
export const getFile = (options) => (options.client ?? client).get({
|
|
81
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
82
|
+
url: '/api/v1/feeds/{feed}/files/{file}',
|
|
83
|
+
...options
|
|
84
|
+
});
|
|
75
85
|
/**
|
|
76
86
|
* Delete a feed
|
|
77
87
|
*
|
|
@@ -109,7 +119,7 @@ export const createFeed = (options) => (options.client ?? client).post({
|
|
|
109
119
|
/**
|
|
110
120
|
* Change a feed's settings
|
|
111
121
|
*
|
|
112
|
-
* Replaces both the title (at most 100 characters) and the description (at most 500); surrounding whitespace is trimmed and control and text-direction override characters are refused. `show_sender` (default true) shows who posted each note to readers; omitted leaves it as it is. `read_id` gives the feed another read link (3 to 64 characters: a-z, 0-9, - and _; empty for a random one): the old id is freed and answers like an unknown read id until another feed takes it, and the notes are not edited (a relative image link follows the new id, a full URL does not). A short readable read id is guessable, so protect the feed with a password if that matters. An instance can turn chosen read ids off (NOTEFEED_ALLOW_CUSTOM_IDS=0): then only an empty `read_id` is accepted. `image` is the file name `uploadImage` returned for this feed (title image), empty to remove it, or omitted to leave it as it is; any other value is a 400. Needs the feed's password if it has one, and counts against the post rate limit. Only on a feed that exists: it is created by its first note. Read links can't change settings.
|
|
122
|
+
* Replaces both the title (at most 100 characters) and the description (at most 500); surrounding whitespace is trimmed and control and text-direction override characters are refused. `show_sender` (default true) shows who posted each note to readers; omitted leaves it as it is. `read_id` gives the feed another read link (3 to 64 characters: a-z, 0-9, - and _; empty for a random one): the old id is freed and answers like an unknown read id until another feed takes it, and the notes are not edited (a relative image link follows the new id, a full URL does not). A short readable read id is guessable, so protect the feed with a password if that matters. An instance can turn chosen read ids off (NOTEFEED_ALLOW_CUSTOM_IDS=0): then only an empty `read_id` is accepted. `image` is the file name `uploadImage` returned for this feed (title image), empty to remove it, or omitted to leave it as it is; any other value is a 400. `name` renames the feed (#350), after everything else is saved: the answer is the feed under its new name, and the old name answers like any unused one from then on. Needs the feed's password if it has one, and counts against the post rate limit. Only on a feed that exists: it is created by its first note. Read links can't change settings.
|
|
113
123
|
*/
|
|
114
124
|
export const updateFeed = (options) => (options.client ?? client).put({
|
|
115
125
|
security: [{ scheme: 'bearer', type: 'http' }],
|
|
@@ -95,6 +95,10 @@ export type Created = {
|
|
|
95
95
|
* The feed's read-only RSS link, safe to share; null only if the server can't read the feed's stored read id, or if that id and the derived one both belong to other feeds
|
|
96
96
|
*/
|
|
97
97
|
read_url: string | null;
|
|
98
|
+
/**
|
|
99
|
+
* The same feed as Atom (RFC 4287), beside the RSS link; null exactly when read_url is
|
|
100
|
+
*/
|
|
101
|
+
atom_url: string | null;
|
|
98
102
|
/**
|
|
99
103
|
* The note's file name, `<id>.<extension>`. For an image note, pass it as a feed's `image` setting
|
|
100
104
|
*/
|
|
@@ -125,6 +129,10 @@ export type Posted = {
|
|
|
125
129
|
* The feed's read-only RSS link, safe to share; null only if the server can't read the feed's stored read id, or if that id and the derived one both belong to other feeds
|
|
126
130
|
*/
|
|
127
131
|
read_url: string | null;
|
|
132
|
+
/**
|
|
133
|
+
* The same feed as Atom (RFC 4287), beside the RSS link; null exactly when read_url is
|
|
134
|
+
*/
|
|
135
|
+
atom_url: string | null;
|
|
128
136
|
/**
|
|
129
137
|
* The note's file name, `<id>.<extension>`. For an image note, pass it as a feed's `image` setting
|
|
130
138
|
*/
|
|
@@ -315,6 +323,10 @@ export type FeedSettings = {
|
|
|
315
323
|
* A new read id (3 to 64 characters: a-z, 0-9, - and _), empty for a random one; omitted leaves it as it is. The old read link stops showing this feed, and may later show another one. Notes are not edited: a relative image link (``) follows the new id, a full URL keeps the old one and is yours to change. Reserved feeds keep theirs. 409 when it is taken
|
|
316
324
|
*/
|
|
317
325
|
read_id?: string;
|
|
326
|
+
/**
|
|
327
|
+
* A new name for the feed (1 to 64 characters: a-z, 0-9, - and _); omitted, empty or the current one leaves it as it is. Everything goes with it: notes, files, settings, password, license and read link. The old name stops working at once and is free: a post to it later creates a new feed, without an error. Change NOTEFEED_FEED, CI secrets, scripts and MCP configurations before they next run (a browser that unlocked the feed unlocks it again). A short name is guessable: protect the feed with a password if that matters. Reserved feeds keep theirs. 409 when it is taken
|
|
328
|
+
*/
|
|
329
|
+
name?: string;
|
|
318
330
|
};
|
|
319
331
|
export type FreeTier = {
|
|
320
332
|
/**
|
|
@@ -347,6 +359,10 @@ export type Feed = {
|
|
|
347
359
|
* The feed's read-only RSS link; null while the feed has no notes, or if the server can't read the feed's stored read id
|
|
348
360
|
*/
|
|
349
361
|
read_url: string | null;
|
|
362
|
+
/**
|
|
363
|
+
* The same feed as Atom (RFC 4287), beside the RSS link; null exactly when read_url is
|
|
364
|
+
*/
|
|
365
|
+
atom_url: string | null;
|
|
350
366
|
/**
|
|
351
367
|
* The feed's title image (absolute URL, served under the read id), or null
|
|
352
368
|
*/
|
|
@@ -355,6 +371,10 @@ export type Feed = {
|
|
|
355
371
|
* Whether readers see who posted each note
|
|
356
372
|
*/
|
|
357
373
|
show_sender: boolean;
|
|
374
|
+
/**
|
|
375
|
+
* The iPhone Shortcut "Send to notefeed": opened on an iPhone, it adds notefeed to the share sheet; at setup it asks for the server's address, this feed's name, its password and, optional, the server password
|
|
376
|
+
*/
|
|
377
|
+
shortcut_url: string;
|
|
358
378
|
/**
|
|
359
379
|
* A feed without a license on an instance that sells them: its notes against the free tier's cap. null when no cap applies (a licensed feed, or an instance that sells no licenses)
|
|
360
380
|
*/
|
|
@@ -838,6 +858,61 @@ export type EditNoteResponses = {
|
|
|
838
858
|
200: NoteEdited;
|
|
839
859
|
};
|
|
840
860
|
export type EditNoteResponse = EditNoteResponses[keyof EditNoteResponses];
|
|
861
|
+
export type GetFileData = {
|
|
862
|
+
body?: never;
|
|
863
|
+
headers?: {
|
|
864
|
+
/**
|
|
865
|
+
* The feed's own password, when it has one: to post, list or get, and (as the current password) to change or remove it. On the `POST` that creates a feed it sets the feed's password; on a `POST` to an existing feed that has none it answers 409. An empty value is the same as no header, so a `POST` with an empty one creates an open feed.
|
|
866
|
+
*/
|
|
867
|
+
'X-Feed-Password'?: string;
|
|
868
|
+
};
|
|
869
|
+
path: {
|
|
870
|
+
/**
|
|
871
|
+
* The feed's name. It is the write key: anyone who knows it can post.
|
|
872
|
+
*/
|
|
873
|
+
feed: string;
|
|
874
|
+
/**
|
|
875
|
+
* A note's file name, `<id>.<ext>` (its `file`)
|
|
876
|
+
*/
|
|
877
|
+
file: string;
|
|
878
|
+
};
|
|
879
|
+
query?: never;
|
|
880
|
+
url: '/api/v1/feeds/{feed}/files/{file}';
|
|
881
|
+
};
|
|
882
|
+
export type GetFileErrors = {
|
|
883
|
+
/**
|
|
884
|
+
* Invalid or reserved feed name
|
|
885
|
+
*/
|
|
886
|
+
400: Error;
|
|
887
|
+
/**
|
|
888
|
+
* The instance has a password, or the feed has its own, and it is missing or wrong
|
|
889
|
+
*/
|
|
890
|
+
401: Error;
|
|
891
|
+
/**
|
|
892
|
+
* No such file
|
|
893
|
+
*/
|
|
894
|
+
404: Error;
|
|
895
|
+
/**
|
|
896
|
+
* The operator removed this note (`removed`, #159): for good, also once its mark is deleted; the mark itself can't be edited
|
|
897
|
+
*/
|
|
898
|
+
410: Error;
|
|
899
|
+
/**
|
|
900
|
+
* Too many wrong passwords from this client
|
|
901
|
+
*/
|
|
902
|
+
429: Error;
|
|
903
|
+
/**
|
|
904
|
+
* The key service is unreachable: the instance is down for maintenance; try again after Retry-After
|
|
905
|
+
*/
|
|
906
|
+
503: Error;
|
|
907
|
+
};
|
|
908
|
+
export type GetFileError = GetFileErrors[keyof GetFileErrors];
|
|
909
|
+
export type GetFileResponses = {
|
|
910
|
+
/**
|
|
911
|
+
* The file's bytes; `Content-Type` is the file's own (an image, `text/markdown`, …)
|
|
912
|
+
*/
|
|
913
|
+
200: Blob | File;
|
|
914
|
+
};
|
|
915
|
+
export type GetFileResponse = GetFileResponses[keyof GetFileResponses];
|
|
841
916
|
export type DeleteFeedData = {
|
|
842
917
|
body?: never;
|
|
843
918
|
headers?: {
|
|
@@ -1012,7 +1087,7 @@ export type UpdateFeedErrors = {
|
|
|
1012
1087
|
*/
|
|
1013
1088
|
404: Error;
|
|
1014
1089
|
/**
|
|
1015
|
-
* The read id belongs to another feed or is held back
|
|
1090
|
+
* The read id or the new name belongs to another feed, or is held back
|
|
1016
1091
|
*/
|
|
1017
1092
|
409: Error;
|
|
1018
1093
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "notefeed",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.35.0",
|
|
4
4
|
"description": "Client and CLI for notefeed, a self-hosted inbox for markdown notes that you read back as RSS.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Marcel Bruckner",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"dist"
|
|
28
28
|
],
|
|
29
29
|
"engines": {
|
|
30
|
-
"node": ">=
|
|
30
|
+
"node": ">=22"
|
|
31
31
|
},
|
|
32
32
|
"scripts": {
|
|
33
33
|
"build": "tsc",
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
"url": "https://github.com/notefeed/notefeed/issues"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@types/node": "^
|
|
47
|
+
"@types/node": "^22",
|
|
48
48
|
"typescript": "^7.0",
|
|
49
|
-
"vitest": "^
|
|
49
|
+
"vitest": "^5.0"
|
|
50
50
|
}
|
|
51
51
|
}
|