@hatk/hatk 0.0.1-alpha.8 → 0.0.1-alpha.80

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 (175) hide show
  1. package/dist/adapter.d.ts +19 -0
  2. package/dist/adapter.d.ts.map +1 -0
  3. package/dist/adapter.js +110 -0
  4. package/dist/backfill.d.ts +21 -2
  5. package/dist/backfill.d.ts.map +1 -1
  6. package/dist/backfill.js +102 -37
  7. package/dist/car.d.ts +42 -10
  8. package/dist/car.d.ts.map +1 -1
  9. package/dist/car.js +154 -14
  10. package/dist/cli.js +243 -1043
  11. package/dist/config.d.ts +74 -1
  12. package/dist/config.d.ts.map +1 -1
  13. package/dist/config.js +43 -9
  14. package/dist/database/adapter-factory.d.ts +6 -0
  15. package/dist/database/adapter-factory.d.ts.map +1 -0
  16. package/dist/database/adapter-factory.js +20 -0
  17. package/dist/database/adapters/duckdb-search.d.ts +12 -0
  18. package/dist/database/adapters/duckdb-search.d.ts.map +1 -0
  19. package/dist/database/adapters/duckdb-search.js +27 -0
  20. package/dist/database/adapters/duckdb.d.ts +25 -0
  21. package/dist/database/adapters/duckdb.d.ts.map +1 -0
  22. package/dist/database/adapters/duckdb.js +161 -0
  23. package/dist/database/adapters/sqlite-search.d.ts +23 -0
  24. package/dist/database/adapters/sqlite-search.d.ts.map +1 -0
  25. package/dist/database/adapters/sqlite-search.js +74 -0
  26. package/dist/database/adapters/sqlite.d.ts +18 -0
  27. package/dist/database/adapters/sqlite.d.ts.map +1 -0
  28. package/dist/database/adapters/sqlite.js +88 -0
  29. package/dist/{db.d.ts → database/db.d.ts} +57 -6
  30. package/dist/database/db.d.ts.map +1 -0
  31. package/dist/{db.js → database/db.js} +755 -552
  32. package/dist/database/dialect.d.ts +45 -0
  33. package/dist/database/dialect.d.ts.map +1 -0
  34. package/dist/database/dialect.js +72 -0
  35. package/dist/{fts.d.ts → database/fts.d.ts} +7 -0
  36. package/dist/database/fts.d.ts.map +1 -0
  37. package/dist/{fts.js → database/fts.js} +116 -32
  38. package/dist/database/index.d.ts +7 -0
  39. package/dist/database/index.d.ts.map +1 -0
  40. package/dist/database/index.js +6 -0
  41. package/dist/database/ports.d.ts +50 -0
  42. package/dist/database/ports.d.ts.map +1 -0
  43. package/dist/database/ports.js +1 -0
  44. package/dist/{schema.d.ts → database/schema.d.ts} +14 -3
  45. package/dist/database/schema.d.ts.map +1 -0
  46. package/dist/{schema.js → database/schema.js} +81 -41
  47. package/dist/dev-entry.d.ts +8 -0
  48. package/dist/dev-entry.d.ts.map +1 -0
  49. package/dist/dev-entry.js +119 -0
  50. package/dist/feeds.d.ts +12 -8
  51. package/dist/feeds.d.ts.map +1 -1
  52. package/dist/feeds.js +51 -6
  53. package/dist/hooks.d.ts +85 -0
  54. package/dist/hooks.d.ts.map +1 -0
  55. package/dist/hooks.js +163 -0
  56. package/dist/hydrate.d.ts +7 -6
  57. package/dist/hydrate.d.ts.map +1 -1
  58. package/dist/hydrate.js +4 -16
  59. package/dist/indexer.d.ts +109 -3
  60. package/dist/indexer.d.ts.map +1 -1
  61. package/dist/indexer.js +338 -66
  62. package/dist/jetstream.d.ts +118 -0
  63. package/dist/jetstream.d.ts.map +1 -0
  64. package/dist/jetstream.js +225 -0
  65. package/dist/labels.d.ts +36 -0
  66. package/dist/labels.d.ts.map +1 -1
  67. package/dist/labels.js +71 -6
  68. package/dist/lexicon-resolve.d.ts.map +1 -1
  69. package/dist/lexicon-resolve.js +27 -112
  70. package/dist/lexicons/com/atproto/label/defs.json +75 -0
  71. package/dist/lexicons/com/atproto/moderation/defs.json +30 -0
  72. package/dist/lexicons/com/atproto/repo/strongRef.json +21 -0
  73. package/dist/lexicons/dev/hatk/applyWrites.json +87 -0
  74. package/dist/lexicons/dev/hatk/createRecord.json +40 -0
  75. package/dist/lexicons/dev/hatk/createReport.json +48 -0
  76. package/dist/lexicons/dev/hatk/deleteRecord.json +25 -0
  77. package/dist/lexicons/dev/hatk/describeCollections.json +41 -0
  78. package/dist/lexicons/dev/hatk/describeFeeds.json +29 -0
  79. package/dist/lexicons/dev/hatk/describeLabels.json +45 -0
  80. package/dist/lexicons/dev/hatk/getFeed.json +30 -0
  81. package/dist/lexicons/dev/hatk/getPreferences.json +19 -0
  82. package/dist/lexicons/dev/hatk/getRecord.json +26 -0
  83. package/dist/lexicons/dev/hatk/getRecords.json +32 -0
  84. package/dist/lexicons/dev/hatk/putPreference.json +28 -0
  85. package/dist/lexicons/dev/hatk/putRecord.json +41 -0
  86. package/dist/lexicons/dev/hatk/searchRecords.json +32 -0
  87. package/dist/lexicons/dev/hatk/uploadBlob.json +23 -0
  88. package/dist/logger.d.ts +29 -0
  89. package/dist/logger.d.ts.map +1 -1
  90. package/dist/logger.js +29 -0
  91. package/dist/main.js +161 -72
  92. package/dist/mst.d.ts +18 -1
  93. package/dist/mst.d.ts.map +1 -1
  94. package/dist/mst.js +19 -8
  95. package/dist/oauth/db.d.ts +3 -1
  96. package/dist/oauth/db.d.ts.map +1 -1
  97. package/dist/oauth/db.js +56 -19
  98. package/dist/oauth/discovery.d.ts.map +1 -1
  99. package/dist/oauth/discovery.js +13 -1
  100. package/dist/oauth/server.d.ts +92 -1
  101. package/dist/oauth/server.d.ts.map +1 -1
  102. package/dist/oauth/server.js +352 -37
  103. package/dist/oauth/service-describe.d.ts +31 -0
  104. package/dist/oauth/service-describe.d.ts.map +1 -0
  105. package/dist/oauth/service-describe.js +61 -0
  106. package/dist/oauth/session.d.ts +32 -0
  107. package/dist/oauth/session.d.ts.map +1 -0
  108. package/dist/oauth/session.js +131 -0
  109. package/dist/opengraph.d.ts +10 -0
  110. package/dist/opengraph.d.ts.map +1 -1
  111. package/dist/opengraph.js +80 -40
  112. package/dist/pds-proxy.d.ts +82 -0
  113. package/dist/pds-proxy.d.ts.map +1 -0
  114. package/dist/pds-proxy.js +356 -0
  115. package/dist/private-collections.d.ts +8 -0
  116. package/dist/private-collections.d.ts.map +1 -0
  117. package/dist/private-collections.js +22 -0
  118. package/dist/push.d.ts +54 -0
  119. package/dist/push.d.ts.map +1 -0
  120. package/dist/push.js +367 -0
  121. package/dist/renderer.d.ts +27 -0
  122. package/dist/renderer.d.ts.map +1 -0
  123. package/dist/renderer.js +46 -0
  124. package/dist/resolve-hatk.d.ts +6 -0
  125. package/dist/resolve-hatk.d.ts.map +1 -0
  126. package/dist/resolve-hatk.js +20 -0
  127. package/dist/response.d.ts +16 -0
  128. package/dist/response.d.ts.map +1 -0
  129. package/dist/response.js +69 -0
  130. package/dist/scanner.d.ts +21 -0
  131. package/dist/scanner.d.ts.map +1 -0
  132. package/dist/scanner.js +88 -0
  133. package/dist/seed.d.ts +19 -0
  134. package/dist/seed.d.ts.map +1 -1
  135. package/dist/seed.js +43 -4
  136. package/dist/server-init.d.ts +8 -0
  137. package/dist/server-init.d.ts.map +1 -0
  138. package/dist/server-init.js +62 -0
  139. package/dist/server.d.ts +26 -3
  140. package/dist/server.d.ts.map +1 -1
  141. package/dist/server.js +832 -638
  142. package/dist/setup.d.ts +28 -1
  143. package/dist/setup.d.ts.map +1 -1
  144. package/dist/setup.js +50 -3
  145. package/dist/templates/feed.tpl +14 -0
  146. package/dist/templates/hook.tpl +5 -0
  147. package/dist/templates/label.tpl +15 -0
  148. package/dist/templates/og.tpl +17 -0
  149. package/dist/templates/seed.tpl +11 -0
  150. package/dist/templates/setup.tpl +5 -0
  151. package/dist/templates/test-feed.tpl +19 -0
  152. package/dist/templates/test-xrpc.tpl +19 -0
  153. package/dist/templates/xrpc.tpl +41 -0
  154. package/dist/test.d.ts +1 -1
  155. package/dist/test.d.ts.map +1 -1
  156. package/dist/test.js +41 -32
  157. package/dist/views.js +1 -1
  158. package/dist/vite-plugin.d.ts +1 -1
  159. package/dist/vite-plugin.d.ts.map +1 -1
  160. package/dist/vite-plugin.js +254 -66
  161. package/dist/xrpc.d.ts +82 -11
  162. package/dist/xrpc.d.ts.map +1 -1
  163. package/dist/xrpc.js +196 -39
  164. package/package.json +17 -9
  165. package/public/admin-auth.js +271 -306
  166. package/public/admin.html +177 -61
  167. package/dist/db.d.ts.map +0 -1
  168. package/dist/fts.d.ts.map +0 -1
  169. package/dist/oauth/hooks.d.ts +0 -10
  170. package/dist/oauth/hooks.d.ts.map +0 -1
  171. package/dist/oauth/hooks.js +0 -40
  172. package/dist/schema.d.ts.map +0 -1
  173. package/dist/test-browser.d.ts +0 -14
  174. package/dist/test-browser.d.ts.map +0 -1
  175. 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,21 @@
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": ["uri", "cid"],
9
+ "properties": {
10
+ "uri": {
11
+ "type": "string",
12
+ "format": "at-uri"
13
+ },
14
+ "cid": {
15
+ "type": "string",
16
+ "format": "cid"
17
+ }
18
+ }
19
+ }
20
+ }
21
+ }
@@ -0,0 +1,87 @@
1
+ {
2
+ "lexicon": 1,
3
+ "id": "dev.hatk.applyWrites",
4
+ "defs": {
5
+ "main": {
6
+ "type": "procedure",
7
+ "description": "Apply multiple record writes in a single atomic PDS transaction.",
8
+ "input": {
9
+ "encoding": "application/json",
10
+ "schema": {
11
+ "type": "object",
12
+ "required": ["writes"],
13
+ "properties": {
14
+ "writes": {
15
+ "type": "array",
16
+ "items": {
17
+ "type": "union",
18
+ "refs": ["#create", "#update", "#delete"]
19
+ }
20
+ }
21
+ }
22
+ }
23
+ },
24
+ "output": {
25
+ "encoding": "application/json",
26
+ "schema": {
27
+ "type": "object",
28
+ "properties": {
29
+ "results": {
30
+ "type": "array",
31
+ "items": {
32
+ "type": "union",
33
+ "refs": ["#createResult", "#updateResult", "#deleteResult"]
34
+ }
35
+ }
36
+ }
37
+ }
38
+ }
39
+ },
40
+ "create": {
41
+ "type": "object",
42
+ "required": ["collection", "value"],
43
+ "properties": {
44
+ "collection": { "type": "string" },
45
+ "rkey": { "type": "string" },
46
+ "value": { "type": "unknown" }
47
+ }
48
+ },
49
+ "update": {
50
+ "type": "object",
51
+ "required": ["collection", "rkey", "value"],
52
+ "properties": {
53
+ "collection": { "type": "string" },
54
+ "rkey": { "type": "string" },
55
+ "value": { "type": "unknown" }
56
+ }
57
+ },
58
+ "delete": {
59
+ "type": "object",
60
+ "required": ["collection", "rkey"],
61
+ "properties": {
62
+ "collection": { "type": "string" },
63
+ "rkey": { "type": "string" }
64
+ }
65
+ },
66
+ "createResult": {
67
+ "type": "object",
68
+ "required": ["uri", "cid"],
69
+ "properties": {
70
+ "uri": { "type": "string", "format": "at-uri" },
71
+ "cid": { "type": "string", "format": "cid" }
72
+ }
73
+ },
74
+ "updateResult": {
75
+ "type": "object",
76
+ "required": ["uri", "cid"],
77
+ "properties": {
78
+ "uri": { "type": "string", "format": "at-uri" },
79
+ "cid": { "type": "string", "format": "cid" }
80
+ }
81
+ },
82
+ "deleteResult": {
83
+ "type": "object",
84
+ "properties": {}
85
+ }
86
+ }
87
+ }
@@ -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,45 @@
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": { "type": "ref", "ref": "#labelDefinition" }
16
+ }
17
+ }
18
+ }
19
+ }
20
+ },
21
+ "labelDefinition": {
22
+ "type": "object",
23
+ "required": ["identifier", "severity", "blurs", "defaultSetting"],
24
+ "properties": {
25
+ "identifier": { "type": "string" },
26
+ "severity": { "type": "string" },
27
+ "blurs": { "type": "string" },
28
+ "defaultSetting": { "type": "string" },
29
+ "locales": {
30
+ "type": "array",
31
+ "items": { "type": "ref", "ref": "#labelLocale" }
32
+ }
33
+ }
34
+ },
35
+ "labelLocale": {
36
+ "type": "object",
37
+ "required": ["lang", "name", "description"],
38
+ "properties": {
39
+ "lang": { "type": "string" },
40
+ "name": { "type": "string" },
41
+ "description": { "type": "string" }
42
+ }
43
+ }
44
+ }
45
+ }
@@ -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/logger.d.ts CHANGED
@@ -1,4 +1,33 @@
1
+ /**
2
+ * Unstructured debug log — use sparingly for human-readable dev output.
3
+ * Prefer {@link emit} for anything that should be queryable in production.
4
+ * Disabled when `DEBUG=0`.
5
+ */
1
6
  export declare function log(...args: unknown[]): void;
