@atproto/lex-space 0.0.0-spaces-alpha-20261112204144

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 (340) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/LICENSE.txt +7 -0
  3. package/README.md +464 -0
  4. package/dist/actions.d.ts +17 -0
  5. package/dist/actions.d.ts.map +1 -0
  6. package/dist/actions.js +20 -0
  7. package/dist/actions.js.map +1 -0
  8. package/dist/atproto-did-resolver.d.ts +3 -0
  9. package/dist/atproto-did-resolver.d.ts.map +1 -0
  10. package/dist/atproto-did-resolver.js +2 -0
  11. package/dist/atproto-did-resolver.js.map +1 -0
  12. package/dist/client-attestation-provider.d.ts +57 -0
  13. package/dist/client-attestation-provider.d.ts.map +1 -0
  14. package/dist/client-attestation-provider.js +51 -0
  15. package/dist/client-attestation-provider.js.map +1 -0
  16. package/dist/delegation-token-provider.d.ts +25 -0
  17. package/dist/delegation-token-provider.d.ts.map +1 -0
  18. package/dist/delegation-token-provider.js +28 -0
  19. package/dist/delegation-token-provider.js.map +1 -0
  20. package/dist/errors.d.ts +27 -0
  21. package/dist/errors.d.ts.map +1 -0
  22. package/dist/errors.js +27 -0
  23. package/dist/errors.js.map +1 -0
  24. package/dist/index.d.ts +15 -0
  25. package/dist/index.d.ts.map +1 -0
  26. package/dist/index.js +15 -0
  27. package/dist/index.js.map +1 -0
  28. package/dist/lexicons/com/atproto/managedspace/policy.d.ts +3 -0
  29. package/dist/lexicons/com/atproto/managedspace/policy.d.ts.map +1 -0
  30. package/dist/lexicons/com/atproto/managedspace/policy.defs.d.ts +78 -0
  31. package/dist/lexicons/com/atproto/managedspace/policy.defs.d.ts.map +1 -0
  32. package/dist/lexicons/com/atproto/managedspace/policy.defs.js +23 -0
  33. package/dist/lexicons/com/atproto/managedspace/policy.defs.js.map +1 -0
  34. package/dist/lexicons/com/atproto/managedspace/policy.js +6 -0
  35. package/dist/lexicons/com/atproto/managedspace/policy.js.map +1 -0
  36. package/dist/lexicons/com/atproto/managedspace.d.ts +2 -0
  37. package/dist/lexicons/com/atproto/managedspace.d.ts.map +1 -0
  38. package/dist/lexicons/com/atproto/managedspace.js +5 -0
  39. package/dist/lexicons/com/atproto/managedspace.js.map +1 -0
  40. package/dist/lexicons/com/atproto/memberspace/defs.d.ts +2 -0
  41. package/dist/lexicons/com/atproto/memberspace/defs.d.ts.map +1 -0
  42. package/dist/lexicons/com/atproto/memberspace/defs.defs.d.ts +14 -0
  43. package/dist/lexicons/com/atproto/memberspace/defs.defs.d.ts.map +1 -0
  44. package/dist/lexicons/com/atproto/memberspace/defs.defs.js +9 -0
  45. package/dist/lexicons/com/atproto/memberspace/defs.defs.js.map +1 -0
  46. package/dist/lexicons/com/atproto/memberspace/defs.js +5 -0
  47. package/dist/lexicons/com/atproto/memberspace/defs.js.map +1 -0
  48. package/dist/lexicons/com/atproto/memberspace/listMembers.d.ts +3 -0
  49. package/dist/lexicons/com/atproto/memberspace/listMembers.d.ts.map +1 -0
  50. package/dist/lexicons/com/atproto/memberspace/listMembers.defs.d.ts +35 -0
  51. package/dist/lexicons/com/atproto/memberspace/listMembers.defs.d.ts.map +1 -0
  52. package/dist/lexicons/com/atproto/memberspace/listMembers.defs.js +15 -0
  53. package/dist/lexicons/com/atproto/memberspace/listMembers.defs.js.map +1 -0
  54. package/dist/lexicons/com/atproto/memberspace/listMembers.js +6 -0
  55. package/dist/lexicons/com/atproto/memberspace/listMembers.js.map +1 -0
  56. package/dist/lexicons/com/atproto/memberspace/policy.d.ts +3 -0
  57. package/dist/lexicons/com/atproto/memberspace/policy.d.ts.map +1 -0
  58. package/dist/lexicons/com/atproto/memberspace/policy.defs.d.ts +120 -0
  59. package/dist/lexicons/com/atproto/memberspace/policy.defs.d.ts.map +1 -0
  60. package/dist/lexicons/com/atproto/memberspace/policy.defs.js +23 -0
  61. package/dist/lexicons/com/atproto/memberspace/policy.defs.js.map +1 -0
  62. package/dist/lexicons/com/atproto/memberspace/policy.js +6 -0
  63. package/dist/lexicons/com/atproto/memberspace/policy.js.map +1 -0
  64. package/dist/lexicons/com/atproto/memberspace/putMembers.d.ts +3 -0
  65. package/dist/lexicons/com/atproto/memberspace/putMembers.d.ts.map +1 -0
  66. package/dist/lexicons/com/atproto/memberspace/putMembers.defs.d.ts +30 -0
  67. package/dist/lexicons/com/atproto/memberspace/putMembers.defs.d.ts.map +1 -0
  68. package/dist/lexicons/com/atproto/memberspace/putMembers.defs.js +16 -0
  69. package/dist/lexicons/com/atproto/memberspace/putMembers.defs.js.map +1 -0
  70. package/dist/lexicons/com/atproto/memberspace/putMembers.js +6 -0
  71. package/dist/lexicons/com/atproto/memberspace/putMembers.js.map +1 -0
  72. package/dist/lexicons/com/atproto/memberspace/removeMembers.d.ts +3 -0
  73. package/dist/lexicons/com/atproto/memberspace/removeMembers.d.ts.map +1 -0
  74. package/dist/lexicons/com/atproto/memberspace/removeMembers.defs.d.ts +33 -0
  75. package/dist/lexicons/com/atproto/memberspace/removeMembers.defs.d.ts.map +1 -0
  76. package/dist/lexicons/com/atproto/memberspace/removeMembers.defs.js +15 -0
  77. package/dist/lexicons/com/atproto/memberspace/removeMembers.defs.js.map +1 -0
  78. package/dist/lexicons/com/atproto/memberspace/removeMembers.js +6 -0
  79. package/dist/lexicons/com/atproto/memberspace/removeMembers.js.map +1 -0
  80. package/dist/lexicons/com/atproto/memberspace.d.ts +6 -0
  81. package/dist/lexicons/com/atproto/memberspace.d.ts.map +1 -0
  82. package/dist/lexicons/com/atproto/memberspace.js +9 -0
  83. package/dist/lexicons/com/atproto/memberspace.js.map +1 -0
  84. package/dist/lexicons/com/atproto/personalspace/policy.d.ts +3 -0
  85. package/dist/lexicons/com/atproto/personalspace/policy.d.ts.map +1 -0
  86. package/dist/lexicons/com/atproto/personalspace/policy.defs.d.ts +50 -0
  87. package/dist/lexicons/com/atproto/personalspace/policy.defs.d.ts.map +1 -0
  88. package/dist/lexicons/com/atproto/personalspace/policy.defs.js +23 -0
  89. package/dist/lexicons/com/atproto/personalspace/policy.defs.js.map +1 -0
  90. package/dist/lexicons/com/atproto/personalspace/policy.js +6 -0
  91. package/dist/lexicons/com/atproto/personalspace/policy.js.map +1 -0
  92. package/dist/lexicons/com/atproto/personalspace.d.ts +2 -0
  93. package/dist/lexicons/com/atproto/personalspace.d.ts.map +1 -0
  94. package/dist/lexicons/com/atproto/personalspace.js +5 -0
  95. package/dist/lexicons/com/atproto/personalspace.js.map +1 -0
  96. package/dist/lexicons/com/atproto/space/applyWrites.d.ts +3 -0
  97. package/dist/lexicons/com/atproto/space/applyWrites.d.ts.map +1 -0
  98. package/dist/lexicons/com/atproto/space/applyWrites.defs.d.ts +97 -0
  99. package/dist/lexicons/com/atproto/space/applyWrites.defs.d.ts.map +1 -0
  100. package/dist/lexicons/com/atproto/space/applyWrites.defs.js +30 -0
  101. package/dist/lexicons/com/atproto/space/applyWrites.defs.js.map +1 -0
  102. package/dist/lexicons/com/atproto/space/applyWrites.js +6 -0
  103. package/dist/lexicons/com/atproto/space/applyWrites.js.map +1 -0
  104. package/dist/lexicons/com/atproto/space/authorizeSpaceSync.d.ts +3 -0
  105. package/dist/lexicons/com/atproto/space/authorizeSpaceSync.d.ts.map +1 -0
  106. package/dist/lexicons/com/atproto/space/authorizeSpaceSync.defs.d.ts +59 -0
  107. package/dist/lexicons/com/atproto/space/authorizeSpaceSync.defs.d.ts.map +1 -0
  108. package/dist/lexicons/com/atproto/space/authorizeSpaceSync.defs.js +17 -0
  109. package/dist/lexicons/com/atproto/space/authorizeSpaceSync.defs.js.map +1 -0
  110. package/dist/lexicons/com/atproto/space/authorizeSpaceSync.js +6 -0
  111. package/dist/lexicons/com/atproto/space/authorizeSpaceSync.js.map +1 -0
  112. package/dist/lexicons/com/atproto/space/clearRecords.d.ts +3 -0
  113. package/dist/lexicons/com/atproto/space/clearRecords.d.ts.map +1 -0
  114. package/dist/lexicons/com/atproto/space/clearRecords.defs.d.ts +33 -0
  115. package/dist/lexicons/com/atproto/space/clearRecords.defs.d.ts.map +1 -0
  116. package/dist/lexicons/com/atproto/space/clearRecords.defs.js +15 -0
  117. package/dist/lexicons/com/atproto/space/clearRecords.defs.js.map +1 -0
  118. package/dist/lexicons/com/atproto/space/clearRecords.js +6 -0
  119. package/dist/lexicons/com/atproto/space/clearRecords.js.map +1 -0
  120. package/dist/lexicons/com/atproto/space/createRecord.d.ts +3 -0
  121. package/dist/lexicons/com/atproto/space/createRecord.d.ts.map +1 -0
  122. package/dist/lexicons/com/atproto/space/createRecord.defs.d.ts +69 -0
  123. package/dist/lexicons/com/atproto/space/createRecord.defs.d.ts.map +1 -0
  124. package/dist/lexicons/com/atproto/space/createRecord.defs.js +15 -0
  125. package/dist/lexicons/com/atproto/space/createRecord.defs.js.map +1 -0
  126. package/dist/lexicons/com/atproto/space/createRecord.js +6 -0
  127. package/dist/lexicons/com/atproto/space/createRecord.js.map +1 -0
  128. package/dist/lexicons/com/atproto/space/createSpace.d.ts +3 -0
  129. package/dist/lexicons/com/atproto/space/createSpace.d.ts.map +1 -0
  130. package/dist/lexicons/com/atproto/space/createSpace.defs.d.ts +46 -0
  131. package/dist/lexicons/com/atproto/space/createSpace.defs.d.ts.map +1 -0
  132. package/dist/lexicons/com/atproto/space/createSpace.defs.js +18 -0
  133. package/dist/lexicons/com/atproto/space/createSpace.defs.js.map +1 -0
  134. package/dist/lexicons/com/atproto/space/createSpace.js +6 -0
  135. package/dist/lexicons/com/atproto/space/createSpace.js.map +1 -0
  136. package/dist/lexicons/com/atproto/space/defs.d.ts +2 -0
  137. package/dist/lexicons/com/atproto/space/defs.d.ts.map +1 -0
  138. package/dist/lexicons/com/atproto/space/defs.defs.d.ts +60 -0
  139. package/dist/lexicons/com/atproto/space/defs.defs.d.ts.map +1 -0
  140. package/dist/lexicons/com/atproto/space/defs.defs.js +16 -0
  141. package/dist/lexicons/com/atproto/space/defs.defs.js.map +1 -0
  142. package/dist/lexicons/com/atproto/space/defs.js +5 -0
  143. package/dist/lexicons/com/atproto/space/defs.js.map +1 -0
  144. package/dist/lexicons/com/atproto/space/deleteRecord.d.ts +3 -0
  145. package/dist/lexicons/com/atproto/space/deleteRecord.d.ts.map +1 -0
  146. package/dist/lexicons/com/atproto/space/deleteRecord.defs.d.ts +45 -0
  147. package/dist/lexicons/com/atproto/space/deleteRecord.defs.d.ts.map +1 -0
  148. package/dist/lexicons/com/atproto/space/deleteRecord.defs.js +15 -0
  149. package/dist/lexicons/com/atproto/space/deleteRecord.defs.js.map +1 -0
  150. package/dist/lexicons/com/atproto/space/deleteRecord.js +6 -0
  151. package/dist/lexicons/com/atproto/space/deleteRecord.js.map +1 -0
  152. package/dist/lexicons/com/atproto/space/deleteSpace.d.ts +3 -0
  153. package/dist/lexicons/com/atproto/space/deleteSpace.d.ts.map +1 -0
  154. package/dist/lexicons/com/atproto/space/deleteSpace.defs.d.ts +27 -0
  155. package/dist/lexicons/com/atproto/space/deleteSpace.defs.d.ts.map +1 -0
  156. package/dist/lexicons/com/atproto/space/deleteSpace.defs.js +15 -0
  157. package/dist/lexicons/com/atproto/space/deleteSpace.defs.js.map +1 -0
  158. package/dist/lexicons/com/atproto/space/deleteSpace.js +6 -0
  159. package/dist/lexicons/com/atproto/space/deleteSpace.js.map +1 -0
  160. package/dist/lexicons/com/atproto/space/getBlob.d.ts +3 -0
  161. package/dist/lexicons/com/atproto/space/getBlob.d.ts.map +1 -0
  162. package/dist/lexicons/com/atproto/space/getBlob.defs.d.ts +36 -0
  163. package/dist/lexicons/com/atproto/space/getBlob.defs.d.ts.map +1 -0
  164. package/dist/lexicons/com/atproto/space/getBlob.defs.js +14 -0
  165. package/dist/lexicons/com/atproto/space/getBlob.defs.js.map +1 -0
  166. package/dist/lexicons/com/atproto/space/getBlob.js +6 -0
  167. package/dist/lexicons/com/atproto/space/getBlob.js.map +1 -0
  168. package/dist/lexicons/com/atproto/space/getDelegationToken.d.ts +3 -0
  169. package/dist/lexicons/com/atproto/space/getDelegationToken.d.ts.map +1 -0
  170. package/dist/lexicons/com/atproto/space/getDelegationToken.defs.d.ts +28 -0
  171. package/dist/lexicons/com/atproto/space/getDelegationToken.defs.d.ts.map +1 -0
  172. package/dist/lexicons/com/atproto/space/getDelegationToken.defs.js +14 -0
  173. package/dist/lexicons/com/atproto/space/getDelegationToken.defs.js.map +1 -0
  174. package/dist/lexicons/com/atproto/space/getDelegationToken.js +6 -0
  175. package/dist/lexicons/com/atproto/space/getDelegationToken.js.map +1 -0
  176. package/dist/lexicons/com/atproto/space/getLatestCommit.d.ts +3 -0
  177. package/dist/lexicons/com/atproto/space/getLatestCommit.d.ts.map +1 -0
  178. package/dist/lexicons/com/atproto/space/getLatestCommit.defs.d.ts +35 -0
  179. package/dist/lexicons/com/atproto/space/getLatestCommit.defs.d.ts.map +1 -0
  180. package/dist/lexicons/com/atproto/space/getLatestCommit.defs.js +15 -0
  181. package/dist/lexicons/com/atproto/space/getLatestCommit.defs.js.map +1 -0
  182. package/dist/lexicons/com/atproto/space/getLatestCommit.js +6 -0
  183. package/dist/lexicons/com/atproto/space/getLatestCommit.js.map +1 -0
  184. package/dist/lexicons/com/atproto/space/getRecord.d.ts +3 -0
  185. package/dist/lexicons/com/atproto/space/getRecord.d.ts.map +1 -0
  186. package/dist/lexicons/com/atproto/space/getRecord.defs.d.ts +58 -0
  187. package/dist/lexicons/com/atproto/space/getRecord.defs.d.ts.map +1 -0
  188. package/dist/lexicons/com/atproto/space/getRecord.defs.js +14 -0
  189. package/dist/lexicons/com/atproto/space/getRecord.defs.js.map +1 -0
  190. package/dist/lexicons/com/atproto/space/getRecord.js +6 -0
  191. package/dist/lexicons/com/atproto/space/getRecord.js.map +1 -0
  192. package/dist/lexicons/com/atproto/space/getRepo.d.ts +3 -0
  193. package/dist/lexicons/com/atproto/space/getRepo.d.ts.map +1 -0
  194. package/dist/lexicons/com/atproto/space/getRepo.defs.d.ts +30 -0
  195. package/dist/lexicons/com/atproto/space/getRepo.defs.d.ts.map +1 -0
  196. package/dist/lexicons/com/atproto/space/getRepo.defs.js +14 -0
  197. package/dist/lexicons/com/atproto/space/getRepo.defs.js.map +1 -0
  198. package/dist/lexicons/com/atproto/space/getRepo.js +6 -0
  199. package/dist/lexicons/com/atproto/space/getRepo.js.map +1 -0
  200. package/dist/lexicons/com/atproto/space/getSpace.d.ts +3 -0
  201. package/dist/lexicons/com/atproto/space/getSpace.d.ts.map +1 -0
  202. package/dist/lexicons/com/atproto/space/getSpace.defs.d.ts +37 -0
  203. package/dist/lexicons/com/atproto/space/getSpace.defs.d.ts.map +1 -0
  204. package/dist/lexicons/com/atproto/space/getSpace.defs.js +17 -0
  205. package/dist/lexicons/com/atproto/space/getSpace.defs.js.map +1 -0
  206. package/dist/lexicons/com/atproto/space/getSpace.js +6 -0
  207. package/dist/lexicons/com/atproto/space/getSpace.js.map +1 -0
  208. package/dist/lexicons/com/atproto/space/listBlobs.d.ts +3 -0
  209. package/dist/lexicons/com/atproto/space/listBlobs.d.ts.map +1 -0
  210. package/dist/lexicons/com/atproto/space/listBlobs.defs.d.ts +44 -0
  211. package/dist/lexicons/com/atproto/space/listBlobs.defs.d.ts.map +1 -0
  212. package/dist/lexicons/com/atproto/space/listBlobs.defs.js +14 -0
  213. package/dist/lexicons/com/atproto/space/listBlobs.defs.js.map +1 -0
  214. package/dist/lexicons/com/atproto/space/listBlobs.js +6 -0
  215. package/dist/lexicons/com/atproto/space/listBlobs.js.map +1 -0
  216. package/dist/lexicons/com/atproto/space/listRecords.d.ts +3 -0
  217. package/dist/lexicons/com/atproto/space/listRecords.d.ts.map +1 -0
  218. package/dist/lexicons/com/atproto/space/listRecords.defs.d.ts +58 -0
  219. package/dist/lexicons/com/atproto/space/listRecords.defs.d.ts.map +1 -0
  220. package/dist/lexicons/com/atproto/space/listRecords.defs.js +16 -0
  221. package/dist/lexicons/com/atproto/space/listRecords.defs.js.map +1 -0
  222. package/dist/lexicons/com/atproto/space/listRecords.js +6 -0
  223. package/dist/lexicons/com/atproto/space/listRecords.js.map +1 -0
  224. package/dist/lexicons/com/atproto/space/listRepoOps.d.ts +3 -0
  225. package/dist/lexicons/com/atproto/space/listRepoOps.d.ts.map +1 -0
  226. package/dist/lexicons/com/atproto/space/listRepoOps.defs.d.ts +74 -0
  227. package/dist/lexicons/com/atproto/space/listRepoOps.defs.d.ts.map +1 -0
  228. package/dist/lexicons/com/atproto/space/listRepoOps.defs.js +18 -0
  229. package/dist/lexicons/com/atproto/space/listRepoOps.defs.js.map +1 -0
  230. package/dist/lexicons/com/atproto/space/listRepoOps.js +6 -0
  231. package/dist/lexicons/com/atproto/space/listRepoOps.js.map +1 -0
  232. package/dist/lexicons/com/atproto/space/listSpaces.d.ts +3 -0
  233. package/dist/lexicons/com/atproto/space/listSpaces.d.ts.map +1 -0
  234. package/dist/lexicons/com/atproto/space/listSpaces.defs.d.ts +59 -0
  235. package/dist/lexicons/com/atproto/space/listSpaces.defs.d.ts.map +1 -0
  236. package/dist/lexicons/com/atproto/space/listSpaces.defs.js +16 -0
  237. package/dist/lexicons/com/atproto/space/listSpaces.defs.js.map +1 -0
  238. package/dist/lexicons/com/atproto/space/listSpaces.js +6 -0
  239. package/dist/lexicons/com/atproto/space/listSpaces.js.map +1 -0
  240. package/dist/lexicons/com/atproto/space/listWriters.d.ts +3 -0
  241. package/dist/lexicons/com/atproto/space/listWriters.d.ts.map +1 -0
  242. package/dist/lexicons/com/atproto/space/listWriters.defs.d.ts +35 -0
  243. package/dist/lexicons/com/atproto/space/listWriters.defs.d.ts.map +1 -0
  244. package/dist/lexicons/com/atproto/space/listWriters.defs.js +15 -0
  245. package/dist/lexicons/com/atproto/space/listWriters.defs.js.map +1 -0
  246. package/dist/lexicons/com/atproto/space/listWriters.js +6 -0
  247. package/dist/lexicons/com/atproto/space/listWriters.js.map +1 -0
  248. package/dist/lexicons/com/atproto/space/putRecord.d.ts +3 -0
  249. package/dist/lexicons/com/atproto/space/putRecord.d.ts.map +1 -0
  250. package/dist/lexicons/com/atproto/space/putRecord.defs.d.ts +69 -0
  251. package/dist/lexicons/com/atproto/space/putRecord.defs.d.ts.map +1 -0
  252. package/dist/lexicons/com/atproto/space/putRecord.defs.js +15 -0
  253. package/dist/lexicons/com/atproto/space/putRecord.defs.js.map +1 -0
  254. package/dist/lexicons/com/atproto/space/putRecord.js +6 -0
  255. package/dist/lexicons/com/atproto/space/putRecord.js.map +1 -0
  256. package/dist/lexicons/com/atproto/space/removeWriter.d.ts +3 -0
  257. package/dist/lexicons/com/atproto/space/removeWriter.d.ts.map +1 -0
  258. package/dist/lexicons/com/atproto/space/removeWriter.defs.d.ts +33 -0
  259. package/dist/lexicons/com/atproto/space/removeWriter.defs.d.ts.map +1 -0
  260. package/dist/lexicons/com/atproto/space/removeWriter.defs.js +15 -0
  261. package/dist/lexicons/com/atproto/space/removeWriter.defs.js.map +1 -0
  262. package/dist/lexicons/com/atproto/space/removeWriter.js +6 -0
  263. package/dist/lexicons/com/atproto/space/removeWriter.js.map +1 -0
  264. package/dist/lexicons/com/atproto/space/updateSpace.d.ts +3 -0
  265. package/dist/lexicons/com/atproto/space/updateSpace.d.ts.map +1 -0
  266. package/dist/lexicons/com/atproto/space/updateSpace.defs.d.ts +32 -0
  267. package/dist/lexicons/com/atproto/space/updateSpace.defs.d.ts.map +1 -0
  268. package/dist/lexicons/com/atproto/space/updateSpace.defs.js +18 -0
  269. package/dist/lexicons/com/atproto/space/updateSpace.defs.js.map +1 -0
  270. package/dist/lexicons/com/atproto/space/updateSpace.js +6 -0
  271. package/dist/lexicons/com/atproto/space/updateSpace.js.map +1 -0
  272. package/dist/lexicons/com/atproto/space.d.ts +23 -0
  273. package/dist/lexicons/com/atproto/space.d.ts.map +1 -0
  274. package/dist/lexicons/com/atproto/space.js +26 -0
  275. package/dist/lexicons/com/atproto/space.js.map +1 -0
  276. package/dist/lexicons/com/atproto.d.ts +5 -0
  277. package/dist/lexicons/com/atproto.d.ts.map +1 -0
  278. package/dist/lexicons/com/atproto.js +8 -0
  279. package/dist/lexicons/com/atproto.js.map +1 -0
  280. package/dist/lexicons/com.d.ts +2 -0
  281. package/dist/lexicons/com.d.ts.map +1 -0
  282. package/dist/lexicons/com.js +5 -0
  283. package/dist/lexicons/com.js.map +1 -0
  284. package/dist/lexicons/index.d.ts +2 -0
  285. package/dist/lexicons/index.d.ts.map +1 -0
  286. package/dist/lexicons/index.js +5 -0
  287. package/dist/lexicons/index.js.map +1 -0
  288. package/dist/policies/baseline.d.ts +7 -0
  289. package/dist/policies/baseline.d.ts.map +1 -0
  290. package/dist/policies/baseline.js +10 -0
  291. package/dist/policies/baseline.js.map +1 -0
  292. package/dist/policies/index.d.ts +6 -0
  293. package/dist/policies/index.d.ts.map +1 -0
  294. package/dist/policies/index.js +6 -0
  295. package/dist/policies/index.js.map +1 -0
  296. package/dist/policies/managedspace.d.ts +12 -0
  297. package/dist/policies/managedspace.d.ts.map +1 -0
  298. package/dist/policies/managedspace.js +12 -0
  299. package/dist/policies/managedspace.js.map +1 -0
  300. package/dist/policies/memberspace.d.ts +31 -0
  301. package/dist/policies/memberspace.d.ts.map +1 -0
  302. package/dist/policies/memberspace.js +48 -0
  303. package/dist/policies/memberspace.js.map +1 -0
  304. package/dist/policies/personalspace.d.ts +11 -0
  305. package/dist/policies/personalspace.d.ts.map +1 -0
  306. package/dist/policies/personalspace.js +11 -0
  307. package/dist/policies/personalspace.js.map +1 -0
  308. package/dist/policies/space-policy-manager.d.ts +73 -0
  309. package/dist/policies/space-policy-manager.d.ts.map +1 -0
  310. package/dist/policies/space-policy-manager.js +81 -0
  311. package/dist/policies/space-policy-manager.js.map +1 -0
  312. package/dist/space-client.d.ts +254 -0
  313. package/dist/space-client.d.ts.map +1 -0
  314. package/dist/space-client.js +301 -0
  315. package/dist/space-client.js.map +1 -0
  316. package/dist/space-collection.d.ts +11 -0
  317. package/dist/space-collection.d.ts.map +1 -0
  318. package/dist/space-collection.js +2 -0
  319. package/dist/space-collection.js.map +1 -0
  320. package/dist/space-credential-provider.d.ts +68 -0
  321. package/dist/space-credential-provider.d.ts.map +1 -0
  322. package/dist/space-credential-provider.js +68 -0
  323. package/dist/space-credential-provider.js.map +1 -0
  324. package/dist/space-credential.d.ts +35 -0
  325. package/dist/space-credential.d.ts.map +1 -0
  326. package/dist/space-credential.js +64 -0
  327. package/dist/space-credential.js.map +1 -0
  328. package/dist/space-manager.d.ts +102 -0
  329. package/dist/space-manager.d.ts.map +1 -0
  330. package/dist/space-manager.js +121 -0
  331. package/dist/space-manager.js.map +1 -0
  332. package/dist/space-reader.d.ts +400 -0
  333. package/dist/space-reader.d.ts.map +1 -0
  334. package/dist/space-reader.js +573 -0
  335. package/dist/space-reader.js.map +1 -0
  336. package/dist/write-operation-builder.d.ts +22 -0
  337. package/dist/write-operation-builder.d.ts.map +1 -0
  338. package/dist/write-operation-builder.js +37 -0
  339. package/dist/write-operation-builder.js.map +1 -0
  340. package/package.json +67 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,48 @@
