@softistx/janus 0.0.0-stage → 0.74.0

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 (911) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +2929 -2
  3. package/dist/auth/api-keys/authenticate-key.d.ts +21 -0
  4. package/dist/auth/api-keys/authenticate-key.d.ts.map +1 -0
  5. package/dist/auth/api-keys/bound.d.ts +11 -0
  6. package/dist/auth/api-keys/bound.d.ts.map +1 -0
  7. package/dist/auth/api-keys/count.d.ts +8 -0
  8. package/dist/auth/api-keys/count.d.ts.map +1 -0
  9. package/dist/auth/api-keys/create/checks.d.ts +42 -0
  10. package/dist/auth/api-keys/create/checks.d.ts.map +1 -0
  11. package/dist/auth/api-keys/create/index.d.ts +10 -0
  12. package/dist/auth/api-keys/create/index.d.ts.map +1 -0
  13. package/dist/auth/api-keys/events.d.ts +22 -0
  14. package/dist/auth/api-keys/events.d.ts.map +1 -0
  15. package/dist/auth/api-keys/expiry.d.ts +11 -0
  16. package/dist/auth/api-keys/expiry.d.ts.map +1 -0
  17. package/dist/auth/api-keys/flows.d.ts +13 -0
  18. package/dist/auth/api-keys/flows.d.ts.map +1 -0
  19. package/dist/auth/api-keys/index.d.ts +11 -0
  20. package/dist/auth/api-keys/index.d.ts.map +1 -0
  21. package/dist/auth/api-keys/read.d.ts +10 -0
  22. package/dist/auth/api-keys/read.d.ts.map +1 -0
  23. package/dist/auth/api-keys/shape.d.ts +24 -0
  24. package/dist/auth/api-keys/shape.d.ts.map +1 -0
  25. package/dist/auth/api-keys/to-api-key.d.ts +8 -0
  26. package/dist/auth/api-keys/to-api-key.d.ts.map +1 -0
  27. package/dist/auth/api-keys/token.d.ts +23 -0
  28. package/dist/auth/api-keys/token.d.ts.map +1 -0
  29. package/dist/auth/api-keys/user-bound.d.ts +10 -0
  30. package/dist/auth/api-keys/user-bound.d.ts.map +1 -0
  31. package/dist/auth/at.d.ts +9 -0
  32. package/dist/auth/at.d.ts.map +1 -0
  33. package/dist/auth/avatar/any-type.d.ts +13 -0
  34. package/dist/auth/avatar/any-type.d.ts.map +1 -0
  35. package/dist/auth/avatar/flows.d.ts +7 -0
  36. package/dist/auth/avatar/flows.d.ts.map +1 -0
  37. package/dist/auth/avatar/id.d.ts +10 -0
  38. package/dist/auth/avatar/id.d.ts.map +1 -0
  39. package/dist/auth/avatar/index.d.ts +7 -0
  40. package/dist/auth/avatar/index.d.ts.map +1 -0
  41. package/dist/auth/avatar/remove.d.ts +10 -0
  42. package/dist/auth/avatar/remove.d.ts.map +1 -0
  43. package/dist/auth/avatar/set.d.ts +12 -0
  44. package/dist/auth/avatar/set.d.ts.map +1 -0
  45. package/dist/auth/concurrency-limit.d.ts +13 -0
  46. package/dist/auth/concurrency-limit.d.ts.map +1 -0
  47. package/dist/auth/config/api-keys-config.d.ts +33 -0
  48. package/dist/auth/config/api-keys-config.d.ts.map +1 -0
  49. package/dist/auth/config/hasher.d.ts +22 -0
  50. package/dist/auth/config/hasher.d.ts.map +1 -0
  51. package/dist/auth/config/index.d.ts +24 -0
  52. package/dist/auth/config/index.d.ts.map +1 -0
  53. package/dist/auth/config/invitations-config.d.ts +74 -0
  54. package/dist/auth/config/invitations-config.d.ts.map +1 -0
  55. package/dist/auth/config/janus-config.d.ts +233 -0
  56. package/dist/auth/config/janus-config.d.ts.map +1 -0
  57. package/dist/auth/config/magic-link-config.d.ts +6 -0
  58. package/dist/auth/config/magic-link-config.d.ts.map +1 -0
  59. package/dist/auth/config/names.d.ts +9 -0
  60. package/dist/auth/config/names.d.ts.map +1 -0
  61. package/dist/auth/config/normalize.d.ts +26 -0
  62. package/dist/auth/config/normalize.d.ts.map +1 -0
  63. package/dist/auth/config/passkeys-config.d.ts +49 -0
  64. package/dist/auth/config/passkeys-config.d.ts.map +1 -0
  65. package/dist/auth/config/password-config.d.ts +22 -0
  66. package/dist/auth/config/password-config.d.ts.map +1 -0
  67. package/dist/auth/config/reserved.d.ts +14 -0
  68. package/dist/auth/config/reserved.d.ts.map +1 -0
  69. package/dist/auth/config/resolve-api-keys.d.ts +5 -0
  70. package/dist/auth/config/resolve-api-keys.d.ts.map +1 -0
  71. package/dist/auth/config/resolve-config.d.ts +9 -0
  72. package/dist/auth/config/resolve-config.d.ts.map +1 -0
  73. package/dist/auth/config/resolve-cookie.d.ts +5 -0
  74. package/dist/auth/config/resolve-cookie.d.ts.map +1 -0
  75. package/dist/auth/config/resolve-devices.d.ts +5 -0
  76. package/dist/auth/config/resolve-devices.d.ts.map +1 -0
  77. package/dist/auth/config/resolve-invitation-types.d.ts +5 -0
  78. package/dist/auth/config/resolve-invitation-types.d.ts.map +1 -0
  79. package/dist/auth/config/resolve-invitations.d.ts +5 -0
  80. package/dist/auth/config/resolve-invitations.d.ts.map +1 -0
  81. package/dist/auth/config/resolve-magic-link.d.ts +4 -0
  82. package/dist/auth/config/resolve-magic-link.d.ts.map +1 -0
  83. package/dist/auth/config/resolve-passkeys.d.ts +5 -0
  84. package/dist/auth/config/resolve-passkeys.d.ts.map +1 -0
  85. package/dist/auth/config/resolve-second-factor.d.ts +5 -0
  86. package/dist/auth/config/resolve-second-factor.d.ts.map +1 -0
  87. package/dist/auth/config/resolve-social.d.ts +17 -0
  88. package/dist/auth/config/resolve-social.d.ts.map +1 -0
  89. package/dist/auth/config/resolve-throttle.d.ts +37 -0
  90. package/dist/auth/config/resolve-throttle.d.ts.map +1 -0
  91. package/dist/auth/config/resolve-type.d.ts +6 -0
  92. package/dist/auth/config/resolve-type.d.ts.map +1 -0
  93. package/dist/auth/config/resolved-config.d.ts +126 -0
  94. package/dist/auth/config/resolved-config.d.ts.map +1 -0
  95. package/dist/auth/config/social-config.d.ts +154 -0
  96. package/dist/auth/config/social-config.d.ts.map +1 -0
  97. package/dist/auth/config/user-type.d.ts +79 -0
  98. package/dist/auth/config/user-type.d.ts.map +1 -0
  99. package/dist/auth/config/warn-throttle-window.d.ts +14 -0
  100. package/dist/auth/config/warn-throttle-window.d.ts.map +1 -0
  101. package/dist/auth/context/create-context.d.ts +31 -0
  102. package/dist/auth/context/create-context.d.ts.map +1 -0
  103. package/dist/auth/context/index.d.ts +17 -0
  104. package/dist/auth/context/index.d.ts.map +1 -0
  105. package/dist/auth/context/logins.d.ts +28 -0
  106. package/dist/auth/context/logins.d.ts.map +1 -0
  107. package/dist/auth/context/password.d.ts +34 -0
  108. package/dist/auth/context/password.d.ts.map +1 -0
  109. package/dist/auth/context/records.d.ts +27 -0
  110. package/dist/auth/context/records.d.ts.map +1 -0
  111. package/dist/auth/context/user.d.ts +21 -0
  112. package/dist/auth/context/user.d.ts.map +1 -0
  113. package/dist/auth/context/validate-fields.d.ts +12 -0
  114. package/dist/auth/context/validate-fields.d.ts.map +1 -0
  115. package/dist/auth/counter-key.d.ts +20 -0
  116. package/dist/auth/counter-key.d.ts.map +1 -0
  117. package/dist/auth/derived-keys.d.ts +9 -0
  118. package/dist/auth/derived-keys.d.ts.map +1 -0
  119. package/dist/auth/devices/cookie.d.ts +56 -0
  120. package/dist/auth/devices/cookie.d.ts.map +1 -0
  121. package/dist/auth/devices/hint.d.ts +42 -0
  122. package/dist/auth/devices/hint.d.ts.map +1 -0
  123. package/dist/auth/devices/index.d.ts +11 -0
  124. package/dist/auth/devices/index.d.ts.map +1 -0
  125. package/dist/auth/devices/report.d.ts +11 -0
  126. package/dist/auth/devices/report.d.ts.map +1 -0
  127. package/dist/auth/devices/token.d.ts +13 -0
  128. package/dist/auth/devices/token.d.ts.map +1 -0
  129. package/dist/auth/email-flows/any-type-change-email.d.ts +18 -0
  130. package/dist/auth/email-flows/any-type-change-email.d.ts.map +1 -0
  131. package/dist/auth/email-flows/any-type-reset-password.d.ts +19 -0
  132. package/dist/auth/email-flows/any-type-reset-password.d.ts.map +1 -0
  133. package/dist/auth/email-flows/any-type-verify-email.d.ts +18 -0
  134. package/dist/auth/email-flows/any-type-verify-email.d.ts.map +1 -0
  135. package/dist/auth/email-flows/change-email-token.d.ts +47 -0
  136. package/dist/auth/email-flows/change-email-token.d.ts.map +1 -0
  137. package/dist/auth/email-flows/change-email.d.ts +17 -0
  138. package/dist/auth/email-flows/change-email.d.ts.map +1 -0
  139. package/dist/auth/email-flows/confirm-reset.d.ts +16 -0
  140. package/dist/auth/email-flows/confirm-reset.d.ts.map +1 -0
  141. package/dist/auth/email-flows/email-token.d.ts +30 -0
  142. package/dist/auth/email-flows/email-token.d.ts.map +1 -0
  143. package/dist/auth/email-flows/flows.d.ts +13 -0
  144. package/dist/auth/email-flows/flows.d.ts.map +1 -0
  145. package/dist/auth/email-flows/index.d.ts +10 -0
  146. package/dist/auth/email-flows/index.d.ts.map +1 -0
  147. package/dist/auth/email-flows/owner-of.d.ts +17 -0
  148. package/dist/auth/email-flows/owner-of.d.ts.map +1 -0
  149. package/dist/auth/email-flows/prove-first.d.ts +45 -0
  150. package/dist/auth/email-flows/prove-first.d.ts.map +1 -0
  151. package/dist/auth/email-flows/reset-password.d.ts +17 -0
  152. package/dist/auth/email-flows/reset-password.d.ts.map +1 -0
  153. package/dist/auth/email-flows/set-email-verified.d.ts +19 -0
  154. package/dist/auth/email-flows/set-email-verified.d.ts.map +1 -0
  155. package/dist/auth/email-flows/verify-email.d.ts +25 -0
  156. package/dist/auth/email-flows/verify-email.d.ts.map +1 -0
  157. package/dist/auth/email-sign-in.d.ts +51 -0
  158. package/dist/auth/email-sign-in.d.ts.map +1 -0
  159. package/dist/auth/events.d.ts +166 -0
  160. package/dist/auth/events.d.ts.map +1 -0
  161. package/dist/auth/first-proof.d.ts +43 -0
  162. package/dist/auth/first-proof.d.ts.map +1 -0
  163. package/dist/auth/hashers.d.ts +52 -0
  164. package/dist/auth/hashers.d.ts.map +1 -0
  165. package/dist/auth/index.d.ts +22 -0
  166. package/dist/auth/index.d.ts.map +1 -0
  167. package/dist/auth/invitations/accept.d.ts +10 -0
  168. package/dist/auth/invitations/accept.d.ts.map +1 -0
  169. package/dist/auth/invitations/change-pending.d.ts +17 -0
  170. package/dist/auth/invitations/change-pending.d.ts.map +1 -0
  171. package/dist/auth/invitations/claim.d.ts +31 -0
  172. package/dist/auth/invitations/claim.d.ts.map +1 -0
  173. package/dist/auth/invitations/events.d.ts +46 -0
  174. package/dist/auth/invitations/events.d.ts.map +1 -0
  175. package/dist/auth/invitations/find-invitee.d.ts +20 -0
  176. package/dist/auth/invitations/find-invitee.d.ts.map +1 -0
  177. package/dist/auth/invitations/find-pending.d.ts +5 -0
  178. package/dist/auth/invitations/find-pending.d.ts.map +1 -0
  179. package/dist/auth/invitations/flows.d.ts +7 -0
  180. package/dist/auth/invitations/flows.d.ts.map +1 -0
  181. package/dist/auth/invitations/history-input.d.ts +29 -0
  182. package/dist/auth/invitations/history-input.d.ts.map +1 -0
  183. package/dist/auth/invitations/history.d.ts +10 -0
  184. package/dist/auth/invitations/history.d.ts.map +1 -0
  185. package/dist/auth/invitations/index.d.ts +11 -0
  186. package/dist/auth/invitations/index.d.ts.map +1 -0
  187. package/dist/auth/invitations/input.d.ts +30 -0
  188. package/dist/auth/invitations/input.d.ts.map +1 -0
  189. package/dist/auth/invitations/invited-type.d.ts +22 -0
  190. package/dist/auth/invitations/invited-type.d.ts.map +1 -0
  191. package/dist/auth/invitations/invitee.d.ts +11 -0
  192. package/dist/auth/invitations/invitee.d.ts.map +1 -0
  193. package/dist/auth/invitations/issue.d.ts +9 -0
  194. package/dist/auth/invitations/issue.d.ts.map +1 -0
  195. package/dist/auth/invitations/limit.d.ts +7 -0
  196. package/dist/auth/invitations/limit.d.ts.map +1 -0
  197. package/dist/auth/invitations/password-invitee.d.ts +18 -0
  198. package/dist/auth/invitations/password-invitee.d.ts.map +1 -0
  199. package/dist/auth/invitations/passwordless-invitee.d.ts +13 -0
  200. package/dist/auth/invitations/passwordless-invitee.d.ts.map +1 -0
  201. package/dist/auth/invitations/preview.d.ts +8 -0
  202. package/dist/auth/invitations/preview.d.ts.map +1 -0
  203. package/dist/auth/invitations/read.d.ts +10 -0
  204. package/dist/auth/invitations/read.d.ts.map +1 -0
  205. package/dist/auth/invitations/resend.d.ts +12 -0
  206. package/dist/auth/invitations/resend.d.ts.map +1 -0
  207. package/dist/auth/invitations/to-invitation.d.ts +11 -0
  208. package/dist/auth/invitations/to-invitation.d.ts.map +1 -0
  209. package/dist/auth/invitations/write.d.ts +17 -0
  210. package/dist/auth/invitations/write.d.ts.map +1 -0
  211. package/dist/auth/issuers/cache.d.ts +21 -0
  212. package/dist/auth/issuers/cache.d.ts.map +1 -0
  213. package/dist/auth/issuers/create.d.ts +18 -0
  214. package/dist/auth/issuers/create.d.ts.map +1 -0
  215. package/dist/auth/issuers/index.d.ts +3 -0
  216. package/dist/auth/issuers/index.d.ts.map +1 -0
  217. package/dist/auth/issuers/types.d.ts +45 -0
  218. package/dist/auth/issuers/types.d.ts.map +1 -0
  219. package/dist/auth/janus.d.ts +39 -0
  220. package/dist/auth/janus.d.ts.map +1 -0
  221. package/dist/auth/magic-link.d.ts +25 -0
  222. package/dist/auth/magic-link.d.ts.map +1 -0
  223. package/dist/auth/mail-requests.d.ts +55 -0
  224. package/dist/auth/mail-requests.d.ts.map +1 -0
  225. package/dist/auth/one-time/codes.d.ts +46 -0
  226. package/dist/auth/one-time/codes.d.ts.map +1 -0
  227. package/dist/auth/one-time/index.d.ts +15 -0
  228. package/dist/auth/one-time/index.d.ts.map +1 -0
  229. package/dist/auth/one-time/issue.d.ts +45 -0
  230. package/dist/auth/one-time/issue.d.ts.map +1 -0
  231. package/dist/auth/one-time/refusals.d.ts +26 -0
  232. package/dist/auth/one-time/refusals.d.ts.map +1 -0
  233. package/dist/auth/one-time/spend.d.ts +24 -0
  234. package/dist/auth/one-time/spend.d.ts.map +1 -0
  235. package/dist/auth/one-time/window.d.ts +50 -0
  236. package/dist/auth/one-time/window.d.ts.map +1 -0
  237. package/dist/auth/outage.d.ts +66 -0
  238. package/dist/auth/outage.d.ts.map +1 -0
  239. package/dist/auth/parse-sealing-keys.d.ts +26 -0
  240. package/dist/auth/parse-sealing-keys.d.ts.map +1 -0
  241. package/dist/auth/passkeys/assert.d.ts +51 -0
  242. package/dist/auth/passkeys/assert.d.ts.map +1 -0
  243. package/dist/auth/passkeys/assertion-options.d.ts +9 -0
  244. package/dist/auth/passkeys/assertion-options.d.ts.map +1 -0
  245. package/dist/auth/passkeys/challenge.d.ts +19 -0
  246. package/dist/auth/passkeys/challenge.d.ts.map +1 -0
  247. package/dist/auth/passkeys/commit.d.ts +33 -0
  248. package/dist/auth/passkeys/commit.d.ts.map +1 -0
  249. package/dist/auth/passkeys/flows.d.ts +13 -0
  250. package/dist/auth/passkeys/flows.d.ts.map +1 -0
  251. package/dist/auth/passkeys/index.d.ts +12 -0
  252. package/dist/auth/passkeys/index.d.ts.map +1 -0
  253. package/dist/auth/passkeys/manage.d.ts +11 -0
  254. package/dist/auth/passkeys/manage.d.ts.map +1 -0
  255. package/dist/auth/passkeys/name.d.ts +4 -0
  256. package/dist/auth/passkeys/name.d.ts.map +1 -0
  257. package/dist/auth/passkeys/register.d.ts +20 -0
  258. package/dist/auth/passkeys/register.d.ts.map +1 -0
  259. package/dist/auth/passkeys/registration-options.d.ts +22 -0
  260. package/dist/auth/passkeys/registration-options.d.ts.map +1 -0
  261. package/dist/auth/passkeys/remove-all.d.ts +26 -0
  262. package/dist/auth/passkeys/remove-all.d.ts.map +1 -0
  263. package/dist/auth/passkeys/sign-in-options.d.ts +12 -0
  264. package/dist/auth/passkeys/sign-in-options.d.ts.map +1 -0
  265. package/dist/auth/passkeys/sign-in.d.ts +21 -0
  266. package/dist/auth/passkeys/sign-in.d.ts.map +1 -0
  267. package/dist/auth/passkeys/verifier.d.ts +113 -0
  268. package/dist/auth/passkeys/verifier.d.ts.map +1 -0
  269. package/dist/auth/passkeys/view.d.ts +5 -0
  270. package/dist/auth/passkeys/view.d.ts.map +1 -0
  271. package/dist/auth/passkeys/wiring.d.ts +24 -0
  272. package/dist/auth/passkeys/wiring.d.ts.map +1 -0
  273. package/dist/auth/password-written.d.ts +55 -0
  274. package/dist/auth/password-written.d.ts.map +1 -0
  275. package/dist/auth/port/assert-api-keys.d.ts +21 -0
  276. package/dist/auth/port/assert-api-keys.d.ts.map +1 -0
  277. package/dist/auth/port/assert-invitations.d.ts +15 -0
  278. package/dist/auth/port/assert-invitations.d.ts.map +1 -0
  279. package/dist/auth/port/assert-stores.d.ts +16 -0
  280. package/dist/auth/port/assert-stores.d.ts.map +1 -0
  281. package/dist/auth/port/memory/api-keys/capabilities.d.ts +8 -0
  282. package/dist/auth/port/memory/api-keys/capabilities.d.ts.map +1 -0
  283. package/dist/auth/port/memory/api-keys/index.d.ts +13 -0
  284. package/dist/auth/port/memory/api-keys/index.d.ts.map +1 -0
  285. package/dist/auth/port/memory/api-keys/pages.d.ts +7 -0
  286. package/dist/auth/port/memory/api-keys/pages.d.ts.map +1 -0
  287. package/dist/auth/port/memory/copy.d.ts +6 -0
  288. package/dist/auth/port/memory/copy.d.ts.map +1 -0
  289. package/dist/auth/port/memory/index.d.ts +10 -0
  290. package/dist/auth/port/memory/index.d.ts.map +1 -0
  291. package/dist/auth/port/memory/invitations-pending.d.ts +6 -0
  292. package/dist/auth/port/memory/invitations-pending.d.ts.map +1 -0
  293. package/dist/auth/port/memory/invitations.d.ts +12 -0
  294. package/dist/auth/port/memory/invitations.d.ts.map +1 -0
  295. package/dist/auth/port/memory/passkeys.d.ts +9 -0
  296. package/dist/auth/port/memory/passkeys.d.ts.map +1 -0
  297. package/dist/auth/port/memory/sessions.d.ts +4 -0
  298. package/dist/auth/port/memory/sessions.d.ts.map +1 -0
  299. package/dist/auth/port/memory/social-links.d.ts +10 -0
  300. package/dist/auth/port/memory/social-links.d.ts.map +1 -0
  301. package/dist/auth/port/memory/stores.d.ts +26 -0
  302. package/dist/auth/port/memory/stores.d.ts.map +1 -0
  303. package/dist/auth/port/memory/tokens.d.ts +4 -0
  304. package/dist/auth/port/memory/tokens.d.ts.map +1 -0
  305. package/dist/auth/port/memory/user-index.d.ts +20 -0
  306. package/dist/auth/port/memory/user-index.d.ts.map +1 -0
  307. package/dist/auth/port/memory/user-update.d.ts +10 -0
  308. package/dist/auth/port/memory/user-update.d.ts.map +1 -0
  309. package/dist/auth/port/memory/users.d.ts +4 -0
  310. package/dist/auth/port/memory/users.d.ts.map +1 -0
  311. package/dist/auth/port/types/api-keys.d.ts +199 -0
  312. package/dist/auth/port/types/api-keys.d.ts.map +1 -0
  313. package/dist/auth/port/types/credentials.d.ts +46 -0
  314. package/dist/auth/port/types/credentials.d.ts.map +1 -0
  315. package/dist/auth/port/types/index.d.ts +75 -0
  316. package/dist/auth/port/types/index.d.ts.map +1 -0
  317. package/dist/auth/port/types/invitations/index.d.ts +15 -0
  318. package/dist/auth/port/types/invitations/index.d.ts.map +1 -0
  319. package/dist/auth/port/types/invitations/page.d.ts +52 -0
  320. package/dist/auth/port/types/invitations/page.d.ts.map +1 -0
  321. package/dist/auth/port/types/invitations/records.d.ts +101 -0
  322. package/dist/auth/port/types/invitations/records.d.ts.map +1 -0
  323. package/dist/auth/port/types/invitations/store.d.ts +82 -0
  324. package/dist/auth/port/types/invitations/store.d.ts.map +1 -0
  325. package/dist/auth/port/types/json.d.ts +27 -0
  326. package/dist/auth/port/types/json.d.ts.map +1 -0
  327. package/dist/auth/port/types/passkeys.d.ts +94 -0
  328. package/dist/auth/port/types/passkeys.d.ts.map +1 -0
  329. package/dist/auth/port/types/sessions.d.ts +142 -0
  330. package/dist/auth/port/types/sessions.d.ts.map +1 -0
  331. package/dist/auth/port/types/social-links.d.ts +72 -0
  332. package/dist/auth/port/types/social-links.d.ts.map +1 -0
  333. package/dist/auth/port/types/stores.d.ts +48 -0
  334. package/dist/auth/port/types/stores.d.ts.map +1 -0
  335. package/dist/auth/port/types/tokens.d.ts +168 -0
  336. package/dist/auth/port/types/tokens.d.ts.map +1 -0
  337. package/dist/auth/port/types/users.d.ts +260 -0
  338. package/dist/auth/port/types/users.d.ts.map +1 -0
  339. package/dist/auth/prepared.d.ts +21 -0
  340. package/dist/auth/prepared.d.ts.map +1 -0
  341. package/dist/auth/proven-sign-in.d.ts +22 -0
  342. package/dist/auth/proven-sign-in.d.ts.map +1 -0
  343. package/dist/auth/sealer-for.d.ts +44 -0
  344. package/dist/auth/sealer-for.d.ts.map +1 -0
  345. package/dist/auth/sealing.d.ts +36 -0
  346. package/dist/auth/sealing.d.ts.map +1 -0
  347. package/dist/auth/second-factor/activate.d.ts +9 -0
  348. package/dist/auth/second-factor/activate.d.ts.map +1 -0
  349. package/dist/auth/second-factor/app-code-attempts.d.ts +47 -0
  350. package/dist/auth/second-factor/app-code-attempts.d.ts.map +1 -0
  351. package/dist/auth/second-factor/challenge.d.ts +15 -0
  352. package/dist/auth/second-factor/challenge.d.ts.map +1 -0
  353. package/dist/auth/second-factor/codes-left.d.ts +14 -0
  354. package/dist/auth/second-factor/codes-left.d.ts.map +1 -0
  355. package/dist/auth/second-factor/disable.d.ts +10 -0
  356. package/dist/auth/second-factor/disable.d.ts.map +1 -0
  357. package/dist/auth/second-factor/enroll.d.ts +6 -0
  358. package/dist/auth/second-factor/enroll.d.ts.map +1 -0
  359. package/dist/auth/second-factor/factor.d.ts +33 -0
  360. package/dist/auth/second-factor/factor.d.ts.map +1 -0
  361. package/dist/auth/second-factor/flows.d.ts +36 -0
  362. package/dist/auth/second-factor/flows.d.ts.map +1 -0
  363. package/dist/auth/second-factor/lifecycle.d.ts +14 -0
  364. package/dist/auth/second-factor/lifecycle.d.ts.map +1 -0
  365. package/dist/auth/second-factor/passkey-confirm.d.ts +21 -0
  366. package/dist/auth/second-factor/passkey-confirm.d.ts.map +1 -0
  367. package/dist/auth/second-factor/recovery-codes.d.ts +36 -0
  368. package/dist/auth/second-factor/recovery-codes.d.ts.map +1 -0
  369. package/dist/auth/second-factor/recovery.d.ts +20 -0
  370. package/dist/auth/second-factor/recovery.d.ts.map +1 -0
  371. package/dist/auth/second-factor/redeem.d.ts +42 -0
  372. package/dist/auth/second-factor/redeem.d.ts.map +1 -0
  373. package/dist/auth/second-factor/refusal.d.ts +6 -0
  374. package/dist/auth/second-factor/refusal.d.ts.map +1 -0
  375. package/dist/auth/second-factor/regenerate.d.ts +12 -0
  376. package/dist/auth/second-factor/regenerate.d.ts.map +1 -0
  377. package/dist/auth/second-factor/reseal.d.ts +17 -0
  378. package/dist/auth/second-factor/reseal.d.ts.map +1 -0
  379. package/dist/auth/second-factor/spend-recovery-code.d.ts +15 -0
  380. package/dist/auth/second-factor/spend-recovery-code.d.ts.map +1 -0
  381. package/dist/auth/secrets.d.ts +17 -0
  382. package/dist/auth/secrets.d.ts.map +1 -0
  383. package/dist/auth/sessions/amr.d.ts +36 -0
  384. package/dist/auth/sessions/amr.d.ts.map +1 -0
  385. package/dist/auth/sessions/authenticate.d.ts +12 -0
  386. package/dist/auth/sessions/authenticate.d.ts.map +1 -0
  387. package/dist/auth/sessions/collect-expired.d.ts +15 -0
  388. package/dist/auth/sessions/collect-expired.d.ts.map +1 -0
  389. package/dist/auth/sessions/cookie.d.ts +9 -0
  390. package/dist/auth/sessions/cookie.d.ts.map +1 -0
  391. package/dist/auth/sessions/fresh.d.ts +35 -0
  392. package/dist/auth/sessions/fresh.d.ts.map +1 -0
  393. package/dist/auth/sessions/index.d.ts +12 -0
  394. package/dist/auth/sessions/index.d.ts.map +1 -0
  395. package/dist/auth/sessions/open-session.d.ts +22 -0
  396. package/dist/auth/sessions/open-session.d.ts.map +1 -0
  397. package/dist/auth/sessions/presented-token.d.ts +25 -0
  398. package/dist/auth/sessions/presented-token.d.ts.map +1 -0
  399. package/dist/auth/sessions/shared-api.d.ts +17 -0
  400. package/dist/auth/sessions/shared-api.d.ts.map +1 -0
  401. package/dist/auth/sessions/standing.d.ts +32 -0
  402. package/dist/auth/sessions/standing.d.ts.map +1 -0
  403. package/dist/auth/shared-api.d.ts +142 -0
  404. package/dist/auth/shared-api.d.ts.map +1 -0
  405. package/dist/auth/sign-in-attempts.d.ts +45 -0
  406. package/dist/auth/sign-in-attempts.d.ts.map +1 -0
  407. package/dist/auth/sign-in-code.d.ts +26 -0
  408. package/dist/auth/sign-in-code.d.ts.map +1 -0
  409. package/dist/auth/social/attach.d.ts +31 -0
  410. package/dist/auth/social/attach.d.ts.map +1 -0
  411. package/dist/auth/social/begin.d.ts +30 -0
  412. package/dist/auth/social/begin.d.ts.map +1 -0
  413. package/dist/auth/social/complete-link.d.ts +17 -0
  414. package/dist/auth/social/complete-link.d.ts.map +1 -0
  415. package/dist/auth/social/complete.d.ts +54 -0
  416. package/dist/auth/social/complete.d.ts.map +1 -0
  417. package/dist/auth/social/cookie.d.ts +16 -0
  418. package/dist/auth/social/cookie.d.ts.map +1 -0
  419. package/dist/auth/social/find-provider.d.ts +23 -0
  420. package/dist/auth/social/find-provider.d.ts.map +1 -0
  421. package/dist/auth/social/finish.d.ts +60 -0
  422. package/dist/auth/social/finish.d.ts.map +1 -0
  423. package/dist/auth/social/flow-cookie-value.d.ts +26 -0
  424. package/dist/auth/social/flow-cookie-value.d.ts.map +1 -0
  425. package/dist/auth/social/flow-secret.d.ts +40 -0
  426. package/dist/auth/social/flow-secret.d.ts.map +1 -0
  427. package/dist/auth/social/index.d.ts +19 -0
  428. package/dist/auth/social/index.d.ts.map +1 -0
  429. package/dist/auth/social/link-holder.d.ts +33 -0
  430. package/dist/auth/social/link-holder.d.ts.map +1 -0
  431. package/dist/auth/social/provider-call.d.ts +31 -0
  432. package/dist/auth/social/provider-call.d.ts.map +1 -0
  433. package/dist/auth/social/redeem.d.ts +45 -0
  434. package/dist/auth/social/redeem.d.ts.map +1 -0
  435. package/dist/auth/social/return-to.d.ts +18 -0
  436. package/dist/auth/social/return-to.d.ts.map +1 -0
  437. package/dist/auth/social/sign-in.d.ts +41 -0
  438. package/dist/auth/social/sign-in.d.ts.map +1 -0
  439. package/dist/auth/social/sign-up.d.ts +37 -0
  440. package/dist/auth/social/sign-up.d.ts.map +1 -0
  441. package/dist/auth/social/start.d.ts +21 -0
  442. package/dist/auth/social/start.d.ts.map +1 -0
  443. package/dist/auth/social/step-up-proof.d.ts +26 -0
  444. package/dist/auth/social/step-up-proof.d.ts.map +1 -0
  445. package/dist/auth/social/step-up-request.d.ts +28 -0
  446. package/dist/auth/social/step-up-request.d.ts.map +1 -0
  447. package/dist/auth/social/step-up.d.ts +19 -0
  448. package/dist/auth/social/step-up.d.ts.map +1 -0
  449. package/dist/auth/social/types-of.d.ts +12 -0
  450. package/dist/auth/social/types-of.d.ts.map +1 -0
  451. package/dist/auth/social/unlink.d.ts +23 -0
  452. package/dist/auth/social/unlink.d.ts.map +1 -0
  453. package/dist/auth/social/wiring.d.ts +10 -0
  454. package/dist/auth/social/wiring.d.ts.map +1 -0
  455. package/dist/auth/standard-schema.d.ts +41 -0
  456. package/dist/auth/standard-schema.d.ts.map +1 -0
  457. package/dist/auth/step-up/codes.d.ts +35 -0
  458. package/dist/auth/step-up/codes.d.ts.map +1 -0
  459. package/dist/auth/step-up/flows.d.ts +18 -0
  460. package/dist/auth/step-up/flows.d.ts.map +1 -0
  461. package/dist/auth/step-up/open.d.ts +23 -0
  462. package/dist/auth/step-up/open.d.ts.map +1 -0
  463. package/dist/auth/step-up/passkey.d.ts +31 -0
  464. package/dist/auth/step-up/passkey.d.ts.map +1 -0
  465. package/dist/auth/step-up/request.d.ts +15 -0
  466. package/dist/auth/step-up/request.d.ts.map +1 -0
  467. package/dist/auth/step-up/spend.d.ts +4 -0
  468. package/dist/auth/step-up/spend.d.ts.map +1 -0
  469. package/dist/auth/totp.d.ts +36 -0
  470. package/dist/auth/totp.d.ts.map +1 -0
  471. package/dist/auth/types/api-keys-of.d.ts +19 -0
  472. package/dist/auth/types/api-keys-of.d.ts.map +1 -0
  473. package/dist/auth/types/api-keys.d.ts +164 -0
  474. package/dist/auth/types/api-keys.d.ts.map +1 -0
  475. package/dist/auth/types/avatar.d.ts +72 -0
  476. package/dist/auth/types/avatar.d.ts.map +1 -0
  477. package/dist/auth/types/change-email.d.ts +82 -0
  478. package/dist/auth/types/change-email.d.ts.map +1 -0
  479. package/dist/auth/types/checks.d.ts +147 -0
  480. package/dist/auth/types/checks.d.ts.map +1 -0
  481. package/dist/auth/types/email-flows.d.ts +117 -0
  482. package/dist/auth/types/email-flows.d.ts.map +1 -0
  483. package/dist/auth/types/find-by-email.d.ts +31 -0
  484. package/dist/auth/types/find-by-email.d.ts.map +1 -0
  485. package/dist/auth/types/find-or-create.d.ts +59 -0
  486. package/dist/auth/types/find-or-create.d.ts.map +1 -0
  487. package/dist/auth/types/index.d.ts +38 -0
  488. package/dist/auth/types/index.d.ts.map +1 -0
  489. package/dist/auth/types/inference.d.ts +62 -0
  490. package/dist/auth/types/inference.d.ts.map +1 -0
  491. package/dist/auth/types/invitations/api.d.ts +203 -0
  492. package/dist/auth/types/invitations/api.d.ts.map +1 -0
  493. package/dist/auth/types/invitations/history.d.ts +87 -0
  494. package/dist/auth/types/invitations/history.d.ts.map +1 -0
  495. package/dist/auth/types/invitations/index.d.ts +10 -0
  496. package/dist/auth/types/invitations/index.d.ts.map +1 -0
  497. package/dist/auth/types/invitations/invitation.d.ts +76 -0
  498. package/dist/auth/types/invitations/invitation.d.ts.map +1 -0
  499. package/dist/auth/types/invitations/issue-type.d.ts +15 -0
  500. package/dist/auth/types/invitations/issue-type.d.ts.map +1 -0
  501. package/dist/auth/types/invitations-of.d.ts +26 -0
  502. package/dist/auth/types/invitations-of.d.ts.map +1 -0
  503. package/dist/auth/types/janus.d.ts +51 -0
  504. package/dist/auth/types/janus.d.ts.map +1 -0
  505. package/dist/auth/types/magic-link.d.ts +69 -0
  506. package/dist/auth/types/magic-link.d.ts.map +1 -0
  507. package/dist/auth/types/passkeys.d.ts +183 -0
  508. package/dist/auth/types/passkeys.d.ts.map +1 -0
  509. package/dist/auth/types/password.d.ts +113 -0
  510. package/dist/auth/types/password.d.ts.map +1 -0
  511. package/dist/auth/types/prepared.d.ts +68 -0
  512. package/dist/auth/types/prepared.d.ts.map +1 -0
  513. package/dist/auth/types/proven-sign-in.d.ts +43 -0
  514. package/dist/auth/types/proven-sign-in.d.ts.map +1 -0
  515. package/dist/auth/types/reset-password.d.ts +46 -0
  516. package/dist/auth/types/reset-password.d.ts.map +1 -0
  517. package/dist/auth/types/second-factor.d.ts +164 -0
  518. package/dist/auth/types/second-factor.d.ts.map +1 -0
  519. package/dist/auth/types/session.d.ts +68 -0
  520. package/dist/auth/types/session.d.ts.map +1 -0
  521. package/dist/auth/types/shared-api.d.ts +96 -0
  522. package/dist/auth/types/shared-api.d.ts.map +1 -0
  523. package/dist/auth/types/sign-in.d.ts +102 -0
  524. package/dist/auth/types/sign-in.d.ts.map +1 -0
  525. package/dist/auth/types/social-flow.d.ts +28 -0
  526. package/dist/auth/types/social-flow.d.ts.map +1 -0
  527. package/dist/auth/types/social-step-up.d.ts +38 -0
  528. package/dist/auth/types/social-step-up.d.ts.map +1 -0
  529. package/dist/auth/types/social.d.ts +201 -0
  530. package/dist/auth/types/social.d.ts.map +1 -0
  531. package/dist/auth/types/step-up.d.ts +133 -0
  532. package/dist/auth/types/step-up.d.ts.map +1 -0
  533. package/dist/auth/types/type-api.d.ts +29 -0
  534. package/dist/auth/types/type-api.d.ts.map +1 -0
  535. package/dist/auth/types/user-type.d.ts +106 -0
  536. package/dist/auth/types/user-type.d.ts.map +1 -0
  537. package/dist/auth/types/user.d.ts +62 -0
  538. package/dist/auth/types/user.d.ts.map +1 -0
  539. package/dist/auth/types/verify-email.d.ts +190 -0
  540. package/dist/auth/types/verify-email.d.ts.map +1 -0
  541. package/dist/auth/users/any-type-api.d.ts +6 -0
  542. package/dist/auth/users/any-type-api.d.ts.map +1 -0
  543. package/dist/auth/users/by-login.d.ts +10 -0
  544. package/dist/auth/users/by-login.d.ts.map +1 -0
  545. package/dist/auth/users/change-password.d.ts +26 -0
  546. package/dist/auth/users/change-password.d.ts.map +1 -0
  547. package/dist/auth/users/delete.d.ts +10 -0
  548. package/dist/auth/users/delete.d.ts.map +1 -0
  549. package/dist/auth/users/email-move-guard.d.ts +20 -0
  550. package/dist/auth/users/email-move-guard.d.ts.map +1 -0
  551. package/dist/auth/users/email-prefix.d.ts +23 -0
  552. package/dist/auth/users/email-prefix.d.ts.map +1 -0
  553. package/dist/auth/users/fields-patch.d.ts +21 -0
  554. package/dist/auth/users/fields-patch.d.ts.map +1 -0
  555. package/dist/auth/users/find-by-email.d.ts +11 -0
  556. package/dist/auth/users/find-by-email.d.ts.map +1 -0
  557. package/dist/auth/users/find-many.d.ts +29 -0
  558. package/dist/auth/users/find-many.d.ts.map +1 -0
  559. package/dist/auth/users/find-or-create.d.ts +12 -0
  560. package/dist/auth/users/find-or-create.d.ts.map +1 -0
  561. package/dist/auth/users/flow-types.d.ts +15 -0
  562. package/dist/auth/users/flow-types.d.ts.map +1 -0
  563. package/dist/auth/users/index.d.ts +9 -0
  564. package/dist/auth/users/index.d.ts.map +1 -0
  565. package/dist/auth/users/insert.d.ts +15 -0
  566. package/dist/auth/users/insert.d.ts.map +1 -0
  567. package/dist/auth/users/name-prefix.d.ts +19 -0
  568. package/dist/auth/users/name-prefix.d.ts.map +1 -0
  569. package/dist/auth/users/password-flows.d.ts +11 -0
  570. package/dist/auth/users/password-flows.d.ts.map +1 -0
  571. package/dist/auth/users/record-flows.d.ts +11 -0
  572. package/dist/auth/users/record-flows.d.ts.map +1 -0
  573. package/dist/auth/users/sign-in.d.ts +24 -0
  574. package/dist/auth/users/sign-in.d.ts.map +1 -0
  575. package/dist/auth/users/sign-up.d.ts +13 -0
  576. package/dist/auth/users/sign-up.d.ts.map +1 -0
  577. package/dist/auth/users/type-api.d.ts +10 -0
  578. package/dist/auth/users/type-api.d.ts.map +1 -0
  579. package/dist/auth/users/update.d.ts +16 -0
  580. package/dist/auth/users/update.d.ts.map +1 -0
  581. package/dist/background/background.d.ts +22 -0
  582. package/dist/background/background.d.ts.map +1 -0
  583. package/dist/chunks/index-2ttdcz7n.js +354 -0
  584. package/dist/chunks/index-2ttdcz7n.js.map +16 -0
  585. package/dist/chunks/index-5dxynm32.js +85 -0
  586. package/dist/chunks/index-5dxynm32.js.map +10 -0
  587. package/dist/chunks/index-7h34nqrm.js +732 -0
  588. package/dist/chunks/index-7h34nqrm.js.map +24 -0
  589. package/dist/chunks/index-ftz0ne6j.js +127 -0
  590. package/dist/chunks/index-ftz0ne6j.js.map +11 -0
  591. package/dist/chunks/index-n8jxmxeg.js +64 -0
  592. package/dist/chunks/index-n8jxmxeg.js.map +11 -0
  593. package/dist/conformance/api-keys/cases/bound.d.ts +3 -0
  594. package/dist/conformance/api-keys/cases/bound.d.ts.map +1 -0
  595. package/dist/conformance/api-keys/cases/expiry.d.ts +3 -0
  596. package/dist/conformance/api-keys/cases/expiry.d.ts.map +1 -0
  597. package/dist/conformance/api-keys/cases/index.d.ts +4 -0
  598. package/dist/conformance/api-keys/cases/index.d.ts.map +1 -0
  599. package/dist/conformance/api-keys/cases/insert.d.ts +3 -0
  600. package/dist/conformance/api-keys/cases/insert.d.ts.map +1 -0
  601. package/dist/conformance/api-keys/cases/outage.d.ts +3 -0
  602. package/dist/conformance/api-keys/cases/outage.d.ts.map +1 -0
  603. package/dist/conformance/api-keys/cases/revoke.d.ts +3 -0
  604. package/dist/conformance/api-keys/cases/revoke.d.ts.map +1 -0
  605. package/dist/conformance/api-keys/cases/touch.d.ts +3 -0
  606. package/dist/conformance/api-keys/cases/touch.d.ts.map +1 -0
  607. package/dist/conformance/api-keys/cases/user-bound.d.ts +3 -0
  608. package/dist/conformance/api-keys/cases/user-bound.d.ts.map +1 -0
  609. package/dist/conformance/api-keys/describe.d.ts +20 -0
  610. package/dist/conformance/api-keys/describe.d.ts.map +1 -0
  611. package/dist/conformance/api-keys/fixtures.d.ts +4 -0
  612. package/dist/conformance/api-keys/fixtures.d.ts.map +1 -0
  613. package/dist/conformance/api-keys/index.d.ts +18 -0
  614. package/dist/conformance/api-keys/index.d.ts.map +1 -0
  615. package/dist/conformance/api-keys/reference.d.ts +4 -0
  616. package/dist/conformance/api-keys/reference.d.ts.map +1 -0
  617. package/dist/conformance/api-keys/types.d.ts +42 -0
  618. package/dist/conformance/api-keys/types.d.ts.map +1 -0
  619. package/dist/conformance/assert.d.ts +40 -0
  620. package/dist/conformance/assert.d.ts.map +1 -0
  621. package/dist/conformance/cases/outage.d.ts +3 -0
  622. package/dist/conformance/cases/outage.d.ts.map +1 -0
  623. package/dist/conformance/cases/outage.passkeys.d.ts +12 -0
  624. package/dist/conformance/cases/outage.passkeys.d.ts.map +1 -0
  625. package/dist/conformance/cases/passkeys/deletion.d.ts +4 -0
  626. package/dist/conformance/cases/passkeys/deletion.d.ts.map +1 -0
  627. package/dist/conformance/cases/passkeys/index.d.ts +8 -0
  628. package/dist/conformance/cases/passkeys/index.d.ts.map +1 -0
  629. package/dist/conformance/cases/passkeys/inserts.d.ts +4 -0
  630. package/dist/conformance/cases/passkeys/inserts.d.ts.map +1 -0
  631. package/dist/conformance/cases/passkeys/reads.d.ts +4 -0
  632. package/dist/conformance/cases/passkeys/reads.d.ts.map +1 -0
  633. package/dist/conformance/cases/passkeys/uses.d.ts +4 -0
  634. package/dist/conformance/cases/passkeys/uses.d.ts.map +1 -0
  635. package/dist/conformance/cases/sessions/deletion.d.ts +4 -0
  636. package/dist/conformance/cases/sessions/deletion.d.ts.map +1 -0
  637. package/dist/conformance/cases/sessions/extension.d.ts +4 -0
  638. package/dist/conformance/cases/sessions/extension.d.ts.map +1 -0
  639. package/dist/conformance/cases/sessions/index.d.ts +4 -0
  640. package/dist/conformance/cases/sessions/index.d.ts.map +1 -0
  641. package/dist/conformance/cases/sessions/inserts.d.ts +4 -0
  642. package/dist/conformance/cases/sessions/inserts.d.ts.map +1 -0
  643. package/dist/conformance/cases/sessions/list.d.ts +4 -0
  644. package/dist/conformance/cases/sessions/list.d.ts.map +1 -0
  645. package/dist/conformance/cases/sessions/reads.d.ts +4 -0
  646. package/dist/conformance/cases/sessions/reads.d.ts.map +1 -0
  647. package/dist/conformance/cases/sessions/reauthentication.d.ts +4 -0
  648. package/dist/conformance/cases/sessions/reauthentication.d.ts.map +1 -0
  649. package/dist/conformance/cases/sessions/revocation.d.ts +4 -0
  650. package/dist/conformance/cases/sessions/revocation.d.ts.map +1 -0
  651. package/dist/conformance/cases/social-links/deletion.d.ts +4 -0
  652. package/dist/conformance/cases/social-links/deletion.d.ts.map +1 -0
  653. package/dist/conformance/cases/social-links/index.d.ts +8 -0
  654. package/dist/conformance/cases/social-links/index.d.ts.map +1 -0
  655. package/dist/conformance/cases/social-links/inserts.d.ts +4 -0
  656. package/dist/conformance/cases/social-links/inserts.d.ts.map +1 -0
  657. package/dist/conformance/cases/social-links/reads.d.ts +4 -0
  658. package/dist/conformance/cases/social-links/reads.d.ts.map +1 -0
  659. package/dist/conformance/cases/tokens/attempts.d.ts +7 -0
  660. package/dist/conformance/cases/tokens/attempts.d.ts.map +1 -0
  661. package/dist/conformance/cases/tokens/change-email.d.ts +8 -0
  662. package/dist/conformance/cases/tokens/change-email.d.ts.map +1 -0
  663. package/dist/conformance/cases/tokens/deletion.d.ts +4 -0
  664. package/dist/conformance/cases/tokens/deletion.d.ts.map +1 -0
  665. package/dist/conformance/cases/tokens/index.d.ts +4 -0
  666. package/dist/conformance/cases/tokens/index.d.ts.map +1 -0
  667. package/dist/conformance/cases/tokens/inserts.d.ts +7 -0
  668. package/dist/conformance/cases/tokens/inserts.d.ts.map +1 -0
  669. package/dist/conformance/cases/tokens/kinds.d.ts +7 -0
  670. package/dist/conformance/cases/tokens/kinds.d.ts.map +1 -0
  671. package/dist/conformance/cases/tokens/redemption.d.ts +7 -0
  672. package/dist/conformance/cases/tokens/redemption.d.ts.map +1 -0
  673. package/dist/conformance/cases/tokens/social-flow.d.ts +8 -0
  674. package/dist/conformance/cases/tokens/social-flow.d.ts.map +1 -0
  675. package/dist/conformance/cases/tokens/spending.d.ts +7 -0
  676. package/dist/conformance/cases/tokens/spending.d.ts.map +1 -0
  677. package/dist/conformance/cases/users/avatar.d.ts +8 -0
  678. package/dist/conformance/cases/users/avatar.d.ts.map +1 -0
  679. package/dist/conformance/cases/users/batch.d.ts +8 -0
  680. package/dist/conformance/cases/users/batch.d.ts.map +1 -0
  681. package/dist/conformance/cases/users/deletion.d.ts +4 -0
  682. package/dist/conformance/cases/users/deletion.d.ts.map +1 -0
  683. package/dist/conformance/cases/users/index.d.ts +4 -0
  684. package/dist/conformance/cases/users/index.d.ts.map +1 -0
  685. package/dist/conformance/cases/users/inserts.d.ts +4 -0
  686. package/dist/conformance/cases/users/inserts.d.ts.map +1 -0
  687. package/dist/conformance/cases/users/listing.d.ts +4 -0
  688. package/dist/conformance/cases/users/listing.d.ts.map +1 -0
  689. package/dist/conformance/cases/users/patches.d.ts +7 -0
  690. package/dist/conformance/cases/users/patches.d.ts.map +1 -0
  691. package/dist/conformance/cases/users/reads.d.ts +7 -0
  692. package/dist/conformance/cases/users/reads.d.ts.map +1 -0
  693. package/dist/conformance/cases/users/second-factor.d.ts +16 -0
  694. package/dist/conformance/cases/users/second-factor.d.ts.map +1 -0
  695. package/dist/conformance/cases/users/versions.d.ts +7 -0
  696. package/dist/conformance/cases/users/versions.d.ts.map +1 -0
  697. package/dist/conformance/describe.d.ts +82 -0
  698. package/dist/conformance/describe.d.ts.map +1 -0
  699. package/dist/conformance/fixtures.d.ts +31 -0
  700. package/dist/conformance/fixtures.d.ts.map +1 -0
  701. package/dist/conformance/index.d.ts +46 -0
  702. package/dist/conformance/index.d.ts.map +1 -0
  703. package/dist/conformance/index.js +4442 -0
  704. package/dist/conformance/index.js.map +86 -0
  705. package/dist/conformance/invitations/cases/actors.d.ts +3 -0
  706. package/dist/conformance/invitations/cases/actors.d.ts.map +1 -0
  707. package/dist/conformance/invitations/cases/find-pending.d.ts +3 -0
  708. package/dist/conformance/invitations/cases/find-pending.d.ts.map +1 -0
  709. package/dist/conformance/invitations/cases/imported.d.ts +3 -0
  710. package/dist/conformance/invitations/cases/imported.d.ts.map +1 -0
  711. package/dist/conformance/invitations/cases/index.d.ts +4 -0
  712. package/dist/conformance/invitations/cases/index.d.ts.map +1 -0
  713. package/dist/conformance/invitations/cases/insert.d.ts +3 -0
  714. package/dist/conformance/invitations/cases/insert.d.ts.map +1 -0
  715. package/dist/conformance/invitations/cases/list-lapsed.d.ts +3 -0
  716. package/dist/conformance/invitations/cases/list-lapsed.d.ts.map +1 -0
  717. package/dist/conformance/invitations/cases/list-status.d.ts +3 -0
  718. package/dist/conformance/invitations/cases/list-status.d.ts.map +1 -0
  719. package/dist/conformance/invitations/cases/list.d.ts +3 -0
  720. package/dist/conformance/invitations/cases/list.d.ts.map +1 -0
  721. package/dist/conformance/invitations/cases/outage.d.ts +3 -0
  722. package/dist/conformance/invitations/cases/outage.d.ts.map +1 -0
  723. package/dist/conformance/invitations/cases/scope.d.ts +3 -0
  724. package/dist/conformance/invitations/cases/scope.d.ts.map +1 -0
  725. package/dist/conformance/invitations/cases/update.d.ts +3 -0
  726. package/dist/conformance/invitations/cases/update.d.ts.map +1 -0
  727. package/dist/conformance/invitations/describe.d.ts +20 -0
  728. package/dist/conformance/invitations/describe.d.ts.map +1 -0
  729. package/dist/conformance/invitations/fixtures.d.ts +4 -0
  730. package/dist/conformance/invitations/fixtures.d.ts.map +1 -0
  731. package/dist/conformance/invitations/index.d.ts +18 -0
  732. package/dist/conformance/invitations/index.d.ts.map +1 -0
  733. package/dist/conformance/invitations/reference.d.ts +4 -0
  734. package/dist/conformance/invitations/reference.d.ts.map +1 -0
  735. package/dist/conformance/invitations/types.d.ts +34 -0
  736. package/dist/conformance/invitations/types.d.ts.map +1 -0
  737. package/dist/conformance/reference.d.ts +13 -0
  738. package/dist/conformance/reference.d.ts.map +1 -0
  739. package/dist/conformance/relations/cases/deletion.d.ts +4 -0
  740. package/dist/conformance/relations/cases/deletion.d.ts.map +1 -0
  741. package/dist/conformance/relations/cases/holders.d.ts +9 -0
  742. package/dist/conformance/relations/cases/holders.d.ts.map +1 -0
  743. package/dist/conformance/relations/cases/index.d.ts +4 -0
  744. package/dist/conformance/relations/cases/index.d.ts.map +1 -0
  745. package/dist/conformance/relations/cases/outage.d.ts +3 -0
  746. package/dist/conformance/relations/cases/outage.d.ts.map +1 -0
  747. package/dist/conformance/relations/cases/reads.d.ts +8 -0
  748. package/dist/conformance/relations/cases/reads.d.ts.map +1 -0
  749. package/dist/conformance/relations/cases/traversal.d.ts +7 -0
  750. package/dist/conformance/relations/cases/traversal.d.ts.map +1 -0
  751. package/dist/conformance/relations/cases/writes.d.ts +4 -0
  752. package/dist/conformance/relations/cases/writes.d.ts.map +1 -0
  753. package/dist/conformance/relations/describe.d.ts +20 -0
  754. package/dist/conformance/relations/describe.d.ts.map +1 -0
  755. package/dist/conformance/relations/fixtures.d.ts +8 -0
  756. package/dist/conformance/relations/fixtures.d.ts.map +1 -0
  757. package/dist/conformance/relations/index.d.ts +18 -0
  758. package/dist/conformance/relations/index.d.ts.map +1 -0
  759. package/dist/conformance/relations/reference.d.ts +4 -0
  760. package/dist/conformance/relations/reference.d.ts.map +1 -0
  761. package/dist/conformance/relations/types.d.ts +34 -0
  762. package/dist/conformance/relations/types.d.ts.map +1 -0
  763. package/dist/conformance/types.d.ts +79 -0
  764. package/dist/conformance/types.d.ts.map +1 -0
  765. package/dist/errors/janus-error/base.d.ts +47 -0
  766. package/dist/errors/janus-error/base.d.ts.map +1 -0
  767. package/dist/errors/janus-error/codes.credentials.d.ts +36 -0
  768. package/dist/errors/janus-error/codes.credentials.d.ts.map +1 -0
  769. package/dist/errors/janus-error/codes.d.ts +23 -0
  770. package/dist/errors/janus-error/codes.d.ts.map +1 -0
  771. package/dist/errors/janus-error/codes.invitations.d.ts +52 -0
  772. package/dist/errors/janus-error/codes.invitations.d.ts.map +1 -0
  773. package/dist/errors/janus-error/codes.one-time.d.ts +63 -0
  774. package/dist/errors/janus-error/codes.one-time.d.ts.map +1 -0
  775. package/dist/errors/janus-error/codes.records.d.ts +86 -0
  776. package/dist/errors/janus-error/codes.records.d.ts.map +1 -0
  777. package/dist/errors/janus-error/codes.social.d.ts +88 -0
  778. package/dist/errors/janus-error/codes.social.d.ts.map +1 -0
  779. package/dist/errors/janus-error/index.d.ts +17 -0
  780. package/dist/errors/janus-error/index.d.ts.map +1 -0
  781. package/dist/errors/janus-error/options.d.ts +105 -0
  782. package/dist/errors/janus-error/options.d.ts.map +1 -0
  783. package/dist/errors/janus-error/refusals.d.ts +151 -0
  784. package/dist/errors/janus-error/refusals.d.ts.map +1 -0
  785. package/dist/errors/janus-error/status.d.ts +21 -0
  786. package/dist/errors/janus-error/status.d.ts.map +1 -0
  787. package/dist/errors/janus-error/store.d.ts +36 -0
  788. package/dist/errors/janus-error/store.d.ts.map +1 -0
  789. package/dist/ids/derived.d.ts +25 -0
  790. package/dist/ids/derived.d.ts.map +1 -0
  791. package/dist/ids/id.d.ts +55 -0
  792. package/dist/ids/id.d.ts.map +1 -0
  793. package/dist/index.d.ts +32 -0
  794. package/dist/index.d.ts.map +1 -0
  795. package/dist/index.js +6948 -0
  796. package/dist/index.js.map +208 -0
  797. package/dist/pagination/cursor-page.d.ts +53 -0
  798. package/dist/pagination/cursor-page.d.ts.map +1 -0
  799. package/dist/permissions/bound-model.d.ts +10 -0
  800. package/dist/permissions/bound-model.d.ts.map +1 -0
  801. package/dist/permissions/can.d.ts +13 -0
  802. package/dist/permissions/can.d.ts.map +1 -0
  803. package/dist/permissions/engine.d.ts +49 -0
  804. package/dist/permissions/engine.d.ts.map +1 -0
  805. package/dist/permissions/holders.d.ts +12 -0
  806. package/dist/permissions/holders.d.ts.map +1 -0
  807. package/dist/permissions/index.d.ts +36 -0
  808. package/dist/permissions/index.d.ts.map +1 -0
  809. package/dist/permissions/index.js +924 -0
  810. package/dist/permissions/index.js.map +28 -0
  811. package/dist/permissions/input.d.ts +43 -0
  812. package/dist/permissions/input.d.ts.map +1 -0
  813. package/dist/permissions/list.d.ts +16 -0
  814. package/dist/permissions/list.d.ts.map +1 -0
  815. package/dist/permissions/model/can.d.ts +41 -0
  816. package/dist/permissions/model/can.d.ts.map +1 -0
  817. package/dist/permissions/model/config.d.ts +36 -0
  818. package/dist/permissions/model/config.d.ts.map +1 -0
  819. package/dist/permissions/model/constraint.d.ts +37 -0
  820. package/dist/permissions/model/constraint.d.ts.map +1 -0
  821. package/dist/permissions/model/ctx.d.ts +23 -0
  822. package/dist/permissions/model/ctx.d.ts.map +1 -0
  823. package/dist/permissions/model/define.d.ts +78 -0
  824. package/dist/permissions/model/define.d.ts.map +1 -0
  825. package/dist/permissions/model/from-field.d.ts +31 -0
  826. package/dist/permissions/model/from-field.d.ts.map +1 -0
  827. package/dist/permissions/model/grant.d.ts +81 -0
  828. package/dist/permissions/model/grant.d.ts.map +1 -0
  829. package/dist/permissions/model/list.d.ts +48 -0
  830. package/dist/permissions/model/list.d.ts.map +1 -0
  831. package/dist/permissions/model/names.d.ts +51 -0
  832. package/dist/permissions/model/names.d.ts.map +1 -0
  833. package/dist/permissions/model/permissions.d.ts +48 -0
  834. package/dist/permissions/model/permissions.d.ts.map +1 -0
  835. package/dist/permissions/model/refs.d.ts +36 -0
  836. package/dist/permissions/model/refs.d.ts.map +1 -0
  837. package/dist/permissions/model/refusal.d.ts +13 -0
  838. package/dist/permissions/model/refusal.d.ts.map +1 -0
  839. package/dist/permissions/model/unions.d.ts +3 -0
  840. package/dist/permissions/model/unions.d.ts.map +1 -0
  841. package/dist/permissions/model/when.d.ts +16 -0
  842. package/dist/permissions/model/when.d.ts.map +1 -0
  843. package/dist/permissions/port/holders.d.ts +38 -0
  844. package/dist/permissions/port/holders.d.ts.map +1 -0
  845. package/dist/permissions/port/memory.d.ts +17 -0
  846. package/dist/permissions/port/memory.d.ts.map +1 -0
  847. package/dist/permissions/port/types.d.ts +101 -0
  848. package/dist/permissions/port/types.d.ts.map +1 -0
  849. package/dist/permissions/replace.d.ts +25 -0
  850. package/dist/permissions/replace.d.ts.map +1 -0
  851. package/dist/permissions/resolve/declared-names.d.ts +24 -0
  852. package/dist/permissions/resolve/declared-names.d.ts.map +1 -0
  853. package/dist/permissions/resolve/refuse-data-beyond-root.d.ts +11 -0
  854. package/dist/permissions/resolve/refuse-data-beyond-root.d.ts.map +1 -0
  855. package/dist/permissions/resolve/refuse-loops.d.ts +10 -0
  856. package/dist/permissions/resolve/refuse-loops.d.ts.map +1 -0
  857. package/dist/permissions/resolve/resolve-model.d.ts +13 -0
  858. package/dist/permissions/resolve/resolve-model.d.ts.map +1 -0
  859. package/dist/permissions/resolve/resolve-relation.d.ts +9 -0
  860. package/dist/permissions/resolve/resolve-relation.d.ts.map +1 -0
  861. package/dist/permissions/resolve/resolve-rule.d.ts +12 -0
  862. package/dist/permissions/resolve/resolve-rule.d.ts.map +1 -0
  863. package/dist/permissions/resolve/resolved.d.ts +52 -0
  864. package/dist/permissions/resolve/resolved.d.ts.map +1 -0
  865. package/dist/permissions/resolve/step.d.ts +4 -0
  866. package/dist/permissions/resolve/step.d.ts.map +1 -0
  867. package/dist/permissions/reverse.d.ts +53 -0
  868. package/dist/permissions/reverse.d.ts.map +1 -0
  869. package/dist/permissions/walk.d.ts +29 -0
  870. package/dist/permissions/walk.d.ts.map +1 -0
  871. package/dist/stores/guard.d.ts +24 -0
  872. package/dist/stores/guard.d.ts.map +1 -0
  873. package/dist/stores/storable.d.ts +15 -0
  874. package/dist/stores/storable.d.ts.map +1 -0
  875. package/dist/subjects/notation.d.ts +39 -0
  876. package/dist/subjects/notation.d.ts.map +1 -0
  877. package/dist/subjects/subject.d.ts +128 -0
  878. package/dist/subjects/subject.d.ts.map +1 -0
  879. package/dist/testing/index.d.ts +12 -0
  880. package/dist/testing/index.d.ts.map +1 -0
  881. package/dist/testing/index.js +26 -0
  882. package/dist/testing/index.js.map +10 -0
  883. package/dist/time/clock.d.ts +31 -0
  884. package/dist/time/clock.d.ts.map +1 -0
  885. package/dist/time/duration.d.ts +23 -0
  886. package/dist/time/duration.d.ts.map +1 -0
  887. package/docs/README.md +46 -0
  888. package/docs/guide/adapters.md +861 -0
  889. package/docs/guide/api-keys.md +316 -0
  890. package/docs/guide/avatars.md +334 -0
  891. package/docs/guide/devices.md +441 -0
  892. package/docs/guide/email-flows.md +880 -0
  893. package/docs/guide/errors.md +180 -0
  894. package/docs/guide/events.md +467 -0
  895. package/docs/guide/invitations.md +465 -0
  896. package/docs/guide/issuers.md +107 -0
  897. package/docs/guide/magic-link.md +580 -0
  898. package/docs/guide/migrating-invitations.md +142 -0
  899. package/docs/guide/passkeys.md +425 -0
  900. package/docs/guide/passwords.md +325 -0
  901. package/docs/guide/permissions.md +719 -0
  902. package/docs/guide/second-factor.md +1124 -0
  903. package/docs/guide/sessions.md +521 -0
  904. package/docs/guide/sign-in-code.md +631 -0
  905. package/docs/guide/social.md +648 -0
  906. package/docs/guide/step-up.md +262 -0
  907. package/docs/guide/users.md +557 -0
  908. package/docs/guide/vocabulary.md +316 -0
  909. package/docs/roadmap.md +102 -0
  910. package/docs/troubleshooting.md +3318 -0
  911. package/package.json +77 -5