7
+ /**
8
+ * Emit a structured wide event as a single JSON line to stdout.
9
+ *
10
+ * Each call produces one canonical log line with a timestamp, module, operation,
11
+ * and arbitrary key-value fields — designed for columnar search and aggregation,
12
+ * not string grep. Pack as much context as possible into `fields` (request IDs,
13
+ * durations, status codes, user DIDs, counts) so a single event tells the full
14
+ * story. See https://loggingsucks.com for the philosophy behind this approach.
15
+ *
16
+ * Disabled when `DEBUG=0`.
17
+ *
18
+ * @param module - Subsystem emitting the event (e.g. "server", "indexer", "backfill")
19
+ * @param op - Operation name (e.g. "request", "commit", "memory")
20
+ * @param fields - High-cardinality key-value context — include everything relevant
21
+ */
2
22
  export declare function emit(module: string, op: string, fields: Record<string, unknown>): void;
23
+ /**
24
+ * Start a millisecond timer. Call the returned function to get elapsed ms.
25
+ * Use with {@link emit} to add `duration_ms` to wide events.
26
+ *
27
+ * @example
28
+ * const elapsed = timer()
29
+ * await doWork()
30
+ * emit('server', 'request', { path, status_code, duration_ms: elapsed() })
31
+ */
3
32
  export declare function timer(): () => number;
4
33
  //# sourceMappingURL=logger.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA,wBAAgB,GAAG,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAG5C;AAED,wBAAgB,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAWtF;AAED,wBAAgB,KAAK,IAAI,MAAM,MAAM,CAGpC"}
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,GAAG,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAG5C;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAWtF;AAED;;;;;;;;GAQG;AACH,wBAAgB,KAAK,IAAI,MAAM,MAAM,CAGpC"}