feedkeeper 0.29.0 → 0.30.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "feedkeeper",
3
- "version": "0.29.0",
3
+ "version": "0.30.1",
4
4
  "description": "A lightweight, self-hosted RSS reader and remote MCP server for your news, blogs, and AI workflows.",
5
5
  "keywords": [
6
6
  "rss",
@@ -39,6 +39,7 @@ const FEATURES = [
39
39
  "edition.revisions",
40
40
  "native-preferences",
41
41
  "native-preferences.edition-size",
42
+ "native-preferences.client-settings",
42
43
  "edition.overview",
43
44
  "edition.layout",
44
45
  "search.fts",
@@ -12,6 +12,11 @@ const timezone = z.string().max(100).refine((value) => {
12
12
  return false;
13
13
  }
14
14
  }, "Use an IANA time zone");
15
+ /** Reverse-DNS style names keep clients from overwriting each other's documents. */
16
+ const clientNamespace = z.string().regex(/^[a-z0-9]+([.-][a-z0-9]+)+$/).max(64);
17
+ const CLIENT_DOCUMENT_BYTES = 16 * 1024;
18
+ const clientDocument = z.record(z.string(), z.unknown()).refine((value) => Buffer.byteLength(JSON.stringify(value)) <= CLIENT_DOCUMENT_BYTES, "Document too large");
19
+ const clientSettingsPatch = z.record(clientNamespace, clientDocument.nullable()).refine((value) => Object.keys(value).length <= 8, "Too many namespaces");
15
20
  export const preferenceFields = {
16
21
  timeZone: timezone,
17
22
  editionSize: z.number().int().min(1).max(24).nullable(),
@@ -20,6 +25,8 @@ export const preferenceFields = {
20
25
  hiddenFolderIds: distinctIds,
21
26
  preferredFolderIds: distinctIds,
22
27
  showUnfiled: z.boolean(),
28
+ /** Opaque documents per client namespace; a null document removes the namespace. */
29
+ clientSettings: clientSettingsPatch,
23
30
  };
24
31
  export const preferencePatchSchema = z.object(preferenceFields).partial().extend({
25
32
  requestId: z.uuid(),
@@ -28,6 +35,7 @@ export const preferencePatchSchema = z.object(preferenceFields).partial().extend
28
35
  const defaults = {
29
36
  timeZone: "UTC", editionSize: 24, editionSizeIsCustom: false, readingMinutes: null,
30
37
  folderOrder: [], hiddenFolderIds: [], preferredFolderIds: [], showUnfiled: true,
38
+ clientSettings: {},
31
39
  };
32
40
  export function getNativePreferences(userId) {
33
41
  const row = db.prepare("SELECT revision, settings, updated_at FROM native_preferences WHERE user_id = ?").get(userId);
@@ -50,6 +58,18 @@ export function patchNativePreferences(userId, input) {
50
58
  if (ids?.some((id) => id !== null && !ownedIds.has(id)))
51
59
  throw new NativeError("folder_not_found", 404);
52
60
  }
61
+ if (patch.clientSettings) {
62
+ const merged = { ...current.clientSettings };
63
+ for (const [name, document] of Object.entries(patch.clientSettings)) {
64
+ if (document === null)
65
+ delete merged[name];
66
+ else
67
+ merged[name] = document;
68
+ }
69
+ if (Object.keys(merged).length > 8)
70
+ throw new NativeError("invalid_input");
71
+ patch.clientSettings = merged;
72
+ }
53
73
  const { revision, updatedAt: _updatedAt, ...settings } = current;
54
74
  const next = { ...settings, ...patch, editionSize: patch.editionSize === null ? defaults.editionSize : patch.editionSize ?? current.editionSize,
55
75
  editionSizeIsCustom: patch.editionSize === undefined ? current.editionSizeIsCustom : patch.editionSize !== null };
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@feedkeeper/server",
3
- "version": "0.29.0",
3
+ "version": "0.30.1",
4
4
  "private": true,
5
5
  "type": "module"
6
6
  }