@cloudhal/comments 0.0.0-stage → 0.1.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.
Files changed (46) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +86 -2
  3. package/dist/src/client/comments.browser.js +245 -0
  4. package/dist/src/client/index.d.ts +19 -0
  5. package/dist/src/client/index.js +39 -0
  6. package/dist/src/client/solver.browser.js +118 -0
  7. package/dist/src/crypto.d.ts +64 -0
  8. package/dist/src/crypto.js +170 -0
  9. package/dist/src/errors.d.ts +38 -0
  10. package/dist/src/errors.js +61 -0
  11. package/dist/src/fixtures/comment-text.json +335 -0
  12. package/dist/src/hashes.d.ts +70 -0
  13. package/dist/src/hashes.js +191 -0
  14. package/dist/src/index.d.ts +24 -0
  15. package/dist/src/index.js +24 -0
  16. package/dist/src/limits.d.ts +73 -0
  17. package/dist/src/limits.js +227 -0
  18. package/dist/src/linkify.d.ts +53 -0
  19. package/dist/src/linkify.js +142 -0
  20. package/dist/src/model.d.ts +287 -0
  21. package/dist/src/model.js +341 -0
  22. package/dist/src/normalize.d.ts +17 -0
  23. package/dist/src/normalize.js +125 -0
  24. package/dist/src/pipeline.d.ts +176 -0
  25. package/dist/src/pipeline.js +898 -0
  26. package/dist/src/pow.d.ts +86 -0
  27. package/dist/src/pow.js +239 -0
  28. package/dist/src/purge.d.ts +87 -0
  29. package/dist/src/purge.js +186 -0
  30. package/dist/src/retention.d.ts +32 -0
  31. package/dist/src/retention.js +106 -0
  32. package/dist/src/rules.d.ts +68 -0
  33. package/dist/src/rules.js +218 -0
  34. package/dist/src/settings.d.ts +108 -0
  35. package/dist/src/settings.js +347 -0
  36. package/dist/src/sql/index.d.ts +7 -0
  37. package/dist/src/sql/index.js +29 -0
  38. package/dist/src/sql/portability.d.ts +113 -0
  39. package/dist/src/sql/portability.js +514 -0
  40. package/dist/src/sql/rows.d.ts +54 -0
  41. package/dist/src/sql/rows.js +145 -0
  42. package/dist/src/sql/store.d.ts +312 -0
  43. package/dist/src/sql/store.js +2111 -0
  44. package/dist/src/thread.d.ts +35 -0
  45. package/dist/src/thread.js +64 -0
  46. package/package.json +61 -3