1
+ # @atproto/lex-space
2
+
3
+ ## 0.0.0-spaces-alpha-20261112204144
4
+
5
+ ### Patch Changes
6
+
7
+ - [#5851](https://github.com/bluesky-social/atproto/pull/5851) [`20aab41`](https://github.com/bluesky-social/atproto/commit/20aab41fedf62b285f2f5addeb7c83f8a4a1c92d) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Creation of package, a client for [atproto spaces](https://github.com/bluesky-social/proposals/tree/main/0016-permissioned-data) built on `@atproto/lex-client`.
8
+
9
+ - [#5187](https://github.com/bluesky-social/atproto/pull/5187) [`d4def6e`](https://github.com/bluesky-social/atproto/commit/d4def6e9f521896ed8222f576d54923d00b5fbeb) Thanks [@dholms](https://github.com/dholms)! - `com.atproto.space.listWriters` and `notifySpaceUpdate` share `com.atproto.space.defs#repoWrite` (`{ repo, repoRev, data, spaceRev, prevSpaceRev? }`) and `#repoRemoved` (`{ repo, spaceRev, prevSpaceRev? }`). Each listWriters entry is now one of these, in place of `{ repo, latest, spaceRev }`, and the `$type` of a notifySpaceUpdate `update` for a repo is `com.atproto.space.defs#repoWrite` or `#repoRemoved`.
10
+
11
+ `@atproto/lex-space`:
12
+ - `notifyRegistrationProvider` registers for notifications of updates to a space with each credential.
13
+ - `SpaceCredential#spaceRev` is the space's revision when the credential was issued.
14
+ - `writers()` yields `repoWrite` and `repoRemoved` entries, and `allRecords()` skips removed writers.
15
+ - `pullRepo()` pulls a repo its host does not have as `{ type: 'empty' }`.
16
+ - Renewing a credential re-resolves the space authority, and a member's DID document missing its KEM key is resolved again.
17
+
18
+ - [#5862](https://github.com/bluesky-social/atproto/pull/5862) [`3c754ab`](https://github.com/bluesky-social/atproto/commit/3c754ab4a0b4cb38d8e5104c6c000666bd3f2b29) Thanks [@dholms](https://github.com/dholms)! - Carry space repo MACs as HTTP message signatures (RFC 9421, `hmac-sha256`). A syncer requests a MAC with `Accept-Signature`, giving its ephemeral KEM key as the `keyid` and the MAC profile (`atproto-space-commit` or `atproto-space-record`) as the `tag`. The repo host responds with an `Atproto-Space-Commit` or `Atproto-Space-Record` header describing the commit or record it returned, and a `Signature-Input` and `Signature` covering that header under the requested label. This replaces the `Atproto-Space-Want-Mac` and `Atproto-Space-Mac` headers. The PDS lists `Accept-Signature` in `Vary`, and exposes the new headers to browsers through `Access-Control-Expose-Headers`.
19
+
20
+ A host ignores requested signatures with other tags, and refuses more than one request with the profile's tag, or a request for parameters other than `keyid`, `tag` and `alg`.
21
+
22
+ Space credential signatures and MACs are verified alike: a verifier finds exactly one signature with the expected tag, whatever its label, covering exactly the expected components, with `keyid` and `alg` matching if present. Other parameters, such as `created`, are covered but otherwise ignored. Space credential signatures are made under the `sig` label.
23
+
24
+ `com.atproto.space.listRepoOps` includes the repo's current commit, and so a MAC, on every page, and answers `RepoNotFound` for a repo that has never been written. A page has a cursor whenever it is full.
25
+
26
+ In `@atproto/space`, `formatMacRequest` and `parseMacRequest` replace the MAC header helpers. `createCommitMacHeaders(commit, params)` and `createRecordMacHeaders(uri, cid, params)` replace `computeCommitMac` and `computeRecordMac`: they take the parsed `MacRequest` with its decapsulated `sharedSecret` (`CreateMacParams`), and return `{ headers }`, as `createSpaceSigHeaders` does. `verifyCommit`, `verifyRecord`, `verifyRepoStar`, `verifyCommitMac` and `verifyRecordMac` take the MAC request's encapsulation (`keyShare` and `sharedSecret`) and the response `headers` (`VerifyMacParams`) in place of `sharedSecret` and `mac`. `COMMIT_MAC_TYPE`, `RECORD_MAC_TYPE` and `MacType` are renamed `COMMIT_MAC_PROFILE`, `RECORD_MAC_PROFILE` and `MacProfile`, and `RECORD_MAC_VERSION` is removed.
27
+
28
+ - [#5864](https://github.com/bluesky-social/atproto/pull/5864) [`51bc559`](https://github.com/bluesky-social/atproto/commit/51bc559745774bea08ac2fb9ccf3d59dda0df8b4) Thanks [@dholms](https://github.com/dholms)! - `com.atproto.space.getSpaceCredential` is renamed to `authorizeSpaceSync`, and returns the space's current `spaceRev` alongside the credential, omitted before the space's first update.
29
+
30
+ Register for space notifications when authorizing space sync. `com.atproto.space.registerNotify` and `unregisterNotify` are removed. Instead, `authorizeSpaceSync` takes an optional `notify` object: an `endpoint` to call notification methods against, and a `token` to include in the body of each call. The endpoint and token together identify a registration, and each authorization carrying the same pair renews it. Before creating a registration, the space host calls `com.atproto.space.confirmRegistration` on the endpoint, which must echo back a random challenge, or the request fails with `RegistrationNotConfirmed`. A refused authorization withdraws the registration it carries.
31
+
32
+ The space host sends syncers `com.atproto.space.notifySpaceUpdate`, whose `update` is a `repoWrite`, `repoRemoved`, `spaceDeleted`, or `registrationExpired`. It replaces `notifySpaceDeleted`, and `notifyRepoUpdate` is now only sent by repo hosts to the space host.
33
+
34
+ A registration stays active while the credential is valid. Once it expires, the next update to the space is replaced by a `registrationExpired` notice, and nothing more is sent but a deletion notice until the syncer reauthorizes. A syncer unregisters by rejecting its expiry notice. Expiry and deletion notices are retried with a backoff that grows from one minute to twelve hours, for at least 72 hours. A syncer that still can't be reached is unregistered.
35
+
36
+ `authorizeSpaceSync` answers `SpaceDeleted` for a deleted space before checking the request's authorization.
37
+
38
+ Requests to syncer endpoints, to other space hosts, and to managing apps are made with SSRF protection.
39
+ - Updated dependencies [[`0d9643b`](https://github.com/bluesky-social/atproto/commit/0d9643bc003205666dd4c5551361761630b307fb), [`20aab41`](https://github.com/bluesky-social/atproto/commit/20aab41fedf62b285f2f5addeb7c83f8a4a1c92d), [`2f77206`](https://github.com/bluesky-social/atproto/commit/2f77206ff8010710db5733c454abff9eb5ebb96b), [`0d9643b`](https://github.com/bluesky-social/atproto/commit/0d9643bc003205666dd4c5551361761630b307fb), [`b348485`](https://github.com/bluesky-social/atproto/commit/b348485873807d704fb48e1705c430f3715a6eee), [`0d9643b`](https://github.com/bluesky-social/atproto/commit/0d9643bc003205666dd4c5551361761630b307fb), [`0d9643b`](https://github.com/bluesky-social/atproto/commit/0d9643bc003205666dd4c5551361761630b307fb), [`0d9643b`](https://github.com/bluesky-social/atproto/commit/0d9643bc003205666dd4c5551361761630b307fb), [`0d9643b`](https://github.com/bluesky-social/atproto/commit/0d9643bc003205666dd4c5551361761630b307fb), [`20aab41`](https://github.com/bluesky-social/atproto/commit/20aab41fedf62b285f2f5addeb7c83f8a4a1c92d), [`35c0cf1`](https://github.com/bluesky-social/atproto/commit/35c0cf1d53a33ec5ea5cd525de12191a9cf0e79c), [`57b24c6`](https://github.com/bluesky-social/atproto/commit/57b24c6ef9ac7738caf32b6a49a299355e3c0ff7), [`0d9643b`](https://github.com/bluesky-social/atproto/commit/0d9643bc003205666dd4c5551361761630b307fb), [`432ef66`](https://github.com/bluesky-social/atproto/commit/432ef660f7a659b1686f8edd46c6782877881133), [`5db8f3d`](https://github.com/bluesky-social/atproto/commit/5db8f3db807b1a37793b86521e833a843ada0b15), [`5791385`](https://github.com/bluesky-social/atproto/commit/57913851ec97acd077658e95bb33f468934bcf78), [`20aab41`](https://github.com/bluesky-social/atproto/commit/20aab41fedf62b285f2f5addeb7c83f8a4a1c92d), [`f3ba20b`](https://github.com/bluesky-social/atproto/commit/f3ba20bc09d5d7b03b754ea82391d61f65492419), [`3c754ab`](https://github.com/bluesky-social/atproto/commit/3c754ab4a0b4cb38d8e5104c6c000666bd3f2b29), [`30e2f7d`](https://github.com/bluesky-social/atproto/commit/30e2f7d0c631e6f796cd42c11603d00861525141), [`bf02818`](https://github.com/bluesky-social/atproto/commit/bf028184028a6e22de278324b220e282aadf0c5b), [`ed361d0`](https://github.com/bluesky-social/atproto/commit/ed361d04b83915c0c5018571711667a40a04cf58), [`7089c42`](https://github.com/bluesky-social/atproto/commit/7089c427ae2a35ede70c4ee7256a4807ea607335), [`0d9643b`](https://github.com/bluesky-social/atproto/commit/0d9643bc003205666dd4c5551361761630b307fb)]:
40
+ - @atproto/lex-client@0.0.0-spaces-alpha-20261112204144
41
+ - @atproto/did@0.0.0-spaces-alpha-20261112204144
42
+ - @atproto/lex-schema@0.0.0-spaces-alpha-20261112204144
43
+ - @atproto/crypto@0.0.0-spaces-alpha-20261112204144
44
+ - @atproto/syntax@0.0.0-spaces-alpha-20261112204144
45
+ - @atproto/space@0.0.0-spaces-alpha-20261112204144
46
+ - @atproto/lex-data@0.0.0-spaces-alpha-20261112204144
47
+ - @atproto-labs/did-resolver@0.0.0-spaces-alpha-20261112204144
48
+ - @atproto/lex-cbor@0.0.0-spaces-alpha-20261112204144
package/LICENSE.txt ADDED
@@ -0,0 +1,7 @@
1
+ Dual MIT/Apache-2.0 License
2
+
3
+ Copyright (c) 2022-2026 Bluesky Social PBC, and Contributors
4
+
5
+ Except as otherwise noted in individual files, this software is licensed under the MIT license (<http://opensource.org/licenses/MIT>), or the Apache License, Version 2.0 (<http://www.apache.org/licenses/LICENSE-2.0>).
6
+
7
+ Downstream projects and end users may chose either license individually, or both together, at their discretion. The motivation for this dual-licensing is the additional software patent assurance provided by Apache 2.0.
package/README.md ADDED
@@ -0,0 +1,464 @@
1
+ # @atproto/lex-space
2
+
3
+ Read and write [atproto spaces](https://github.com/bluesky-social/proposals/tree/main/0016-permissioned-data) with the `Client` from [`@atproto/lex`](../lex).
4
+
5
+ Spaces hold data with an access perimeter: personal data (bookmarks, drafts), gated content, private posts, group forums. This package handles the protocol for you: it obtains and renews space credentials, sends each request to the right server, signs it, and verifies what comes back.
6
+
7
+ ```typescript
8
+ import { Client } from '@atproto/lex'
9
+ import { SpaceClient, listSpaces } from '@atproto/lex-space'
10
+ import { com } from './lexicons/index.js'
11
+
12
+ const client = new Client(oauthSession)
13
+ const forum = com.example.forum // the space type's schema
14
+
15
+ const { spaces } = await client.call(listSpaces, { spaceType: forum.nsid })
16
+ const space = SpaceClient.openSpace(forum, spaces[0].space, {
17
+ agent: client.agent,
18
+ })
19
+
20
+ for await (const { repo, collection, record } of space.allRecords()) {
21
+ console.log(repo, collection, record)
22
+ }
23
+ ```
24
+
25
+ - [Concepts](#concepts)
26
+ - [Getting started](#getting-started)
27
+ - [Errors and verification](#errors-and-verification)
28
+ - [Managing a space](#managing-a-space)
29
+ - [Building a sync service](#building-a-sync-service)
30
+ - [Configuration](#configuration)
31
+ - [Reference](#reference)
32
+
33
+ ## Concepts
34
+
35
+ - A **space** is identified by its authority, its type and its key, in a URI: `at://{authority}/space/{type}/{skey}` (e.g. `at://did:plc:abc/space/com.example.forum/general`).
36
+ - A **space type** is declared by a Lexicon (`"type": "space"`): its key type, an optional title, and the record collections clients should expect in its spaces. Its generated schema (`l.space()`) is required to open, create or read a space.
37
+ - The space **authority** is the DID at the root of the space. Its PDS is the **space host**, which decides who may read the space.
38
+ - Each account writing to a space holds its own **repo** in it, on its own PDS. The accounts holding a repo in a space form its **writer set**.
39
+ - Reading other accounts' repos requires a **space credential**, issued by the space host in exchange for a **delegation token**. The user's PDS mints delegation tokens for apps the user granted access to the space. This package handles both.
40
+ - Records read from other accounts' repos are verified against a MAC computed by their host, so a response cannot be forged on the way.
41
+
42
+ ## Getting started
43
+
44
+ ### 1. Install
45
+
46
+ ```bash
47
+ npm install @atproto/lex @atproto/lex-space
48
+ ```
49
+
50
+ Space types and records are typed with Lexicon schemas: install and build those of the space types and record types you use (see [Lexicon Schemas](../lex/README.md#lexicon-schemas)), or declare them with the `l` builder from `@atproto/lex`.
51
+
52
+ ### 2. Request access to spaces
53
+
54
+ Access to spaces is granted through `space:` OAuth scopes, by space type and authority. For example:
55
+
56
+ | Scope | Grants |
57
+ | ------------------------------------------------------ | ------------------------------------------------------------------------------------- |
58
+ | `space:com.example.bookmarks` | The user's own bookmarks spaces: read, and write the collections the type declares |
59
+ | `space:com.example.forum?authority=*` | Every forum the user is in, under any authority: read, and write declared collections |
60
+ | `space:com.example.forum?authority=*&action=read` | The same forums, read-only |
61
+ | `space:com.example.forum?authority=*&action=read_self` | Only the user's own repo in those forums, read-only |
62
+ | `space:*?authority=*&action=read_self` | List all of the user's spaces, and read the user's own repo in each |
63
+
64
+ A `read` grant lets the app read every repo in the space. A `read_self` grant only covers the user's own repo: enough to read the user's own data, but not to obtain a space credential.
65
+
66
+ ### 3. List the user's spaces
67
+
68
+ ```typescript
69
+ import { listSpaces } from '@atproto/lex-space'
70
+
71
+ // The spaces the user holds a repo in, or is the authority of
72
+ const { spaces, cursor } = await client.call(listSpaces)
73
+
74
+ // Only the spaces the user is the authority of
75
+ const owned = await client.call(listSpaces, { spaceDid: client.did })
76
+
77
+ // Only the spaces of a given type
78
+ const forums = await client.call(listSpaces, {
79
+ spaceType: com.example.forum.nsid,
80
+ })
81
+ ```
82
+
83
+ ### 4. Open a space
84
+
85
+ ```typescript
86
+ import { SpaceClient } from '@atproto/lex-space'
87
+
88
+ // By URI
89
+ const space = SpaceClient.openSpace(
90
+ com.example.forum,
91
+ 'at://did:plc:abc/space/com.example.forum/general',
92
+ { agent: client.agent },
93
+ )
94
+
95
+ // By authority and key (the key can be left out for space types with a literal key)
96
+ const space = SpaceClient.openSpace(
97
+ com.example.forum,
98
+ { authority: 'did:plc:abc', skey: 'general' },
99
+ { agent: client.agent },
100
+ )
101
+ ```
102
+
103
+ The space must be of the type described by the schema (a `TypeError` is thrown otherwise). Opening a space makes no request. The space credential is obtained when a request first needs it, then cached and renewed shortly before it expires. To check right away that the space grants access, call `authorize()`:
104
+
105
+ ```typescript
106
+ await space.authorize() // throws if the space does not grant access (e.g. SpaceNotFound)
107
+ ```
108
+
109
+ Each `SpaceClient` obtains its own credential: keep one instance per space, rather than opening the space again for every use.
110
+
111
+ To create a space instead, with the user as its authority, use `SpaceClient.createSpace()`. It returns the new space, opened:
112
+
113
+ ```typescript
114
+ import { SpaceClient, memberspace } from '@atproto/lex-space'
115
+
116
+ const space = await SpaceClient.createSpace(client.agent, com.example.forum, {
117
+ skey: 'general', // Defaults to the literal key of the space type, or to a TID
118
+ policy: memberspace.policy.$build({}),
119
+ })
120
+ ```
121
+
122
+ ### 5. Read and write the user's own records
123
+
124
+ `SpaceClient` mirrors the record helpers of `Client`. Writes always target the user's own repo, and reads target it unless `repo` is set:
125
+
126
+ ```typescript
127
+ import { com } from './lexicons/index.js'
128
+
129
+ const { uri } = await space.create(com.example.post, { text: 'Hello, space!' })
130
+
131
+ const { records, cursor } = await space.list(com.example.post)
132
+ for (const { rkey, valid, value } of records) {
133
+ if (valid) console.log(rkey, value.text) // typed as com.example.post.Main
134
+ }
135
+
136
+ const post = await space.get(com.example.post, { rkey })
137
+ await space.put(com.example.post, { text: 'Edited' }, { rkey })
138
+ await space.delete(com.example.post, { rkey })
139
+
140
+ await space.applyWrites((op) => [
141
+ op.create(com.example.post, { text: 'First' }),
142
+ op.create(com.example.post, { text: 'Second' }),
143
+ ])
144
+ ```
145
+
146
+ Reads and writes of the user's own repo use the user's session, so a `read_self` grant is enough to read it.
147
+
148
+ These typed methods only accept the collections the space type declares: other record types are rejected at compile time, and throw before any request. Spaces may hold records of any type though: pass `validateRequest: false` to read or write other collections (e.g. with a `collection=*` grant). With `validateRequest: true`, records are also validated against their schema before being written. The lower level methods (`createRecord()`, `putRecord()`, `deleteRecord()`, `applyWrites()`) accept any record, as in `Client`. To restrict your own helpers the same way, use `SpaceCollectionSchema<S, T>` (or `SpaceCollection<S>` for the collection NSIDs).
149
+
150
+ ```typescript
151
+ await space.create(app.bsky.feed.post, post, { validateRequest: false })
152
+ ```
153
+
154
+ ### 6. Read other members' records
155
+
156
+ Set `repo` to read another account's repo. This requires a `read` grant:
157
+
158
+ ```typescript
159
+ // The accounts holding a repo in the space
160
+ for await (const { $type, repo } of space.writers()) {
161
+ if ($type !== 'com.atproto.space.defs#repoWrite') continue // removed
162
+ // Every post of each of them, across pages
163
+ for await (const post of space.listAll(com.example.post, { repo })) {
164
+ if (post.valid) console.log(repo, post.value.text)
165
+ }
166
+ }
167
+
168
+ // A single record, verified against the MAC its host computed
169
+ const { value } = await space.get(com.example.post, { repo, rkey })
170
+ ```
171
+
172
+ ### 7. Read the whole space
173
+
174
+ `allRecords()` reads every repo of the writer set. Each repo is fetched in full and verified (its commit against its host's MAC, its records against its commit) before its records are yielded:
175
+
176
+ ```typescript
177
+ // Every record, flagged with whether its collection is declared by the space type
178
+ for await (const {
179
+ repo,
180
+ collection,
181
+ rkey,
182
+ valid,
183
+ record,
184
+ } of space.allRecords()) {
185
+ if (valid) record // of a declared collection (not validated)
186
+ }
187
+
188
+ // The records of some collections, validated against their schema
189
+ for await (const post of space.allRecords({
190
+ collections: [com.example.post],
191
+ })) {
192
+ if (post.valid) post.record // typed as com.example.post.Main
193
+ }
194
+ ```
195
+
196
+ Repos that are unavailable (not found, taken down, suspended or deactivated) are skipped.
197
+
198
+ ### 8. Fetch blobs
199
+
200
+ Blobs referenced by records in the space are fetched from the repo that references them, and verified against their CID:
201
+
202
+ ```typescript
203
+ import { getBlobCid } from '@atproto/lex'
204
+
205
+ const { body } = await space.getBlob({
206
+ repo,
207
+ cid: getBlobCid(post.value.image),
208
+ })
209
+ // body: Uint8Array
210
+ ```
211
+
212
+ ## Errors and verification
213
+
214
+ | Error | When |
215
+ | ---------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ |
216
+ | `XrpcResponseError` with `error: 'SpaceNotFound'` | The space does not exist, or does not grant the user access (authorities do not disclose which) |
217
+ | `XrpcResponseError` with `error: 'AppNotAuthorized'` | The space only grants access to specific apps (see `clientAttestationProvider` in [Configuration](#configuration)) |
218
+ | `XrpcResponseError` with `error: 'SpaceDeleted'` | The space was deleted: drop any copy of its data |
219
+ | `SpaceRepoVerificationError` | A record, commit, repo or blob failed verification |
220
+ | `RepoGapError` | A repo cannot be synced incrementally from a known state (see [Building a sync service](#building-a-sync-service)) |
221
+ | `UnsupportedSpacePolicyError` | A space is not governed by one of the expected policies (see [Managing a space](#managing-a-space)) |
222
+ | `TypeError` | A space is not of the schema's type, or a record type is not one of its collections (see `validateRequest`) |
223
+
224
+ Some failures are recovered from automatically:
225
+
226
+ - A request rejected because of its credential (HTTP 401, e.g. after the credential was revoked) is retried once with a new credential.
227
+ - A response failing MAC verification is retried once after re-resolving the author's key, which may have been rotated.
228
+
229
+ ## Managing a space
230
+
231
+ The authority of a space manages it: its policy (who may read it, whose writes are tracked), and its lifecycle. Managing requires a `manage` grant on the space.
232
+
233
+ ### The policy
234
+
235
+ `SpaceManager.open()` reads the policy governing a space, and returns the API of that policy. The baseline policies, which every PDS supports, are handled out of the box:
236
+
237
+ ```typescript
238
+ import {
239
+ MemberspacePolicyManager,
240
+ SpaceClient,
241
+ SpaceManager,
242
+ memberspace,
243
+ } from '@atproto/lex-space'
244
+
245
+ const space = await SpaceClient.createSpace(client.agent, com.example.forum, {
246
+ policy: memberspace.policy.$build({}),
247
+ })
248
+
249
+ const manager = await SpaceManager.open(client.agent, space.uri)
250
+ if (manager instanceof MemberspacePolicyManager) {
251
+ await manager.putMembers([{ did, read: true, write: true }])
252
+ for await (const member of manager.members()) console.log(member)
253
+ await manager.updatePolicy({ publicRead: true })
254
+ }
255
+ ```
256
+
257
+ | Policy | Manager | API |
258
+ | ---------------------------------- | ---------------------------- | --------------------------------------------------------------------------------- |
259
+ | `com.atproto.personalspace.policy` | `PersonalspacePolicyManager` | `updatePolicy()` |
260
+ | `com.atproto.memberspace.policy` | `MemberspacePolicyManager` | `putMembers()`, `removeMembers()`, `listMembers()`, `members()`, `updatePolicy()` |
261
+ | `com.atproto.managedspace.policy` | `ManagedspacePolicyManager` | `updatePolicy()` (e.g. the `managingApp`) |
262
+
263
+ The schemas of these policies are exported under `personalspace`, `memberspace` and `managedspace` (e.g. `memberspace.policy`), and their managers as `baselineSpacePolicies`.
264
+
265
+ To only accept some policies, list their managers: the result is typed accordingly, and `UnsupportedSpacePolicyError` is thrown for any other policy.
266
+
267
+ ```typescript
268
+ const members = await SpaceManager.open(client.agent, spaceUri, {
269
+ policies: [MemberspacePolicyManager],
270
+ }) // MemberspacePolicyManager
271
+ ```
272
+
273
+ `updatePolicy()` replaces the policy wholesale: concurrent changes are overwritten (last write wins).
274
+
275
+ A space host may implement other policies, which define their own methods. To manage them the same way, extend `SpacePolicyManager`, with the policy's schema as static `schema`, and list it in `policies`:
276
+
277
+ ```typescript
278
+ import { xrpc } from '@atproto/lex'
279
+ import { SpacePolicyManager, baselineSpacePolicies } from '@atproto/lex-space'
280
+
281
+ class ForumPolicyManager extends SpacePolicyManager<forum.policy.Main> {
282
+ static readonly schema = forum.policy.main
283
+
284
+ async ban(did: DidString) {
285
+ await xrpc(this.agent, forum.ban, { body: { space: this.uri, did } })
286
+ }
287
+ }
288
+
289
+ const manager = await SpaceManager.open(client.agent, spaceUri, {
290
+ policies: [ForumPolicyManager, ...baselineSpacePolicies],
291
+ })
292
+ if (manager instanceof ForumPolicyManager) await manager.ban(did)
293
+ ```
294
+
295
+ The first manager whose schema matches the policy manages the space.
296
+
297
+ ### The lifecycle
298
+
299
+ `SpaceManager` handles what every policy shares, including policies no manager supports:
300
+
301
+ ```typescript
302
+ import { SpaceManager, managedspace } from '@atproto/lex-space'
303
+
304
+ const space = new SpaceManager(client.agent, spaceUri)
305
+
306
+ const { policy } = await space.getSpace()
307
+ await space.removeWriter(did) // from the writer set
308
+ await space.updateSpace(managedspace.policy.$build({ managingApp }))
309
+ await space.deleteSpace()
310
+ ```
311
+
312
+ Governing a space by a policy of another type discards the state of the previous policy (e.g. a member list).
313
+
314
+ ## Building a sync service
315
+
316
+ A sync service keeps its own copy of spaces, e.g. to index them for the users of an app. It does not act for one specific user: use a `SpaceReader`, which provides every read above (but no writes) with space credentials only. `SpaceClient` extends it.
317
+
318
+ ### Obtaining credentials
319
+
320
+ A `SpaceReader` exchanges delegation tokens for space credentials. A delegation token is always issued by the PDS of a user the space grants access to, with that user's session, but the session does not need to live in the service:
321
+
322
+ ```typescript
323
+ import { SpaceReader, delegationTokenProviderFor } from '@atproto/lex-space'
324
+
325
+ // With the session of a user the space grants access to
326
+ const reader = SpaceReader.openSpace(com.example.forum, spaceUri, {
327
+ delegationTokenProvider: delegationTokenProviderFor(client.agent),
328
+ })
329
+
330
+ // With tokens issued elsewhere, e.g. by the app holding the users' sessions
331
+ const reader = SpaceReader.openSpace(com.example.forum, spaceUri, {
332
+ delegationTokenProvider: async (space, { signal }) =>
333
+ app.issueToken(space.toString(), { signal }),
334
+ })
335
+
336
+ // For spaces with public read access, which need no delegation token
337
+ const reader = SpaceReader.openSpace(com.example.forum, { authority, skey })
338
+ ```
339
+
340
+ ### Syncing repos
341
+
342
+ The service keeps a copy of each repo: its records, and a `head` (`{ rev, state }`, where `state` is the repo's LtHash state). It decides when to sync each repo, e.g. when notified of a write:
343
+
344
+ ```typescript
345
+ // No known state at first: the first pull fetches the repo in full
346
+ let head: SpaceReader.RepoHead | undefined
347
+
348
+ for await (const _ of notified) {
349
+ // The operations since `head`, or a full copy of the repo (verified) when
350
+ // there is no `head`, or the operation log cannot be applied to it
351
+ const pulled = await reader.pullRepo({
352
+ repo,
353
+ head,
354
+ lookup: (collection, rkey) => store.getCid(repo, collection, rkey),
355
+ })
356
+ if (pulled.type === 'changes') {
357
+ for (const { collection, rkey, cid, record } of pulled.changes) {
358
+ if (cid) store.put(repo, collection, rkey, cid, record)
359
+ else store.delete(repo, collection, rkey)
360
+ }
361
+ head = pulled.head
362
+ } else if (pulled.type === 'snapshot') {
363
+ store.replace(repo, pulled.records)
364
+ head = pulled.head
365
+ } else {
366
+ // Its host does not have the repo (e.g. cleared and garbage collected)
367
+ store.replace(repo, [])
368
+ head = undefined
369
+ }
370
+ }
371
+ ```
372
+
373
+ To discover the repos to sync, list the writer set with `reader.writers()`. It yields the latest update to each repo: a `repoWrite`, with the repo's current `repoRev` and `data`, or a `repoRemoved`, for a repo removed from the writer set, which is no longer part of the space. The highest `spaceRev` it yields can be passed as `cursor` later, to only list the repos updated since. Removals may be forgotten after 72 hours, so a service that hasn't caught up in that time lists the whole writer set instead, and drops the repos missing from it.
374
+
375
+ ### Notifications
376
+
377
+ A sync service can register an endpoint to be notified of updates to the space, rather than polling it. The registration is made, and renewed, with each space credential obtained:
378
+
379
+ ```typescript
380
+ const reader = SpaceReader.openSpace(com.example.forum, spaceUri, {
381
+ delegationTokenProvider,
382
+ // A token unique to the space, that stays the same across credentials
383
+ notifyRegistrationProvider: async (space) => ({
384
+ endpoint: 'https://sync.example.com',
385
+ token: await store.notifyTokenFor(space.toString()),
386
+ }),
387
+ })
388
+
389
+ // Registers, if not already done. The space's revision at the time can be
390
+ // compared with the last one seen, to catch up on missed updates.
391
+ const { spaceRev } = await reader.authorize()
392
+ ```
393
+
394
+ The registration stays active while the latest credential is valid. The endpoint must implement `com.atproto.space.confirmRegistration`, which the space host calls before registering it, and `com.atproto.space.notifySpaceUpdate`: serving these is up to the service.
395
+
396
+ A notification of a repo's update (`repoWrite` or `repoRemoved`) carries its `spaceRev`, and the `prevSpaceRev` before it: a gap means missed notifications, which `writers({ cursor })` recovers. When notified that its registration expired, the service renews it with `reader.authorize({ renew: true })`. When notified that the space was deleted, it confirms with `reader.authorize({ renew: true })`, which fails with `SpaceDeleted` if so, before dropping its copy of the space.
397
+
398
+ ## Configuration
399
+
400
+ `SpaceClient.openSpace()`, `SpaceClient.createSpace()` and `SpaceReader.openSpace()` accept these options (`SpaceClient.openSpace()` also takes the user's `agent` in them):
401
+
402
+ ```typescript
403
+ import { createDidResolver } from '@atproto-labs/did-resolver'
404
+ import { clientAttestationProviderForOAuthClient } from '@atproto/lex-space'
405
+
406
+ const space = SpaceClient.openSpace(com.example.forum, spaceUri, {
407
+ agent: client.agent,
408
+
409
+ // Resolves the space authority and members to their PDS and keys. Defaults
410
+ // to a new caching resolver for did:plc (through plc.directory) and did:web:
411
+ // pass one to share its cache between instances.
412
+ didResolver: createDidResolver({ plcDirectoryUrl: 'http://localhost:2582' }),
413
+
414
+ // For spaces that only grant access to specific apps. Signs with the keyset
415
+ // of a confidential OAuth client. `clientAttestationProviderFor(clientId,
416
+ // signer)` takes a `Keyset` or an `@atproto/crypto` keypair instead.
417
+ clientAttestationProvider:
418
+ clientAttestationProviderForOAuthClient(oauthClient),
419
+
420
+ // Registers for notifications of updates to the space (see Notifications)
421
+ notifyRegistrationProvider,
422
+
423
+ // Used for every request to hosts other than the user's PDS (e.g. to
424
+ // enforce your own network policy)
425
+ fetch,
426
+ })
427
+ ```
428
+
429
+ ## Reference
430
+
431
+ ### How requests are routed
432
+
433
+ | Request | Sent to | Authenticated with |
434
+ | ---------------------------------------------------------- | ------------------------------------ | --------------------------------------- |
435
+ | The user's own repo (all writes, and reads without `repo`) | The user's PDS | The user's session (their agent) |
436
+ | Another account's repo (reads with `repo`) | That account's PDS | The space credential, for that account |
437
+ | The space as a whole (`writers()`, `listWriters()`, …) | The space host (the authority's PDS) | The space credential, for the authority |
438
+
439
+ ### Methods
440
+
441
+ | Method | Description | On |
442
+ | ------------------------------------------------------------------------------------ | ---------------------------------------------------------------- | ----------------------------- |
443
+ | `authorize()` | Obtain (or renew) the space credential, to check access early | `SpaceReader` / `SpaceClient` |
444
+ | `writers()`, `listWriters()` | The writer set | `SpaceReader` / `SpaceClient` |
445
+ | `records()`, `listRecords()` | A repo's records (not covered by a MAC) | `SpaceReader` / `SpaceClient` |
446
+ | `getRecord()` | A record, verified | `SpaceReader` / `SpaceClient` |
447
+ | `allRecords()` | The records of every repo in the writer set, verified | `SpaceReader` / `SpaceClient` |
448
+ | `getLatestCommit()`, `getRepo()`, `listRepoOps()` | A repo's commit, full content and operation log, verified | `SpaceReader` / `SpaceClient` |
449
+ | `getRepoSnapshot()`, `syncRepo()`, `pullRepo()` | Full and incremental repo sync | `SpaceReader` / `SpaceClient` |
450
+ | `getBlob()`, `listBlobs()` | Blobs referenced by a repo's records | `SpaceReader` / `SpaceClient` |
451
+ | `list()`, `listAll()`, `get()` | Typed reads, of the space type's collections | `SpaceClient` |
452
+ | `create()`, `put()`, `delete()` | Typed writes to the user's repo, of the space type's collections | `SpaceClient` |
453
+ | `createRecord()`, `putRecord()`, `deleteRecord()`, `applyWrites()`, `clearRecords()` | Lower level writes to the user's repo, of any collection | `SpaceClient` |
454
+
455
+ Other calls to the user's PDS can be made with the user's agent: `xrpc(space.agent, method, options)`. The package exports the space schemas it uses, under `lexicons` (e.g. `lexicons.com.atproto.space.getDelegationToken`). To manage a space, see [Managing a space](#managing-a-space).
456
+
457
+ ### Current limitations
458
+
459
+ - `getRepo()` and `getBlob()` buffer the response in memory: they will stream once `@atproto/lex-client` supports streamed responses.
460
+ - Space credentials are kept in memory only, and each `SpaceClient` obtains its own.
461
+
462
+ ## License
463
+
464
+ MIT or Apache2
@@ -0,0 +1,17 @@
1
+ import type { ActionOptions, Client, XrpcRequestParams, XrpcResponseBody } from '@atproto/lex-client';
2
+ import { main as listSpacesQuery } from './lexicons/com/atproto/space/listSpaces.js';
3
+ export type ListSpacesParams = XrpcRequestParams<typeof listSpacesQuery>;
4
+ export type ListSpacesOutput = XrpcResponseBody<typeof listSpacesQuery>;
5
+ /**
6
+ * Lists the spaces the user holds a repo in, or is the authority of.
7
+ *
8
+ * @example
9
+ * ```typescript
10
+ * const { spaces, cursor } = await client.call(listSpaces, { limit: 50 })
11
+ *
12
+ * // Only the spaces the user is the authority of
13
+ * const { spaces } = await client.call(listSpaces, { spaceDid: client.did })
14
+ * ```
15
+ */
16
+ export declare function listSpaces(client: Client, params?: ListSpacesParams, options?: ActionOptions): Promise<ListSpacesOutput>;
17
+ //# sourceMappingURL=actions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../src/actions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,MAAM,EACN,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,IAAI,IAAI,eAAe,EAAE,MAAM,4CAA4C,CAAA;AAEpF,MAAM,MAAM,gBAAgB,GAAG,iBAAiB,CAAC,OAAO,eAAe,CAAC,CAAA;AACxE,MAAM,MAAM,gBAAgB,GAAG,gBAAgB,CAAC,OAAO,eAAe,CAAC,CAAA;AAEvE;;;;;;;;;;GAUG;AACH,wBAAsB,UAAU,CAC9B,MAAM,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,gBAAgB,EACzB,OAAO,CAAC,EAAE,aAAa,GACtB,OAAO,CAAC,gBAAgB,CAAC,CAM3B"}
@@ -0,0 +1,20 @@
1
+ import { main as listSpacesQuery } from './lexicons/com/atproto/space/listSpaces.js';
2
+ /**
3
+ * Lists the spaces the user holds a repo in, or is the authority of.
4
+ *
5
+ * @example
6
+ * ```typescript
7
+ * const { spaces, cursor } = await client.call(listSpaces, { limit: 50 })
8
+ *
9
+ * // Only the spaces the user is the authority of
10
+ * const { spaces } = await client.call(listSpaces, { spaceDid: client.did })
11
+ * ```
12
+ */
13
+ export async function listSpaces(client, params, options) {
14
+ return client.call(listSpacesQuery, params ?? {}, {
15
+ ...options,
16
+ service: null,
17
+ labelers: null,
18
+ });
19
+ }
20
+ //# sourceMappingURL=actions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"actions.js","sourceRoot":"","sources":["../src/actions.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,IAAI,IAAI,eAAe,EAAE,MAAM,4CAA4C,CAAA;AAKpF;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,MAAc,EACd,MAAyB,EACzB,OAAuB;IAEvB,OAAO,MAAM,CAAC,IAAI,CAAC,eAAe,EAAE,MAAM,IAAI,EAAE,EAAE;QAChD,GAAG,OAAO;QACV,OAAO,EAAE,IAAI;QACb,QAAQ,EAAE,IAAI;KACf,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import type {\n ActionOptions,\n Client,\n XrpcRequestParams,\n XrpcResponseBody,\n} from '@atproto/lex-client'\nimport { main as listSpacesQuery } from './lexicons/com/atproto/space/listSpaces.js'\n\nexport type ListSpacesParams = XrpcRequestParams<typeof listSpacesQuery>\nexport type ListSpacesOutput = XrpcResponseBody<typeof listSpacesQuery>\n\n/**\n * Lists the spaces the user holds a repo in, or is the authority of.\n *\n * @example\n * ```typescript\n * const { spaces, cursor } = await client.call(listSpaces, { limit: 50 })\n *\n * // Only the spaces the user is the authority of\n * const { spaces } = await client.call(listSpaces, { spaceDid: client.did })\n * ```\n */\nexport async function listSpaces(\n client: Client,\n params?: ListSpacesParams,\n options?: ActionOptions,\n): Promise<ListSpacesOutput> {\n return client.call(listSpacesQuery, params ?? {}, {\n ...options,\n service: null,\n labelers: null,\n })\n}\n"]}
@@ -0,0 +1,3 @@
1
+ import type { AtprotoIdentityDidMethods, DidResolver } from '@atproto-labs/did-resolver';
2
+ export type AtprotoDidResolver = DidResolver<AtprotoIdentityDidMethods>;
3
+ //# sourceMappingURL=atproto-did-resolver.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"atproto-did-resolver.d.ts","sourceRoot":"","sources":["../src/atproto-did-resolver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,yBAAyB,EACzB,WAAW,EACZ,MAAM,4BAA4B,CAAA;AAEnC,MAAM,MAAM,kBAAkB,GAAG,WAAW,CAAC,yBAAyB,CAAC,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=atproto-did-resolver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"atproto-did-resolver.js","sourceRoot":"","sources":["../src/atproto-did-resolver.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n AtprotoIdentityDidMethods,\n DidResolver,\n} from '@atproto-labs/did-resolver'\n\nexport type AtprotoDidResolver = DidResolver<AtprotoIdentityDidMethods>\n"]}
@@ -0,0 +1,57 @@
1
+ import type { Signer } from '@atproto/crypto';
2
+ import { type UnsignedSpaceToken } from '@atproto/space';
3
+ export type ClientAttestationProvider = (
4
+ /** The space host the attestation is addressed to. */
5
+ aud: string) => Promise<string>;
6
+ export type ClientAttestationSigner =
7
+ /** An `@atproto/crypto` keypair. */
8
+ Signer
9
+ /**
10
+ * An `@atproto/jwk` `Keyset` (e.g. an OAuth client's `keyset`), which picks
11
+ * the key and sets `alg` itself.
12
+ */
13
+ | {
14
+ createJwt: (header: UnsignedSpaceToken['header'], payload: UnsignedSpaceToken['payload']) => Promise<string>;
15
+ };
16
+ export type ClientAttestationOptions = {
17
+ /** The signing key's `kid` in the client's JWKS. */
18
+ kid?: string;
19
+ /** @default 60 */
20
+ expiresInSec?: number;
21
+ };
22
+ /**
23
+ * Provides attestations, for spaces that only grant access to specific apps,
24
+ * on behalf of the OAuth client `clientId`. `signer` must hold a key published
25
+ * in the client's JWKS.
26
+ *
27
+ * @example
28
+ * ```typescript
29
+ * const reader = SpaceReader.openSpace(com.example.forum, spaceUri, {
30
+ * delegationTokenProvider: delegationTokenProviderFor(client.agent),
31
+ * clientAttestationProvider: clientAttestationProviderFor(clientId, keyset),
32
+ * })
33
+ * ```
34
+ */
35
+ export declare function clientAttestationProviderFor(clientId: string, signer: ClientAttestationSigner, options?: ClientAttestationOptions): ClientAttestationProvider;
36
+ /**
37
+ * Provides attestations, for spaces that only grant access to specific apps,
38
+ * signed with the keys of a confidential OAuth client (such as an `OAuthClient`
39
+ * from `@atproto/oauth-client`).
40
+ *
41
+ * @throws {TypeError} if `client` has no `keyset`
42
+ *
43
+ * @example
44
+ * ```typescript
45
+ * const reader = SpaceReader.openSpace(com.example.forum, spaceUri, {
46
+ * delegationTokenProvider: delegationTokenProviderFor(client.agent),
47
+ * clientAttestationProvider: clientAttestationProviderForOAuthClient(oauthClient),
48
+ * })
49
+ * ```
50
+ */
51
+ export declare function clientAttestationProviderForOAuthClient(client: {
52
+ clientMetadata: {
53
+ client_id: string;
54
+ };
55
+ keyset?: ClientAttestationSigner;
56
+ }, options?: ClientAttestationOptions): ClientAttestationProvider;
57
+ //# sourceMappingURL=client-attestation-provider.d.ts.map