@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
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"lexicon": 1,
|
|
3
|
+
"id": "dev.hatk.describeFeeds",
|
|
4
|
+
"defs": {
|
|
5
|
+
"main": {
|
|
6
|
+
"type": "query",
|
|
7
|
+
"description": "List available feeds.",
|
|
8
|
+
"output": {
|
|
9
|
+
"encoding": "application/json",
|
|
10
|
+
"schema": {
|
|
11
|
+
"type": "object",
|
|
12
|
+
"properties": {
|
|
13
|
+
"feeds": {
|
|
14
|
+
"type": "array",
|
|
15
|
+
"items": {
|
|
16
|
+
"type": "object",
|
|
17
|
+
"required": ["name", "label"],
|
|
18
|
+
"properties": {
|
|
19
|
+
"name": { "type": "string" },
|
|
20
|
+
"label": { "type": "string" }
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"lexicon": 1,
|
|
3
|
+
"id": "dev.hatk.describeLabels",
|
|
4
|
+
"defs": {
|
|
5
|
+
"main": {
|
|
6
|
+
"type": "query",
|
|
7
|
+
"description": "List available label definitions.",
|
|
8
|
+
"output": {
|
|
9
|
+
"encoding": "application/json",
|
|
10
|
+
"schema": {
|
|
11
|
+
"type": "object",
|
|
12
|
+
"properties": {
|
|
13
|
+
"definitions": {
|
|
14
|
+
"type": "array",
|
|
15
|
+
"items": {
|
|
16
|
+
"type": "object",
|
|
17
|
+
"required": ["identifier", "severity", "blurs", "defaultSetting"],
|
|
18
|
+
"properties": {
|
|
19
|
+
"identifier": { "type": "string" },
|
|
20
|
+
"severity": { "type": "string" },
|
|
21
|
+
"blurs": { "type": "string" },
|
|
22
|
+
"defaultSetting": { "type": "string" }
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"lexicon": 1,
|
|
3
|
+
"id": "dev.hatk.getFeed",
|
|
4
|
+
"defs": {
|
|
5
|
+
"main": {
|
|
6
|
+
"type": "query",
|
|
7
|
+
"description": "Retrieve a named feed of items.",
|
|
8
|
+
"parameters": {
|
|
9
|
+
"type": "params",
|
|
10
|
+
"required": ["feed"],
|
|
11
|
+
"properties": {
|
|
12
|
+
"feed": { "type": "string", "description": "Feed name" },
|
|
13
|
+
"limit": { "type": "integer", "minimum": 1, "maximum": 100, "default": 30 },
|
|
14
|
+
"cursor": { "type": "string" }
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"output": {
|
|
18
|
+
"encoding": "application/json",
|
|
19
|
+
"schema": {
|
|
20
|
+
"type": "object",
|
|
21
|
+
"required": ["items"],
|
|
22
|
+
"properties": {
|
|
23
|
+
"items": { "type": "array", "items": { "type": "unknown" } },
|
|
24
|
+
"cursor": { "type": "string" }
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"lexicon": 1,
|
|
3
|
+
"id": "dev.hatk.getPreferences",
|
|
4
|
+
"defs": {
|
|
5
|
+
"main": {
|
|
6
|
+
"type": "query",
|
|
7
|
+
"description": "Get all preferences for the authenticated user.",
|
|
8
|
+
"output": {
|
|
9
|
+
"encoding": "application/json",
|
|
10
|
+
"schema": {
|
|
11
|
+
"type": "object",
|
|
12
|
+
"properties": {
|
|
13
|
+
"preferences": { "type": "unknown" }
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"lexicon": 1,
|
|
3
|
+
"id": "dev.hatk.getRecord",
|
|
4
|
+
"defs": {
|
|
5
|
+
"main": {
|
|
6
|
+
"type": "query",
|
|
7
|
+
"description": "Fetch a single record by AT URI.",
|
|
8
|
+
"parameters": {
|
|
9
|
+
"type": "params",
|
|
10
|
+
"required": ["uri"],
|
|
11
|
+
"properties": {
|
|
12
|
+
"uri": { "type": "string", "format": "at-uri" }
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"output": {
|
|
16
|
+
"encoding": "application/json",
|
|
17
|
+
"schema": {
|
|
18
|
+
"type": "object",
|
|
19
|
+
"properties": {
|
|
20
|
+
"record": { "type": "unknown" }
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"lexicon": 1,
|
|
3
|
+
"id": "dev.hatk.getRecords",
|
|
4
|
+
"defs": {
|
|
5
|
+
"main": {
|
|
6
|
+
"type": "query",
|
|
7
|
+
"description": "List records from a collection with optional filters.",
|
|
8
|
+
"parameters": {
|
|
9
|
+
"type": "params",
|
|
10
|
+
"required": ["collection"],
|
|
11
|
+
"properties": {
|
|
12
|
+
"collection": { "type": "string" },
|
|
13
|
+
"limit": { "type": "integer", "minimum": 1, "maximum": 100, "default": 20 },
|
|
14
|
+
"cursor": { "type": "string" },
|
|
15
|
+
"sort": { "type": "string" },
|
|
16
|
+
"order": { "type": "string" }
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"output": {
|
|
20
|
+
"encoding": "application/json",
|
|
21
|
+
"schema": {
|
|
22
|
+
"type": "object",
|
|
23
|
+
"required": ["items"],
|
|
24
|
+
"properties": {
|
|
25
|
+
"items": { "type": "array", "items": { "type": "unknown" } },
|
|
26
|
+
"cursor": { "type": "string" }
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"lexicon": 1,
|
|
3
|
+
"id": "dev.hatk.putPreference",
|
|
4
|
+
"defs": {
|
|
5
|
+
"main": {
|
|
6
|
+
"type": "procedure",
|
|
7
|
+
"description": "Set a single preference by key.",
|
|
8
|
+
"input": {
|
|
9
|
+
"encoding": "application/json",
|
|
10
|
+
"schema": {
|
|
11
|
+
"type": "object",
|
|
12
|
+
"required": ["key", "value"],
|
|
13
|
+
"properties": {
|
|
14
|
+
"key": { "type": "string" },
|
|
15
|
+
"value": { "type": "unknown" }
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"output": {
|
|
20
|
+
"encoding": "application/json",
|
|
21
|
+
"schema": {
|
|
22
|
+
"type": "object",
|
|
23
|
+
"properties": {}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"lexicon": 1,
|
|
3
|
+
"id": "dev.hatk.putRecord",
|
|
4
|
+
"defs": {
|
|
5
|
+
"main": {
|
|
6
|
+
"type": "procedure",
|
|
7
|
+
"description": "Create or update a record via the user's PDS.",
|
|
8
|
+
"input": {
|
|
9
|
+
"encoding": "application/json",
|
|
10
|
+
"schema": {
|
|
11
|
+
"type": "object",
|
|
12
|
+
"required": ["collection", "rkey", "record"],
|
|
13
|
+
"properties": {
|
|
14
|
+
"collection": { "type": "string" },
|
|
15
|
+
"rkey": { "type": "string" },
|
|
16
|
+
"record": { "type": "unknown" },
|
|
17
|
+
"repo": { "type": "string", "format": "did" }
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"output": {
|
|
22
|
+
"encoding": "application/json",
|
|
23
|
+
"schema": {
|
|
24
|
+
"type": "object",
|
|
25
|
+
"properties": {
|
|
26
|
+
"uri": { "type": "string", "format": "at-uri" },
|
|
27
|
+
"cid": { "type": "string", "format": "cid" },
|
|
28
|
+
"commit": {
|
|
29
|
+
"type": "object",
|
|
30
|
+
"properties": {
|
|
31
|
+
"cid": { "type": "string", "format": "cid" },
|
|
32
|
+
"rev": { "type": "string" }
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"validationStatus": { "type": "string" }
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"lexicon": 1,
|
|
3
|
+
"id": "dev.hatk.searchRecords",
|
|
4
|
+
"defs": {
|
|
5
|
+
"main": {
|
|
6
|
+
"type": "query",
|
|
7
|
+
"description": "Full-text search across a collection.",
|
|
8
|
+
"parameters": {
|
|
9
|
+
"type": "params",
|
|
10
|
+
"required": ["collection", "q"],
|
|
11
|
+
"properties": {
|
|
12
|
+
"collection": { "type": "string" },
|
|
13
|
+
"q": { "type": "string", "description": "Search query" },
|
|
14
|
+
"limit": { "type": "integer", "minimum": 1, "maximum": 100, "default": 20 },
|
|
15
|
+
"cursor": { "type": "string" },
|
|
16
|
+
"fuzzy": { "type": "boolean", "default": true }
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"output": {
|
|
20
|
+
"encoding": "application/json",
|
|
21
|
+
"schema": {
|
|
22
|
+
"type": "object",
|
|
23
|
+
"required": ["items"],
|
|
24
|
+
"properties": {
|
|
25
|
+
"items": { "type": "array", "items": { "type": "unknown" } },
|
|
26
|
+
"cursor": { "type": "string" }
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"lexicon": 1,
|
|
3
|
+
"id": "dev.hatk.uploadBlob",
|
|
4
|
+
"defs": {
|
|
5
|
+
"main": {
|
|
6
|
+
"type": "procedure",
|
|
7
|
+
"description": "Upload a blob via the user's PDS.",
|
|
8
|
+
"input": {
|
|
9
|
+
"encoding": "*/*"
|
|
10
|
+
},
|
|
11
|
+
"output": {
|
|
12
|
+
"encoding": "application/json",
|
|
13
|
+
"schema": {
|
|
14
|
+
"type": "object",
|
|
15
|
+
"required": ["blob"],
|
|
16
|
+
"properties": {
|
|
17
|
+
"blob": { "type": "blob" }
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
package/dist/main.js
CHANGED
|
@@ -19,7 +19,7 @@ import { createAdapter } from "./database/adapter-factory.js";
|
|
|
19
19
|
import { getDialect } from "./database/dialect.js";
|
|
20
20
|
import { setSearchPort } from "./database/fts.js";
|
|
21
21
|
import { initFeeds, listFeeds } from "./feeds.js";
|
|
22
|
-
import { initXrpc, listXrpc, configureRelay, callXrpc } from "./xrpc.js";
|
|
22
|
+
import { initXrpc, listXrpc, configureRelay, configureOAuth, callXrpc } from "./xrpc.js";
|
|
23
23
|
import { initOpengraph } from "./opengraph.js";
|
|
24
24
|
import { initLabels, getLabelDefinitions } from "./labels.js";
|
|
25
25
|
import { startIndexer } from "./indexer.js";
|
|
@@ -112,6 +112,7 @@ else {
|
|
|
112
112
|
}
|
|
113
113
|
// Register built-in dev.hatk.* handlers so callXrpc() can find them
|
|
114
114
|
registerCoreHandlers(collections, config.oauth);
|
|
115
|
+
configureOAuth(config.oauth);
|
|
115
116
|
// Write db/schema.sql (after setup, so setup-created tables are included)
|
|
116
117
|
try {
|
|
117
118
|
const schemaDir = resolve(configDir, 'db');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/oauth/server.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/oauth/server.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AA4E/C,wBAAsB,SAAS,CAAC,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAsBrG;AAID,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW;;;;;;;;;;;;;;;;;;;EAqBxE;AAED,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW;;;;;EAO/E;AAED,wBAAgB,OAAO;;;;;;;;;;;;;;;;;;;;;;EAWtB;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW;;;;;;;;;EAcpE;AAID,wBAAsB,SAAS,CAC7B,MAAM,EAAE,WAAW,EACnB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC5B,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAAC,CA2ItD;AAID,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,GAAG,GAAG,MAAM,CAShF;AAID,wBAAsB,WAAW,CAAC,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAoGtF;AAID,wBAAsB,cAAc,CAClC,MAAM,EAAE,WAAW,EACnB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,GAAG,IAAI,EACpB,GAAG,EAAE,MAAM,GAAG,IAAI,GACjB,OAAO,CAAC;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,iBAAiB,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC,CAyHrG;AAID,wBAAsB,WAAW,CAC/B,MAAM,EAAE,WAAW,EACnB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC5B,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,GAAG,CAAC,CAUd;AA0JD,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,WAAW,EACnB,OAAO,EAAE;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GACtF,OAAO,CAAC;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAAC,CAoEpF;AAID,wBAAsB,YAAY,CAChC,UAAU,EAAE,MAAM,GAAG,IAAI,EACzB,UAAU,EAAE,MAAM,GAAG,IAAI,EACzB,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,MAAM,GACV,OAAO,CAAC;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAAC,CA0BjC"}
|
package/dist/oauth/server.js
CHANGED
|
@@ -4,7 +4,7 @@ import { parseDpopProof, createDpopProof } from "./dpop.js";
|
|
|
4
4
|
import { initSession } from "./session.js";
|
|
5
5
|
import { resolveClient, validateRedirectUri, isLoopbackClient } from "./client.js";
|
|
6
6
|
import { discoverAuthServer, resolveHandle } from "./discovery.js";
|
|
7
|
-
import { getServerKey, storeServerKey, storeOAuthRequest, getOAuthRequest, deleteOAuthRequest, storeAuthCode, consumeAuthCode, storeSession, checkAndStoreDpopJti, cleanupExpiredOAuth, storeRefreshToken, getRefreshToken, revokeRefreshToken, } from "./db.js";
|
|
7
|
+
import { getServerKey, storeServerKey, storeOAuthRequest, getOAuthRequest, deleteOAuthRequest, storeAuthCode, consumeAuthCode, storeSession, deleteSession, checkAndStoreDpopJti, cleanupExpiredOAuth, storeRefreshToken, getRefreshToken, revokeRefreshToken, } from "./db.js";
|
|
8
8
|
import { emit } from "../logger.js";
|
|
9
9
|
import { querySQL } from "../database/db.js";
|
|
10
10
|
import { fireOnLoginHook } from "../hooks.js";
|
|
@@ -432,7 +432,7 @@ export async function handleCallback(config, code, state, iss) {
|
|
|
432
432
|
dpopJkt: serverJkt,
|
|
433
433
|
tokenExpiresAt: tokenData.expires_in ? Math.floor(Date.now() / 1000) + tokenData.expires_in : undefined,
|
|
434
434
|
});
|
|
435
|
-
await fireOnLoginHook(did);
|
|
435
|
+
await fireOnLoginHook(did, config);
|
|
436
436
|
// Generate authorization code for the client
|
|
437
437
|
const clientCode = randomToken();
|
|
438
438
|
await storeAuthCode(clientCode, request.request_uri);
|
|
@@ -621,6 +621,7 @@ export async function refreshPdsSession(config, session) {
|
|
|
621
621
|
did: session.did,
|
|
622
622
|
pds_endpoint: session.pds_endpoint,
|
|
623
623
|
});
|
|
624
|
+
await deleteSession(session.did);
|
|
624
625
|
return null;
|
|
625
626
|
}
|
|
626
627
|
const tokenData = await tokenRes.json();
|
package/dist/pds-proxy.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pds-proxy.d.ts","sourceRoot":"","sources":["../src/pds-proxy.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"pds-proxy.d.ts","sourceRoot":"","sources":["../src/pds-proxy.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAU9C,qBAAa,UAAW,SAAQ,KAAK;IAE1B,MAAM,EAAE,MAAM;gBAAd,MAAM,EAAE,MAAM,EACrB,OAAO,EAAE,MAAM;CAIlB;AAED,qBAAa,sBAAuB,SAAQ,UAAU;;CAIrD;AAoHD,wBAAsB,eAAe,CACnC,WAAW,EAAE,WAAW,EACxB,MAAM,EAAE;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,EACvB,KAAK,EAAE;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,GAC3F,OAAO,CAAC;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAwCzC;AAED,wBAAsB,eAAe,CACnC,WAAW,EAAE,WAAW,EACxB,MAAM,EAAE;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,EACvB,KAAK,EAAE;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC1C,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAyBlC;AAED,wBAAsB,YAAY,CAChC,WAAW,EAAE,WAAW,EACxB,MAAM,EAAE;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,EACvB,KAAK,EAAE;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GAC1F,OAAO,CAAC;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAqCzC;AAED,wBAAsB,aAAa,CACjC,WAAW,EAAE,WAAW,EACxB,MAAM,EAAE;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,EACvB,IAAI,EAAE,UAAU,EAChB,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC,CAS5B"}
|
package/dist/pds-proxy.js
CHANGED
|
@@ -6,6 +6,7 @@ import { validateRecord } from '@bigmoves/lexicon';
|
|
|
6
6
|
import { getLexiconArray } from "./database/schema.js";
|
|
7
7
|
import { insertRecord, deleteRecord as dbDeleteRecord } from "./database/db.js";
|
|
8
8
|
import { emit } from "./logger.js";
|
|
9
|
+
import { runLabelRules } from "./labels.js";
|
|
9
10
|
export class ProxyError extends Error {
|
|
10
11
|
status;
|
|
11
12
|
constructor(status, message) {
|
|
@@ -117,6 +118,13 @@ export async function pdsCreateRecord(oauthConfig, viewer, input) {
|
|
|
117
118
|
throw new ProxyError(pdsRes.status, String(pdsRes.body.error || 'PDS write failed'));
|
|
118
119
|
try {
|
|
119
120
|
await insertRecord(input.collection, String(pdsRes.body.uri), String(pdsRes.body.cid), viewer.did, input.record);
|
|
121
|
+
await runLabelRules({
|
|
122
|
+
uri: String(pdsRes.body.uri),
|
|
123
|
+
cid: String(pdsRes.body.cid),
|
|
124
|
+
did: viewer.did,
|
|
125
|
+
collection: input.collection,
|
|
126
|
+
value: input.record,
|
|
127
|
+
});
|
|
120
128
|
}
|
|
121
129
|
catch (err) {
|
|
122
130
|
emit('pds-proxy', 'local_index_error', {
|
|
@@ -171,6 +179,13 @@ export async function pdsPutRecord(oauthConfig, viewer, input) {
|
|
|
171
179
|
throw new ProxyError(pdsRes.status, String(pdsRes.body.error || 'PDS write failed'));
|
|
172
180
|
try {
|
|
173
181
|
await insertRecord(input.collection, String(pdsRes.body.uri), String(pdsRes.body.cid), viewer.did, input.record);
|
|
182
|
+
await runLabelRules({
|
|
183
|
+
uri: String(pdsRes.body.uri),
|
|
184
|
+
cid: String(pdsRes.body.cid),
|
|
185
|
+
did: viewer.did,
|
|
186
|
+
collection: input.collection,
|
|
187
|
+
value: input.record,
|
|
188
|
+
});
|
|
174
189
|
}
|
|
175
190
|
catch (err) {
|
|
176
191
|
emit('pds-proxy', 'local_index_error', { op: 'putRecord', error: err instanceof Error ? err.message : String(err) });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-init.d.ts","sourceRoot":"","sources":["../src/server-init.ts"],"names":[],"mappings":"AAWA;;;GAGG;AACH,wBAAsB,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE;IAAE,SAAS,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"server-init.d.ts","sourceRoot":"","sources":["../src/server-init.ts"],"names":[],"mappings":"AAWA;;;GAGG;AACH,wBAAsB,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE;IAAE,SAAS,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CA4DjG"}
|
package/dist/server-init.js
CHANGED
|
@@ -3,7 +3,7 @@ import { log } from "./logger.js";
|
|
|
3
3
|
import { scanServerDir } from "./scanner.js";
|
|
4
4
|
import { registerFeed, listFeeds } from "./feeds.js";
|
|
5
5
|
import { registerXrpcHandler, listXrpc } from "./xrpc.js";
|
|
6
|
-
import { registerLabelModule, getLabelDefinitions } from "./labels.js";
|
|
6
|
+
import { registerLabelModule, getLabelDefinitions, clearLabels } from "./labels.js";
|
|
7
7
|
import { registerOgHandler } from "./opengraph.js";
|
|
8
8
|
import { registerHook } from "./hooks.js";
|
|
9
9
|
import { runSetupHandler } from "./setup.js";
|
|
@@ -40,7 +40,8 @@ export async function initServer(serverDir, opts) {
|
|
|
40
40
|
for (const entry of scanned.hooks) {
|
|
41
41
|
registerHook(entry.mod.event, entry.mod.handler);
|
|
42
42
|
}
|
|
43
|
-
// 5. Register labels
|
|
43
|
+
// 5. Register labels (clear first for hot-reload)
|
|
44
|
+
clearLabels();
|
|
44
45
|
for (const entry of scanned.labels) {
|
|
45
46
|
registerLabelModule(entry.name, entry.mod);
|
|
46
47
|
}
|
package/dist/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAyDA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AA0B9C;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,WAAW,GAAG,IAAI,GAAG,IAAI,CAuK3F;AAED,MAAM,WAAW,aAAa;IAC5B,WAAW,EAAE,MAAM,EAAE,CAAA;IACrB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,KAAK,EAAE,WAAW,GAAG,IAAI,CAAA;IACzB,MAAM,EAAE,MAAM,EAAE,CAAA;IAChB,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,KAAK,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IACxF,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAA;IAC5D,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAA;CACtB;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,aAAa,GAAG,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC,CA6zB5F;AAGD,wBAAgB,WAAW,CACzB,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,EAAE,EACrB,SAAS,EAAE,MAAM,GAAG,IAAI,EACxB,KAAK,EAAE,WAAW,GAAG,IAAI,EACzB,MAAM,GAAE,MAAM,EAAO,EACrB,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,EAC5D,QAAQ,CAAC,EAAE,MAAM,IAAI,GACpB,OAAO,WAAW,EAAE,MAAM,CAG5B"}
|