@@ -0,0 +1,514 @@
1
+ /**
2
+ * Moving comments between deployments (RFC-0007 §5.3, §9.4, D8): `cloudhal comments export|import`
3
+ * locally and, over the deployment token, `GET|POST /api/admin/sites/:siteId/comments/export|import`.
4
+ *
5
+ * **The file** is JSON lines: one header `{"cloudhal":"comments","version":1,"siteId",…}`, then
6
+ * one `Comment` contract record per line, oldest first. With personal data (people with
7
+ * `commenters:data`, or the operator) `{"commenter":{commenterId,email,firstSeen,commentIds}}`
8
+ * lines follow the comments. Nothing else ever leaves: no IP hash, challenge or proof (C1).
9
+ *
10
+ * **Export** is paged so one Worker request stays far inside D1 Free's 50 queries (at most 10
11
+ * reads of comments, or 4 for a page of commenters): `cursor` continues where the last page
12
+ * stopped (`c:` comments, then `p:` commenters). Studio's REST export and the deployment-token
13
+ * export use the same pages.
14
+ *
15
+ * **Import** is idempotent: a record whose `id` exists is skipped, and so is one whose `origin`
16
+ * (importers' `{system, id}`) is already stored for the site. Each record must be a valid
17
+ * `Comment`, name a content entry of the target site (otherwise the hourly job would delete it
18
+ * as a comment of a deleted entry) and, as a reply, a parent stored for the same entry. The
19
+ * site comes from the caller, never from the file (C14): `siteId` is rewritten. Imported rows
20
+ * keep their status (the operator's import is the one non-person way to `approved`, C3), carry
21
+ * `proof = 'import'`, no IP hash and no challenge. Commenter lines need the deployment's comments
22
+ * key: the address is hashed and encrypted again under the target's key and linked only to
23
+ * imported comments. Approved comments queue a normal purge of their entry's tag.
24
+ */
25
+ import { isValid } from "@cloudhal/core-contracts";
26
+
27
+
28
+ import { commentRecordHash, emailHmac, ID_PREFIX, newCommentsId, sealEmail } from "../hashes.js";
29
+ import { num } from "../model.js";
30
+ import { checkEmail, normalizeEmail } from "../normalize.js";
31
+ import { commentsCacheTag, PURGE_LIMITS } from "../purge.js";
32
+ import { withoutScriptAllowed } from "../settings.js";
33
+
34
+
35
+ /** The first line of an export file. */
36
+
37
+
38
+
39
+
40
+
41
+
42
+
43
+
44
+ /** A personal-data line (only with `personal`). */
45
+
46
+
47
+
48
+
49
+
50
+
51
+
52
+
53
+
54
+ export const exportHeader = (
55
+ siteId ,
56
+ exportedAt ,
57
+ personal = false,
58
+ ) => ({
59
+ cloudhal: "comments",
60
+ version: 1,
61
+ siteId,
62
+ exportedAt,
63
+ ...(personal ? { personalData: true } : {}),
64
+ });
65
+
66
+ /** Comments per export page: 10 indexed reads of 50. */
67
+ export const EXPORT_PAGE_COMMENTS = 500;
68
+ /** Commenters per export page: four reads for the whole page (`SqlCommentStore.commenters`). */
69
+ export const EXPORT_PAGE_COMMENTERS = 100;
70
+ /** Lines one import call accepts (the CLI sends batches of this size or less). */
71
+ export const IMPORT_MAX_LINES = 200;
72
+ /** Records written per statement, and the size of their JSON parameter. */
73
+ const IMPORT_CHUNK = 50;
74
+ const IMPORT_CHUNK_BYTES = 512 * 1024;
75
+
76
+
77
+
78
+
79
+
80
+
81
+
82
+
83
+
84
+
85
+ /**
86
+ * One page of a site's export. Without `cursor` the page starts with the header. With
87
+ * `personal`, commenter lines follow the comments (needs `keys`).
88
+ */
89
+ export async function exportPage(
90
+ store ,
91
+ siteId ,
92
+ o
93
+
94
+
95
+
96
+
97
+
98
+
99
+ = {},
100
+ ) {
101
+ const lines = [];
102
+ if (o.cursor === undefined || o.cursor === "")
103
+ lines.push(
104
+ JSON.stringify(exportHeader(siteId, (o.now ?? new Date()).toISOString(), o.personal)),
105
+ );
106
+ const cursor = o.cursor ?? "";
107
+ if (cursor !== "" && !/^[cp]:/.test(cursor)) throw new CommentImportError("invalid cursor");
108
+ let comments = 0;
109
+ let commenters = 0;
110
+ if (!cursor.startsWith("p:")) {
111
+ let list = cursor.startsWith("c:") ? cursor.slice(2) : undefined;
112
+ if (list === "") list = undefined;
113
+ const max = o.maxComments ?? EXPORT_PAGE_COMMENTS;
114
+ while (comments < max) {
115
+ const page = await store.list(siteId, {
116
+ order: "oldest",
117
+ limit: Math.min(50, max - comments),
118
+ ...(list ? { cursor: list } : {}),
119
+ });
120
+ for (const x of page.comments) lines.push(JSON.stringify(x));
121
+ comments += page.comments.length;
122
+ list = page.nextCursor;
123
+ if (!list) break;
124
+ }
125
+ if (list) return { lines, next: `c:${list}`, comments, commenters };
126
+ if (!o.personal) return { lines, comments, commenters };
127
+ }
128
+ if (!o.keys)
129
+ throw new CommentImportError(
130
+ "exporting personal data needs the deployment's CLOUDHAL_COMMENTS_KEY",
131
+ );
132
+ const after = cursor.startsWith("p:") ? cursor.slice(2) : "";
133
+ const [at, id] = after ? after.split("|") : ["", ""];
134
+ const max = o.maxCommenters ?? EXPORT_PAGE_COMMENTERS;
135
+ const rows = await store.sql.all (
136
+ `SELECT id, created_at FROM commenter_emails WHERE site_id = ?${after ? " AND (created_at > ? OR (created_at = ? AND id > ?))" : ""}
137
+ ORDER BY created_at, id LIMIT ?`,
138
+ [siteId, ...(after ? [at ?? "", at ?? "", id ?? ""] : []), max + 1],
139
+ );
140
+ // three reads for the whole page, whatever its size
141
+ for (const who of await store.commenters(
142
+ siteId,
143
+ rows.slice(0, max).map((r) => r.id),
144
+ o.keys,
145
+ )) {
146
+ commenters++;
147
+ const line = {
148
+ commenter: {
149
+ commenterId: who.id,
150
+ email: who.email,
151
+ firstSeen: who.firstSeen,
152
+ commentIds: who.commentIds,
153
+ },
154
+ };
155
+ lines.push(JSON.stringify(line));
156
+ }
157
+ const last = rows.slice(0, max).at(-1);
158
+ return {
159
+ lines,
160
+ ...(rows.length > max && last ? { next: `p:${last.created_at}|${last.id}` } : {}),
161
+ comments,
162
+ commenters,
163
+ };
164
+ }
165
+
166
+ export class CommentImportError extends Error {
167
+ name = "CommentImportError";
168
+ }
169
+
170
+
171
+
172
+
173
+
174
+
175
+
176
+
177
+
178
+
179
+
180
+
181
+
182
+
183
+
184
+
185
+
186
+
187
+
188
+
189
+
190
+ /** The refusal a caller may retry once the rest of the file is in (a parent in a later call). */
191
+ export const PARENT_MISSING = "the parent comment is not stored for this entry";
192
+
193
+ const SOURCES_V1 = new Set(["native", "import"]);
194
+ const COMMENTER_ID = /^cmr_[A-Za-z0-9]{6,32}$/;
195
+ const COMMENT_ID = /^cmt_[A-Za-z0-9]{6,32}$/;
196
+
197
+
198
+
199
+
200
+
201
+
202
+
203
+
204
+
205
+
206
+
207
+
208
+
209
+
210
+
211
+
212
+
213
+
214
+
215
+ /** Cross-field rules the contract cannot state (RFC-0007 §5.4), for imported records. */
216
+ function crossFieldProblem(c ) {
217
+ if (!SOURCES_V1.has(c.source)) return `source ${c.source} is not accepted yet`;
218
+ if (c.inReplyToId && !c.parentId) return "inReplyToId needs parentId";
219
+ if (c.parentId === c.id) return "a comment cannot answer itself";
220
+ if (!c.body && c.status !== "deleted" && c.author.kind !== "erased")
221
+ return "only a deleted comment or an erased author may have no text";
222
+ const m = c.moderation;
223
+ if (m && ["hide", "spam", "delete", "erase"].includes(m.action) && !m.reasonCode)
224
+ return `moderation ${m.action} needs a reasonCode`;
225
+ return undefined;
226
+ }
227
+
228
+ /**
229
+ * Imports JSON lines into a site (see the module comment). `entries` answers which node ids are
230
+ * content entries of the site. At most `IMPORT_MAX_LINES` lines per call.
231
+ */
232
+ export async function importLines(
233
+ store ,
234
+ siteId ,
235
+ input ,
236
+ o
237
+
238
+
239
+
240
+ ,
241
+ ) {
242
+ if (input.length > IMPORT_MAX_LINES)
243
+ throw new CommentImportError(`at most ${IMPORT_MAX_LINES} lines per call`);
244
+ const now = (o.now ?? new Date()).toISOString();
245
+ const invalid = [];
246
+ const records = [];
247
+ const people = [];
248
+ input.forEach((raw, i) => {
249
+ const line = i + 1;
250
+ const text = raw.trim();
251
+ if (text === "") return;
252
+ let v ;
253
+ try {
254
+ v = JSON.parse(text);
255
+ } catch {
256
+ invalid.push({ line, error: "not JSON" });
257
+ return;
258
+ }
259
+ if (!v || typeof v !== "object" || Array.isArray(v)) {
260
+ invalid.push({ line, error: "not a JSON object" });
261
+ return;
262
+ }
263
+ const obj = v ;
264
+ if ("cloudhal" in obj) {
265
+ if (obj.cloudhal !== "comments" || obj.version !== 1)
266
+ throw new CommentImportError("not a Cloudhal comments export (version 1)");
267
+ return;
268
+ }
269
+ if ("commenter" in obj) {
270
+ const p = obj.commenter ;
271
+ const email = typeof p?.email === "string" ? normalizeEmail(p.email) : undefined;
272
+ const ids = Array.isArray(p?.commentIds)
273
+ ? p.commentIds.filter((x) => typeof x === "string" && COMMENT_ID.test(x))
274
+ : [];
275
+ if (!email || checkEmail(email)) invalid.push({ line, error: "invalid commenter email" });
276
+ else if (p?.commenterId !== undefined && !COMMENTER_ID.test(String(p.commenterId)))
277
+ invalid.push({ line, error: "invalid commenterId" });
278
+ else people.push({ line, email, commentIds: ids });
279
+ return;
280
+ }
281
+ // C14: the target site is the caller's, whatever the file says
282
+ const c = { ...obj, siteId } ;
283
+ if (!isValid("comment", c)) {
284
+ invalid.push({
285
+ line,
286
+ ...(typeof obj.id === "string" ? { id: obj.id } : {}),
287
+ error: "not a valid Comment record",
288
+ });
289
+ return;
290
+ }
291
+ const problem = crossFieldProblem(c);
292
+ if (problem) invalid.push({ line, id: c.id, error: problem });
293
+ else records.push({ line, c });
294
+ });
295
+
296
+ // Entries and parents: reads only, before anything is written.
297
+ const known = await o.entries([...new Set(records.map((r) => r.c.nodeId))]);
298
+ const parents = [...new Set(records.flatMap((r) => (r.c.parentId ? [r.c.parentId] : [])))];
299
+ const stored = new Map ();
300
+ for (let i = 0; i < parents.length; i += IMPORT_CHUNK) {
301
+ const rows = await store.sql.all (
302
+ "SELECT id, node_id FROM comments WHERE site_id = ? AND id IN (SELECT value FROM json_each(?))",
303
+ [siteId, JSON.stringify(parents.slice(i, i + IMPORT_CHUNK))],
304
+ );
305
+ for (const r of rows) stored.set(r.id, r.node_id);
306
+ }
307
+ const seenOrigins = new Set ();
308
+ const accepted = [];
309
+ // top-level comments first: a reply may come before its parent when their times tie
310
+ const ordered = [...records].sort((x, y) => Number(!!x.c.parentId) - Number(!!y.c.parentId));
311
+ for (const { line, c } of ordered) {
312
+ if (!known.has(c.nodeId)) {
313
+ invalid.push({
314
+ line,
315
+ id: c.id,
316
+ error: `entry ${c.nodeId} is not a content entry of this site`,
317
+ });
318
+ continue;
319
+ }
320
+ if (c.parentId && (stored.get(c.parentId) ?? "") !== c.nodeId) {
321
+ invalid.push({ line, id: c.id, error: PARENT_MISSING });
322
+ continue;
323
+ }
324
+ const origin = c.origin ? JSON.stringify({ system: c.origin.system, id: c.origin.id }) : null;
325
+ if (origin && seenOrigins.has(origin)) continue;
326
+ if (origin) seenOrigins.add(origin);
327
+ // later lines of the same call may answer this one
328
+ if (!c.parentId) stored.set(c.id, c.nodeId);
329
+ accepted.push({
330
+ line,
331
+ approved: c.status === "approved",
332
+ row: {
333
+ id: c.id,
334
+ nodeId: c.nodeId,
335
+ parentId: c.parentId ?? null,
336
+ inReplyToId: c.inReplyToId ?? null,
337
+ source: c.source,
338
+ origin,
339
+ author: JSON.stringify(c.author),
340
+ body: c.body?.text ?? null,
341
+ status: c.status,
342
+ labels: JSON.stringify(c.labels ?? []),
343
+ moderation: c.moderation ? JSON.stringify(c.moderation) : null,
344
+ hash: await commentRecordHash(c ),
345
+ createdAt: c.createdAt,
346
+ editedAt: c.editedAt ?? null,
347
+ rev: c.rev,
348
+ },
349
+ });
350
+ }
351
+
352
+ let imported = 0;
353
+ const purge = new Set ();
354
+ let chunk = [];
355
+ let bytes = 0;
356
+ const flush = async () => {
357
+ if (chunk.length === 0) return;
358
+ const rows = chunk.map((x) => x.row);
359
+ const j = "json_extract(j.value, ";
360
+ const statements = [
361
+ {
362
+ sql: `INSERT OR IGNORE INTO comments (id, site_id, node_id, parent_id, in_reply_to_id, source, origin, author, body, status, labels, moderation, email_id, ip_hmac, challenge_id, proof, op, hash, created_at, edited_at, rev)
363
+ SELECT ${j}'$.id'), ?, ${j}'$.nodeId'), ${j}'$.parentId'), ${j}'$.inReplyToId'), ${j}'$.source'), ${j}'$.origin'), ${j}'$.author'), ${j}'$.body'), ${j}'$.status'), ${j}'$.labels'), ${j}'$.moderation'), NULL, NULL, NULL, 'import', NULL, ${j}'$.hash'), ${j}'$.createdAt'), ${j}'$.editedAt'), ${j}'$.rev')
364
+ FROM json_each(?) j
365
+ WHERE ${j}'$.origin') IS NULL
366
+ OR NOT EXISTS (SELECT 1 FROM comments c WHERE c.site_id = ? AND c.origin = ${j}'$.origin'))`,
367
+ params: [siteId, JSON.stringify(rows), siteId],
368
+ },
369
+ ];
370
+ const [res] = await store.sql.batch(statements);
371
+ imported += res?.changes ?? 0;
372
+ if ((res?.changes ?? 0) > 0)
373
+ for (const x of chunk) if (x.approved) purge.add(commentsCacheTag(x.row.nodeId));
374
+ chunk = [];
375
+ bytes = 0;
376
+ };
377
+ for (const x of accepted) {
378
+ const size = JSON.stringify(x.row).length;
379
+ if (chunk.length >= IMPORT_CHUNK || (chunk.length > 0 && bytes + size > IMPORT_CHUNK_BYTES))
380
+ await flush();
381
+ chunk.push(x);
382
+ bytes += size;
383
+ }
384
+ await flush();
385
+ // a stored approved comment appears on the cached page at the next coalesced purge
386
+ const tags = [...purge];
387
+ for (let i = 0; i < tags.length; i += PURGE_LIMITS.tagsPerRequest)
388
+ await store.purgeQueue.enqueue(
389
+ siteId,
390
+ tags.slice(i, i + PURGE_LIMITS.tagsPerRequest),
391
+ "normal",
392
+ );
393
+
394
+ let commenters = 0;
395
+ if (people.length > 0) {
396
+ if (!o.keys) {
397
+ for (const p of people)
398
+ invalid.push({
399
+ line: p.line,
400
+ error: "storing commenter emails needs the deployment's CLOUDHAL_COMMENTS_KEY",
401
+ });
402
+ } else {
403
+ const statements = [];
404
+ for (const p of people) {
405
+ const hmac = await emailHmac(o.keys, p.email);
406
+ const sealed = await sealEmail(o.keys, siteId, p.email);
407
+ statements.push(
408
+ {
409
+ sql: "INSERT OR IGNORE INTO commenter_emails (id, site_id, email_hmac, email_ciphertext, email_iv, created_at) VALUES (?, ?, ?, ?, ?, ?)",
410
+ params: [
411
+ newCommentsId(ID_PREFIX.commenter),
412
+ siteId,
413
+ hmac,
414
+ sealed.ciphertext,
415
+ sealed.iv,
416
+ now,
417
+ ],
418
+ },
419
+ {
420
+ // only imported comments, never a native comment of this deployment
421
+ sql: `UPDATE comments SET email_id = (SELECT id FROM commenter_emails WHERE site_id = ? AND email_hmac = ?)
422
+ WHERE site_id = ? AND proof = 'import' AND email_id IS NULL AND id IN (SELECT value FROM json_each(?))`,
423
+ params: [siteId, hmac, siteId, JSON.stringify(p.commentIds)],
424
+ },
425
+ );
426
+ commenters++;
427
+ }
428
+ for (let i = 0; i < statements.length; i += 20)
429
+ await store.sql.batch(statements.slice(i, i + 20));
430
+ }
431
+ }
432
+ invalid.sort((a, b) => a.line - b.line);
433
+ return {
434
+ imported,
435
+ skipped: accepted.length - imported,
436
+ commenters,
437
+ invalid,
438
+ purged: tags,
439
+ };
440
+ }
441
+
442
+ /** What `cloudhal comments status` shows (RFC-0007 §15.4): counts and budgets, never reader text. */
443
+
444
+
445
+
446
+
447
+
448
+
449
+
450
+
451
+
452
+
453
+
454
+
455
+
456
+  
457
+
458
+
459
+
460
+
461
+
462
+
463
+  
464
+
465
+
466
+
467
+
468
+
469
+
470
+
471
+
472
+
473
+ export async function commentsStatus(
474
+ store ,
475
+ siteId ,
476
+ now = new Date(),
477
+ ) {
478
+ const day = `${now.toISOString().slice(0, 10)}T00:00:00.000Z`;
479
+ const [settings, counts, stats, today, queue, recent] = await Promise.all([
480
+ store.settings(siteId),
481
+ store.counts(siteId),
482
+ store.summary(siteId, day),
483
+ store.storedSince(siteId, day),
484
+ store.purgeQueue.queued(siteId),
485
+ store.purgeQueue.recent(now),
486
+ ]);
487
+ return {
488
+ siteId,
489
+ settings: {
490
+ enabled: settings.enabled,
491
+ collections: Object.entries(settings.collections)
492
+ .filter(([, c]) => c.enabled)
493
+ .map(([name]) => name),
494
+ protection: settings.protection,
495
+ allowWithoutScript: withoutScriptAllowed(settings),
496
+ closeAfterDays: settings.closeAfterDays,
497
+ stored: settings.rev > 0,
498
+ },
499
+ counts,
500
+ pending: { count: stats.pending.count, oldestAt: stats.pending.oldestAt },
501
+ today: {
502
+ stored: today.total,
503
+ withoutScript: today.withoutScript,
504
+ cap: settings.dailyCap,
505
+ paused: settings.enabled && today.total >= settings.dailyCap,
506
+ },
507
+ purge: {
508
+ queued: queue.length,
509
+ takedowns: queue.filter((r) => r.priority === "takedown").length,
510
+ oldestAt: queue[0]?.enqueuedAt ?? null,
511
+ lastMinute: recent.reduce((a, r) => a + num(r.requests), 0),
512
+ },
513
+ };
514
+ }
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Row ↔ record mapping for the comment tables. `toComment` is the only way a `comments` row
3
+ * leaves the store, and it reads none of `email_id`, `ip_hmac`, `challenge_id`, `proof` or `op`,
4
+ * so no returned record can carry them (invariant C1).
5
+ */
6
+ import type { Comment } from "@cloudhal/core-contracts";
7
+ import { type CommentSettings } from "../settings.js";
8
+ export interface CommentRow extends Record<string, unknown> {
9
+ id: string;
10
+ site_id: string;
11
+ node_id: string;
12
+ parent_id: string | null;
13
+ in_reply_to_id: string | null;
14
+ source: string;
15
+ origin: string | null;
16
+ author: string;
17
+ body: string | null;
18
+ status: string;
19
+ labels: string;
20
+ moderation: string | null;
21
+ email_id: string | null;
22
+ ip_hmac: string | null;
23
+ challenge_id: string | null;
24
+ proof: string;
25
+ op: string | null;
26
+ hash: string;
27
+ created_at: string;
28
+ edited_at: string | null;
29
+ rev: number;
30
+ }
31
+ export declare function toComment(r: CommentRow): Comment;
32
+ export interface SettingsRow extends Record<string, unknown> {
33
+ site_id: string;
34
+ enabled: number;
35
+ show_when_off: number;
36
+ collections: string;
37
+ close_after_days: number | null;
38
+ protection: string;
39
+ turnstile_site_key: string | null;
40
+ allow_without_script: number;
41
+ link_limit: number;
42
+ watch_words: string;
43
+ blocked_words: string;
44
+ daily_cap: number;
45
+ ai_labels: string;
46
+ retention: string;
47
+ plan_hint: string | null;
48
+ rev: number;
49
+ updated_at: string;
50
+ updated_by: string;
51
+ }
52
+ export declare function toSettings(r: SettingsRow): CommentSettings;
53
+ export declare function settingsValues(s: CommentSettings): (string | number | null)[];
54
+ export declare const SETTINGS_COLUMNS = "enabled, show_when_off, collections, close_after_days, protection, turnstile_site_key, allow_without_script, link_limit, watch_words, blocked_words, daily_cap, ai_labels, retention, plan_hint";