@@ -0,0 +1,719 @@
1
+ # Permissions — `@softistx/janus/permissions`
2
+
3
+ This page is for modelling who may do what, and asking: `defineModel`,
4
+ `fromField`, `when`, then `can`, `list`, `grant`, `revoke` and `replace`. It is
5
+ Zanzibar's model — relations between objects and subjects, permissions
6
+ computed from them — **without its infrastructure**: the tuples live in your
7
+ database, so a read follows a write and there is nothing to cache.
8
+
9
+ It is the **permissions** side, and it is usable alone: the example below wires
10
+ it to `janus()` so the user types become the subjects, but `subjects` takes
11
+ any list of names — `defineModel({ subjects: ['user'], … })` — when your users
12
+ live elsewhere. Importing `@softistx/janus/permissions` loads no identity code.
13
+
14
+ ## The running example: a clinic
15
+
16
+ Every snippet on this page uses this model, and only its names. Two sections
17
+ need something else and say so: a [folder tree](#a-hierarchy) and
18
+ [permissions on a user](#permissions-on-a-user).
19
+
20
+ ```ts
21
+ import { z } from 'zod';
22
+ import { createMemoryStores, type CursorPage, janus, scryptHasher } from '@softistx/janus';
23
+ import { createMemoryRelations, defineModel, fromField, permissions, when } from '@softistx/janus/permissions';
24
+
25
+ const relations = createMemoryRelations();
26
+
27
+ const auth = janus({
28
+ users: {
29
+ staff: { schema: z.object({ username: z.string() }), password: { login: 'username' } },
30
+ patient: { schema: z.object({ email: z.email() }), password: { login: 'email' } },
31
+ },
32
+ store: createMemoryStores(),
33
+ relations, // deleting a user deletes every tuple naming them
34
+ hasher: scryptHasher(),
35
+ });
36
+
37
+ const model = defineModel({
38
+ subjects: auth.types, // 'staff' | 'patient': a user type is a subject type
39
+ types: {
40
+ team: {
41
+ related: { members: ['staff', 'team#members'], leads: ['staff'] },
42
+ permits: { manage: ['leads'], view: ['members', 'manage'] },
43
+ },
44
+ record: {
45
+ related: {
46
+ doctors: fromField('doctorId', 'staff', { lookup: (staffId) => db.records.idsByDoctor(staffId) }),
47
+ patients: fromField('patientId', 'patient', { lookup: (patientId) => db.records.idsByPatient(patientId) }),
48
+ teams: ['team'],
49
+ },
50
+ permits: {
51
+ view: ['doctors', 'patients', 'teams->view'],
52
+ review: ['teams->leads'],
53
+ edit: [when('doctors', (ctx: { onShift: boolean }) => ctx.onShift)],
54
+ },
55
+ },
56
+ },
57
+ });
58
+
59
+ const access = permissions({ model, store: relations });
60
+
61
+ const grace = await auth.staff.create({ username: 'grace' }); // a doctor
62
+ const ada = await auth.staff.create({ username: 'ada' }); // a team lead
63
+ const team = { type: 'team', id: 't1' } as const;
64
+ const record = { id: 'r1', doctorId: grace.id, patientId: 'p1', title: 'Chart' }; // as your database answered it
65
+ ```
66
+
67
+ `db` is your database; the two `lookup`s answer the ids of the records whose
68
+ field names the subject — see [`fromField`](#a-relation-read-from-the-object).
69
+
70
+ In words: a team has **members** — staff, or every member of another team —
71
+ and **leads**; whoever leads it may **manage** it, and members and managers
72
+ may **view** it. A record's **doctors** and **patients** are read from its own
73
+ fields, its **teams** are stored; its doctors, its patients and whoever can
74
+ view one of its teams may **view** it, the leads of its teams may **review**
75
+ it, and its doctors may **edit** it while on shift.
76
+
77
+ ## The model
78
+
79
+ ```ts
80
+ function defineModel<
81
+ const Subjects extends readonly string[], // auth.types
82
+ const Ts extends ModelConfig['types'] & ModelTypesOf<Subjects[number], Ts>, // what your editor completes
83
+ >(config: { readonly subjects: Subjects; readonly types: Ts }): PermissionModel<{ readonly subjects: Subjects; readonly types: Ts }>;
84
+ // ModelTypesOf<S, Ts>: the names each relation and rule of each type may take
85
+
86
+ interface ModelConfig {
87
+ readonly subjects: readonly string[]; // pass auth.types
88
+ readonly types: {
89
+ readonly [objectType: string]: {
90
+ readonly related?: { readonly [relation: string]: readonly string[] | FromField };
91
+ readonly permits?: { readonly [permission: string]: readonly (string | When)[] };
92
+ };
93
+ };
94
+ }
95
+ ```
96
+
97
+ An object type has two keys, Keto's words: **`related`**, who may hold each
98
+ relation, and **`permits`**, what each permission is made of. Relation names
99
+ are plural by convention — `members`, `doctors`, `teams` — because a relation
100
+ holds many; `defineModel` does not enforce it.
101
+
102
+ **A relation** lists who may hold it:
103
+
104
+ | Holder | Means |
105
+ | --- | --- |
106
+ | `'staff'` | one user of type `staff` |
107
+ | `'team'` | one object of type `team` — what an arrow follows |
108
+ | `'team#members'` | a **subject set**: every member of a team |
109
+ | `fromField('doctorId', 'staff')` | read from the object's own data — see [`fromField`](#a-relation-read-from-the-object) |
110
+
111
+ **A permission** is the union of its rules:
112
+
113
+ | Rule | Means |
114
+ | --- | --- |
115
+ | `'members'` | a relation of the same object |
116
+ | `'manage'` | another permission of the same object |
117
+ | `'teams->view'` | an **arrow**: whoever holds `view` on one of the object's `teams` |
118
+ | `'teams->leads'` | an arrow to a relation: whoever leads one of the object's `teams` |
119
+ | `when('doctors', (ctx: { onShift: boolean }) => ctx.onShift)` | a rule under a condition — see [`when`](#a-condition) |
120
+
121
+ A rule may name another permission of the same type — `view: ['members',
122
+ 'manage']` — but never the permission itself: `view: ['view']` adds nothing
123
+ and is a loop no relation ends, so your editor does not offer it and the
124
+ compiler refuses it. A loop through another permission (`view: ['edit'],
125
+ edit: ['view']`) is refused by `defineModel` when it runs.
126
+
127
+ A permission may be asked of `can` and `list` like a relation, and a relation
128
+ like a permission.
129
+
130
+ ### What the compiler refuses
131
+
132
+ A relation naming a type that does not exist, a rule naming nothing, an arrow
133
+ to a permission its target lacks, an arrow through a relation that can hold a
134
+ subject set, a name that is both a relation and a permission, a key other than
135
+ `related` and `permits` — `permit:`, singular — on an object type: each is a
136
+ compile error **on the offending name** — on the whole `fromField(…)` or
137
+ `when(…)` call for those two. Except for the name used twice, which says to
138
+ rename one, the error lists what you could have written, with "Did you mean"
139
+ when one is close.
140
+
141
+ ```ts
142
+ defineModel({
143
+ subjects: ['staff'],
144
+ types: {
145
+ team: {
146
+ // @ts-expect-error — Type '"staf"' is not assignable to type '"staff" | "team" | "team#members"'. Did you mean '"staff"'?
147
+ related: { members: ['staf'] },
148
+ },
149
+ },
150
+ });
151
+ ```
152
+
153
+ **The keys before 0.2**, `relations` and `permissions`, are refused with the
154
+ name that replaced them — rename the key, nothing else changes:
155
+
156
+ ```ts
157
+ defineModel({
158
+ subjects: ['staff'],
159
+ types: {
160
+ team: {
161
+ // @ts-expect-error — 'members' does not exist in type 'Refusal<"team.relations is now related: rename the key", never>'
162
+ relations: { members: ['staff'] },
163
+ },
164
+ },
165
+ });
166
+ ```
167
+
168
+ `permissions:` is refused the same way: `team.permissions is now permits:
169
+ rename the key`.
170
+
171
+ Your editor offers those names as you type — subject types and subject sets
172
+ in a relation, subject types in `fromField`, relations, permissions and arrows
173
+ in a rule and in `when` — because `defineModel` types its `types` with a
174
+ constraint an editor reads, not only with a check. A spec asks the TypeScript
175
+ language service what it completes, so a change that loses it fails.
176
+
177
+ ### What `defineModel` refuses at run time
178
+
179
+ With a `TypeError`, when the model is defined — never at a check. Each names
180
+ the key you wrote, `types.record.permits.view` or `types.team.related.members`:
181
+
182
+ - `relations` or `permissions` — the keys before 0.2 — and any key other than
183
+ `related` and `permits`;
184
+ - a name that is not camelCase;
185
+ - a permission that reaches itself without crossing a relation (`view:
186
+ ['edit'], edit: ['view']`) — no data could ever end that loop;
187
+ - a subject set or an arrow that would have to read **another** object's
188
+ `fromField` — only the object passed to `can()` carries its data. Store that
189
+ relation instead.
190
+
191
+ A loop that crosses a relation — a folder viewable through its parents — is
192
+ fine: the data ends it. See [a hierarchy](#a-hierarchy).
193
+
194
+ ## Use cases
195
+
196
+ Each case below runs against the clinic above, in order — except the two that
197
+ say otherwise: a folder tree for a hierarchy, and staff members who manage
198
+ each other for permissions on a user.
199
+
200
+ ### A direct relation
201
+
202
+ A relation is what you store: `grant` writes it, `can` reads it.
203
+
204
+ ```ts
205
+ await access.grant(team, 'leads', ada);
206
+ await access.can(ada, 'leads', team); // true: a relation may be asked like a permission
207
+ await access.can(grace, 'leads', team); // false
208
+ ```
209
+
210
+ ### A permission naming a permission
211
+
212
+ `view: ['members', 'manage']` includes whoever holds `manage`, which is
213
+ `['leads']` — so a lead can view the team without being a member.
214
+
215
+ ```ts
216
+ await access.can(ada, 'manage', team); // true: ada leads t1
217
+ await access.can(ada, 'view', team); // true: view includes manage
218
+ ```
219
+
220
+ ### A subject set
221
+
222
+ `members: ['staff', 'team#members']` admits a staff member, or **every member
223
+ of another team** at once. Grant the set with its `relation`:
224
+
225
+ ```ts
226
+ const cardiology = { type: 'team', id: 't2' } as const;
227
+ await access.grant(cardiology, 'members', grace);
228
+ await access.grant(team, 'members', { type: 'team', id: 't2', relation: 'members' });
229
+ await access.can(grace, 'view', team); // true: grace is a member of t2, whose members are members of t1
230
+ ```
231
+
232
+ `setOf(cardiology, 'members')`, from `@softistx/janus`, writes the same set. On an
233
+ object type the two are the same; on a user type only `setOf` makes a set —
234
+ see [permissions on a user](#permissions-on-a-user).
235
+
236
+ The set is followed as the data stands: revoke grace from `t2`, and she no
237
+ longer views `t1`. A team member of itself — a cycle in the data — is cut, and
238
+ is not an error.
239
+
240
+ ### An arrow
241
+
242
+ `'teams->view'` is **whoever can view one of the record's teams**; the arrow
243
+ follows the objects the `teams` relation holds, and asks them `view`. Grant
244
+ the record its team, then everyone who views the team views the record:
245
+
246
+ ```ts
247
+ await access.grant({ type: 'record', id: record.id }, 'teams', team);
248
+ await access.can(ada, 'view', { type: 'record', ...record }); // true: ada views t1 (she leads it)
249
+ ```
250
+
251
+ An arrow may end on a relation too: `review: ['teams->leads']` is whoever
252
+ **leads** one of the record's teams — not its members.
253
+
254
+ ```ts
255
+ await access.can(ada, 'review', { type: 'record', ...record }); // true: ada leads t1
256
+ await access.can(grace, 'review', { type: 'record', ...record }); // false: grace is a member, not a lead
257
+ ```
258
+
259
+ An arrow follows **object types only**: through a relation that can hold a
260
+ subject set (`teams: ['team', 'team#members']`), `'teams->view'` is a compile
261
+ error.
262
+
263
+ ### A hierarchy
264
+
265
+ A folder tree, one of the two models on this page besides the clinic: a folder is
266
+ viewable by its owners and by whoever views one of its parents. The arrow
267
+ names the folder's own `view` — a loop in the model, which **the data ends**:
268
+ the walk stops at a folder with no parents.
269
+
270
+ ```ts
271
+ const files = permissions({
272
+ model: defineModel({
273
+ subjects: auth.types,
274
+ types: {
275
+ folder: {
276
+ related: { owners: ['staff'], parents: ['folder'] },
277
+ permits: { view: ['owners', 'parents->view'] },
278
+ },
279
+ },
280
+ }),
281
+ store: createMemoryRelations(),
282
+ });
283
+
284
+ const root = { type: 'folder', id: 'root' } as const;
285
+ const reports = { type: 'folder', id: 'reports' } as const;
286
+ await files.grant(root, 'owners', grace);
287
+ await files.grant(reports, 'parents', root);
288
+ await files.can(grace, 'view', reports); // true: she owns its parent
289
+ ```
290
+
291
+ A deep tree crosses one relation per level; past `maxDepth` (`25`) the check
292
+ is `PERMISSION_DEPTH`, never `false`.
293
+
294
+ ### A relation read from the object
295
+
296
+ ```ts
297
+ function fromField(field, subjectType): FromField;
298
+ function fromField(field, subjectType, { lookup }): ReversibleFromField;
299
+ type Lookup = (subjectId: string) => Promise<readonly string[]>;
300
+ ```
301
+
302
+ `doctors: fromField('doctorId', 'staff')` reads the record's own `doctorId`
303
+ rather than a tuple kept in sync with it. Nothing is stored, and `grant`
304
+ refuses it at compile time. `can()` is given the object, and the compiler
305
+ requires every field a `fromField` of its type reads — here `doctorId` and
306
+ `patientId`:
307
+
308
+ ```ts
309
+ await access.can(grace, 'view', { type: 'record', ...record }); // true: record.doctorId is grace's id
310
+ // @ts-expect-error — doctors is read from a field: there is nothing to grant
311
+ await access.grant({ type: 'record', id: record.id }, 'doctors', grace);
312
+ ```
313
+
314
+ **Spread the loaded object.** A field missing at run time is a `TypeError`,
315
+ never a denial. `null` in the field holds nobody.
316
+
317
+ **`list()` needs a `lookup`.** It cannot read a field of objects it has not
318
+ found, so it asks `lookup` for the ids of the objects whose field names the
319
+ subject — in the clinic, `db.records.idsByDoctor(staffId)`. A `list()` that
320
+ would reach a `fromField` without one is a compile error, and your editor does
321
+ not offer that permission.
322
+
323
+ A lookup is your code, and it is not guarded: one that throws rejects `list()`
324
+ with its own error. **Never answer `[]` for a database that could not answer**
325
+ — that is a denial made of an outage.
326
+
327
+ ### A condition
328
+
329
+ ```ts
330
+ function when<const Rule extends string, Ctx>(rule: Rule, test: (ctx: Ctx) => boolean): When<Rule, Ctx>;
331
+ ```
332
+
333
+ `edit: [when('doctors', (ctx: { onShift: boolean }) => ctx.onShift)]` grants
334
+ the record's doctors, **while on shift**. The rule is any rule of the same
335
+ type — a relation, a permission, an arrow. The test is synchronous and pure:
336
+ it decides on what the caller passes, and reads nothing. Its `ctx` is what
337
+ `can()` and `list()` then **require** — and only for the permissions whose
338
+ rules reach it:
339
+
340
+ ```ts
341
+ await access.can(grace, 'edit', { type: 'record', ...record }, { ctx: { onShift: true } }); // true
342
+ await access.can(grace, 'edit', { type: 'record', ...record }, { ctx: { onShift: false } }); // false
343
+ // @ts-expect-error — ctx is required: edit reaches a condition
344
+ await access.can(grace, 'edit', { type: 'record', ...record });
345
+
346
+ await access.can(grace, 'view', { type: 'record', ...record }); // no ctx: view reaches no condition
347
+ await access.list(grace, 'edit', 'record', { ctx: { onShift: true } });
348
+ ```
349
+
350
+ ### Permissions on a user
351
+
352
+ A user type may also be an object type: declare `staff` under `types`, and a
353
+ staff member is an object like a record — asked `can()`, granted relations,
354
+ listed. To decide who may edit a staff member, give `staff` the relations that
355
+ say so:
356
+
357
+ ```ts
358
+ import { setOf } from '@softistx/janus';
359
+
360
+ const people = permissions({
361
+ model: defineModel({
362
+ subjects: auth.types,
363
+ types: {
364
+ staff: {
365
+ related: {
366
+ self: fromField('id', 'staff', { lookup: async (staffId) => [staffId] }),
367
+ managers: ['staff', 'staff#managers'],
368
+ },
369
+ permits: { edit: ['self', 'managers'] },
370
+ },
371
+ note: {
372
+ related: { readers: ['staff', 'staff#managers'] },
373
+ permits: { read: ['readers'] },
374
+ },
375
+ },
376
+ }),
377
+ store: relations,
378
+ });
379
+
380
+ const bob = await auth.staff.create({ username: 'bob' });
381
+ await people.can(bob, 'edit', bob); // true: himself, read from his id
382
+ await people.can(ada, 'edit', bob); // false
383
+ await people.grant(bob, 'managers', ada);
384
+ await people.can(ada, 'edit', bob); // true: she manages him
385
+ await people.list(ada, 'edit', 'staff'); // herself, and bob
386
+ ```
387
+
388
+ **A user passed as it is, is that user** — never a set, even when one of its
389
+ fields is named `relation`. A set on a user type is made by **`setOf`**: every
390
+ staff member who manages bob reads the note, as the data stands:
391
+
392
+ ```ts
393
+ const note = { type: 'note', id: 'n1' } as const;
394
+ await people.grant(note, 'readers', setOf(bob, 'managers'));
395
+ await people.can(ada, 'read', note); // true: she manages bob
396
+ await people.can(bob, 'read', note); // false: bob is not his own manager
397
+ ```
398
+
399
+ Only `setOf` marks a set. `{ type: 'staff', id: bob.id, relation: 'managers' }`
400
+ written out is bob himself at run time: granted silently where the relation
401
+ admits a staff member, refused where it does not. The compiler refuses it in
402
+ `grant()` and `revoke()`; `can()` and `list()` accept it and ask about bob, a
403
+ gap the README names. A spread
404
+ of a set keeps the mark; `JSON` and `structuredClone` drop it, so a set read
405
+ back from either is bob again — call `setOf` on it, or keep its notation
406
+ (`staff:…#managers`), which `parseSubject` reads back as the set. It copies
407
+ `type` and `id` only, so none of bob's fields reaches a tuple. A set on a user type
408
+ the model does not also declare under `types` is refused by `can()`, `list()`,
409
+ `grant()` and `revoke()` — and by the compiler first: there is no relation to
410
+ hold.
411
+
412
+ The `lookup` of `self` answers the one staff member whose id is the subject's,
413
+ so `list()` finds ada herself too.
414
+
415
+ ## `permissions()`
416
+
417
+ ```ts
418
+ function permissions<C extends ModelConfig>(options: PermissionsOptions<C>): Permissions<C>;
419
+ ```
420
+
421
+ | Option | Type | Default | Effect |
422
+ | --- | --- | --- | --- |
423
+ | `model` | `PermissionModel` | — | What `defineModel` answered |
424
+ | `store` | `RelationStore` | — | Where tuples live: `createMemoryRelations()` in tests, `createMongoRelations(db)` from `@softistx/janus-mongo` |
425
+ | `maxDepth` | positive integer | `25` | How many relations a check may cross. Past it: `PERMISSION_DEPTH` |
426
+
427
+ It connects to nothing, and refuses a store missing a method with a
428
+ `TypeError`.
429
+
430
+ ### `can`
431
+
432
+ ```ts
433
+ can(subject, permission, object, options?): Promise<boolean>;
434
+ ```
435
+
436
+ - `subject` is a user from `janus()` as it is — any object with `type` and
437
+ `id` — an object of the model, or `null` for anonymous, which answers `false`
438
+ before any store call.
439
+ - `permission` must be a relation or a permission of the object's type.
440
+ - `object` is `{ type, id }` plus every field its `fromField`s read.
441
+ - `options.ctx` is required exactly when a `when` is reachable.
442
+
443
+ Your editor completes `permission` with the names of the object's type once
444
+ the object is written. **Before, it offers the names of every type**: the
445
+ permission comes before the object, and nothing yet says which type it is.
446
+
447
+ ```ts
448
+ await access.can(grace, 'view', { type: 'record', ...record }); // true
449
+ await access.can(grace, 'edit', { type: 'record', ...record }, { ctx: { onShift: false } }); // false
450
+ await access.can(null, 'view', { type: 'record', ...record }); // false, no store call
451
+ ```
452
+
453
+ **A denial is `false`; a failure throws.** A store that cannot answer is
454
+ `STORE_FAILED`; a walk past `maxDepth` is `PERMISSION_DEPTH`. Neither is ever
455
+ `false`, which would deny everybody everything during an outage and say
456
+ nothing. A cycle in the data — a team member of itself — is cut, and is not an
457
+ error.
458
+
459
+ **An id no store can keep is held by nobody.** An id holding a NUL character
460
+ (`\u0000`) or a lone surrogate cannot be written to PostgreSQL, so no tuple can
461
+ name it: `can()` answers `false` for such an object or subject before any
462
+ store call, a `fromField` whose value holds one names nobody, and `list()`
463
+ leaves out an id a `lookup` answers holding one. Every other character is an
464
+ id like any other.
465
+
466
+ ### `list`
467
+
468
+ ```ts
469
+ list(subject, permission, objectType, options?): Promise<CursorPage<string>>;
470
+ ```
471
+
472
+ The ids of the objects of `objectType` on which `subject` holds `permission`,
473
+ ascending, by pages — what `can()` answers `true` for, found without naming
474
+ them. Page with `limit` and `after`, passing each `nextCursor` back as it
475
+ came, until it is `null`:
476
+
477
+ ```ts
478
+ const page = await access.list(grace, 'view', 'record', { limit: 50 });
479
+ page.items; // readonly string[]: the records grace can view — hers, and her teams'
480
+ page.nextCursor; // string | null
481
+ await access.list(grace, 'view', 'record', { after: page.nextCursor, limit: 50 });
482
+
483
+ // Every page — annotate the page, or TypeScript cannot type the loop (TS7022):
484
+ let after: string | null = null;
485
+ do {
486
+ const next: CursorPage<string> = await access.list(grace, 'view', 'record', { after, limit: 100 });
487
+ for (const id of next.items) console.log(id);
488
+ after = next.nextCursor;
489
+ } while (after);
490
+ ```
491
+
492
+ `CursorPage` is exported from `@softistx/janus`.
493
+
494
+ `limit` is 20 by default and at most 100 — a larger one is capped, and one
495
+ that is not a positive integer is a `TypeError`, so parse a limit read from a
496
+ request first ([troubleshooting](../troubleshooting.md#call-limit-must-be-an-integer-of-at-least-1-or-absent)).
497
+ `ctx` is required as for `can` — `list(grace, 'edit', 'record', { ctx })`.
498
+ Your editor completes `permission` with what `list()` can answer only: a name
499
+ reaching a `fromField` with no `lookup` is neither offered nor accepted.
500
+ `null` answers an empty page before any store call, and so does a subject
501
+ whose id no store can keep; an id a `lookup` answers that no store can keep is
502
+ left out of the page.
503
+
504
+ `list()` walks backwards from the subject, reading every page of the reverse
505
+ index for every id each step reaches. That is fine for what one user can see,
506
+ and not for a subject set holding most of the database — write a query of your
507
+ own for that.
508
+
509
+ ### `grant` and `revoke`
510
+
511
+ ```ts
512
+ grant(object, relation, subject): Promise<void>;
513
+ revoke(object, relation, subject): Promise<void>;
514
+ ```
515
+
516
+ Both are typed from the model: only a stored relation (never a `fromField`),
517
+ and only a holder the relation admits — a staff member, or a team's members
518
+ where `'team#members'` is declared.
519
+
520
+ ```ts
521
+ await access.grant(team, 'members', grace); // a staff member
522
+ await access.grant(team, 'members', { type: 'team', id: 't2', relation: 'members' }); // a subject set
523
+ await access.grant({ type: 'record', id: 'r1' }, 'teams', team); // what 'teams->view' follows
524
+ await access.revoke(team, 'members', grace);
525
+ ```
526
+
527
+ An object or subject id holding a NUL character or a lone surrogate is a
528
+ `TypeError` — no store can keep it, so nothing could hold it
529
+ ([troubleshooting](../troubleshooting.md#other-can-list-grant-and-revoke-messages)).
530
+ Both are idempotent: granting what is held, or revoking what is not, is not an
531
+ error. Each writes one tuple.
532
+
533
+ The same rule holds when reading: `can()` and `list()` follow only the holders
534
+ a relation admits. A tuple stored past `grant()` — by an older model, or by
535
+ hand — that the model does not admit grants nothing. `revoke()` refuses it as
536
+ it refuses to `grant()` it, so remove it with the store:
537
+
538
+ ```ts
539
+ await relations.write({
540
+ remove: [{ object: { type: 'record', id: 'r1' }, relation: 'teams', subject: { type: 'team', id: 't1' } }],
541
+ });
542
+ ```
543
+
544
+ Narrowing a model therefore hides the tuples it no longer admits; it does not
545
+ delete them, and widening it again brings them back.
546
+
547
+ ### `replace`
548
+
549
+ ```ts
550
+ replace(object, relation, subjects): Promise<{ added: RelationTuple[]; removed: RelationTuple[] }>;
551
+ ```
552
+
553
+ Makes `subjects` the only holders of `relation` on `object`: the use is
554
+ keeping a group's members equal to a list the application already holds.
555
+ `subjects` is typed as `grant`'s `subject`, as an array. It answers the
556
+ tuples it added and the tuples it removed, `{ object, relation, subject }`
557
+ each, in the order written, so the application can audit or mirror them.
558
+
559
+ ```ts
560
+ const wanted = await db.staff.membersOf('cardiology');
561
+ const { added, removed } = await access.replace(cardiology, 'members', wanted);
562
+ // added[0] is { object: cardiology, relation: 'members', subject: … }
563
+
564
+ await access.replace(cardiology, 'members', []); // removes every holder
565
+ ```
566
+
567
+ - Every subject is checked first, as `grant()` checks it, and one refusal
568
+ anywhere in the list is a `TypeError` that writes nothing. An empty list
569
+ still names an object and a stored relation, and those are checked.
570
+ - The current holders are read (`findEntities` and `findSubjectSets`), and the
571
+ difference is one `write`: removals and additions together, all or nothing
572
+ as the port requires, and no write when both are empty.
573
+ - A holder is told apart by its type, id and, for a subject set, its relation:
574
+ `team:t2#members` is not the entity `team:t2`. A subject listed twice counts
575
+ once.
576
+ - Tuples of other relations, and of other objects, are never touched. A tuple
577
+ stored past the model (an older model, or by hand) that the list does not
578
+ name is removed like any other holder.
579
+ - A failure is `STORE_FAILED`, as for `grant()`.
580
+ - It reads every holder of the relation, so a relation store must answer them
581
+ all through `findEntities` and `findSubjectSets` and never cap.
582
+
583
+ **Two concurrent calls on the same object and relation are not serialised.**
584
+ Each reads, then writes its own diff, so the result can hold the union of both
585
+ adds. A caller that needs one winner serialises them itself, with a lock or a
586
+ queue of its own.
587
+
588
+ ### `holders`
589
+
590
+ ```ts
591
+ holders(object, relation, { first?, after?, search?, matches?, matchesMany?, scanLimit? }): Promise<CursorPage<Entity>>;
592
+ ```
593
+
594
+ The single entities holding `relation` on `object`, ordered by type then id,
595
+ by pages: the reverse of `grant`, for a screen that lists who holds a role.
596
+ Subject sets are not listed.
597
+
598
+ ```ts
599
+ const platform = { type: 'platform', id: 'main' };
600
+
601
+ const page = await access.holders(platform, 'admins', { first: 20, search: 'ada' });
602
+ // page.items: [{ type: 'user', id: 'u1' }, ...]; page.nextCursor is null on the last page
603
+ const next = await access.holders(platform, 'admins', { first: 20, search: 'ada', after: page.nextCursor });
604
+ ```
605
+
606
+ - `first` is between 1 and 100, 20 when absent; `after` is the `nextCursor` of
607
+ the previous page. A cursor the store did not mint is `InvalidCursorError`.
608
+ - `search` keeps the holders whose **id** contains the text, ignoring case
609
+ (ASCII on PostgreSQL); `%`, `_` and `.` match themselves. The relation store
610
+ holds ids only, so a match on the holder's email or name is `matches`, a
611
+ predicate over each holder (it may be async) that you answer from your user
612
+ store: `matches: async (h) => (await users.find(h.id))?.email.includes(text)`.
613
+ Paging stays right, and a selective predicate costs more reads.
614
+ - `matchesMany(holders)` is `matches` for a batch: it receives up to 100
615
+ holders in order and answers one boolean per holder, in the same order, so
616
+ the page's users are read in one query:
617
+ `matchesMany: async (hs) => { const found = await users.findMany(hs.map((h) => h.id)); return hs.map((h) => found.some((u) => u.id === h.id && u.email.includes(text))); }`.
618
+ Pass `matches` or `matchesMany`, never both.
619
+ - `scanLimit` bounds the cost of a call that has a predicate: it looks at most
620
+ that many holders (a positive integer or `Infinity`; 500 when absent). When
621
+ the limit is spent before `first` holders are kept, the call answers the
622
+ holders kept so far, possibly none, with a `nextCursor` to resume from. **A
623
+ page may therefore hold fewer than `first` and still not be the last: only a
624
+ `null` `nextCursor` ends the list.** Loop on `nextCursor` until it is null:
625
+
626
+ ```ts
627
+ let after: string | null = null;
628
+ do {
629
+ const page = await access.holders(platform, 'admins', { first: 20, matchesMany, scanLimit: 200, after });
630
+ show(page.items);
631
+ after = page.nextCursor;
632
+ } while (after !== null);
633
+ ```
634
+ - A store with `findHolders` pages in the database. One without it still
635
+ works: the core pages `findEntities` in memory, which is fine for a handful
636
+ of holders and does not scale for thousands.
637
+ - A failure is `STORE_FAILED`, as for `list()`.
638
+
639
+ ### Deleting
640
+
641
+ Wire the relation store into `janus({ relations })`, as the clinic does, and
642
+ deleting a user deletes every tuple naming them. Deleting an object's tuples
643
+ is yours, from your own code, when you delete the object:
644
+
645
+ ```ts
646
+ await auth.staff.delete(grace); // grace, her sessions, and every tuple naming her
647
+ await relations.deleteEntity({ type: 'record', id: 'r1' }); // answers how many tuples it removed
648
+ ```
649
+
650
+ ## A route guard
651
+
652
+ ```ts
653
+ import { PermissionDepthError, StoreFailure } from '@softistx/janus';
654
+
655
+ export async function getRecord(request: Request, id: string): Promise<Response> {
656
+ try {
657
+ const current = await auth.authenticate(request, { type: 'staff' });
658
+ const record = await loadRecord(id);
659
+ if (record === null) return new Response(null, { status: 404 });
660
+
661
+ const allowed = await access.can(current?.user ?? null, 'view', { type: 'record', ...record });
662
+ if (!allowed) return new Response(null, { status: current ? 403 : 401 });
663
+ return Response.json(record);
664
+ } catch (error) {
665
+ if (error instanceof StoreFailure) return new Response(null, { status: 503 });
666
+ if (error instanceof PermissionDepthError) return new Response(null, { status: 500 });
667
+ throw error;
668
+ }
669
+ }
670
+ ```
671
+
672
+ Load the record first: `can()` needs its `doctorId` and `patientId`. An
673
+ anonymous caller is `null`, which `can()` answers `false` without a store call
674
+ — a `401` here, a `403` for a signed-in one.
675
+
676
+ ### A function of your own around `can()`
677
+
678
+ `Can<C>` is `can()`'s signature, and `CheckArgs<C, T, P>` its options
679
+ argument — required exactly when a `when` is reachable, as for `can()`
680
+ itself. A wrapper that spreads them refuses the same mistakes:
681
+
682
+ ```ts
683
+ import type {
684
+ CheckableOf, CheckArgs, ModelConfig, ObjectRef, ObjectTypeOf, Permissions, SubjectRef,
685
+ } from '@softistx/janus/permissions';
686
+
687
+ export function audited<C extends ModelConfig, const T extends ObjectTypeOf<C>, const P extends CheckableOf<C, T>>(
688
+ access: Permissions<C>,
689
+ subject: SubjectRef<C> | null,
690
+ permission: P,
691
+ object: ObjectRef<C, T>,
692
+ ...options: CheckArgs<C, T, P>
693
+ ): Promise<boolean> {
694
+ log.info({ permission, object: object.id });
695
+ return access.can(subject, permission, object, ...options);
696
+ }
697
+ ```
698
+
699
+ ## Subjects and the notation
700
+
701
+ A user **is** a subject: `subjectOf(user)` from `@softistx/janus` answers its
702
+ `{ type, id }`, and `can` takes the user as it is. Tuples print in Zanzibar's
703
+ notation, typed — `record:r1#teams@team:t1`, `team:t1#members@team:t2#members`
704
+ — see [the shared vocabulary](vocabulary.md#subjects-and-the-tuple-notation).
705
+
706
+ ## The relation store
707
+
708
+ `RelationStore` is six methods (and an optional seventh, `findHolders`) answering one-hop questions about stored tuples
709
+ — `write`, `has`, `findSubjectSets`, `findEntities`, `findObjects`,
710
+ `deleteEntity`. The traversal is the core's. `createMemoryRelations()` is the
711
+ reference implementation, and [Writing an adapter](adapters.md) covers the
712
+ rest.
713
+
714
+ ## See also
715
+
716
+ - [Users](users.md) — `janus({ relations })`, and user types as subject types
717
+ - [Errors](errors.md) — `STORE_FAILED` and `PERMISSION_DEPTH`
718
+ - [Writing an adapter](adapters.md) — `RelationStore` and its conformance suite
719
+ - [Troubleshooting](../troubleshooting.md#definemodel-) — every `defineModel` message