@hatk/hatk 0.0.1-alpha.40 → 0.0.1-alpha.42
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/dist/cli.js +16 -553
- package/dist/database/adapters/sqlite.d.ts.map +1 -1
- package/dist/database/adapters/sqlite.js +2 -1
- package/dist/database/db.d.ts +23 -0
- package/dist/database/db.d.ts.map +1 -1
- package/dist/database/db.js +81 -4
- package/dist/dev-entry.d.ts.map +1 -1
- package/dist/dev-entry.js +2 -1
- package/dist/hooks.d.ts +24 -3
- package/dist/hooks.d.ts.map +1 -1
- package/dist/hooks.js +34 -7
- package/dist/indexer.d.ts +2 -0
- package/dist/indexer.d.ts.map +1 -1
- package/dist/indexer.js +17 -0
- package/dist/labels.d.ts +2 -0
- package/dist/labels.d.ts.map +1 -1
- package/dist/labels.js +5 -0
- package/dist/lexicon-resolve.d.ts.map +1 -1
- package/dist/lexicon-resolve.js +27 -112
- package/dist/lexicons/com/atproto/label/defs.json +75 -0
- package/dist/lexicons/com/atproto/moderation/defs.json +30 -0
- package/dist/lexicons/com/atproto/repo/strongRef.json +24 -0
- package/dist/lexicons/dev/hatk/createRecord.json +40 -0
- package/dist/lexicons/dev/hatk/createReport.json +48 -0
- package/dist/lexicons/dev/hatk/deleteRecord.json +25 -0
- package/dist/lexicons/dev/hatk/describeCollections.json +41 -0
- package/dist/lexicons/dev/hatk/describeFeeds.json +29 -0
- package/dist/lexicons/dev/hatk/describeLabels.json +31 -0
- package/dist/lexicons/dev/hatk/getFeed.json +30 -0
- package/dist/lexicons/dev/hatk/getPreferences.json +19 -0
- package/dist/lexicons/dev/hatk/getRecord.json +26 -0
- package/dist/lexicons/dev/hatk/getRecords.json +32 -0
- package/dist/lexicons/dev/hatk/putPreference.json +28 -0
- package/dist/lexicons/dev/hatk/putRecord.json +41 -0
- package/dist/lexicons/dev/hatk/searchRecords.json +32 -0
- package/dist/lexicons/dev/hatk/uploadBlob.json +23 -0
- package/dist/main.js +2 -1
- package/dist/oauth/server.d.ts.map +1 -1
- package/dist/oauth/server.js +3 -2
- package/dist/pds-proxy.d.ts.map +1 -1
- package/dist/pds-proxy.js +15 -0
- package/dist/server-init.d.ts.map +1 -1
- package/dist/server-init.js +3 -2
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +91 -13
- package/dist/templates/feed.tpl +14 -0
- package/dist/templates/hook.tpl +5 -0
- package/dist/templates/label.tpl +15 -0
- package/dist/templates/og.tpl +17 -0
- package/dist/templates/seed.tpl +11 -0
- package/dist/templates/setup.tpl +5 -0
- package/dist/templates/test-feed.tpl +19 -0
- package/dist/templates/test-xrpc.tpl +19 -0
- package/dist/templates/xrpc.tpl +41 -0
- package/dist/xrpc.d.ts +14 -0
- package/dist/xrpc.d.ts.map +1 -1
- package/dist/xrpc.js +27 -0
- package/package.json +3 -2
- package/public/admin.html +133 -0
- package/dist/cloudflare/container.d.ts +0 -73
- package/dist/cloudflare/container.d.ts.map +0 -1
- package/dist/cloudflare/container.js +0 -232
- package/dist/cloudflare/hooks.d.ts +0 -33
- package/dist/cloudflare/hooks.d.ts.map +0 -1
- package/dist/cloudflare/hooks.js +0 -40
- package/dist/cloudflare/init.d.ts +0 -27
- package/dist/cloudflare/init.d.ts.map +0 -1
- package/dist/cloudflare/init.js +0 -103
- package/dist/cloudflare/worker.d.ts +0 -27
- package/dist/cloudflare/worker.d.ts.map +0 -1
- package/dist/cloudflare/worker.js +0 -54
- package/dist/database/adapters/d1.d.ts +0 -56
- package/dist/database/adapters/d1.d.ts.map +0 -1
- package/dist/database/adapters/d1.js +0 -108
- package/dist/db.d.ts +0 -134
- package/dist/db.d.ts.map +0 -1
- package/dist/db.js +0 -1327
- package/dist/fts.d.ts +0 -20
- package/dist/fts.d.ts.map +0 -1
- package/dist/fts.js +0 -767
- package/dist/oauth/hooks.d.ts +0 -10
- package/dist/oauth/hooks.d.ts.map +0 -1
- package/dist/oauth/hooks.js +0 -40
- package/dist/schema.d.ts +0 -59
- package/dist/schema.d.ts.map +0 -1
- package/dist/schema.js +0 -387
- package/dist/test-browser.d.ts +0 -14
- package/dist/test-browser.d.ts.map +0 -1
- package/dist/test-browser.js +0 -26
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"db.d.ts","sourceRoot":"","sources":["../../src/database/db.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAe,MAAM,aAAa,CAAA;AAC3D,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAA;AAI1C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAC9C,OAAO,EAAc,KAAK,UAAU,EAAE,MAAM,cAAc,CAAA;AAM1D,wBAAgB,eAAe,IAAI,YAAY,CAE9C;AACD,wBAAgB,aAAa,IAAI,UAAU,CAE1C;AAED,wBAAgB,aAAa,IAAI,IAAI,CAEpC;AAMD,wBAAsB,QAAQ,CAAC,UAAU,EAAE,KAAK,CAAC;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,OAAO,EAAE,CAAA;CAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAcnG;AAMD,wBAAsB,YAAY,CAChC,OAAO,EAAE,YAAY,EACrB,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,WAAW,EAAE,EAC3B,aAAa,EAAE,MAAM,EAAE,GACtB,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"db.d.ts","sourceRoot":"","sources":["../../src/database/db.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAe,MAAM,aAAa,CAAA;AAC3D,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAA;AAI1C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAC9C,OAAO,EAAc,KAAK,UAAU,EAAE,MAAM,cAAc,CAAA;AAM1D,wBAAgB,eAAe,IAAI,YAAY,CAE9C;AACD,wBAAgB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C,CAK9E;AAED,wBAAsB,YAAY,CAAC,MAAM,EAAE;IACzC,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;IAClB,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,UAAU,EAAE,MAAM,CAAA;CACnB,GAAG,OAAO,CAAC;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC,CAO1B;AAED,wBAAsB,YAAY,CAAC,IAAI,EAAE;IACvC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,GAAG,OAAO,CAAC;IAAE,OAAO,EAAE,GAAG,EAAE,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,CA8B7C;AAED,wBAAsB,aAAa,CACjC,EAAE,EAAE,MAAM,EACV,MAAM,EAAE,UAAU,GAAG,WAAW,EAChC,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAAC,CAevD;AAED,wBAAsB,kBAAkB,IAAI,OAAO,CAAC,MAAM,CAAC,CAK1D"}
|
package/dist/database/db.js
CHANGED
|
@@ -103,6 +103,38 @@ export async function initDatabase(adapter, dbPath, tableSchemas, ddlStatements)
|
|
|
103
103
|
updated_at ${dialect.timestampType} DEFAULT ${dialect.currentTimestamp},
|
|
104
104
|
PRIMARY KEY (did, key)
|
|
105
105
|
)`);
|
|
106
|
+
// Reports table (user-submitted moderation reports)
|
|
107
|
+
if (dialect.supportsSequences) {
|
|
108
|
+
await run(`CREATE SEQUENCE IF NOT EXISTS _reports_seq START 1`);
|
|
109
|
+
await run(`CREATE TABLE IF NOT EXISTS _reports (
|
|
110
|
+
id INTEGER PRIMARY KEY DEFAULT nextval('_reports_seq'),
|
|
111
|
+
subject_uri TEXT NOT NULL,
|
|
112
|
+
subject_did TEXT NOT NULL,
|
|
113
|
+
label TEXT NOT NULL,
|
|
114
|
+
reason TEXT,
|
|
115
|
+
reported_by TEXT NOT NULL,
|
|
116
|
+
status TEXT NOT NULL DEFAULT 'open',
|
|
117
|
+
resolved_by TEXT,
|
|
118
|
+
resolved_at ${dialect.timestampType},
|
|
119
|
+
created_at ${dialect.timestampType} NOT NULL
|
|
120
|
+
)`);
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
await run(`CREATE TABLE IF NOT EXISTS _reports (
|
|
124
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
125
|
+
subject_uri TEXT NOT NULL,
|
|
126
|
+
subject_did TEXT NOT NULL,
|
|
127
|
+
label TEXT NOT NULL,
|
|
128
|
+
reason TEXT,
|
|
129
|
+
reported_by TEXT NOT NULL,
|
|
130
|
+
status TEXT NOT NULL DEFAULT 'open',
|
|
131
|
+
resolved_by TEXT,
|
|
132
|
+
resolved_at TEXT,
|
|
133
|
+
created_at TEXT NOT NULL
|
|
134
|
+
)`);
|
|
135
|
+
}
|
|
136
|
+
await run(`CREATE INDEX IF NOT EXISTS idx_reports_status ON _reports(status)`);
|
|
137
|
+
await run(`CREATE INDEX IF NOT EXISTS idx_reports_subject_uri ON _reports(subject_uri)`);
|
|
106
138
|
// OAuth tables
|
|
107
139
|
await port.executeMultiple(OAUTH_DDL);
|
|
108
140
|
}
|
|
@@ -442,6 +474,8 @@ export async function getSchemaDump() {
|
|
|
442
474
|
sql = sql.replace(/\n\s*"(\w+)"/g, '\n$1');
|
|
443
475
|
// Ensure closing paren is on its own line
|
|
444
476
|
sql = sql.replace(/([^(\s])\)$/, '$1\n)');
|
|
477
|
+
// Normalize leading-comma columns added by ALTER TABLE into trailing commas
|
|
478
|
+
sql = sql.replace(/\n\s*,\s*/g, ',\n');
|
|
445
479
|
// Split into lines and re-indent consistently
|
|
446
480
|
const lines = sql.split('\n').map((l) => l.trim());
|
|
447
481
|
sql = lines
|
|
@@ -619,7 +653,7 @@ export async function insertLabels(labels) {
|
|
|
619
653
|
if (labels.length === 0)
|
|
620
654
|
return;
|
|
621
655
|
for (const label of labels) {
|
|
622
|
-
// Skip if an active (non-negated, non-expired, not-superseded-by-negation) label already exists
|
|
656
|
+
// Skip if an active (non-negated, non-expired, not-superseded-by-negation) label already exists for this src+uri+val
|
|
623
657
|
const existing = await all(`SELECT 1 FROM _labels l1 WHERE l1.src = $1 AND l1.uri = $2 AND l1.val = $3 AND l1.neg = false AND (l1.exp IS NULL OR l1.exp > CURRENT_TIMESTAMP) AND NOT EXISTS (SELECT 1 FROM _labels l2 WHERE l2.uri = l1.uri AND l2.val = l1.val AND l2.neg = true AND l2.id > l1.id) LIMIT 1`, [label.src, label.uri, label.val]);
|
|
624
658
|
if (!label.neg && existing.length > 0)
|
|
625
659
|
continue;
|
|
@@ -637,7 +671,7 @@ export async function queryLabelsForUris(uris) {
|
|
|
637
671
|
if (uris.length === 0)
|
|
638
672
|
return new Map();
|
|
639
673
|
const placeholders = uris.map((_, i) => `$${i + 1}`).join(',');
|
|
640
|
-
const rows = await all(`SELECT src, uri, val, neg, cts, exp FROM _labels l1 WHERE uri IN (${placeholders}) AND (exp IS NULL OR exp > CURRENT_TIMESTAMP) AND neg = false AND NOT EXISTS (SELECT 1 FROM _labels l2 WHERE l2.uri = l1.uri AND l2.val = l1.val AND l2.neg = true AND l2.id > l1.id)`, uris);
|
|
674
|
+
const rows = await all(`SELECT src, uri, val, neg, cts, exp FROM _labels l1 WHERE uri IN (${placeholders}) AND (exp IS NULL OR exp > CURRENT_TIMESTAMP) AND neg = false AND NOT EXISTS (SELECT 1 FROM _labels l2 WHERE l2.uri = l1.uri AND l2.val = l1.val AND l2.neg = true AND l2.id > l1.id) GROUP BY uri, val`, uris);
|
|
641
675
|
const result = new Map();
|
|
642
676
|
for (const row of rows) {
|
|
643
677
|
const key = row.uri;
|
|
@@ -647,9 +681,9 @@ export async function queryLabelsForUris(uris) {
|
|
|
647
681
|
src: row.src,
|
|
648
682
|
uri: row.uri,
|
|
649
683
|
val: row.val,
|
|
650
|
-
neg: row.neg,
|
|
684
|
+
neg: !!row.neg,
|
|
651
685
|
cts: normalizeValue(row.cts),
|
|
652
|
-
|
|
686
|
+
...(row.exp ? { exp: String(row.exp) } : {}),
|
|
653
687
|
});
|
|
654
688
|
}
|
|
655
689
|
return result;
|
|
@@ -1443,3 +1477,46 @@ export async function filterTakendownDids(dids) {
|
|
|
1443
1477
|
const rows = await all(`SELECT did FROM _repos WHERE did IN (${placeholders}) AND status = 'takendown'`, dids);
|
|
1444
1478
|
return new Set(rows.map((r) => r.did));
|
|
1445
1479
|
}
|
|
1480
|
+
export async function insertReport(report) {
|
|
1481
|
+
const createdAt = new Date().toISOString();
|
|
1482
|
+
const rows = await all(`INSERT INTO _reports (subject_uri, subject_did, label, reason, reported_by, created_at) VALUES ($1, $2, $3, $4, $5, $6) RETURNING id`, [report.subjectUri, report.subjectDid, report.label, report.reason || null, report.reportedBy, createdAt]);
|
|
1483
|
+
return { id: rows[0].id };
|
|
1484
|
+
}
|
|
1485
|
+
export async function queryReports(opts) {
|
|
1486
|
+
const conditions = [];
|
|
1487
|
+
const params = [];
|
|
1488
|
+
let idx = 1;
|
|
1489
|
+
if (opts.status) {
|
|
1490
|
+
conditions.push(`r.status = $${idx++}`);
|
|
1491
|
+
params.push(opts.status);
|
|
1492
|
+
}
|
|
1493
|
+
if (opts.label) {
|
|
1494
|
+
conditions.push(`r.label = $${idx++}`);
|
|
1495
|
+
params.push(opts.label);
|
|
1496
|
+
}
|
|
1497
|
+
const where = conditions.length > 0 ? `WHERE ${conditions.join(' AND ')}` : '';
|
|
1498
|
+
const limit = opts.limit || 50;
|
|
1499
|
+
const offset = opts.offset || 0;
|
|
1500
|
+
const countRows = await all(`SELECT ${dialect.countAsInteger} as count FROM _reports r ${where}`, params);
|
|
1501
|
+
const total = Number(countRows[0]?.count || 0);
|
|
1502
|
+
const rows = await all(`SELECT r.*, rp.handle as reported_by_handle FROM _reports r LEFT JOIN _repos rp ON r.reported_by = rp.did ${where} ORDER BY r.created_at DESC LIMIT $${idx++} OFFSET $${idx++}`, [...params, limit, offset]);
|
|
1503
|
+
return { reports: rows, total };
|
|
1504
|
+
}
|
|
1505
|
+
export async function resolveReport(id, action, resolvedBy) {
|
|
1506
|
+
const rows = await all(`SELECT subject_uri, label, status FROM _reports WHERE id = $1`, [id]);
|
|
1507
|
+
if (!rows.length)
|
|
1508
|
+
return null;
|
|
1509
|
+
if (rows[0].status !== 'open')
|
|
1510
|
+
return null;
|
|
1511
|
+
await run(`UPDATE _reports SET status = $1, resolved_by = $2, resolved_at = $3 WHERE id = $4`, [
|
|
1512
|
+
action,
|
|
1513
|
+
resolvedBy,
|
|
1514
|
+
new Date().toISOString(),
|
|
1515
|
+
id,
|
|
1516
|
+
]);
|
|
1517
|
+
return { subjectUri: rows[0].subject_uri, label: rows[0].label };
|
|
1518
|
+
}
|
|
1519
|
+
export async function getOpenReportCount() {
|
|
1520
|
+
const rows = await all(`SELECT ${dialect.countAsInteger} as count FROM _reports WHERE status = 'open'`);
|
|
1521
|
+
return Number(rows[0]?.count || 0);
|
|
1522
|
+
}
|
package/dist/dev-entry.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev-entry.d.ts","sourceRoot":"","sources":["../src/dev-entry.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dev-entry.d.ts","sourceRoot":"","sources":["../src/dev-entry.ts"],"names":[],"mappings":"AA4GA,eAAO,MAAM,OAAO,yCAKlB,CAAA;AAEF,yEAAyE;AACzE,wBAAsB,YAAY,kBAEjC;AAED,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AACpC,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAA"}
|
package/dist/dev-entry.js
CHANGED
|
@@ -9,7 +9,7 @@ import { initDatabase, migrateSchema, getSchemaDump } from "./database/db.js";
|
|
|
9
9
|
import { createAdapter } from "./database/adapter-factory.js";
|
|
10
10
|
import { getDialect } from "./database/dialect.js";
|
|
11
11
|
import { setSearchPort } from "./database/fts.js";
|
|
12
|
-
import { configureRelay } from "./xrpc.js";
|
|
12
|
+
import { configureRelay, configureOAuth } from "./xrpc.js";
|
|
13
13
|
import { initOAuth } from "./oauth/server.js";
|
|
14
14
|
import { initServer } from "./server-init.js";
|
|
15
15
|
import { createHandler, registerCoreHandlers } from "./server.js";
|
|
@@ -63,6 +63,7 @@ catch { }
|
|
|
63
63
|
await initServer(resolve(configDir, 'server'));
|
|
64
64
|
// Register built-in dev.hatk.* handlers so callXrpc() can find them
|
|
65
65
|
registerCoreHandlers(collections, config.oauth);
|
|
66
|
+
configureOAuth(config.oauth);
|
|
66
67
|
if (config.oauth) {
|
|
67
68
|
await initOAuth(config.oauth, config.plc, config.relay);
|
|
68
69
|
}
|
package/dist/hooks.d.ts
CHANGED
|
@@ -1,9 +1,30 @@
|
|
|
1
|
+
import type { OAuthConfig } from './config.ts';
|
|
2
|
+
import { type BaseContext } from './hydrate.ts';
|
|
1
3
|
/** Context passed to the on-login hook after a successful OAuth login. */
|
|
2
|
-
export type OnLoginCtx = {
|
|
4
|
+
export type OnLoginCtx = Omit<BaseContext, 'db'> & {
|
|
3
5
|
/** DID of the user who just logged in. */
|
|
4
6
|
did: string;
|
|
5
|
-
/**
|
|
7
|
+
/** Database access with both read and write. */
|
|
8
|
+
db: {
|
|
9
|
+
query: (sql: string, params?: unknown[]) => Promise<unknown[]>;
|
|
10
|
+
run: (sql: string, params?: unknown[]) => Promise<void>;
|
|
11
|
+
};
|
|
12
|
+
/** Trigger a backfill for a DID and wait for it to complete. */
|
|
6
13
|
ensureRepo: (did: string) => Promise<void>;
|
|
14
|
+
/** Write a record to the user's PDS and index locally. */
|
|
15
|
+
createRecord: (collection: string, record: Record<string, unknown>, opts?: {
|
|
16
|
+
rkey?: string;
|
|
17
|
+
}) => Promise<{
|
|
18
|
+
uri?: string;
|
|
19
|
+
cid?: string;
|
|
20
|
+
}>;
|
|
21
|
+
/** Create or update a record on the user's PDS and index locally. */
|
|
22
|
+
putRecord: (collection: string, rkey: string, record: Record<string, unknown>) => Promise<{
|
|
23
|
+
uri?: string;
|
|
24
|
+
cid?: string;
|
|
25
|
+
}>;
|
|
26
|
+
/** Delete a record from the user's PDS and local index. */
|
|
27
|
+
deleteRecord: (collection: string, rkey: string) => Promise<void>;
|
|
7
28
|
};
|
|
8
29
|
export declare function defineHook(event: 'on-login', handler: (ctx: OnLoginCtx) => Promise<void>): {
|
|
9
30
|
__type: "hook";
|
|
@@ -18,5 +39,5 @@ export declare function loadOnLoginHook(hooksDir: string): Promise<void>;
|
|
|
18
39
|
/** Register a hook from a scanned server/ module. */
|
|
19
40
|
export declare function registerHook(event: string, handler: Function): void;
|
|
20
41
|
/** Fire the on-login hook if loaded. Errors are logged but never block login. */
|
|
21
|
-
export declare function fireOnLoginHook(did: string): Promise<void>;
|
|
42
|
+
export declare function fireOnLoginHook(did: string, oauthConfig: OAuthConfig | null): Promise<void>;
|
|
22
43
|
//# sourceMappingURL=hooks.d.ts.map
|
package/dist/hooks.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAK9C,OAAO,EAAoB,KAAK,WAAW,EAAE,MAAM,cAAc,CAAA;AAEjE,0EAA0E;AAC1E,MAAM,MAAM,UAAU,GAAG,IAAI,CAAC,WAAW,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U,KAAK,OAAO,CAAC,IAAI,CAAC;EAExF;AAMD;;;GAGG;AACH,wBAAsB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAQrE;AASD,qDAAqD;AACrD,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,GAAG,IAAI,CAKnE;AAED,iFAAiF;AACjF,wBAAsB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CA8BjG"}
|
package/dist/hooks.js
CHANGED
|
@@ -29,9 +29,11 @@ var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExte
|
|
|
29
29
|
*/
|
|
30
30
|
import { existsSync } from 'node:fs';
|
|
31
31
|
import { resolve } from 'node:path';
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
32
|
+
import { pdsCreateRecord, pdsPutRecord, pdsDeleteRecord } from "./pds-proxy.js";
|
|
33
|
+
import { log, emit } from "./logger.js";
|
|
34
|
+
import { setRepoStatus, runSQL } from "./database/db.js";
|
|
35
|
+
import { triggerAutoBackfill, awaitBackfill } from "./indexer.js";
|
|
36
|
+
import { buildBaseContext } from "./hydrate.js";
|
|
35
37
|
export function defineHook(event, handler) {
|
|
36
38
|
return { __type: 'hook', event, handler };
|
|
37
39
|
}
|
|
@@ -50,10 +52,11 @@ export async function loadOnLoginHook(hooksDir) {
|
|
|
50
52
|
onLoginHook = mod.default;
|
|
51
53
|
log('[hooks] on-login hook loaded');
|
|
52
54
|
}
|
|
53
|
-
/** Mark a DID as pending
|
|
55
|
+
/** Mark a DID as pending, trigger auto-backfill, and wait for completion. */
|
|
54
56
|
async function ensureRepo(did) {
|
|
55
57
|
await setRepoStatus(did, 'pending');
|
|
56
58
|
triggerAutoBackfill(did);
|
|
59
|
+
await awaitBackfill(did);
|
|
57
60
|
}
|
|
58
61
|
/** Register a hook from a scanned server/ module. */
|
|
59
62
|
export function registerHook(event, handler) {
|
|
@@ -63,13 +66,37 @@ export function registerHook(event, handler) {
|
|
|
63
66
|
}
|
|
64
67
|
}
|
|
65
68
|
/** Fire the on-login hook if loaded. Errors are logged but never block login. */
|
|
66
|
-
export async function fireOnLoginHook(did) {
|
|
69
|
+
export async function fireOnLoginHook(did, oauthConfig) {
|
|
67
70
|
if (!onLoginHook)
|
|
68
71
|
return;
|
|
69
72
|
try {
|
|
70
|
-
|
|
73
|
+
const base = buildBaseContext({ did });
|
|
74
|
+
const viewer = { did };
|
|
75
|
+
const hookPromise = onLoginHook({
|
|
76
|
+
...base,
|
|
77
|
+
did,
|
|
78
|
+
db: { query: base.db.query, run: runSQL },
|
|
79
|
+
ensureRepo,
|
|
80
|
+
createRecord: async (collection, record, opts) => {
|
|
81
|
+
if (!oauthConfig)
|
|
82
|
+
throw new Error('No OAuth config — cannot write to PDS');
|
|
83
|
+
return pdsCreateRecord(oauthConfig, viewer, { collection, record, rkey: opts?.rkey });
|
|
84
|
+
},
|
|
85
|
+
putRecord: async (collection, rkey, record) => {
|
|
86
|
+
if (!oauthConfig)
|
|
87
|
+
throw new Error('No OAuth config — cannot write to PDS');
|
|
88
|
+
return pdsPutRecord(oauthConfig, viewer, { collection, rkey, record });
|
|
89
|
+
},
|
|
90
|
+
deleteRecord: async (collection, rkey) => {
|
|
91
|
+
if (!oauthConfig)
|
|
92
|
+
throw new Error('No OAuth config — cannot write to PDS');
|
|
93
|
+
await pdsDeleteRecord(oauthConfig, viewer, { collection, rkey });
|
|
94
|
+
},
|
|
95
|
+
});
|
|
96
|
+
const timeout = new Promise((_, reject) => setTimeout(() => reject(new Error('on-login hook timed out after 30s')), 30_000));
|
|
97
|
+
await Promise.race([hookPromise, timeout]);
|
|
71
98
|
}
|
|
72
99
|
catch (err) {
|
|
73
|
-
|
|
100
|
+
emit('hooks', 'on_login_error', { did, error: err.message });
|
|
74
101
|
}
|
|
75
102
|
}
|
package/dist/indexer.d.ts
CHANGED
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
* `maxConcurrentBackfills`. Failed backfills retry with exponential delay up
|
|
7
7
|
* to `maxRetries`.
|
|
8
8
|
*/
|
|
9
|
+
/** Wait for a DID's backfill to complete if one is in flight. */
|
|
10
|
+
export declare function awaitBackfill(did: string): Promise<void>;
|
|
9
11
|
export declare function triggerAutoBackfill(did: string, attempt?: number): Promise<void>;
|
|
10
12
|
/** Configuration for the firehose indexer. */
|
|
11
13
|
interface IndexerOpts {
|
package/dist/indexer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"indexer.d.ts","sourceRoot":"","sources":["../src/indexer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"indexer.d.ts","sourceRoot":"","sources":["../src/indexer.ts"],"names":[],"mappings":"AAwJA;;;;;;;GAOG;AACH,iEAAiE;AACjE,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAGxD;AAED,wBAAsB,mBAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,SAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CA4EjF;AAED,8CAA8C;AAC9C,UAAU,WAAW;IACnB,QAAQ,EAAE,MAAM,CAAA;IAChB,WAAW,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IACxB,iBAAiB,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IAC/B,WAAW,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IACzB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB,YAAY,EAAE,MAAM,CAAA;IACpB,UAAU,EAAE,MAAM,CAAA;IAClB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,kBAAkB,CAAC,EAAE,MAAM,CAAA;CAC5B;AAyBD;;;;;;;;;GASG;AACH,wBAAsB,YAAY,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,SAAS,CAAC,CAmDxE"}
|
package/dist/indexer.js
CHANGED
|
@@ -18,6 +18,7 @@ let ftsRebuildInterval = 500;
|
|
|
18
18
|
const pendingBuffers = new Map();
|
|
19
19
|
// Track in-flight backfills to avoid duplicates
|
|
20
20
|
const backfillInFlight = new Set();
|
|
21
|
+
const backfillPromises = new Map();
|
|
21
22
|
const pendingReschedule = new Set();
|
|
22
23
|
// In-memory cache of repo status to avoid flooding the DB read queue
|
|
23
24
|
const repoStatusCache = new Map();
|
|
@@ -130,6 +131,11 @@ function bufferWrite(item) {
|
|
|
130
131
|
* `maxConcurrentBackfills`. Failed backfills retry with exponential delay up
|
|
131
132
|
* to `maxRetries`.
|
|
132
133
|
*/
|
|
134
|
+
/** Wait for a DID's backfill to complete if one is in flight. */
|
|
135
|
+
export function awaitBackfill(did) {
|
|
136
|
+
const entry = backfillPromises.get(did);
|
|
137
|
+
return entry ? entry.promise : Promise.resolve();
|
|
138
|
+
}
|
|
133
139
|
export async function triggerAutoBackfill(did, attempt = 0) {
|
|
134
140
|
if (backfillInFlight.has(did))
|
|
135
141
|
return;
|
|
@@ -145,6 +151,11 @@ export async function triggerAutoBackfill(did, attempt = 0) {
|
|
|
145
151
|
}
|
|
146
152
|
backfillInFlight.add(did);
|
|
147
153
|
pendingBuffers.set(did, []);
|
|
154
|
+
if (!backfillPromises.has(did)) {
|
|
155
|
+
let resolveBackfill;
|
|
156
|
+
const promise = new Promise((r) => { resolveBackfill = r; });
|
|
157
|
+
backfillPromises.set(did, { promise, resolve: resolveBackfill });
|
|
158
|
+
}
|
|
148
159
|
if (attempt === 0)
|
|
149
160
|
await setRepoStatus(did, 'pending');
|
|
150
161
|
const elapsed = timer();
|
|
@@ -184,6 +195,12 @@ export async function triggerAutoBackfill(did, attempt = 0) {
|
|
|
184
195
|
error,
|
|
185
196
|
retry_count: currentRetryCount,
|
|
186
197
|
});
|
|
198
|
+
// Resolve awaiting callers (e.g. on-login hooks)
|
|
199
|
+
const entry = backfillPromises.get(did);
|
|
200
|
+
if (entry) {
|
|
201
|
+
entry.resolve();
|
|
202
|
+
backfillPromises.delete(did);
|
|
203
|
+
}
|
|
187
204
|
if (status === 'error' && currentRetryCount < indexerMaxRetries) {
|
|
188
205
|
const delaySecs = Math.min(currentRetryCount * 60, 3600);
|
|
189
206
|
const delayMs = Math.max(delaySecs, 60) * 1000;
|
package/dist/labels.d.ts
CHANGED
|
@@ -32,6 +32,8 @@ export declare function defineLabel(module: LabelModule): {
|
|
|
32
32
|
* @param labelsDir - Absolute path to the `labels/` directory
|
|
33
33
|
*/
|
|
34
34
|
export declare function initLabels(labelsDir: string): Promise<void>;
|
|
35
|
+
/** Clear all registered label definitions and rules (for hot-reload). */
|
|
36
|
+
export declare function clearLabels(): void;
|
|
35
37
|
/** Register a single label module from a scanned server/ module. */
|
|
36
38
|
export declare function registerLabelModule(name: string, labelMod: {
|
|
37
39
|
definition?: LabelDefinition;
|
package/dist/labels.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"labels.d.ts","sourceRoot":"","sources":["../src/labels.ts"],"names":[],"mappings":"AA8BA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAIlD,wDAAwD;AACxD,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE;QACF,KAAK,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC,GAAG,EAAE,CAAC,CAAA;QACtD,GAAG,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;KACtD,CAAA;IACD,MAAM,EAAE;QACN,GAAG,EAAE,MAAM,CAAA;QACX,GAAG,EAAE,MAAM,CAAA;QACX,GAAG,EAAE,MAAM,CAAA;QACX,UAAU,EAAE,MAAM,CAAA;QAClB,KAAK,EAAE,MAAM,CAAC,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MAAM,EAAE,CAAC,CAAA;CAAE,GAClG,IAAI,CAON;AAED;;;GAGG;AACH,wBAAsB,aAAa,CAAC,MAAM,EAAE;IAC1C,GAAG,EAAE,MAAM,CAAA;IACX,GAAG,EAAE,MAAM,CAAA;IACX,GAAG,EAAE,MAAM,CAAA;IACX,UAAU,EAAE,MAAM,CAAA;IAClB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;CAC3B,GAAG,OAAO,CAAC,IAAI,CAAC,CAyBhB;AAED;;;;;GAKG;AACH,wBAAsB,YAAY,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,CAuCvG;AAED,yEAAyE;AACzE,wBAAgB,mBAAmB,IAAI,eAAe,EAAE,CAEvD"}
|
package/dist/labels.js
CHANGED
|
@@ -85,6 +85,11 @@ export async function initLabels(labelsDir) {
|
|
|
85
85
|
log(`[labels] ${labelDefs.length} label definitions loaded`);
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
|
+
/** Clear all registered label definitions and rules (for hot-reload). */
|
|
89
|
+
export function clearLabels() {
|
|
90
|
+
labelDefs.length = 0;
|
|
91
|
+
rules.length = 0;
|
|
92
|
+
}
|
|
88
93
|
/** Register a single label module from a scanned server/ module. */
|
|
89
94
|
export function registerLabelModule(name, labelMod) {
|
|
90
95
|
if (labelMod.definition) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lexicon-resolve.d.ts","sourceRoot":"","sources":["../src/lexicon-resolve.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"lexicon-resolve.d.ts","sourceRoot":"","sources":["../src/lexicon-resolve.ts"],"names":[],"mappings":"AAoFA,UAAU,OAAO;IACf,OAAO,EAAE,MAAM,CAAA;IACf,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IACzB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CACnB;AAyFD;;;;GAIG;AACH,wBAAsB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAgChF"}
|
package/dist/lexicon-resolve.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
// Lexicon resolver — fetches lexicons from the AT Protocol registry via DNS → DID → PDS chain
|
|
2
2
|
// and recursively resolves all $ref dependencies.
|
|
3
3
|
import { isValidDid } from '@bigmoves/lexicon';
|
|
4
|
+
import { join } from 'node:path';
|
|
5
|
+
import { readdirSync, readFileSync, statSync } from 'node:fs';
|
|
4
6
|
// --- Authority ---
|
|
5
7
|
function nsidToDomain(nsid) {
|
|
6
8
|
const parts = nsid.split('.');
|
|
@@ -71,118 +73,31 @@ async function resolveDid(did, opts = {}) {
|
|
|
71
73
|
return null;
|
|
72
74
|
}
|
|
73
75
|
}
|
|
74
|
-
// --- Built-in core schemas (
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
uri: { type: 'string', format: 'uri' },
|
|
100
|
-
cid: { type: 'string', format: 'cid' },
|
|
101
|
-
val: { type: 'string', maxLength: 128 },
|
|
102
|
-
neg: { type: 'boolean' },
|
|
103
|
-
cts: { type: 'string', format: 'datetime' },
|
|
104
|
-
exp: { type: 'string', format: 'datetime' },
|
|
105
|
-
sig: { type: 'bytes' },
|
|
106
|
-
},
|
|
107
|
-
},
|
|
108
|
-
selfLabels: {
|
|
109
|
-
type: 'object',
|
|
110
|
-
description: 'Metadata tags on an atproto record, published by the author within the record.',
|
|
111
|
-
required: ['values'],
|
|
112
|
-
properties: { values: { type: 'array', items: { type: 'ref', ref: '#selfLabel' }, maxLength: 10 } },
|
|
113
|
-
},
|
|
114
|
-
selfLabel: { type: 'object', required: ['val'], properties: { val: { type: 'string', maxLength: 128 } } },
|
|
115
|
-
labelValueDefinition: {
|
|
116
|
-
type: 'object',
|
|
117
|
-
description: 'Declares a label value and its expected interpretations and behaviors.',
|
|
118
|
-
required: ['identifier', 'severity', 'blurs', 'locales'],
|
|
119
|
-
properties: {
|
|
120
|
-
identifier: { type: 'string', maxLength: 100 },
|
|
121
|
-
severity: { type: 'string', knownValues: ['inform', 'alert', 'none'] },
|
|
122
|
-
blurs: { type: 'string', knownValues: ['content', 'media', 'none'] },
|
|
123
|
-
defaultSetting: { type: 'string', knownValues: ['ignore', 'warn', 'hide'] },
|
|
124
|
-
adultOnly: { type: 'boolean' },
|
|
125
|
-
locales: { type: 'array', items: { type: 'ref', ref: '#labelValueDefinitionStrings' } },
|
|
126
|
-
},
|
|
127
|
-
},
|
|
128
|
-
labelValueDefinitionStrings: {
|
|
129
|
-
type: 'object',
|
|
130
|
-
required: ['lang', 'name', 'description'],
|
|
131
|
-
properties: {
|
|
132
|
-
lang: { type: 'string', format: 'language' },
|
|
133
|
-
name: { type: 'string', maxLength: 640 },
|
|
134
|
-
description: { type: 'string', maxLength: 100000 },
|
|
135
|
-
},
|
|
136
|
-
},
|
|
137
|
-
labelValue: {
|
|
138
|
-
type: 'string',
|
|
139
|
-
knownValues: [
|
|
140
|
-
'!hide',
|
|
141
|
-
'!no-promote',
|
|
142
|
-
'!warn',
|
|
143
|
-
'!no-unauthenticated',
|
|
144
|
-
'dmca-violation',
|
|
145
|
-
'doxxing',
|
|
146
|
-
'porn',
|
|
147
|
-
'sexual',
|
|
148
|
-
'nudity',
|
|
149
|
-
'nsfl',
|
|
150
|
-
'gore',
|
|
151
|
-
],
|
|
152
|
-
},
|
|
153
|
-
},
|
|
154
|
-
},
|
|
155
|
-
'com.atproto.moderation.defs': {
|
|
156
|
-
lexicon: 1,
|
|
157
|
-
id: 'com.atproto.moderation.defs',
|
|
158
|
-
defs: {
|
|
159
|
-
reasonType: {
|
|
160
|
-
type: 'string',
|
|
161
|
-
knownValues: [
|
|
162
|
-
'com.atproto.moderation.defs#reasonSpam',
|
|
163
|
-
'com.atproto.moderation.defs#reasonViolation',
|
|
164
|
-
'com.atproto.moderation.defs#reasonMisleading',
|
|
165
|
-
'com.atproto.moderation.defs#reasonSexual',
|
|
166
|
-
'com.atproto.moderation.defs#reasonRude',
|
|
167
|
-
'com.atproto.moderation.defs#reasonOther',
|
|
168
|
-
'com.atproto.moderation.defs#reasonAppeal',
|
|
169
|
-
],
|
|
170
|
-
},
|
|
171
|
-
reasonSpam: { type: 'token', description: 'Spam: frequent unwanted promotion, replies, mentions.' },
|
|
172
|
-
reasonViolation: { type: 'token', description: 'Direct violation of server rules, laws, terms of service.' },
|
|
173
|
-
reasonMisleading: { type: 'token', description: 'Misleading identity, affiliation, or content.' },
|
|
174
|
-
reasonSexual: { type: 'token', description: 'Unwanted or mislabeled sexual content.' },
|
|
175
|
-
reasonRude: { type: 'token', description: 'Rude, harassing, explicit, or otherwise unwelcoming behavior.' },
|
|
176
|
-
reasonOther: { type: 'token', description: 'Reports not falling under another report category.' },
|
|
177
|
-
reasonAppeal: { type: 'token', description: 'Appeal a previously taken moderation action.' },
|
|
178
|
-
subjectType: {
|
|
179
|
-
type: 'string',
|
|
180
|
-
description: 'Tag describing a type of subject that might be reported.',
|
|
181
|
-
knownValues: ['account', 'record', 'chat'],
|
|
182
|
-
},
|
|
183
|
-
},
|
|
184
|
-
},
|
|
185
|
-
};
|
|
76
|
+
// --- Built-in core schemas (loaded from src/lexicons/) ---
|
|
77
|
+
function loadCoreSchemas() {
|
|
78
|
+
const schemas = {};
|
|
79
|
+
const lexDir = join(import.meta.dirname, 'lexicons');
|
|
80
|
+
function walk(dir) {
|
|
81
|
+
for (const entry of readdirSync(dir)) {
|
|
82
|
+
const full = join(dir, entry);
|
|
83
|
+
if (statSync(full).isDirectory()) {
|
|
84
|
+
walk(full);
|
|
85
|
+
}
|
|
86
|
+
else if (entry.endsWith('.json')) {
|
|
87
|
+
const lexicon = JSON.parse(readFileSync(full, 'utf-8'));
|
|
88
|
+
if (lexicon.id)
|
|
89
|
+
schemas[lexicon.id] = lexicon;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
try {
|
|
94
|
+
walk(lexDir);
|
|
95
|
+
}
|
|
96
|
+
catch { }
|
|
97
|
+
return schemas;
|
|
98
|
+
}
|
|
99
|
+
const coreSchemas = loadCoreSchemas();
|
|
100
|
+
// --- Resolver ---
|
|
186
101
|
function refToNsid(ref) {
|
|
187
102
|
let nsid = ref.startsWith('lex:') ? ref.slice(4) : ref;
|
|
188
103
|
const hashIndex = nsid.indexOf('#');
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
{
|
|
2
|
+
"lexicon": 1,
|
|
3
|
+
"id": "com.atproto.label.defs",
|
|
4
|
+
"defs": {
|
|
5
|
+
"label": {
|
|
6
|
+
"type": "object",
|
|
7
|
+
"description": "Metadata tag on an atproto resource (eg, repo or record).",
|
|
8
|
+
"required": ["src", "uri", "val", "cts"],
|
|
9
|
+
"properties": {
|
|
10
|
+
"ver": { "type": "integer" },
|
|
11
|
+
"src": { "type": "string", "format": "did" },
|
|
12
|
+
"uri": { "type": "string", "format": "uri" },
|
|
13
|
+
"cid": { "type": "string", "format": "cid" },
|
|
14
|
+
"val": { "type": "string", "maxLength": 128 },
|
|
15
|
+
"neg": { "type": "boolean" },
|
|
16
|
+
"cts": { "type": "string", "format": "datetime" },
|
|
17
|
+
"exp": { "type": "string", "format": "datetime" },
|
|
18
|
+
"sig": { "type": "bytes" }
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"selfLabels": {
|
|
22
|
+
"type": "object",
|
|
23
|
+
"description": "Metadata tags on an atproto record, published by the author within the record.",
|
|
24
|
+
"required": ["values"],
|
|
25
|
+
"properties": {
|
|
26
|
+
"values": { "type": "array", "items": { "type": "ref", "ref": "#selfLabel" }, "maxLength": 10 }
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"selfLabel": {
|
|
30
|
+
"type": "object",
|
|
31
|
+
"required": ["val"],
|
|
32
|
+
"properties": {
|
|
33
|
+
"val": { "type": "string", "maxLength": 128 }
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"labelValueDefinition": {
|
|
37
|
+
"type": "object",
|
|
38
|
+
"description": "Declares a label value and its expected interpretations and behaviors.",
|
|
39
|
+
"required": ["identifier", "severity", "blurs", "locales"],
|
|
40
|
+
"properties": {
|
|
41
|
+
"identifier": { "type": "string", "maxLength": 100 },
|
|
42
|
+
"severity": { "type": "string", "knownValues": ["inform", "alert", "none"] },
|
|
43
|
+
"blurs": { "type": "string", "knownValues": ["content", "media", "none"] },
|
|
44
|
+
"defaultSetting": { "type": "string", "knownValues": ["ignore", "warn", "hide"] },
|
|
45
|
+
"adultOnly": { "type": "boolean" },
|
|
46
|
+
"locales": { "type": "array", "items": { "type": "ref", "ref": "#labelValueDefinitionStrings" } }
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"labelValueDefinitionStrings": {
|
|
50
|
+
"type": "object",
|
|
51
|
+
"required": ["lang", "name", "description"],
|
|
52
|
+
"properties": {
|
|
53
|
+
"lang": { "type": "string", "format": "language" },
|
|
54
|
+
"name": { "type": "string", "maxLength": 640 },
|
|
55
|
+
"description": { "type": "string", "maxLength": 100000 }
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
"labelValue": {
|
|
59
|
+
"type": "string",
|
|
60
|
+
"knownValues": [
|
|
61
|
+
"!hide",
|
|
62
|
+
"!no-promote",
|
|
63
|
+
"!warn",
|
|
64
|
+
"!no-unauthenticated",
|
|
65
|
+
"dmca-violation",
|
|
66
|
+
"doxxing",
|
|
67
|
+
"porn",
|
|
68
|
+
"sexual",
|
|
69
|
+
"nudity",
|
|
70
|
+
"nsfl",
|
|
71
|
+
"gore"
|
|
72
|
+
]
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|