@hatk/hatk 0.0.1-alpha.41 → 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.
Files changed (77) hide show
  1. package/dist/cli.js +16 -553
  2. package/dist/database/adapters/sqlite.d.ts.map +1 -1
  3. package/dist/database/adapters/sqlite.js +2 -1
  4. package/dist/database/db.d.ts +23 -0
  5. package/dist/database/db.d.ts.map +1 -1
  6. package/dist/database/db.js +81 -4
  7. package/dist/labels.d.ts +2 -0
  8. package/dist/labels.d.ts.map +1 -1
  9. package/dist/labels.js +5 -0
  10. package/dist/lexicon-resolve.d.ts.map +1 -1
  11. package/dist/lexicon-resolve.js +27 -112
  12. package/dist/lexicons/com/atproto/label/defs.json +75 -0
  13. package/dist/lexicons/com/atproto/moderation/defs.json +30 -0
  14. package/dist/lexicons/com/atproto/repo/strongRef.json +24 -0
  15. package/dist/lexicons/dev/hatk/createRecord.json +40 -0
  16. package/dist/lexicons/dev/hatk/createReport.json +48 -0
  17. package/dist/lexicons/dev/hatk/deleteRecord.json +25 -0
  18. package/dist/lexicons/dev/hatk/describeCollections.json +41 -0
  19. package/dist/lexicons/dev/hatk/describeFeeds.json +29 -0
  20. package/dist/lexicons/dev/hatk/describeLabels.json +31 -0
  21. package/dist/lexicons/dev/hatk/getFeed.json +30 -0
  22. package/dist/lexicons/dev/hatk/getPreferences.json +19 -0
  23. package/dist/lexicons/dev/hatk/getRecord.json +26 -0
  24. package/dist/lexicons/dev/hatk/getRecords.json +32 -0
  25. package/dist/lexicons/dev/hatk/putPreference.json +28 -0
  26. package/dist/lexicons/dev/hatk/putRecord.json +41 -0
  27. package/dist/lexicons/dev/hatk/searchRecords.json +32 -0
  28. package/dist/lexicons/dev/hatk/uploadBlob.json +23 -0
  29. package/dist/oauth/server.d.ts.map +1 -1
  30. package/dist/oauth/server.js +2 -1
  31. package/dist/pds-proxy.d.ts.map +1 -1
  32. package/dist/pds-proxy.js +15 -0
  33. package/dist/server-init.d.ts.map +1 -1
  34. package/dist/server-init.js +3 -2
  35. package/dist/server.d.ts.map +1 -1
  36. package/dist/server.js +91 -13
  37. package/dist/templates/feed.tpl +14 -0
  38. package/dist/templates/hook.tpl +5 -0
  39. package/dist/templates/label.tpl +15 -0
  40. package/dist/templates/og.tpl +17 -0
  41. package/dist/templates/seed.tpl +11 -0
  42. package/dist/templates/setup.tpl +5 -0
  43. package/dist/templates/test-feed.tpl +19 -0
  44. package/dist/templates/test-xrpc.tpl +19 -0
  45. package/dist/templates/xrpc.tpl +41 -0
  46. package/package.json +3 -2
  47. package/public/admin.html +133 -0
  48. package/dist/cloudflare/container.d.ts +0 -73
  49. package/dist/cloudflare/container.d.ts.map +0 -1
  50. package/dist/cloudflare/container.js +0 -232
  51. package/dist/cloudflare/hooks.d.ts +0 -33
  52. package/dist/cloudflare/hooks.d.ts.map +0 -1
  53. package/dist/cloudflare/hooks.js +0 -40
  54. package/dist/cloudflare/init.d.ts +0 -27
  55. package/dist/cloudflare/init.d.ts.map +0 -1
  56. package/dist/cloudflare/init.js +0 -103
  57. package/dist/cloudflare/worker.d.ts +0 -27
  58. package/dist/cloudflare/worker.d.ts.map +0 -1
  59. package/dist/cloudflare/worker.js +0 -54
  60. package/dist/database/adapters/d1.d.ts +0 -56
  61. package/dist/database/adapters/d1.d.ts.map +0 -1
  62. package/dist/database/adapters/d1.js +0 -108
  63. package/dist/db.d.ts +0 -134
  64. package/dist/db.d.ts.map +0 -1
  65. package/dist/db.js +0 -1327
  66. package/dist/fts.d.ts +0 -20
  67. package/dist/fts.d.ts.map +0 -1
  68. package/dist/fts.js +0 -767
  69. package/dist/oauth/hooks.d.ts +0 -10
  70. package/dist/oauth/hooks.d.ts.map +0 -1
  71. package/dist/oauth/hooks.js +0 -40
  72. package/dist/schema.d.ts +0 -59
  73. package/dist/schema.d.ts.map +0 -1
  74. package/dist/schema.js +0 -387
  75. package/dist/test-browser.d.ts +0 -14
  76. package/dist/test-browser.d.ts.map +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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"}
@@ -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
- exp: row.exp ? String(row.exp) : null,
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/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;
@@ -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,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AsB,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAmCjE;AAED,yEAAyE;AACzE,wBAAgB,WAAW,IAAI,IAAI,CAGlC;AAED,oEAAoE;AACpE,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE;IAAE,UAAU,CAAC,EAAE,eAAe,CAAC;IAAC,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,gBAAgB,KAAK,OAAO,CAAC,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":"AAsMA,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;AA+DD;;;;GAIG;AACH,wBAAsB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAgChF"}
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"}
@@ -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 (not published via DNS) ---
75
- const coreSchemas = {
76
- 'com.atproto.repo.strongRef': {
77
- lexicon: 1,
78
- id: 'com.atproto.repo.strongRef',
79
- description: 'A URI with a content-hash fingerprint.',
80
- defs: {
81
- main: {
82
- type: 'object',
83
- required: ['uri', 'cid'],
84
- properties: { uri: { type: 'string', format: 'at-uri' }, cid: { type: 'string', format: 'cid' } },
85
- },
86
- },
87
- },
88
- 'com.atproto.label.defs': {
89
- lexicon: 1,
90
- id: 'com.atproto.label.defs',
91
- defs: {
92
- label: {
93
- type: 'object',
94
- description: 'Metadata tag on an atproto resource (eg, repo or record).',
95
- required: ['src', 'uri', 'val', 'cts'],
96
- properties: {
97
- ver: { type: 'integer' },
98
- src: { type: 'string', format: 'did' },
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
+ }
@@ -0,0 +1,30 @@
1
+ {
2
+ "lexicon": 1,
3
+ "id": "com.atproto.moderation.defs",
4
+ "defs": {
5
+ "reasonType": {
6
+ "type": "string",
7
+ "knownValues": [
8
+ "com.atproto.moderation.defs#reasonSpam",
9
+ "com.atproto.moderation.defs#reasonViolation",
10
+ "com.atproto.moderation.defs#reasonMisleading",
11
+ "com.atproto.moderation.defs#reasonSexual",
12
+ "com.atproto.moderation.defs#reasonRude",
13
+ "com.atproto.moderation.defs#reasonOther",
14
+ "com.atproto.moderation.defs#reasonAppeal"
15
+ ]
16
+ },
17
+ "reasonSpam": { "type": "token", "description": "Spam: frequent unwanted promotion, replies, mentions." },
18
+ "reasonViolation": { "type": "token", "description": "Direct violation of server rules, laws, terms of service." },
19
+ "reasonMisleading": { "type": "token", "description": "Misleading identity, affiliation, or content." },
20
+ "reasonSexual": { "type": "token", "description": "Unwanted or mislabeled sexual content." },
21
+ "reasonRude": { "type": "token", "description": "Rude, harassing, explicit, or otherwise unwelcoming behavior." },
22
+ "reasonOther": { "type": "token", "description": "Reports not falling under another report category." },
23
+ "reasonAppeal": { "type": "token", "description": "Appeal a previously taken moderation action." },
24
+ "subjectType": {
25
+ "type": "string",
26
+ "description": "Tag describing a type of subject that might be reported.",
27
+ "knownValues": ["account", "record", "chat"]
28
+ }
29
+ }
30
+ }
@@ -0,0 +1,24 @@
1
+ {
2
+ "lexicon": 1,
3
+ "id": "com.atproto.repo.strongRef",
4
+ "description": "A URI with a content-hash fingerprint.",
5
+ "defs": {
6
+ "main": {
7
+ "type": "object",
8
+ "required": [
9
+ "uri",
10
+ "cid"
11
+ ],
12
+ "properties": {
13
+ "uri": {
14
+ "type": "string",
15
+ "format": "at-uri"
16
+ },
17
+ "cid": {
18
+ "type": "string",
19
+ "format": "cid"
20
+ }
21
+ }
22
+ }
23
+ }
24
+ }
@@ -0,0 +1,40 @@
1
+ {
2
+ "lexicon": 1,
3
+ "id": "dev.hatk.createRecord",
4
+ "defs": {
5
+ "main": {
6
+ "type": "procedure",
7
+ "description": "Create a record via the user's PDS.",
8
+ "input": {
9
+ "encoding": "application/json",
10
+ "schema": {
11
+ "type": "object",
12
+ "required": ["collection", "repo", "record"],
13
+ "properties": {
14
+ "collection": { "type": "string" },
15
+ "repo": { "type": "string", "format": "did" },
16
+ "record": { "type": "unknown" }
17
+ }
18
+ }
19
+ },
20
+ "output": {
21
+ "encoding": "application/json",
22
+ "schema": {
23
+ "type": "object",
24
+ "properties": {
25
+ "uri": { "type": "string", "format": "at-uri" },
26
+ "cid": { "type": "string", "format": "cid" },
27
+ "commit": {
28
+ "type": "object",
29
+ "properties": {
30
+ "cid": { "type": "string", "format": "cid" },
31
+ "rev": { "type": "string" }
32
+ }
33
+ },
34
+ "validationStatus": { "type": "string" }
35
+ }
36
+ }
37
+ }
38
+ }
39
+ }
40
+ }
@@ -0,0 +1,48 @@
1
+ {
2
+ "lexicon": 1,
3
+ "id": "dev.hatk.createReport",
4
+ "defs": {
5
+ "main": {
6
+ "type": "procedure",
7
+ "description": "Report an account or record for moderation review.",
8
+ "input": {
9
+ "encoding": "application/json",
10
+ "schema": {
11
+ "type": "object",
12
+ "required": ["subject", "label"],
13
+ "properties": {
14
+ "subject": {
15
+ "type": "union",
16
+ "description": "The account or record being reported.",
17
+ "refs": ["#repoRef", "com.atproto.repo.strongRef"]
18
+ },
19
+ "label": { "type": "string", "description": "Label identifier for the report reason." },
20
+ "reason": { "type": "string", "maxLength": 2000, "description": "Optional free-text explanation." }
21
+ }
22
+ }
23
+ },
24
+ "output": {
25
+ "encoding": "application/json",
26
+ "schema": {
27
+ "type": "object",
28
+ "required": ["id", "subject", "label", "reportedBy", "createdAt"],
29
+ "properties": {
30
+ "id": { "type": "integer" },
31
+ "subject": { "type": "unknown" },
32
+ "label": { "type": "string" },
33
+ "reason": { "type": "string" },
34
+ "reportedBy": { "type": "string", "format": "did" },
35
+ "createdAt": { "type": "string", "format": "datetime" }
36
+ }
37
+ }
38
+ }
39
+ },
40
+ "repoRef": {
41
+ "type": "object",
42
+ "required": ["did"],
43
+ "properties": {
44
+ "did": { "type": "string", "format": "did" }
45
+ }
46
+ }
47
+ }
48
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ "lexicon": 1,
3
+ "id": "dev.hatk.deleteRecord",
4
+ "defs": {
5
+ "main": {
6
+ "type": "procedure",
7
+ "description": "Delete a record via the user's PDS.",
8
+ "input": {
9
+ "encoding": "application/json",
10
+ "schema": {
11
+ "type": "object",
12
+ "required": ["collection", "rkey"],
13
+ "properties": {
14
+ "collection": { "type": "string" },
15
+ "rkey": { "type": "string" }
16
+ }
17
+ }
18
+ },
19
+ "output": {
20
+ "encoding": "application/json",
21
+ "schema": { "type": "object", "properties": {} }
22
+ }
23
+ }
24
+ }
25
+ }
@@ -0,0 +1,41 @@
1
+ {
2
+ "lexicon": 1,
3
+ "id": "dev.hatk.describeCollections",
4
+ "defs": {
5
+ "main": {
6
+ "type": "query",
7
+ "description": "List indexed collections and their schemas.",
8
+ "output": {
9
+ "encoding": "application/json",
10
+ "schema": {
11
+ "type": "object",
12
+ "properties": {
13
+ "collections": {
14
+ "type": "array",
15
+ "items": {
16
+ "type": "object",
17
+ "required": ["collection"],
18
+ "properties": {
19
+ "collection": { "type": "string" },
20
+ "columns": {
21
+ "type": "array",
22
+ "items": {
23
+ "type": "object",
24
+ "required": ["name", "originalName", "type", "required"],
25
+ "properties": {
26
+ "name": { "type": "string" },
27
+ "originalName": { "type": "string" },
28
+ "type": { "type": "string" },
29
+ "required": { "type": "boolean" }
30
+ }
31
+ }
32
+ }
33
+ }
34
+ }
35
+ }
36
+ }
37
+ }
38
+ }
39
+ }
40
+ }
41
+ }