@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,86 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/conformance/assert.ts", "../src/conformance/api-keys/fixtures.ts", "../src/conformance/api-keys/cases/bound.ts", "../src/conformance/api-keys/cases/expiry.ts", "../src/conformance/api-keys/cases/insert.ts", "../src/conformance/api-keys/cases/revoke.ts", "../src/conformance/api-keys/cases/touch.ts", "../src/conformance/api-keys/cases/user-bound.ts", "../src/conformance/api-keys/cases/index.ts", "../src/conformance/api-keys/cases/outage.ts", "../src/conformance/fixtures.ts", "../src/conformance/cases/outage.passkeys.ts", "../src/conformance/cases/outage.ts", "../src/conformance/cases/passkeys/deletion.ts", "../src/conformance/cases/passkeys/inserts.ts", "../src/conformance/cases/passkeys/reads.ts", "../src/conformance/cases/passkeys/uses.ts", "../src/conformance/cases/passkeys/index.ts", "../src/conformance/cases/sessions/deletion.ts", "../src/conformance/cases/sessions/extension.ts", "../src/conformance/cases/sessions/inserts.ts", "../src/conformance/cases/sessions/list.ts", "../src/conformance/cases/sessions/reads.ts", "../src/conformance/cases/sessions/reauthentication.ts", "../src/conformance/cases/sessions/revocation.ts", "../src/conformance/cases/sessions/index.ts", "../src/conformance/cases/social-links/deletion.ts", "../src/conformance/cases/social-links/inserts.ts", "../src/conformance/cases/social-links/reads.ts", "../src/conformance/cases/social-links/index.ts", "../src/conformance/cases/tokens/attempts.ts", "../src/conformance/cases/tokens/change-email.ts", "../src/conformance/cases/tokens/deletion.ts", "../src/conformance/cases/tokens/inserts.ts", "../src/conformance/cases/tokens/kinds.ts", "../src/conformance/cases/tokens/redemption.ts", "../src/conformance/cases/tokens/social-flow.ts", "../src/conformance/cases/tokens/spending.ts", "../src/conformance/cases/tokens/index.ts", "../src/conformance/cases/users/batch.ts", "../src/conformance/cases/users/deletion.ts", "../src/conformance/cases/users/inserts.ts", "../src/conformance/cases/users/listing.ts", "../src/conformance/cases/users/avatar.ts", "../src/conformance/cases/users/second-factor.ts", "../src/conformance/cases/users/patches.ts", "../src/conformance/cases/users/reads.ts", "../src/conformance/cases/users/versions.ts", "../src/conformance/cases/users/index.ts", "../src/conformance/describe.ts", "../src/conformance/api-keys/describe.ts", "../src/conformance/api-keys/reference.ts", "../src/conformance/invitations/fixtures.ts", "../src/conformance/invitations/cases/actors.ts", "../src/conformance/invitations/cases/find-pending.ts", "../src/conformance/invitations/cases/imported.ts", "../src/conformance/invitations/cases/insert.ts", "../src/conformance/invitations/cases/list.ts", "../src/conformance/invitations/cases/list-lapsed.ts", "../src/conformance/invitations/cases/list-status.ts", "../src/conformance/invitations/cases/scope.ts", "../src/conformance/invitations/cases/update.ts", "../src/conformance/invitations/cases/index.ts", "../src/conformance/invitations/cases/outage.ts", "../src/conformance/invitations/describe.ts", "../src/conformance/invitations/reference.ts", "../src/conformance/reference.ts", "../src/conformance/relations/fixtures.ts", "../src/conformance/relations/cases/deletion.ts", "../src/conformance/relations/cases/holders.ts", "../src/conformance/relations/cases/reads.ts", "../src/conformance/relations/cases/traversal.ts", "../src/conformance/relations/cases/writes.ts", "../src/conformance/relations/cases/index.ts", "../src/conformance/relations/cases/outage.ts", "../src/conformance/relations/describe.ts", "../src/conformance/relations/reference.ts"],
4
+ "sourcesContent": [
5
+ "/**\n * The suite's five assertions.\n *\n * **No assertion library, no test framework**: `bun:test` in the dependency\n * graph of a published library is a dependency every consumer installs, and an\n * adapter author on vitest could not run the suite at all. Each throws a plain\n * `Error` whose message names the port method and what it should have answered\n * — the sentence an adapter author reads first.\n */\n\n/** Fails unless `actual` deep-equals `expected`: dates by instant, `1` never `'1'`. */\nexport function equal(actual: unknown, expected: unknown, what: string): void {\n\tconst difference = differ(actual, expected, '');\n\tif (difference !== null) {\n\t\tthrow new Error(\n\t\t\t`${what}\\n at ${difference.path || '(root)'}: expected ${show(difference.expected)}, got ${show(difference.actual)}`,\n\t\t);\n\t}\n}\n\n/** Fails unless `actual` is `null` — not `undefined`, which is a store that forgot to answer. */\nexport function isNull(actual: unknown, what: string): void {\n\tif (actual !== null) {\n\t\tthrow new Error(\n\t\t\t`${what}\\n expected null, got ${actual === undefined ? 'undefined — an absence is null; undefined is a store that forgot to answer' : show(actual)}`,\n\t\t);\n\t}\n}\n\n/** Fails unless `condition` holds. */\nexport function ok(condition: boolean, what: string): void {\n\tif (!condition) throw new Error(what);\n}\n\n/**\n * The rejection of `promise`, or a failure when it resolves.\n *\n * **Settled where it is created**, with `.then(ok, ko)`: a rejection awaited\n * too late is counted unhandled by Bun and fails the case with the very error\n * it was checking — measured in nxgt-data, where a loaded CI runner failed\n * where an idle laptop passed.\n */\nexport function rejects(\n\tpromise: Promise<unknown>,\n\twhat: string,\n): Promise<unknown> {\n\treturn promise.then(\n\t\t(answer) => {\n\t\t\tthrow new Error(`${what}\\n expected a rejection, got ${show(answer)}`);\n\t\t},\n\t\t(error: unknown) => error,\n\t);\n}\n\n/**\n * The `instanceof` probe: a class that is named like this package's but is not\n * this package's class means **two copies of `@softistx/janus`** are installed —\n * the adapter depends on it instead of peering it. Then `StoreConflict` stops\n * passing through the core, and a login that is taken is answered as an\n * outage.\n *\n * The probe says what breaks; `verify:artifacts` says whether a duplicate is\n * present. Both are needed.\n *\n * `name` is the error's own `name` field, passed rather than read from\n * `cls.name`: a bundler renames a class that collides — `StoreFailure2` in\n * `dist` — and the probe would then never recognise the duplicate.\n */\nexport function isOurs<T>(\n\terror: unknown,\n\tcls: abstract new (...args: never[]) => T,\n\tname: string,\n\twhat: string,\n): asserts error is T {\n\tif (error instanceof cls) return;\n\n\t// Same name, not the same class: the duplicate the probe exists for.\n\tif ((error as { name?: unknown } | null)?.name === name) {\n\t\tthrow new Error(\n\t\t\t`${what}\\n the error is named ${name} but is not @softistx/janus's ${name}: two copies of @softistx/janus are installed. The adapter must list it as a peer dependency, never a dependency`,\n\t\t);\n\t}\n\n\tthrow new Error(`${what}\\n expected ${name}, got ${show(error)}`);\n}\n\ninterface Difference {\n\treadonly path: string;\n\treadonly expected: unknown;\n\treadonly actual: unknown;\n}\n\nfunction differ(\n\tactual: unknown,\n\texpected: unknown,\n\tpath: string,\n): Difference | null {\n\tif (expected instanceof Date || actual instanceof Date) {\n\t\treturn actual instanceof Date &&\n\t\t\texpected instanceof Date &&\n\t\t\tactual.getTime() === expected.getTime()\n\t\t\t? null\n\t\t\t: { path, expected, actual };\n\t}\n\n\tif (Array.isArray(expected) || Array.isArray(actual)) {\n\t\tif (!Array.isArray(expected) || !Array.isArray(actual)) {\n\t\t\treturn { path, expected, actual };\n\t\t}\n\t\tif (expected.length !== actual.length) {\n\t\t\treturn {\n\t\t\t\tpath: `${path}.length`,\n\t\t\t\texpected: expected.length,\n\t\t\t\tactual: actual.length,\n\t\t\t};\n\t\t}\n\t\tfor (let i = 0; i < expected.length; i += 1) {\n\t\t\tconst inner = differ(actual[i], expected[i], `${path}[${i}]`);\n\t\t\tif (inner !== null) return inner;\n\t\t}\n\t\treturn null;\n\t}\n\n\tif (\n\t\ttypeof expected === 'object' &&\n\t\texpected !== null &&\n\t\ttypeof actual === 'object' &&\n\t\tactual !== null\n\t) {\n\t\tconst keys = new Set([...Object.keys(expected), ...Object.keys(actual)]);\n\t\tfor (const key of keys) {\n\t\t\tconst inner = differ(\n\t\t\t\t(actual as Record<string, unknown>)[key],\n\t\t\t\t(expected as Record<string, unknown>)[key],\n\t\t\t\tpath === '' ? key : `${path}.${key}`,\n\t\t\t);\n\t\t\tif (inner !== null) return inner;\n\t\t}\n\t\treturn null;\n\t}\n\n\treturn Object.is(actual, expected) ? null : { path, expected, actual };\n}\n\nfunction show(value: unknown): string {\n\tif (value instanceof Error) return `${value.name}: ${value.message}`;\n\tif (value instanceof Date) return value.toISOString();\n\tif (value === undefined) return 'undefined';\n\tif (typeof value === 'string') return JSON.stringify(value);\n\ttry {\n\t\tconst json = JSON.stringify(value);\n\t\treturn json.length > 200 ? `${json.slice(0, 200)}…` : json;\n\t} catch {\n\t\treturn String(value);\n\t}\n}\n",
6
+ "import type { ApiKeyRecord } from '../../auth/port/types';\nimport { mintId } from '../../ids/id';\n\n/** A standing key; override what a case is about. */\nexport function apiKey(overrides: Partial<ApiKeyRecord> = {}): ApiKeyRecord {\n\treturn {\n\t\tid: mintId(),\n\t\tuserId: mintId(),\n\t\tname: 'ci',\n\t\tsecretHash: 'a'.repeat(64),\n\t\tcreatedAt: new Date('2026-01-01T00:00:00.000Z'),\n\t\texpiresAt: new Date('2027-01-01T00:00:00.000Z'),\n\t\tlastUsedAt: null,\n\t\trevokedAt: null,\n\t\t...overrides,\n\t};\n}\n",
7
+ "import type { ApiKeyBound, ApiKeyStore } from '../../../auth/port/types';\nimport { mintId } from '../../../ids/id';\nimport { equal } from '../../assert';\nimport { apiKey } from '../fixtures';\nimport type { ApiKeyCase } from '../types';\n\nconst group = 'apiKeys';\nconst needs = 'bound';\nconst at = (iso: string) => new Date(iso);\n\n/** The `bound` capability's methods, present once the case runs: `needs` skipped it otherwise. */\nconst bound = (store: ApiKeyStore) =>\n\tstore as Required<\n\t\tPick<ApiKeyStore, 'listBoundApiKeys' | 'revokeBoundApiKeys'>\n\t> &\n\t\tApiKeyStore;\n\nconst workspace = (id: string): ApiKeyBound => ({ type: 'workspace', id });\n\nexport const apiKeyBoundCases: readonly ApiKeyCase[] = [\n\t{\n\t\tid: 'apiKeys.bound.insert',\n\t\tgroup,\n\t\tneeds,\n\t\tname: 'a store with the bound capability answers scopes and bound verbatim',\n\t\tasync run({ store }) {\n\t\t\tconst key = apiKey({\n\t\t\t\tscopes: ['mcp:read', 'mcp:write'],\n\t\t\t\tbound: workspace('w1'),\n\t\t\t});\n\t\t\tawait store.insertApiKey(key);\n\n\t\t\tequal(\n\t\t\t\tawait store.findApiKey(key.id),\n\t\t\t\tkey,\n\t\t\t\t'findApiKey: the scopes and the bound object as written',\n\t\t\t);\n\t\t\tconst unscoped = apiKey();\n\t\t\tawait store.insertApiKey(unscoped);\n\t\t\tequal(\n\t\t\t\tawait store.findApiKey(unscoped.id),\n\t\t\t\tunscoped,\n\t\t\t\t'findApiKey: a key without scopes or bound is answered without them',\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tid: 'apiKeys.bound.list',\n\t\tgroup,\n\t\tneeds,\n\t\tname: 'listBoundApiKeys pages the keys bound to one object in id order, whoever holds them and whatever their state',\n\t\tasync run({ store }) {\n\t\t\tconst s = bound(store);\n\t\t\tconst ids = [mintId(), mintId(), mintId()].sort();\n\t\t\tconst [a, b, c] = ids as [string, string, string];\n\t\t\t// Inserted out of order, by two users, one revoked.\n\t\t\tawait store.insertApiKey(apiKey({ id: c, bound: workspace('w1') }));\n\t\t\tawait store.insertApiKey(apiKey({ id: a, bound: workspace('w1') }));\n\t\t\tawait store.insertApiKey(apiKey({ id: b, bound: workspace('w1') }));\n\t\t\tawait store.revokeApiKey(b, at('2026-03-01T00:00:00.000Z'));\n\t\t\t// Another id, another type with the same id, and no binding at all.\n\t\t\tawait store.insertApiKey(apiKey({ bound: workspace('w2') }));\n\t\t\tawait store.insertApiKey(\n\t\t\t\tapiKey({ bound: { type: 'account', id: 'w1' } }),\n\t\t\t);\n\t\t\tawait store.insertApiKey(apiKey());\n\n\t\t\tconst first = await s.listBoundApiKeys(workspace('w1'), {\n\t\t\t\tfirst: 2,\n\t\t\t\tafter: null,\n\t\t\t});\n\t\t\tequal(\n\t\t\t\tfirst.items.map((key) => key.id),\n\t\t\t\t[a, b],\n\t\t\t\t'listBoundApiKeys: the first page, revoked keys included',\n\t\t\t);\n\t\t\tequal(first.nextCursor, b, 'listBoundApiKeys: nextCursor is the last id');\n\t\t\tconst second = await s.listBoundApiKeys(workspace('w1'), {\n\t\t\t\tfirst: 2,\n\t\t\t\tafter: first.nextCursor,\n\t\t\t});\n\t\t\tequal(\n\t\t\t\tsecond.items.map((key) => key.id),\n\t\t\t\t[c],\n\t\t\t\t'listBoundApiKeys: the second page',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tsecond.nextCursor,\n\t\t\t\tnull,\n\t\t\t\t'listBoundApiKeys: no cursor on the last page',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait s.listBoundApiKeys(workspace('nothing'), {\n\t\t\t\t\tfirst: 10,\n\t\t\t\t\tafter: null,\n\t\t\t\t}),\n\t\t\t\t{ items: [], nextCursor: null },\n\t\t\t\t'listBoundApiKeys: an object without keys has an empty page, never null',\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tid: 'apiKeys.bound.revoke',\n\t\tgroup,\n\t\tneeds,\n\t\tname: 'revokeBoundApiKeys revokes one user’s standing keys bound to one object, keeps earlier revokedAt, and counts what it revoked',\n\t\tasync run({ store }) {\n\t\t\tconst s = bound(store);\n\t\t\tconst userId = mintId();\n\t\t\tconst mine = [\n\t\t\t\tapiKey({ userId, bound: workspace('w1') }),\n\t\t\t\tapiKey({ userId, bound: workspace('w1') }),\n\t\t\t];\n\t\t\tconst already = apiKey({ userId, bound: workspace('w1') });\n\t\t\tconst elsewhere = apiKey({ userId, bound: workspace('w2') });\n\t\t\tconst unbound = apiKey({ userId });\n\t\t\tconst theirs = apiKey({ bound: workspace('w1') });\n\t\t\tfor (const key of [...mine, already, elsewhere, unbound, theirs]) {\n\t\t\t\tawait store.insertApiKey(key);\n\t\t\t}\n\t\t\tconst earlier = at('2026-05-01T00:00:00.000Z');\n\t\t\tconst now = at('2026-06-01T00:00:00.000Z');\n\t\t\tawait store.revokeApiKey(already.id, earlier);\n\n\t\t\tequal(\n\t\t\t\tawait s.revokeBoundApiKeys(userId, workspace('w1'), now),\n\t\t\t\t2,\n\t\t\t\t'revokeBoundApiKeys: counts the keys it revoked, not the ones already revoked',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\t(await store.findApiKey(mine[0]?.id ?? ''))?.revokedAt,\n\t\t\t\tnow,\n\t\t\t\t'revokeBoundApiKeys: a standing key is revoked at the instant given',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\t(await store.findApiKey(already.id))?.revokedAt,\n\t\t\t\tearlier,\n\t\t\t\t'revokeBoundApiKeys: an earlier revokedAt is kept',\n\t\t\t);\n\t\t\tfor (const [key, what] of [\n\t\t\t\t[elsewhere, 'a key bound to another object'],\n\t\t\t\t[unbound, 'an unbound key'],\n\t\t\t\t[theirs, 'another user’s key'],\n\t\t\t] as const) {\n\t\t\t\tequal(\n\t\t\t\t\t(await store.findApiKey(key.id))?.revokedAt,\n\t\t\t\t\tnull,\n\t\t\t\t\t`revokeBoundApiKeys: ${what} stands`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tequal(\n\t\t\t\tawait s.revokeBoundApiKeys(userId, workspace('w1'), now),\n\t\t\t\t0,\n\t\t\t\t'revokeBoundApiKeys replayed answers 0, not a failure',\n\t\t\t);\n\t\t},\n\t},\n];\n",
8
+ "import type { ApiKeyStore } from '../../../auth/port/types';\nimport { mintId } from '../../../ids/id';\nimport { equal } from '../../assert';\nimport { apiKey } from '../fixtures';\nimport type { ApiKeyCase } from '../types';\n\nconst group = 'apiKeys';\nconst needs = 'expiryNotice';\nconst at = (iso: string) => new Date(iso);\n\n/** The `expiryNotice` capability's methods, present once the case runs. */\nconst expiry = (store: ApiKeyStore) =>\n\tstore as Required<\n\t\tPick<ApiKeyStore, 'listExpiringApiKeys' | 'markApiKeyExpiryNotified'>\n\t> &\n\t\tApiKeyStore;\n\nconst now = at('2026-06-01T00:00:00.000Z');\nconst before = at('2026-06-08T00:00:00.000Z');\n\nexport const apiKeyExpiryCases: readonly ApiKeyCase[] = [\n\t{\n\t\tid: 'apiKeys.expiring',\n\t\tgroup,\n\t\tneeds,\n\t\tname: 'listExpiringApiKeys pages the standing keys lapsing after now and by before, not yet notified, in id order',\n\t\tasync run({ store }) {\n\t\t\tconst s = expiry(store);\n\t\t\tconst ids = [mintId(), mintId(), mintId()].sort();\n\t\t\tconst [a, b, c] = ids as [string, string, string];\n\t\t\tawait store.insertApiKey(apiKey({ id: c, expiresAt: before }));\n\t\t\tawait store.insertApiKey(\n\t\t\t\tapiKey({ id: a, expiresAt: at('2026-06-01T00:00:00.001Z') }),\n\t\t\t);\n\t\t\tawait store.insertApiKey(\n\t\t\t\tapiKey({ id: b, expiresAt: at('2026-06-03T00:00:00.000Z') }),\n\t\t\t);\n\t\t\t// Lapsed, too far, revoked, and already notified: none is listed.\n\t\t\tawait store.insertApiKey(apiKey({ expiresAt: now }));\n\t\t\tawait store.insertApiKey(\n\t\t\t\tapiKey({ expiresAt: at('2026-06-08T00:00:00.001Z') }),\n\t\t\t);\n\t\t\tconst revoked = apiKey({ expiresAt: at('2026-06-02T00:00:00.000Z') });\n\t\t\tawait store.insertApiKey(revoked);\n\t\t\tawait store.revokeApiKey(revoked.id, at('2026-05-01T00:00:00.000Z'));\n\t\t\tawait store.insertApiKey(\n\t\t\t\tapiKey({\n\t\t\t\t\texpiresAt: at('2026-06-02T00:00:00.000Z'),\n\t\t\t\t\texpiryNotifiedAt: at('2026-05-25T00:00:00.000Z'),\n\t\t\t\t}),\n\t\t\t);\n\n\t\t\tconst first = await s.listExpiringApiKeys({\n\t\t\t\tnow,\n\t\t\t\tbefore,\n\t\t\t\tfirst: 2,\n\t\t\t\tafter: null,\n\t\t\t});\n\t\t\tequal(\n\t\t\t\tfirst.items.map((key) => key.id),\n\t\t\t\t[a, b],\n\t\t\t\t'listExpiringApiKeys: the first page',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tfirst.nextCursor,\n\t\t\t\tb,\n\t\t\t\t'listExpiringApiKeys: nextCursor is the last id',\n\t\t\t);\n\t\t\tconst second = await s.listExpiringApiKeys({\n\t\t\t\tnow,\n\t\t\t\tbefore,\n\t\t\t\tfirst: 2,\n\t\t\t\tafter: first.nextCursor,\n\t\t\t});\n\t\t\tequal(\n\t\t\t\tsecond.items.map((key) => key.id),\n\t\t\t\t[c],\n\t\t\t\t'listExpiringApiKeys: the second page, a key lapsing at before included',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tsecond.nextCursor,\n\t\t\t\tnull,\n\t\t\t\t'listExpiringApiKeys: no cursor on the last page',\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tid: 'apiKeys.expiryNotified',\n\t\tgroup,\n\t\tneeds,\n\t\tname: 'markApiKeyExpiryNotified writes once, keeps the first instant, and drops the key from listExpiringApiKeys',\n\t\tasync run({ store }) {\n\t\t\tconst s = expiry(store);\n\t\t\tconst key = apiKey({ expiresAt: at('2026-06-03T00:00:00.000Z') });\n\t\t\tawait store.insertApiKey(key);\n\t\t\tconst first = at('2026-05-30T00:00:00.000Z');\n\n\t\t\tequal(\n\t\t\t\tawait s.markApiKeyExpiryNotified(key.id, first),\n\t\t\t\ttrue,\n\t\t\t\t'markApiKeyExpiryNotified: a key not yet notified is written',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait s.markApiKeyExpiryNotified(key.id, now),\n\t\t\t\tfalse,\n\t\t\t\t'markApiKeyExpiryNotified: a key already notified is left alone',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\t(await store.findApiKey(key.id))?.expiryNotifiedAt,\n\t\t\t\tfirst,\n\t\t\t\t'markApiKeyExpiryNotified: the first instant is kept',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\t(await s.listExpiringApiKeys({ now, before, first: 10, after: null }))\n\t\t\t\t\t.items,\n\t\t\t\t[],\n\t\t\t\t'listExpiringApiKeys: a notified key is left out',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait s.markApiKeyExpiryNotified(mintId(), now),\n\t\t\t\tfalse,\n\t\t\t\t'markApiKeyExpiryNotified: an unknown key is false, not a failure',\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tid: 'apiKeys.expiryNotified.concurrent',\n\t\tgroup,\n\t\tneeds,\n\t\tname: 'markApiKeyExpiryNotified lets exactly one of concurrent calls win',\n\t\tasync run({ store }) {\n\t\t\tconst s = expiry(store);\n\t\t\tconst key = apiKey();\n\t\t\tawait store.insertApiKey(key);\n\n\t\t\tconst answers = await Promise.all(\n\t\t\t\tArray.from({ length: 8 }, () =>\n\t\t\t\t\ts.markApiKeyExpiryNotified(key.id, now),\n\t\t\t\t),\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tanswers.filter(Boolean).length,\n\t\t\t\t1,\n\t\t\t\t'markApiKeyExpiryNotified: exactly one concurrent call answers true',\n\t\t\t);\n\t\t},\n\t},\n];\n",
9
+ "import { mintId } from '../../../ids/id';\nimport { equal, isNull } from '../../assert';\nimport { apiKey } from '../fixtures';\nimport type { ApiKeyCase } from '../types';\n\nconst group = 'apiKeys';\nconst at = (iso: string) => new Date(iso);\n\nexport const apiKeyInsertCases: readonly ApiKeyCase[] = [\n\t{\n\t\tid: 'apiKeys.insert',\n\t\tgroup,\n\t\tname: 'insertApiKey stores a key that findApiKey answers verbatim, and null for an unknown id',\n\t\tasync run({ store }) {\n\t\t\tconst key = apiKey({ lastUsedAt: at('2026-02-01T00:00:00.000Z') });\n\t\t\tawait store.insertApiKey(key);\n\n\t\t\tequal(\n\t\t\t\tawait store.findApiKey(key.id),\n\t\t\t\tkey,\n\t\t\t\t'findApiKey: the key as written',\n\t\t\t);\n\t\t\tisNull(\n\t\t\t\tawait store.findApiKey(mintId()),\n\t\t\t\t'findApiKey: an unknown id is null, not undefined',\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tid: 'apiKeys.insert.idempotent',\n\t\tgroup,\n\t\tname: 'insertApiKey is idempotent by id: a retry writes nothing and does not throw',\n\t\tasync run({ store }) {\n\t\t\tconst key = apiKey();\n\t\t\tawait store.insertApiKey(key);\n\t\t\tawait store.revokeApiKey(key.id, at('2026-03-01T00:00:00.000Z'));\n\t\t\tawait store.insertApiKey({\n\t\t\t\t...key,\n\t\t\t\tname: 'replayed',\n\t\t\t\tsecretHash: 'b'.repeat(64),\n\t\t\t});\n\n\t\t\tequal(\n\t\t\t\tawait store.findApiKey(key.id),\n\t\t\t\t{ ...key, revokedAt: at('2026-03-01T00:00:00.000Z') },\n\t\t\t\t'insertApiKey replayed should leave the stored key untouched',\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tid: 'apiKeys.list',\n\t\tgroup,\n\t\tname: 'listUserApiKeys pages one user’s keys in id order with a cursor, whatever their state, and leaves other users’ out',\n\t\tasync run({ store }) {\n\t\t\tconst userId = mintId();\n\t\t\tconst ids = [mintId(), mintId(), mintId()].sort();\n\t\t\t// Inserted out of order: the page is id order, not insertion order.\n\t\t\tconst [a, b, c] = ids as [string, string, string];\n\t\t\tawait store.insertApiKey(apiKey({ id: c, userId }));\n\t\t\tawait store.insertApiKey(apiKey({ id: a, userId }));\n\t\t\tawait store.insertApiKey(apiKey({ id: b, userId }));\n\t\t\tawait store.insertApiKey(apiKey({ userId: mintId() }));\n\t\t\tawait store.revokeApiKey(b, at('2026-03-01T00:00:00.000Z'));\n\n\t\t\tconst first = await store.listUserApiKeys(userId, {\n\t\t\t\tfirst: 2,\n\t\t\t\tafter: null,\n\t\t\t});\n\t\t\tequal(\n\t\t\t\tfirst.items.map((key) => key.id),\n\t\t\t\t[a, b],\n\t\t\t\t'listUserApiKeys: the first page, revoked keys included',\n\t\t\t);\n\t\t\tequal(first.nextCursor, b, 'listUserApiKeys: nextCursor is the last id');\n\n\t\t\tconst second = await store.listUserApiKeys(userId, {\n\t\t\t\tfirst: 2,\n\t\t\t\tafter: first.nextCursor,\n\t\t\t});\n\t\t\tequal(\n\t\t\t\tsecond.items.map((key) => key.id),\n\t\t\t\t[c],\n\t\t\t\t'listUserApiKeys: the last page',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tsecond.nextCursor,\n\t\t\t\tnull,\n\t\t\t\t'listUserApiKeys: the last page ends with null',\n\t\t\t);\n\n\t\t\tconst exact = await store.listUserApiKeys(userId, {\n\t\t\t\tfirst: 3,\n\t\t\t\tafter: null,\n\t\t\t});\n\t\t\tequal(\n\t\t\t\texact.nextCursor,\n\t\t\t\tnull,\n\t\t\t\t'listUserApiKeys: a page that ends exactly has no cursor',\n\t\t\t);\n\n\t\t\tequal(\n\t\t\t\tawait store.listUserApiKeys(userId, { first: 5, after: c }),\n\t\t\t\t{ items: [], nextCursor: null },\n\t\t\t\t'listUserApiKeys: past the end is an empty page',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait store.listUserApiKeys(mintId(), { first: 5, after: null }),\n\t\t\t\t{ items: [], nextCursor: null },\n\t\t\t\t'listUserApiKeys: a user without keys has an empty page, never null',\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tid: 'apiKeys.list.after-unknown',\n\t\tgroup,\n\t\tname: 'listUserApiKeys with an after that names no stored key answers the keys past it in id order',\n\t\tasync run({ store }) {\n\t\t\tconst userId = mintId();\n\t\t\tconst [a, b, c] = [mintId(), mintId(), mintId()].sort() as [\n\t\t\t\tstring,\n\t\t\t\tstring,\n\t\t\t\tstring,\n\t\t\t];\n\t\t\tawait store.insertApiKey(apiKey({ id: a, userId }));\n\t\t\tawait store.insertApiKey(apiKey({ id: c, userId }));\n\n\t\t\t// `b` sorts between the two and was never stored.\n\t\t\tconst page = await store.listUserApiKeys(userId, {\n\t\t\t\tfirst: 5,\n\t\t\t\tafter: b,\n\t\t\t});\n\n\t\t\tequal(\n\t\t\t\tpage.items.map((key) => key.id),\n\t\t\t\t[c],\n\t\t\t\t'listUserApiKeys: a cursor naming no stored key still pages past it',\n\t\t\t);\n\t\t\tequal(page.nextCursor, null, 'listUserApiKeys: and ends with null');\n\t\t},\n\t},\n\t{\n\t\tid: 'apiKeys.lapsed',\n\t\tgroup,\n\t\tname: 'a lapsed key is still found and listed: expiry is the core’s to read, not the store’s',\n\t\tasync run({ store }) {\n\t\t\tconst userId = mintId();\n\t\t\tconst key = apiKey({\n\t\t\t\tuserId,\n\t\t\t\tcreatedAt: at('2020-01-01T00:00:00.000Z'),\n\t\t\t\texpiresAt: at('2020-02-01T00:00:00.000Z'),\n\t\t\t});\n\t\t\tawait store.insertApiKey(key);\n\n\t\t\tequal(\n\t\t\t\tawait store.findApiKey(key.id),\n\t\t\t\tkey,\n\t\t\t\t'findApiKey: a lapsed key is answered as written',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\t(await store.listUserApiKeys(userId, { first: 5, after: null })).items,\n\t\t\t\t[key],\n\t\t\t\t'listUserApiKeys: a lapsed key is listed',\n\t\t\t);\n\t\t},\n\t},\n];\n",
10
+ "import { mintId } from '../../../ids/id';\nimport { equal, isNull } from '../../assert';\nimport { apiKey } from '../fixtures';\nimport type { ApiKeyCase } from '../types';\n\nconst group = 'apiKeys';\nconst at = (iso: string) => new Date(iso);\n\nexport const apiKeyRevokeCases: readonly ApiKeyCase[] = [\n\t{\n\t\tid: 'apiKeys.revoke',\n\t\tgroup,\n\t\tname: 'revokeApiKey answers whether the key exists and keeps the first revokedAt',\n\t\tasync run({ store }) {\n\t\t\tconst key = apiKey();\n\t\t\tawait store.insertApiKey(key);\n\t\t\tconst first = at('2026-05-01T00:00:00.000Z');\n\n\t\t\tequal(\n\t\t\t\tawait store.revokeApiKey(key.id, first),\n\t\t\t\ttrue,\n\t\t\t\t'revokeApiKey: a standing key',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait store.revokeApiKey(key.id, at('2026-06-01T00:00:00.000Z')),\n\t\t\t\ttrue,\n\t\t\t\t'revokeApiKey: a key already revoked still exists',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\t(await store.findApiKey(key.id))?.revokedAt,\n\t\t\t\tfirst,\n\t\t\t\t'revokeApiKey: the first revokedAt is kept',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait store.revokeApiKey(mintId(), first),\n\t\t\t\tfalse,\n\t\t\t\t'revokeApiKey: an unknown key is false, not a failure',\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tid: 'apiKeys.revokeUser',\n\t\tgroup,\n\t\tname: 'revokeUserApiKeys revokes only that user’s standing keys, keeps earlier revokedAt, and counts what this call revoked',\n\t\tasync run({ store }) {\n\t\t\tconst userId = mintId();\n\t\t\tconst already = apiKey({ userId });\n\t\t\tconst standing = [apiKey({ userId }), apiKey({ userId })];\n\t\t\tconst other = apiKey();\n\t\t\tfor (const key of [already, ...standing, other])\n\t\t\t\tawait store.insertApiKey(key);\n\t\t\tconst earlier = at('2026-05-01T00:00:00.000Z');\n\t\t\tawait store.revokeApiKey(already.id, earlier);\n\n\t\t\tequal(\n\t\t\t\tawait store.revokeUserApiKeys(userId, at('2026-06-01T00:00:00.000Z')),\n\t\t\t\t2,\n\t\t\t\t'revokeUserApiKeys: counts the keys it revoked, not the ones already revoked',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\t(await store.findApiKey(already.id))?.revokedAt,\n\t\t\t\tearlier,\n\t\t\t\t'revokeUserApiKeys: an earlier revokedAt is kept',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\t(await store.findApiKey(standing[0]?.id ?? ''))?.revokedAt,\n\t\t\t\tat('2026-06-01T00:00:00.000Z'),\n\t\t\t\t'revokeUserApiKeys: a standing key is revoked at the instant given',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\t(await store.findApiKey(other.id))?.revokedAt,\n\t\t\t\tnull,\n\t\t\t\t'revokeUserApiKeys: another user’s key stands',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait store.revokeUserApiKeys(userId, at('2026-07-01T00:00:00.000Z')),\n\t\t\t\t0,\n\t\t\t\t'revokeUserApiKeys replayed answers 0, not a failure',\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tid: 'apiKeys.deleteUser',\n\t\tgroup,\n\t\tname: 'deleteUserApiKeys deletes every key of that user, revoked or not, and counts them',\n\t\tasync run({ store }) {\n\t\t\tconst userId = mintId();\n\t\t\tconst keys = [apiKey({ userId }), apiKey({ userId })];\n\t\t\tconst other = apiKey();\n\t\t\tfor (const key of [...keys, other]) await store.insertApiKey(key);\n\t\t\tawait store.revokeApiKey(\n\t\t\t\tkeys[0]?.id ?? '',\n\t\t\t\tat('2026-05-01T00:00:00.000Z'),\n\t\t\t);\n\n\t\t\tequal(\n\t\t\t\tawait store.deleteUserApiKeys(userId),\n\t\t\t\t2,\n\t\t\t\t'deleteUserApiKeys: how many it deleted',\n\t\t\t);\n\t\t\tisNull(\n\t\t\t\tawait store.findApiKey(keys[1]?.id ?? ''),\n\t\t\t\t'deleteUserApiKeys: the key is gone',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\t(await store.findApiKey(other.id))?.id,\n\t\t\t\tother.id,\n\t\t\t\t'deleteUserApiKeys: another user’s key stays',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait store.deleteUserApiKeys(userId),\n\t\t\t\t0,\n\t\t\t\t'deleteUserApiKeys replayed answers 0, not a failure',\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tid: 'apiKeys.deleteExpired',\n\t\tgroup,\n\t\tname: 'deleteExpiredApiKeys deletes the keys whose expiresAt is at or before the instant, and counts them',\n\t\tasync run({ store }) {\n\t\t\tif (store.deleteExpiredApiKeys === undefined) return;\n\t\t\tconst before = at('2026-08-01T00:00:00.000Z');\n\t\t\tconst lapsed = apiKey({ expiresAt: before });\n\t\t\tconst older = apiKey({ expiresAt: at('2026-07-01T00:00:00.000Z') });\n\t\t\tconst live = apiKey({ expiresAt: at('2026-08-01T00:00:00.001Z') });\n\t\t\tfor (const key of [lapsed, older, live]) await store.insertApiKey(key);\n\n\t\t\tequal(\n\t\t\t\tawait store.deleteExpiredApiKeys(before),\n\t\t\t\t2,\n\t\t\t\t'deleteExpiredApiKeys: how many it deleted',\n\t\t\t);\n\t\t\tisNull(\n\t\t\t\tawait store.findApiKey(lapsed.id),\n\t\t\t\t'deleteExpiredApiKeys: a lapsed key is gone',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\t(await store.findApiKey(live.id))?.id,\n\t\t\t\tlive.id,\n\t\t\t\t'deleteExpiredApiKeys: a live key stays',\n\t\t\t);\n\t\t},\n\t},\n];\n",
11
+ "import { mintId } from '../../../ids/id';\nimport { equal } from '../../assert';\nimport { apiKey } from '../fixtures';\nimport type { ApiKeyCase } from '../types';\n\nconst group = 'apiKeys';\nconst at = (iso: string) => new Date(iso);\n\nexport const apiKeyTouchCases: readonly ApiKeyCase[] = [\n\t{\n\t\tid: 'apiKeys.touch',\n\t\tgroup,\n\t\tname: 'touchApiKey writes lastUsedAt only for a key never used or used before staleBefore, and answers whether it wrote',\n\t\tasync run({ store }) {\n\t\t\tconst key = apiKey();\n\t\t\tawait store.insertApiKey(key);\n\t\t\tconst t1 = at('2026-04-01T12:00:00.000Z');\n\t\t\tconst t2 = at('2026-04-01T12:30:00.000Z');\n\t\t\tconst t3 = at('2026-04-01T13:30:00.000Z');\n\n\t\t\tequal(\n\t\t\t\tawait store.touchApiKey(key.id, t1, at('2026-04-01T11:00:00.000Z')),\n\t\t\t\ttrue,\n\t\t\t\t'touchApiKey: a key never used is written',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\t(await store.findApiKey(key.id))?.lastUsedAt,\n\t\t\t\tt1,\n\t\t\t\t'touchApiKey: lastUsedAt is the instant given',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait store.touchApiKey(key.id, t2, at('2026-04-01T11:30:00.000Z')),\n\t\t\t\tfalse,\n\t\t\t\t'touchApiKey: a key used at or after staleBefore is left alone',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\t(await store.findApiKey(key.id))?.lastUsedAt,\n\t\t\t\tt1,\n\t\t\t\t'touchApiKey: a refused touch changes nothing',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait store.touchApiKey(key.id, t3, at('2026-04-01T12:30:00.000Z')),\n\t\t\t\ttrue,\n\t\t\t\t'touchApiKey: a key last used before staleBefore is written',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait store.touchApiKey(key.id, at('2026-04-01T14:00:00.000Z'), t3),\n\t\t\t\tfalse,\n\t\t\t\t'touchApiKey: a key last used exactly at staleBefore is left alone',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\t(await store.findApiKey(key.id))?.lastUsedAt,\n\t\t\t\tt3,\n\t\t\t\t'touchApiKey: a key used exactly at staleBefore keeps its lastUsedAt',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait store.touchApiKey(mintId(), t3, t3),\n\t\t\t\tfalse,\n\t\t\t\t'touchApiKey: an unknown key is false, not a failure',\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tid: 'apiKeys.touch.concurrent',\n\t\tgroup,\n\t\tname: 'touchApiKey: of concurrent calls on a stale key exactly one answers true',\n\t\tasync run({ store }) {\n\t\t\tconst key = apiKey();\n\t\t\tawait store.insertApiKey(key);\n\t\t\tconst at1 = at('2026-04-01T12:00:00.000Z');\n\t\t\tconst stale = at('2026-04-01T11:00:00.000Z');\n\n\t\t\tconst results = await Promise.all(\n\t\t\t\tArray.from({ length: 10 }, () => store.touchApiKey(key.id, at1, stale)),\n\t\t\t);\n\n\t\t\tequal(\n\t\t\t\tresults.filter(Boolean).length,\n\t\t\t\t1,\n\t\t\t\t'touchApiKey: exactly one of ten concurrent calls should have written',\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tid: 'apiKeys.touch.revoked',\n\t\tgroup,\n\t\tname: 'touchApiKey never writes a revoked key',\n\t\tasync run({ store }) {\n\t\t\tconst key = apiKey();\n\t\t\tawait store.insertApiKey(key);\n\t\t\tawait store.revokeApiKey(key.id, at('2026-04-01T00:00:00.000Z'));\n\n\t\t\tequal(\n\t\t\t\tawait store.touchApiKey(\n\t\t\t\t\tkey.id,\n\t\t\t\t\tat('2026-04-02T00:00:00.000Z'),\n\t\t\t\t\tat('2026-04-03T00:00:00.000Z'),\n\t\t\t\t),\n\t\t\t\tfalse,\n\t\t\t\t'touchApiKey: a revoked key is false',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\t(await store.findApiKey(key.id))?.lastUsedAt,\n\t\t\t\tnull,\n\t\t\t\t'touchApiKey: a revoked key stays unused',\n\t\t\t);\n\t\t},\n\t},\n];\n",
12
+ "import type { ApiKeyBound, ApiKeyStore } from '../../../auth/port/types';\nimport { mintId } from '../../../ids/id';\nimport { equal } from '../../assert';\nimport { apiKey } from '../fixtures';\nimport type { ApiKeyCase } from '../types';\n\nconst group = 'apiKeys';\nconst needs = ['bound', 'userBound'] as const;\nconst at = (iso: string) => new Date(iso);\n\n/** The `userBound` capability's method, present once the case runs: `needs` skipped it otherwise. */\nconst userBound = (store: ApiKeyStore) =>\n\tstore as Required<Pick<ApiKeyStore, 'listUserBoundApiKeys'>> & ApiKeyStore;\n\nconst workspace = (id: string): ApiKeyBound => ({ type: 'workspace', id });\n\nexport const apiKeyUserBoundCases: readonly ApiKeyCase[] = [\n\t{\n\t\tid: 'apiKeys.userBound.list',\n\t\tgroup,\n\t\tneeds,\n\t\tname: 'listUserBoundApiKeys pages one user’s keys bound to one object in id order, whatever their state',\n\t\tasync run({ store }) {\n\t\t\tconst s = userBound(store);\n\t\t\tconst userId = mintId();\n\t\t\tconst [a, b, c] = [mintId(), mintId(), mintId()].sort() as [\n\t\t\t\tstring,\n\t\t\t\tstring,\n\t\t\t\tstring,\n\t\t\t];\n\t\t\t// Inserted out of order, one revoked, one lapsed.\n\t\t\tawait store.insertApiKey(\n\t\t\t\tapiKey({ id: c, userId, bound: workspace('w1') }),\n\t\t\t);\n\t\t\tawait store.insertApiKey(\n\t\t\t\tapiKey({\n\t\t\t\t\tid: a,\n\t\t\t\t\tuserId,\n\t\t\t\t\tbound: workspace('w1'),\n\t\t\t\t\texpiresAt: at('2020-01-01T00:00:00.000Z'),\n\t\t\t\t}),\n\t\t\t);\n\t\t\tawait store.insertApiKey(\n\t\t\t\tapiKey({ id: b, userId, bound: workspace('w1') }),\n\t\t\t);\n\t\t\tawait store.revokeApiKey(b, at('2026-03-01T00:00:00.000Z'));\n\t\t\t// Another object, another type with the same id, no binding, and\n\t\t\t// another user's key bound to the same object.\n\t\t\tawait store.insertApiKey(apiKey({ userId, bound: workspace('w2') }));\n\t\t\tawait store.insertApiKey(\n\t\t\t\tapiKey({ userId, bound: { type: 'account', id: 'w1' } }),\n\t\t\t);\n\t\t\tawait store.insertApiKey(apiKey({ userId }));\n\t\t\tawait store.insertApiKey(apiKey({ bound: workspace('w1') }));\n\n\t\t\tconst first = await s.listUserBoundApiKeys(userId, workspace('w1'), {\n\t\t\t\tfirst: 2,\n\t\t\t\tafter: null,\n\t\t\t});\n\t\t\tequal(\n\t\t\t\tfirst.items.map((key) => key.id),\n\t\t\t\t[a, b],\n\t\t\t\t'listUserBoundApiKeys: the first page, revoked and lapsed keys included, no other user’s key',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tfirst.nextCursor,\n\t\t\t\tb,\n\t\t\t\t'listUserBoundApiKeys: nextCursor is the last id',\n\t\t\t);\n\t\t\tconst second = await s.listUserBoundApiKeys(userId, workspace('w1'), {\n\t\t\t\tfirst: 2,\n\t\t\t\tafter: first.nextCursor,\n\t\t\t});\n\t\t\tequal(\n\t\t\t\tsecond.items.map((key) => key.id),\n\t\t\t\t[c],\n\t\t\t\t'listUserBoundApiKeys: the second page',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tsecond.nextCursor,\n\t\t\t\tnull,\n\t\t\t\t'listUserBoundApiKeys: no cursor on the last page',\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tid: 'apiKeys.userBound.unbound',\n\t\tgroup,\n\t\tneeds,\n\t\tname: 'listUserBoundApiKeys with null pages only the user’s unbound keys',\n\t\tasync run({ store }) {\n\t\t\tconst s = userBound(store);\n\t\t\tconst userId = mintId();\n\t\t\tconst [a, b, c] = [mintId(), mintId(), mintId()].sort() as [\n\t\t\t\tstring,\n\t\t\t\tstring,\n\t\t\t\tstring,\n\t\t\t];\n\t\t\tawait store.insertApiKey(apiKey({ id: c, userId }));\n\t\t\tawait store.insertApiKey(apiKey({ id: a, userId }));\n\t\t\tawait store.insertApiKey(apiKey({ id: b, userId }));\n\t\t\tawait store.insertApiKey(apiKey({ userId, bound: workspace('w1') }));\n\t\t\tawait store.insertApiKey(apiKey());\n\n\t\t\tconst first = await s.listUserBoundApiKeys(userId, null, {\n\t\t\t\tfirst: 2,\n\t\t\t\tafter: null,\n\t\t\t});\n\t\t\tequal(\n\t\t\t\tfirst.items.map((key) => key.id),\n\t\t\t\t[a, b],\n\t\t\t\t'listUserBoundApiKeys(null): the user’s unbound keys only, in id order',\n\t\t\t);\n\t\t\tequal(first.nextCursor, b, 'listUserBoundApiKeys(null): nextCursor');\n\t\t\tconst second = await s.listUserBoundApiKeys(userId, null, {\n\t\t\t\tfirst: 2,\n\t\t\t\tafter: first.nextCursor,\n\t\t\t});\n\t\t\tequal(\n\t\t\t\t[second.items.map((key) => key.id), second.nextCursor],\n\t\t\t\t[[c], null],\n\t\t\t\t'listUserBoundApiKeys(null): the second page',\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tid: 'apiKeys.userBound.none',\n\t\tgroup,\n\t\tneeds,\n\t\tname: 'listUserBoundApiKeys answers an empty page, never null, for nothing bound and for an unknown cursor',\n\t\tasync run({ store }) {\n\t\t\tconst s = userBound(store);\n\t\t\tconst userId = mintId();\n\t\t\tconst key = apiKey({ userId, bound: workspace('w1') });\n\t\t\tawait store.insertApiKey(key);\n\t\t\tconst empty = { items: [], nextCursor: null };\n\n\t\t\tequal(\n\t\t\t\tawait s.listUserBoundApiKeys(userId, workspace('nothing'), {\n\t\t\t\t\tfirst: 10,\n\t\t\t\t\tafter: null,\n\t\t\t\t}),\n\t\t\t\tempty,\n\t\t\t\t'listUserBoundApiKeys: an object the user has no key for',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait s.listUserBoundApiKeys(mintId(), workspace('w1'), {\n\t\t\t\t\tfirst: 10,\n\t\t\t\t\tafter: null,\n\t\t\t\t}),\n\t\t\t\tempty,\n\t\t\t\t'listUserBoundApiKeys: a user without keys',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait s.listUserBoundApiKeys(userId, null, {\n\t\t\t\t\tfirst: 10,\n\t\t\t\t\tafter: null,\n\t\t\t\t}),\n\t\t\t\tempty,\n\t\t\t\t'listUserBoundApiKeys(null): a user with bound keys only',\n\t\t\t);\n\t\t\tconst unknown = await s.listUserBoundApiKeys(userId, workspace('w1'), {\n\t\t\t\tfirst: 10,\n\t\t\t\tafter: '00000000-0000-7000-8000-000000000000',\n\t\t\t});\n\t\t\tequal(\n\t\t\t\tunknown.items.map((found) => found.id),\n\t\t\t\t[key.id],\n\t\t\t\t'listUserBoundApiKeys: an after naming no stored key still pages',\n\t\t\t);\n\t\t},\n\t},\n];\n",
13
+ "import type { ApiKeyCase } from '../types';\nimport { apiKeyBoundCases } from './bound';\nimport { apiKeyExpiryCases } from './expiry';\nimport { apiKeyInsertCases } from './insert';\nimport { apiKeyRevokeCases } from './revoke';\nimport { apiKeyTouchCases } from './touch';\nimport { apiKeyUserBoundCases } from './user-bound';\n\n/** Every case of the API key store, outages aside, in the order they are described. */\nexport const apiKeyStoreCases: readonly ApiKeyCase[] = [\n\t...apiKeyInsertCases,\n\t...apiKeyTouchCases,\n\t...apiKeyRevokeCases,\n\t...apiKeyBoundCases,\n\t...apiKeyUserBoundCases,\n\t...apiKeyExpiryCases,\n];\n",
14
+ "import type { ApiKeyStore } from '../../../auth/port/types';\nimport { JanusError, StoreFailure } from '../../../errors/janus-error';\nimport { equal, isOurs, ok, rejects } from '../../assert';\nimport { apiKey } from '../fixtures';\nimport type { ApiKeyCase, ApiKeyMethod } from '../types';\n\nconst seeded = apiKey({ id: '00000000-0000-7000-8000-000000000001' });\nconst boundTo = { type: 'workspace', id: 'w1' } as const;\n/** The seed of a `bound` case: only a store with the capability is handed a bound key. */\nconst seededBound = { ...seeded, bound: boundTo };\nconst when = new Date('2026-09-01T00:00:00.000Z');\n\n/**\n * For each method, a store that cannot answer must **reject** — never\n * `null`, `false`, `0` or an empty page. A key store that answers `null` for\n * an outage tells every holder of a valid key that it does not exist; one that\n * answers `true` or resolves a revocation it did not make leaves a stolen key\n * standing.\n */\nfunction outage(\n\tmethod: ApiKeyMethod,\n\tcall: (store: ApiKeyStore) => Promise<unknown>,\n\tafter?: (store: ApiKeyStore) => Promise<void>,\n\tcapability?: 'bound' | 'userBound' | 'expiryNotice',\n): ApiKeyCase {\n\tconst seed =\n\t\tcapability === 'bound' || capability === 'userBound' ? seededBound : seeded;\n\treturn {\n\t\tid: `outage.${method}`,\n\t\tgroup: 'outage',\n\t\tname: `apiKeys.${method} rejects when the store cannot answer — never null, false, 0 or an empty page`,\n\t\tneeds: capability === undefined ? 'faults' : ['faults', capability],\n\t\tasync run({ store, faults }) {\n\t\t\tawait store.insertApiKey(seed);\n\t\t\tawait faults?.fail(method);\n\n\t\t\tconst error = await rejects(\n\t\t\t\tcall(store),\n\t\t\t\t`apiKeys.${method} under an outage should reject`,\n\t\t\t);\n\t\t\tif (\n\t\t\t\terror instanceof JanusError ||\n\t\t\t\t(error as { name?: unknown })?.name === 'StoreFailure'\n\t\t\t) {\n\t\t\t\tisOurs(\n\t\t\t\t\terror,\n\t\t\t\t\tStoreFailure,\n\t\t\t\t\t'StoreFailure',\n\t\t\t\t\t`apiKeys.${method} under an outage`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tok(\n\t\t\t\t(error as { code?: unknown } | null)?.code !== 'NOT_FOUND',\n\t\t\t\t`apiKeys.${method} under an outage rejected with NOT_FOUND: an outage is never an absence`,\n\t\t\t);\n\t\t\tawait after?.(store);\n\t\t},\n\t};\n}\n\n/** A case about an optional method: passes for a store that does not have it. */\nfunction optional(apiKeyCase: ApiKeyCase): ApiKeyCase {\n\tconst method = apiKeyCase.id.slice('outage.'.length) as ApiKeyMethod;\n\treturn {\n\t\t...apiKeyCase,\n\t\tasync run(context) {\n\t\t\tif (context.store[method] === undefined) return;\n\t\t\tawait apiKeyCase.run(context);\n\t\t},\n\t};\n}\n\n/** A rejected write is one that did nothing. */\nconst unrevoked = async (store: ApiKeyStore) =>\n\tequal(\n\t\t(await store.findApiKey(seeded.id))?.revokedAt,\n\t\tnull,\n\t\t'a rejected revocation should have changed nothing',\n\t);\n\nexport const apiKeyOutageCases: readonly ApiKeyCase[] = [\n\toutage('insertApiKey', (store) => store.insertApiKey(apiKey())),\n\toutage('findApiKey', (store) => store.findApiKey(seeded.id)),\n\toutage('listUserApiKeys', (store) =>\n\t\tstore.listUserApiKeys(seeded.userId, { first: 10, after: null }),\n\t),\n\toutage('touchApiKey', (store) => store.touchApiKey(seeded.id, when, when)),\n\toutage(\n\t\t'revokeApiKey',\n\t\t(store) => store.revokeApiKey(seeded.id, when),\n\t\tunrevoked,\n\t),\n\toutage(\n\t\t'revokeUserApiKeys',\n\t\t(store) => store.revokeUserApiKeys(seeded.userId, when),\n\t\tunrevoked,\n\t),\n\toutage(\n\t\t'deleteUserApiKeys',\n\t\t(store) => store.deleteUserApiKeys(seeded.userId),\n\t\tasync (store) =>\n\t\t\tequal(\n\t\t\t\t(await store.findApiKey(seeded.id))?.id,\n\t\t\t\tseeded.id,\n\t\t\t\t'a rejected deletion should have deleted nothing',\n\t\t\t),\n\t),\n\toptional(\n\t\toutage('deleteExpiredApiKeys', (store) =>\n\t\t\t(\n\t\t\t\tstore.deleteExpiredApiKeys as NonNullable<\n\t\t\t\t\ttypeof store.deleteExpiredApiKeys\n\t\t\t\t>\n\t\t\t)(new Date('2100-01-01T00:00:00.000Z')),\n\t\t),\n\t),\n\toutage(\n\t\t'listBoundApiKeys',\n\t\t(store) =>\n\t\t\tpresent(store.listBoundApiKeys)(boundTo, { first: 10, after: null }),\n\t\tundefined,\n\t\t'bound',\n\t),\n\toutage(\n\t\t'revokeBoundApiKeys',\n\t\t(store) => present(store.revokeBoundApiKeys)(seeded.userId, boundTo, when),\n\t\tunrevoked,\n\t\t'bound',\n\t),\n\toutage(\n\t\t'listUserBoundApiKeys',\n\t\t(store) =>\n\t\t\tpresent(store.listUserBoundApiKeys)(seeded.userId, boundTo, {\n\t\t\t\tfirst: 10,\n\t\t\t\tafter: null,\n\t\t\t}),\n\t\tundefined,\n\t\t'userBound',\n\t),\n\toutage(\n\t\t'listExpiringApiKeys',\n\t\t(store) =>\n\t\t\tpresent(store.listExpiringApiKeys)({\n\t\t\t\tnow: when,\n\t\t\t\tbefore: new Date('2100-01-01T00:00:00.000Z'),\n\t\t\t\tfirst: 10,\n\t\t\t\tafter: null,\n\t\t\t}),\n\t\tundefined,\n\t\t'expiryNotice',\n\t),\n\toutage(\n\t\t'markApiKeyExpiryNotified',\n\t\t(store) => present(store.markApiKeyExpiryNotified)(seeded.id, when),\n\t\tasync (store) =>\n\t\t\tequal(\n\t\t\t\t(await store.findApiKey(seeded.id))?.expiryNotifiedAt,\n\t\t\t\tundefined,\n\t\t\t\t'a rejected notice should have recorded nothing',\n\t\t\t),\n\t\t'expiryNotice',\n\t),\n];\n\n/** An optional method the case's `needs` proved present. */\nfunction present<F>(method: F | undefined): F {\n\treturn method as F;\n}\n",
15
+ "import type {\n\tPasskeyRecord,\n\tPasskeyStore,\n\tSessionRecord,\n\tSocialLinkRecord,\n\tSocialLinkStore,\n\tTokenRecord,\n\tUserRecord,\n} from '../auth/port/types';\nimport { mintId } from '../ids/id';\n\n/**\n * Records the cases write. Every id is minted, so no two cases — and no two\n * records of one case — ever collide by accident; every collision a case\n * tests is one it wrote on purpose.\n */\n\nexport const at = (iso: string): Date => new Date(iso);\n\n/** A fresh login, so each record holds its own unless a case says otherwise. */\nconst fresh = () => `user-${mintId()}@example.test`;\n\nexport function userRecord(overrides: Partial<UserRecord> = {}): UserRecord {\n\tconst email = fresh();\n\treturn {\n\t\tid: mintId(),\n\t\ttype: 'user',\n\t\tschemaVersion: '1',\n\t\tactive: true,\n\t\tfields: { email, name: { first: 'Ada', last: 'Lovelace' } },\n\t\tlogins: [email],\n\t\tpassword: {\n\t\t\thash: '$scrypt$ln=17,r=8,p=1$c2FsdA==$a2V5',\n\t\t\tupdatedAt: at('2026-01-01T00:00:00.000Z'),\n\t\t},\n\t\tsecondFactor: null,\n\t\tavatar: null,\n\t\temailVerifiedAt: null,\n\t\tversion: 0,\n\t\tcreatedAt: at('2026-01-01T00:00:00.000Z'),\n\t\tupdatedAt: at('2026-01-01T00:00:00.000Z'),\n\t\t...overrides,\n\t};\n}\n\nexport function sessionRecord(\n\toverrides: Partial<SessionRecord> = {},\n): SessionRecord {\n\treturn {\n\t\tid: mintId(),\n\t\ttokenHash: hexOf(mintId()),\n\t\tuserId: mintId(),\n\t\tauthenticatedAt: at('2026-01-01T00:00:00.000Z'),\n\t\texpiresAt: at('2099-01-01T00:00:00.000Z'),\n\t\trevokedAt: null,\n\t\tcreatedAt: at('2026-01-01T00:00:00.000Z'),\n\t\t...overrides,\n\t};\n}\n\nexport function tokenRecord(overrides: Partial<TokenRecord> = {}): TokenRecord {\n\treturn {\n\t\ttokenHash: hexOf(mintId()),\n\t\tkind: 'resetPassword',\n\t\tuserId: mintId(),\n\t\taddress: fresh(),\n\t\tcodeHash: null,\n\t\tattempts: 0,\n\t\texpiresAt: at('2099-01-01T00:00:00.000Z'),\n\t\tspentAt: null,\n\t\tcreatedAt: at('2026-01-01T00:00:00.000Z'),\n\t\t...overrides,\n\t};\n}\n\n/** A link with its own minted account id, so no two collide by accident. */\nexport function socialLinkRecord(\n\toverrides: Partial<SocialLinkRecord> = {},\n): SocialLinkRecord {\n\treturn {\n\t\tprovider: 'google',\n\t\taccountId: `acct-${mintId()}`,\n\t\tuserId: mintId(),\n\t\temail: fresh(),\n\t\tcreatedAt: at('2026-01-01T00:00:00.000Z'),\n\t\t...overrides,\n\t};\n}\n\n/**\n * The `socialLinks` slot of the stores a case runs against. Every case that\n * calls it declares `needs: 'socialLinks'`, so the runner has already skipped\n * it when the slot is absent; the throw is for a case written without it.\n */\nexport function socialLinksOf(stores: {\n\treadonly socialLinks?: SocialLinkStore;\n}): SocialLinkStore {\n\tif (stores.socialLinks === undefined) {\n\t\tthrow new Error(\n\t\t\t'this case needs stores.socialLinks: declare needs: \"socialLinks\"',\n\t\t);\n\t}\n\treturn stores.socialLinks;\n}\n\n/** A passkey with its own minted credential id, so no two collide by accident. */\nexport function passkeyRecord(\n\toverrides: Partial<PasskeyRecord> = {},\n): PasskeyRecord {\n\treturn {\n\t\tcredentialId: `cred-${mintId()}`,\n\t\tuserId: mintId(),\n\t\tpublicKey: 'pQECAyYgASFYIEdA_-Zq0wFfX3k8w1x2yq9uZ7Jm',\n\t\tcounter: 0,\n\t\ttransports: ['internal', 'hybrid'],\n\t\taaguid: '00000000-0000-0000-0000-000000000000',\n\t\tbackupEligible: true,\n\t\tbackedUp: false,\n\t\tname: 'Laptop',\n\t\tcreatedAt: at('2026-01-01T00:00:00.000Z'),\n\t\tlastUsedAt: null,\n\t\t...overrides,\n\t};\n}\n\n/**\n * The `passkeys` slot of the stores a case runs against. Every case that\n * calls it declares `needs: 'passkeys'`, so the runner has already skipped it\n * when the slot is absent; the throw is for a case written without it.\n */\nexport function passkeysOf(stores: {\n\treadonly passkeys?: PasskeyStore;\n}): PasskeyStore {\n\tif (stores.passkeys === undefined) {\n\t\tthrow new Error(\n\t\t\t'this case needs stores.passkeys: declare needs: \"passkeys\"',\n\t\t);\n\t}\n\treturn stores.passkeys;\n}\n\n/** A 64-character hex string, shaped like a `sha256`, unique per call. */\nfunction hexOf(seed: string): string {\n\treturn seed.replace(/-/g, '').padEnd(64, '0').slice(0, 64);\n}\n",
16
+ "import type { JanusStores } from '../../auth/port/types';\nimport type { Id } from '../../ids/id';\nimport { passkeyRecord, passkeysOf } from '../fixtures';\nimport type { CaseContext, ConformanceCase, PortMethod } from '../types';\n\n/** The outage case builder of `./outage`, passed in so the two files do not import each other. */\ntype OutageCase = <S extends keyof JanusStores>(\n\tslot: S,\n\tmethod: PortMethod<S>,\n\tcall: (context: CaseContext) => Promise<unknown>,\n\tseed: (context: CaseContext) => Promise<void>,\n) => ConformanceCase;\n\n/**\n * One outage case per method of the optional passkey store, each needing the\n * slot as well as `faults`. The seeding is the slot's own: a passkey of `userId`.\n */\nexport function passkeyOutageCases(\n\toutage: OutageCase,\n\tuserId: Id,\n\tnow: Date,\n): readonly ConformanceCase[] {\n\tconst passkey = passkeyRecord({ userId });\n\n\tconst seed = async ({ stores }: CaseContext) => {\n\t\tawait passkeysOf(stores).insertPasskey(passkey);\n\t};\n\n\tconst passkeyOutage = (\n\t\tmethod: PortMethod<'passkeys'>,\n\t\tcall: (passkeys: ReturnType<typeof passkeysOf>) => Promise<unknown>,\n\t): ConformanceCase => ({\n\t\t...outage(\n\t\t\t'passkeys',\n\t\t\tmethod,\n\t\t\t({ stores }) => call(passkeysOf(stores)),\n\t\t\tseed,\n\t\t),\n\t\tneeds: ['faults', 'passkeys'],\n\t});\n\n\treturn [\n\t\tpasskeyOutage('insertPasskey', (passkeys) =>\n\t\t\tpasskeys.insertPasskey(passkey),\n\t\t),\n\t\tpasskeyOutage('findPasskey', (passkeys) =>\n\t\t\tpasskeys.findPasskey(passkey.credentialId),\n\t\t),\n\t\tpasskeyOutage('listUserPasskeys', (passkeys) =>\n\t\t\tpasskeys.listUserPasskeys(userId),\n\t\t),\n\t\tpasskeyOutage('recordPasskeyUse', (passkeys) =>\n\t\t\tpasskeys.recordPasskeyUse(\n\t\t\t\tuserId,\n\t\t\t\tpasskey.credentialId,\n\t\t\t\t{ counter: 1, backedUp: false, lastUsedAt: now },\n\t\t\t\tpasskey.counter,\n\t\t\t),\n\t\t),\n\t\tpasskeyOutage('renamePasskey', (passkeys) =>\n\t\t\tpasskeys.renamePasskey(userId, passkey.credentialId, 'Phone'),\n\t\t),\n\t\tpasskeyOutage('deletePasskey', (passkeys) =>\n\t\t\tpasskeys.deletePasskey(userId, passkey.credentialId),\n\t\t),\n\t\tpasskeyOutage('deleteUserPasskeys', (passkeys) =>\n\t\t\tpasskeys.deleteUserPasskeys(userId),\n\t\t),\n\t];\n}\n",
17
+ "import type { JanusStores } from '../../auth/port/types';\nimport { JanusError, StoreFailure } from '../../errors/janus-error';\nimport { isOurs, ok, rejects } from '../assert';\nimport {\n\tat,\n\tsessionRecord,\n\tsocialLinkRecord,\n\tsocialLinksOf,\n\ttokenRecord,\n\tuserRecord,\n} from '../fixtures';\nimport type { CaseContext, ConformanceCase, PortMethod } from '../types';\nimport { passkeyOutageCases } from './outage.passkeys';\n\n/**\n * **The invariant, as cases.** For each of the twenty-nine methods whose honest\n * answer can be \"nothing\" — `null`, `false`, `0`, an empty page or list — a\n * store that cannot answer must **reject**, and the rejection must not be\n * `NOT_FOUND`.\n *\n * Every case seeds a record first, so a store that swallows its failure into an\n * absence answers something *false* rather than something merely empty.\n *\n * The rejection is either `@softistx/janus`'s own `StoreFailure` — the `instanceof`\n * probe, which fails on a second copy of the package — or an error that is no\n * `JanusError` at all, which the core wraps into `STORE_FAILED` itself.\n */\nfunction outage<S extends keyof JanusStores>(\n\tslot: S,\n\tmethod: PortMethod<S>,\n\tcall: (context: CaseContext) => Promise<unknown>,\n\tseed: (context: CaseContext) => Promise<void>,\n): ConformanceCase {\n\treturn {\n\t\tid: `outage.${method}`,\n\t\tgroup: 'outage',\n\t\tname: `${slot}.${method} rejects when the store cannot answer — never null, false, 0 or an empty page`,\n\t\tneeds: 'faults',\n\t\tasync run(context) {\n\t\t\tawait seed(context);\n\t\t\tawait context.faults?.fail(slot, method);\n\n\t\t\tconst error = await rejects(\n\t\t\t\tcall(context),\n\t\t\t\t`${slot}.${method} under an outage should reject: answering an absence turns an outage into a silent lockout`,\n\t\t\t);\n\n\t\t\tif (\n\t\t\t\terror instanceof JanusError ||\n\t\t\t\t(error as { name?: unknown })?.name === 'StoreFailure'\n\t\t\t) {\n\t\t\t\tisOurs(\n\t\t\t\t\terror,\n\t\t\t\t\tStoreFailure,\n\t\t\t\t\t'StoreFailure',\n\t\t\t\t\t`${slot}.${method} under an outage`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tok(\n\t\t\t\t(error as { code?: unknown } | null)?.code !== 'NOT_FOUND',\n\t\t\t\t`${slot}.${method} under an outage rejected with NOT_FOUND: an outage is never an absence`,\n\t\t\t);\n\t\t},\n\t};\n}\n\nconst user = userRecord();\nconst session = sessionRecord({ userId: user.id });\nconst token = tokenRecord({ userId: user.id });\nconst link = socialLinkRecord({ userId: user.id });\nconst now = at('2026-02-01T00:00:00.000Z');\n\n/** Each case writes the same three records, fresh stores every time. */\nconst seed = async ({ stores }: CaseContext) => {\n\tawait stores.users.insertUser(user);\n\tawait stores.sessions.insertSession(session);\n\tawait stores.tokens.insertToken(token);\n};\n\n/** The optional social link store's own seed: only when the slot is there. */\nconst seedLink = async ({ stores }: CaseContext) => {\n\tawait socialLinksOf(stores).insertSocialLink(link);\n};\n\n/** One outage case per social link method; each needs the slot as well. */\nconst socialLinkOutage = (\n\tmethod: PortMethod<'socialLinks'>,\n\tcall: (links: ReturnType<typeof socialLinksOf>) => Promise<unknown>,\n): ConformanceCase => ({\n\t...outage(\n\t\t'socialLinks',\n\t\tmethod,\n\t\t({ stores }) => call(socialLinksOf(stores)),\n\t\tseedLink,\n\t),\n\tneeds: ['faults', 'socialLinks'],\n});\n\nexport const outageCases: readonly ConformanceCase[] = [\n\toutage(\n\t\t'users',\n\t\t'findUser',\n\t\t({ stores }) => stores.users.findUser(user.id),\n\t\tseed,\n\t),\n\t{\n\t\t// Optional: a store without it is read with findUser, whose outage is\n\t\t// the case above.\n\t\t...outage(\n\t\t\t'users',\n\t\t\t'findUsers',\n\t\t\tasync ({ stores }) =>\n\t\t\t\tstores.users.findUsers?.call(stores.users, [user.id]),\n\t\t\tseed,\n\t\t),\n\t\tneeds: ['faults', 'findUsers'],\n\t},\n\toutage(\n\t\t'users',\n\t\t'findUserByLogin',\n\t\t({ stores }) =>\n\t\t\tstores.users.findUserByLogin(user.type, user.logins[0] ?? ''),\n\t\tseed,\n\t),\n\toutage(\n\t\t'users',\n\t\t'listUsers',\n\t\t({ stores }) =>\n\t\t\tstores.users.listUsers({ type: user.type, after: null, limit: 10 }),\n\t\tseed,\n\t),\n\toutage(\n\t\t'users',\n\t\t'countUsers',\n\t\t({ stores }) => stores.users.countUsers({ type: user.type }),\n\t\tseed,\n\t),\n\toutage(\n\t\t'sessions',\n\t\t'findSessionByTokenHash',\n\t\t({ stores }) => stores.sessions.findSessionByTokenHash(session.tokenHash),\n\t\tseed,\n\t),\n\toutage(\n\t\t'sessions',\n\t\t'extendSession',\n\t\t({ stores }) =>\n\t\t\tstores.sessions.extendSession(session.id, at('2099-06-01T00:00:00.000Z')),\n\t\tseed,\n\t),\n\toutage(\n\t\t'sessions',\n\t\t'reauthenticateSession',\n\t\t({ stores }) => stores.sessions.reauthenticateSession(session.id, now),\n\t\tseed,\n\t),\n\toutage(\n\t\t'sessions',\n\t\t'revokeSession',\n\t\t({ stores }) => stores.sessions.revokeSession(session.id, now),\n\t\tseed,\n\t),\n\toutage(\n\t\t'sessions',\n\t\t'revokeUserSessions',\n\t\t({ stores }) => stores.sessions.revokeUserSessions(user.id, now),\n\t\tseed,\n\t),\n\toutage(\n\t\t'tokens',\n\t\t'consumeToken',\n\t\t({ stores }) =>\n\t\t\tstores.tokens.consumeToken(token.tokenHash, 'resetPassword', now),\n\t\tseed,\n\t),\n\toutage(\n\t\t'tokens',\n\t\t'countAttempt',\n\t\t({ stores }) =>\n\t\t\tstores.tokens.countAttempt(token.tokenHash, 'resetPassword'),\n\t\tseed,\n\t),\n\toutage(\n\t\t'tokens',\n\t\t'spendUserTokens',\n\t\t({ stores }) =>\n\t\t\tstores.tokens.spendUserTokens(user.id, 'resetPassword', now),\n\t\tseed,\n\t),\n\toutage(\n\t\t'users',\n\t\t'deleteUser',\n\t\t({ stores }) => stores.users.deleteUser(user.id),\n\t\tseed,\n\t),\n\toutage(\n\t\t'sessions',\n\t\t'deleteUserSessions',\n\t\t({ stores }) => stores.sessions.deleteUserSessions(user.id),\n\t\tseed,\n\t),\n\toutage(\n\t\t'tokens',\n\t\t'deleteUserTokens',\n\t\t({ stores }) => stores.tokens.deleteUserTokens(user.id),\n\t\tseed,\n\t),\n\t{\n\t\t// Optional: a store with its own expiry has no such method.\n\t\t...outage(\n\t\t\t'tokens',\n\t\t\t'deleteExpiredTokens',\n\t\t\tasync ({ stores }) =>\n\t\t\t\tstores.tokens.deleteExpiredTokens?.call(stores.tokens, now),\n\t\t\tseed,\n\t\t),\n\t\tneeds: ['faults', 'deleteExpiredTokens'],\n\t},\n\tsocialLinkOutage('insertSocialLink', (links) => links.insertSocialLink(link)),\n\tsocialLinkOutage('findSocialLink', (links) =>\n\t\tlinks.findSocialLink(link.provider, link.accountId),\n\t),\n\tsocialLinkOutage('listUserSocialLinks', (links) =>\n\t\tlinks.listUserSocialLinks(user.id),\n\t),\n\tsocialLinkOutage('deleteSocialLink', (links) =>\n\t\tlinks.deleteSocialLink(user.id, link.provider, link.accountId),\n\t),\n\tsocialLinkOutage('deleteUserSocialLinks', (links) =>\n\t\tlinks.deleteUserSocialLinks(user.id),\n\t),\n\t...passkeyOutageCases(outage, user.id, now),\n];\n",
18
+ "import { mintId } from '../../../ids/id';\nimport { equal, isNull, ok } from '../../assert';\nimport { passkeyRecord, passkeysOf } from '../../fixtures';\nimport type { ConformanceCase } from '../../types';\n\nconst group = 'passkeys';\nconst needs = 'passkeys';\n\n/** What a rename and a deletion change, and what they leave. */\nexport const passkeyDeletionCases: readonly ConformanceCase[] = [\n\t{\n\t\tid: 'passkeys.renameOwner',\n\t\tgroup,\n\t\tneeds,\n\t\tname: 'renames a passkey only for its owner: true and the name changed, false for another user or an unknown credential',\n\t\tasync run({ stores }) {\n\t\t\tconst passkeys = passkeysOf(stores);\n\t\t\tconst record = passkeyRecord({ counter: 3 });\n\t\t\tawait passkeys.insertPasskey(record);\n\t\t\tconst { userId, credentialId } = record;\n\n\t\t\tok(\n\t\t\t\t(await passkeys.renamePasskey(mintId(), credentialId, 'Stolen')) ===\n\t\t\t\t\tfalse,\n\t\t\t\t'renamePasskey by another user should answer false',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait passkeys.findPasskey(credentialId),\n\t\t\t\trecord,\n\t\t\t\t'renamePasskey by another user should keep the name',\n\t\t\t);\n\t\t\tok(\n\t\t\t\t(await passkeys.renamePasskey(userId, credentialId, 'Phone 😀')) ===\n\t\t\t\t\ttrue,\n\t\t\t\t'renamePasskey by the owner should answer true',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait passkeys.findPasskey(credentialId),\n\t\t\t\t{ ...record, name: 'Phone 😀' },\n\t\t\t\t'renamePasskey should change the name and nothing else',\n\t\t\t);\n\t\t\tok(\n\t\t\t\t(await passkeys.renamePasskey(userId, `${credentialId}-x`, 'Y')) ===\n\t\t\t\t\tfalse,\n\t\t\t\t'renamePasskey of an unknown credential should answer false',\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tid: 'passkeys.deleteOwner',\n\t\tgroup,\n\t\tneeds,\n\t\tname: 'deletes a passkey only for its owner: a wrong owner is false and keeps it, a repeat is false',\n\t\tasync run({ stores }) {\n\t\t\tconst passkeys = passkeysOf(stores);\n\t\t\tconst record = passkeyRecord();\n\t\t\tawait passkeys.insertPasskey(record);\n\t\t\tconst { userId, credentialId } = record;\n\n\t\t\tok(\n\t\t\t\t(await passkeys.deletePasskey(mintId(), credentialId)) === false,\n\t\t\t\t'deletePasskey by another user should answer false',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait passkeys.findPasskey(credentialId),\n\t\t\t\trecord,\n\t\t\t\t'deletePasskey by another user should keep the passkey',\n\t\t\t);\n\t\t\tok(\n\t\t\t\t(await passkeys.deletePasskey(userId, credentialId)) === true,\n\t\t\t\t'deletePasskey by the owner should answer true',\n\t\t\t);\n\t\t\tisNull(\n\t\t\t\tawait passkeys.findPasskey(credentialId),\n\t\t\t\t'findPasskey after deletePasskey',\n\t\t\t);\n\t\t\tok(\n\t\t\t\t(await passkeys.deletePasskey(userId, credentialId)) === false,\n\t\t\t\t'deletePasskey repeated should answer false',\n\t\t\t);\n\t\t\tok(\n\t\t\t\t(await passkeys.deletePasskey(userId, `${credentialId}-x`)) === false,\n\t\t\t\t'deletePasskey of an unknown credential should answer false',\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tid: 'passkeys.deleteUser',\n\t\tgroup,\n\t\tneeds,\n\t\tname: 'deletes every passkey of one user and counts them, 0 for a user with none, and leaves other users’ passkeys',\n\t\tasync run({ stores }) {\n\t\t\tconst passkeys = passkeysOf(stores);\n\t\t\tconst userId = mintId();\n\t\t\tconst own = [\n\t\t\t\tpasskeyRecord({ userId }),\n\t\t\t\tpasskeyRecord({ userId }),\n\t\t\t\tpasskeyRecord({ userId }),\n\t\t\t];\n\t\t\tconst stranger = passkeyRecord();\n\t\t\tfor (const record of [...own, stranger]) {\n\t\t\t\tawait passkeys.insertPasskey(record);\n\t\t\t}\n\n\t\t\tequal(\n\t\t\t\tawait passkeys.deleteUserPasskeys(userId),\n\t\t\t\t3,\n\t\t\t\t'deleteUserPasskeys should answer how many it deleted',\n\t\t\t);\n\t\t\tfor (const record of own) {\n\t\t\t\tisNull(\n\t\t\t\t\tawait passkeys.findPasskey(record.credentialId),\n\t\t\t\t\t'findPasskey after deleteUserPasskeys',\n\t\t\t\t);\n\t\t\t}\n\t\t\tequal(\n\t\t\t\tawait passkeys.findPasskey(stranger.credentialId),\n\t\t\t\tstranger,\n\t\t\t\t'deleteUserPasskeys should not touch another user',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait passkeys.deleteUserPasskeys(userId),\n\t\t\t\t0,\n\t\t\t\t'deleteUserPasskeys for a user with none answers 0, not a failure',\n\t\t\t);\n\t\t},\n\t},\n];\n",
19
+ "import { mintId } from '../../../ids/id';\nimport { equal, ok } from '../../assert';\nimport { passkeyRecord, passkeysOf } from '../../fixtures';\nimport type { ConformanceCase } from '../../types';\n\nconst group = 'passkeys';\nconst needs = 'passkeys';\n\n/** Insert-if-absent: the credential id is unique, and the loser is answered the holder. */\nexport const passkeyInsertCases: readonly ConformanceCase[] = [\n\t{\n\t\tid: 'passkeys.insertIdempotent',\n\t\tgroup,\n\t\tneeds,\n\t\tname: 'answers the stored record when the same user inserts the same credential again, and writes nothing',\n\t\tasync run({ stores }) {\n\t\t\tconst passkeys = passkeysOf(stores);\n\t\t\tconst first = passkeyRecord();\n\t\t\tawait passkeys.insertPasskey(first);\n\n\t\t\tconst again = { ...first, name: 'Changed', counter: 9 };\n\t\t\tequal(\n\t\t\t\tawait passkeys.insertPasskey(again),\n\t\t\t\tfirst,\n\t\t\t\t'insertPasskey of a credential its user already holds should answer the stored record, not the new one',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait passkeys.findPasskey(first.credentialId),\n\t\t\t\tfirst,\n\t\t\t\t'insertPasskey of a credential already held should not write',\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tid: 'passkeys.insertTaken',\n\t\tgroup,\n\t\tneeds,\n\t\tname: 'answers the holder’s record, and writes nothing, when another user inserts a held credential',\n\t\tasync run({ stores }) {\n\t\t\tconst passkeys = passkeysOf(stores);\n\t\t\tconst holder = passkeyRecord();\n\t\t\tawait passkeys.insertPasskey(holder);\n\t\t\tconst rival = passkeyRecord({\n\t\t\t\tcredentialId: holder.credentialId,\n\t\t\t\tuserId: mintId(),\n\t\t\t});\n\n\t\t\tequal(\n\t\t\t\tawait passkeys.insertPasskey(rival),\n\t\t\t\tholder,\n\t\t\t\t'insertPasskey of another user’s credential should answer the holder’s record: the core compares userId to learn it lost',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait passkeys.findPasskey(holder.credentialId),\n\t\t\t\tholder,\n\t\t\t\t'insertPasskey of another user’s credential should not replace the holder',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait passkeys.listUserPasskeys(rival.userId),\n\t\t\t\t[],\n\t\t\t\t'insertPasskey of another user’s credential should leave the rival with no passkey',\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tid: 'passkeys.insertConcurrent',\n\t\tgroup,\n\t\tneeds,\n\t\tname: 'stores one record when twenty users insert one credential at once, and answers all of them that record',\n\t\tasync run({ stores }) {\n\t\t\tconst passkeys = passkeysOf(stores);\n\t\t\tconst base = passkeyRecord();\n\t\t\tconst attempts = Array.from({ length: 20 }, () => ({\n\t\t\t\t...base,\n\t\t\t\tuserId: mintId(),\n\t\t\t}));\n\n\t\t\tconst answers = await Promise.all(\n\t\t\t\tattempts.map((record) => passkeys.insertPasskey(record)),\n\t\t\t);\n\n\t\t\tconst stored = await passkeys.findPasskey(base.credentialId);\n\t\t\tok(\n\t\t\t\tstored !== null && attempts.some((a) => a.userId === stored.userId),\n\t\t\t\t'one of the twenty inserts should be the stored record',\n\t\t\t);\n\t\t\tfor (const answer of answers) {\n\t\t\t\tequal(\n\t\t\t\t\tanswer,\n\t\t\t\t\tstored,\n\t\t\t\t\t'every concurrent insertPasskey should answer the one stored record: a unique key, never a read then a write',\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tlet held = 0;\n\t\t\tfor (const record of attempts) {\n\t\t\t\theld += (await passkeys.listUserPasskeys(record.userId)).length;\n\t\t\t}\n\t\t\tequal(held, 1, 'exactly one of the twenty users should hold the passkey');\n\t\t},\n\t},\n];\n",
20
+ "import { mintId } from '../../../ids/id';\nimport { equal, isNull } from '../../assert';\nimport { passkeyRecord, passkeysOf } from '../../fixtures';\nimport type { ConformanceCase } from '../../types';\n\nconst group = 'passkeys';\nconst needs = 'passkeys';\n\n/** What a passkey's reads answer: the record verbatim, nothing as `null` or `[]`. */\nexport const passkeyReadCases: readonly ConformanceCase[] = [\n\t{\n\t\tid: 'passkeys.findVerbatim',\n\t\tgroup,\n\t\tneeds,\n\t\tname: 'answers a stored passkey verbatim by its credential id, and null for an unknown one',\n\t\tasync run({ stores }) {\n\t\t\tconst passkeys = passkeysOf(stores);\n\t\t\tconst record = passkeyRecord({\n\t\t\t\ttransports: [],\n\t\t\t\tlastUsedAt: new Date('2026-01-05T10:20:30.456Z'),\n\t\t\t\tcreatedAt: new Date('2026-01-04T10:20:30.123Z'),\n\t\t\t});\n\t\t\tequal(\n\t\t\t\tawait passkeys.insertPasskey(record),\n\t\t\t\trecord,\n\t\t\t\t'insertPasskey should answer the record as written: empty transports kept, dates to the millisecond',\n\t\t\t);\n\n\t\t\tequal(\n\t\t\t\tawait passkeys.findPasskey(record.credentialId),\n\t\t\t\trecord,\n\t\t\t\t'findPasskey should answer the stored record verbatim',\n\t\t\t);\n\t\t\tisNull(\n\t\t\t\tawait passkeys.findPasskey(`${record.credentialId}-x`),\n\t\t\t\t'findPasskey for an unknown credential id',\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tid: 'passkeys.bytesRoundTrip',\n\t\tgroup,\n\t\tneeds,\n\t\tname: 'round-trips the public key byte for byte, and compares credential ids case-sensitively',\n\t\tasync run({ stores }) {\n\t\t\tconst passkeys = passkeysOf(stores);\n\t\t\tconst tag = mintId();\n\t\t\tconst key = 'pQECAyYgASFYIEdA_-Zq0wFfX3k8w1x2yq9uZ7JmAbC-_zZ09';\n\t\t\tconst lower = passkeyRecord({\n\t\t\t\tcredentialId: `abc-${tag}`,\n\t\t\t\tpublicKey: key,\n\t\t\t});\n\t\t\tconst upper = passkeyRecord({\n\t\t\t\tcredentialId: `ABC-${tag}`,\n\t\t\t\tpublicKey: key.toUpperCase(),\n\t\t\t\tuserId: mintId(),\n\t\t\t});\n\t\t\tconst named = passkeyRecord({\n\t\t\t\tname: 'Clé de Ada 日本 😀',\n\t\t\t\tpublicKey: `${key}${key}`,\n\t\t\t});\n\t\t\tfor (const record of [lower, upper, named]) {\n\t\t\t\tequal(\n\t\t\t\t\tawait passkeys.insertPasskey(record),\n\t\t\t\t\trecord,\n\t\t\t\t\t`insertPasskey of \"${record.credentialId}\" should write a credential of its own: case is a difference`,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tfor (const record of [lower, upper, named]) {\n\t\t\t\tequal(\n\t\t\t\t\tawait passkeys.findPasskey(record.credentialId),\n\t\t\t\t\trecord,\n\t\t\t\t\t`findPasskey of \"${record.credentialId}\" should answer it as written, public key included`,\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t},\n\t{\n\t\tid: 'passkeys.listIsolation',\n\t\tgroup,\n\t\tneeds,\n\t\tname: 'lists one user’s passkeys and only theirs, and an empty list — never null — for a user with none',\n\t\tasync run({ stores }) {\n\t\t\tconst passkeys = passkeysOf(stores);\n\t\t\tconst userId = mintId();\n\t\t\tconst own = [\n\t\t\t\tpasskeyRecord({ userId, name: 'a' }),\n\t\t\t\tpasskeyRecord({ userId, name: 'b' }),\n\t\t\t];\n\t\t\tconst stranger = passkeyRecord();\n\t\t\tfor (const record of [...own, stranger]) {\n\t\t\t\tawait passkeys.insertPasskey(record);\n\t\t\t}\n\n\t\t\tconst listed = [...(await passkeys.listUserPasskeys(userId))].sort(\n\t\t\t\t(a, b) => a.name.localeCompare(b.name),\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tlisted,\n\t\t\t\town,\n\t\t\t\t'listUserPasskeys should answer the user’s own passkeys, verbatim, and no one else’s',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait passkeys.listUserPasskeys(mintId()),\n\t\t\t\t[],\n\t\t\t\t'listUserPasskeys for a user with none answers [], not null',\n\t\t\t);\n\t\t},\n\t},\n];\n",
21
+ "import { mintId } from '../../../ids/id';\nimport { equal, isNull, ok } from '../../assert';\nimport { passkeyRecord, passkeysOf } from '../../fixtures';\nimport type { ConformanceCase } from '../../types';\n\nconst group = 'passkeys';\nconst needs = 'passkeys';\n\nconst usedAt = new Date('2026-03-01T08:09:10.111Z');\n\n/** Recording a use is conditional on the counter, so a replayed assertion cannot pass twice. */\nexport const passkeyUseCases: readonly ConformanceCase[] = [\n\t{\n\t\tid: 'passkeys.useConditional',\n\t\tgroup,\n\t\tneeds,\n\t\tname: 'records a use only if the counter is still ifCounter: the updated record is answered, a stale counter is null and writes nothing',\n\t\tasync run({ stores }) {\n\t\t\tconst passkeys = passkeysOf(stores);\n\t\t\tconst record = passkeyRecord({ counter: 4, backedUp: false });\n\t\t\tawait passkeys.insertPasskey(record);\n\t\t\tconst { userId, credentialId } = record;\n\n\t\t\tconst updated = await passkeys.recordPasskeyUse(\n\t\t\t\tuserId,\n\t\t\t\tcredentialId,\n\t\t\t\t{ counter: 7, backedUp: true, lastUsedAt: usedAt },\n\t\t\t\t4,\n\t\t\t);\n\t\t\tconst expected = {\n\t\t\t\t...record,\n\t\t\t\tcounter: 7,\n\t\t\t\tbackedUp: true,\n\t\t\t\tlastUsedAt: usedAt,\n\t\t\t};\n\t\t\tequal(\n\t\t\t\tupdated,\n\t\t\t\texpected,\n\t\t\t\t'recordPasskeyUse with the matching counter should answer the updated record',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait passkeys.findPasskey(credentialId),\n\t\t\t\texpected,\n\t\t\t\t'recordPasskeyUse should have written counter, backedUp and lastUsedAt, and nothing else',\n\t\t\t);\n\n\t\t\tisNull(\n\t\t\t\tawait passkeys.recordPasskeyUse(\n\t\t\t\t\tuserId,\n\t\t\t\t\tcredentialId,\n\t\t\t\t\t{ counter: 9, backedUp: false, lastUsedAt: new Date(0) },\n\t\t\t\t\t4,\n\t\t\t\t),\n\t\t\t\t'recordPasskeyUse with a counter that no longer matches',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait passkeys.findPasskey(credentialId),\n\t\t\t\texpected,\n\t\t\t\t'recordPasskeyUse with a stale counter should write nothing',\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tid: 'passkeys.useOwnerAndUnknown',\n\t\tgroup,\n\t\tneeds,\n\t\tname: 'answers null, and writes nothing, for a use by another user or of an unknown credential',\n\t\tasync run({ stores }) {\n\t\t\tconst passkeys = passkeysOf(stores);\n\t\t\tconst record = passkeyRecord({ counter: 2 });\n\t\t\tawait passkeys.insertPasskey(record);\n\t\t\tconst use = { counter: 3, backedUp: false, lastUsedAt: usedAt };\n\n\t\t\tisNull(\n\t\t\t\tawait passkeys.recordPasskeyUse(mintId(), record.credentialId, use, 2),\n\t\t\t\t'recordPasskeyUse by another user',\n\t\t\t);\n\t\t\tisNull(\n\t\t\t\tawait passkeys.recordPasskeyUse(\n\t\t\t\t\trecord.userId,\n\t\t\t\t\t`${record.credentialId}-unknown`,\n\t\t\t\t\tuse,\n\t\t\t\t\t2,\n\t\t\t\t),\n\t\t\t\t'recordPasskeyUse of an unknown credential',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait passkeys.findPasskey(record.credentialId),\n\t\t\t\trecord,\n\t\t\t\t'a refused recordPasskeyUse should leave the passkey whole',\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tid: 'passkeys.useConcurrent',\n\t\tgroup,\n\t\tneeds,\n\t\tname: 'lets one of twenty concurrent uses that read the same counter pass, and answers null to the others',\n\t\tasync run({ stores }) {\n\t\t\tconst passkeys = passkeysOf(stores);\n\t\t\tconst record = passkeyRecord({ counter: 10 });\n\t\t\tawait passkeys.insertPasskey(record);\n\n\t\t\tconst answers = await Promise.all(\n\t\t\t\tArray.from({ length: 20 }, (_, index) =>\n\t\t\t\t\tpasskeys.recordPasskeyUse(\n\t\t\t\t\t\trecord.userId,\n\t\t\t\t\t\trecord.credentialId,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcounter: 11 + index,\n\t\t\t\t\t\t\tbackedUp: false,\n\t\t\t\t\t\t\tlastUsedAt: usedAt,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t10,\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t);\n\n\t\t\tconst winners = answers.filter((answer) => answer !== null);\n\t\t\tequal(\n\t\t\t\twinners.length,\n\t\t\t\t1,\n\t\t\t\t'exactly one concurrent recordPasskeyUse should pass: a conditional write, never a read then a write',\n\t\t\t);\n\t\t\tconst stored = await passkeys.findPasskey(record.credentialId);\n\t\t\tok(\n\t\t\t\tstored !== null && stored.counter === winners[0]?.counter,\n\t\t\t\t'the stored counter should be the winner’s',\n\t\t\t);\n\t\t},\n\t},\n];\n",
22
+ "import type { ConformanceCase } from '../../types';\nimport { passkeyDeletionCases } from './deletion';\nimport { passkeyInsertCases } from './inserts';\nimport { passkeyReadCases } from './reads';\nimport { passkeyUseCases } from './uses';\n\n/**\n * Every case of the optional passkey store, in the order they are described.\n * Each needs `stores.passkeys`, and is skipped — with its reason — when the\n * harness opens stores without it.\n */\nexport const passkeyStoreCases: readonly ConformanceCase[] = [\n\t...passkeyReadCases,\n\t...passkeyInsertCases,\n\t...passkeyUseCases,\n\t...passkeyDeletionCases,\n];\n",
23
+ "import { mintId } from '../../../ids/id';\nimport { equal, isNull, ok } from '../../assert';\nimport { at, sessionRecord } from '../../fixtures';\nimport type { ConformanceCase } from '../../types';\n\nconst group = 'sessions';\n\n/** What a deletion of sessions removes — a user’s, or the lapsed ones — and what it leaves. */\nexport const sessionDeletionCases: readonly ConformanceCase[] = [\n\t{\n\t\tid: 'sessions.deleteUser',\n\t\tgroup,\n\t\tname: 'deletes every session of one user — standing, revoked or lapsed — and counts them',\n\t\tasync run({ stores }) {\n\t\t\tconst userId = mintId();\n\t\t\tconst lapsed = sessionRecord({\n\t\t\t\tuserId,\n\t\t\t\texpiresAt: at('2026-01-02T00:00:00.000Z'),\n\t\t\t});\n\t\t\tconst records = [\n\t\t\t\tsessionRecord({ userId }),\n\t\t\t\tsessionRecord({ userId, revokedAt: at('2026-01-02T00:00:00.000Z') }),\n\t\t\t\tlapsed,\n\t\t\t];\n\t\t\tconst stranger = sessionRecord();\n\t\t\tfor (const record of [...records, stranger]) {\n\t\t\t\tawait stores.sessions.insertSession(record);\n\t\t\t}\n\n\t\t\t// The lapsed one may be gone already: a store with its own expiry —\n\t\t\t// a Redis key TTL — drops it as soon as it lapses, which the port\n\t\t\t// allows. Whether it is still there is what the store answers for it.\n\t\t\tconst lapsedHeld =\n\t\t\t\t(await stores.sessions.findSessionByTokenHash(lapsed.tokenHash)) !==\n\t\t\t\tnull;\n\t\t\tconst expected = lapsedHeld ? 3 : 2;\n\t\t\tconst deleted = await stores.sessions.deleteUserSessions(userId);\n\t\t\tok(\n\t\t\t\tdeleted === expected,\n\t\t\t\t`deleteUserSessions: how many it deleted, revoked and lapsed ones included — ${String(expected)}, as the lapsed one is ${lapsedHeld ? 'still held' : 'already expired'}; got ${String(deleted)}`,\n\t\t\t);\n\t\t\tfor (const record of records) {\n\t\t\t\tisNull(\n\t\t\t\t\tawait stores.sessions.findSessionByTokenHash(record.tokenHash),\n\t\t\t\t\t'findSessionByTokenHash after deleteUserSessions',\n\t\t\t\t);\n\t\t\t}\n\t\t\tequal(\n\t\t\t\tawait stores.sessions.findSessionByTokenHash(stranger.tokenHash),\n\t\t\t\tstranger,\n\t\t\t\t'deleteUserSessions should not touch another user',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait stores.sessions.deleteUserSessions(userId),\n\t\t\t\t0,\n\t\t\t\t'deleteUserSessions for a user with none answers 0, not a failure',\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tid: 'sessions.deleteExpired',\n\t\tgroup,\n\t\tname: 'deletes sessions whose expiry is at or before the instant, and only those',\n\t\tneeds: 'deleteExpiredSessions',\n\t\tasync run({ stores }) {\n\t\t\tconst collect = stores.sessions.deleteExpiredSessions;\n\t\t\tok(collect !== undefined, 'deleteExpiredSessions should be present');\n\t\t\tconst lapsed = sessionRecord({\n\t\t\t\texpiresAt: at('2026-01-10T00:00:00.000Z'),\n\t\t\t});\n\t\t\tconst living = sessionRecord({\n\t\t\t\texpiresAt: at('2026-01-10T00:00:00.001Z'),\n\t\t\t});\n\t\t\tawait stores.sessions.insertSession(lapsed);\n\t\t\tawait stores.sessions.insertSession(living);\n\n\t\t\tequal(\n\t\t\t\tawait collect?.call(stores.sessions, at('2026-01-10T00:00:00.000Z')),\n\t\t\t\t1,\n\t\t\t\t'deleteExpiredSessions: how many it deleted',\n\t\t\t);\n\t\t\tisNull(\n\t\t\t\tawait stores.sessions.findSessionByTokenHash(lapsed.tokenHash),\n\t\t\t\t'findSessionByTokenHash after deleteExpiredSessions',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait stores.sessions.findSessionByTokenHash(living.tokenHash),\n\t\t\t\tliving,\n\t\t\t\t'deleteExpiredSessions should keep a session one millisecond short of lapsing',\n\t\t\t);\n\t\t},\n\t},\n];\n",
24
+ "import { mintId } from '../../../ids/id';\nimport { equal, isNull } from '../../assert';\nimport { at, sessionRecord } from '../../fixtures';\nimport type { ConformanceCase } from '../../types';\n\nconst group = 'sessions';\n\n/** What an extension moves, and the revoked session it never brings back. */\nexport const sessionExtensionCases: readonly ConformanceCase[] = [\n\t{\n\t\tid: 'sessions.extend',\n\t\tgroup,\n\t\tname: 'extends a standing session, and never brings back a revoked one',\n\t\tasync run({ stores }) {\n\t\t\tconst standing = sessionRecord();\n\t\t\tconst revoked = sessionRecord({\n\t\t\t\trevokedAt: at('2026-01-02T00:00:00.000Z'),\n\t\t\t});\n\t\t\tawait stores.sessions.insertSession(standing);\n\t\t\tawait stores.sessions.insertSession(revoked);\n\t\t\tconst later = at('2099-06-01T00:00:00.000Z');\n\n\t\t\tequal(\n\t\t\t\tawait stores.sessions.extendSession(standing.id, later),\n\t\t\t\t{ ...standing, expiresAt: later },\n\t\t\t\t'extendSession should answer the session with its new expiresAt',\n\t\t\t);\n\t\t\tisNull(\n\t\t\t\tawait stores.sessions.extendSession(revoked.id, later),\n\t\t\t\t'extendSession on a revoked session — an extension racing a revocation must never bring it back',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait stores.sessions.findSessionByTokenHash(revoked.tokenHash),\n\t\t\t\trevoked,\n\t\t\t\t'extendSession refused on a revoked session should have written nothing',\n\t\t\t);\n\t\t\tisNull(\n\t\t\t\tawait stores.sessions.extendSession(mintId(), later),\n\t\t\t\t'extendSession on an unknown session',\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tid: 'sessions.extendLastUsed',\n\t\tgroup,\n\t\tname: 'writes lastUsedAt with the extension when given, and keeps device and lastUsedAt otherwise',\n\t\tasync run({ stores }) {\n\t\t\tconst first = at('2026-01-01T00:00:00.000Z');\n\t\t\tconst record = sessionRecord({\n\t\t\t\tdevice: 'Firefox on Linux',\n\t\t\t\tlastUsedAt: first,\n\t\t\t});\n\t\t\tconst old = sessionRecord();\n\t\t\tawait stores.sessions.insertSession(record);\n\t\t\tawait stores.sessions.insertSession(old);\n\t\t\tconst later = at('2099-06-01T00:00:00.000Z');\n\t\t\tconst used = at('2026-02-01T00:00:00.000Z');\n\n\t\t\tequal(\n\t\t\t\tawait stores.sessions.findSessionByTokenHash(record.tokenHash),\n\t\t\t\trecord,\n\t\t\t\t'device and lastUsedAt should be stored and read back',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait stores.sessions.extendSession(record.id, later),\n\t\t\t\t{ ...record, expiresAt: later },\n\t\t\t\t'extendSession without lastUsedAt should leave device and lastUsedAt as they were',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait stores.sessions.extendSession(record.id, later, used),\n\t\t\t\t{ ...record, expiresAt: later, lastUsedAt: used },\n\t\t\t\t'extendSession with lastUsedAt should write it and keep device',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait stores.sessions.extendSession(old.id, later, used),\n\t\t\t\t{ ...old, expiresAt: later, lastUsedAt: used },\n\t\t\t\t'a record written without device or lastUsedAt should take lastUsedAt on extension',\n\t\t\t);\n\t\t},\n\t},\n];\n",
25
+ "import { equal } from '../../assert';\nimport { sessionRecord } from '../../fixtures';\nimport type { ConformanceCase } from '../../types';\n\nconst group = 'sessions';\n\n/** What an insert writes, and what retrying it writes: nothing. */\nexport const sessionInsertCases: readonly ConformanceCase[] = [\n\t{\n\t\tid: 'sessions.idempotentInsert',\n\t\tgroup,\n\t\tname: 'is idempotent under retry: inserting an existing session id writes nothing',\n\t\tasync run({ stores }) {\n\t\t\tconst record = sessionRecord();\n\t\t\tawait stores.sessions.insertSession(record);\n\t\t\tawait stores.sessions.insertSession({\n\t\t\t\t...record,\n\t\t\t\texpiresAt: new Date('2099-06-01T00:00:00.000Z'),\n\t\t\t});\n\n\t\t\tequal(\n\t\t\t\tawait stores.sessions.findSessionByTokenHash(record.tokenHash),\n\t\t\t\trecord,\n\t\t\t\t'insertSession retried with the same id should write nothing',\n\t\t\t);\n\t\t},\n\t},\n];\n",
26
+ "import { mintId } from '../../../ids/id';\nimport { equal } from '../../assert';\nimport { at, sessionRecord } from '../../fixtures';\nimport type { ConformanceCase } from '../../types';\n\nconst group = 'sessions';\n\n/** What listing one user's sessions answers: the standing ones, and only that user's. */\nexport const sessionListCases: readonly ConformanceCase[] = [\n\t{\n\t\tid: 'sessions.listUser',\n\t\tgroup,\n\t\tname: 'lists the standing sessions of one user: not revoked, not lapsed at the instant, not another user',\n\t\tneeds: 'listUserSessions',\n\t\tasync run({ stores }) {\n\t\t\tconst list = stores.sessions.listUserSessions?.bind(stores.sessions);\n\t\t\tif (list === undefined) {\n\t\t\t\tthrow new Error('listUserSessions should be present');\n\t\t\t}\n\t\t\tconst userId = mintId();\n\t\t\tconst standing = sessionRecord({\n\t\t\t\tuserId,\n\t\t\t\tdevice: 'Safari on iOS',\n\t\t\t\tlastUsedAt: at('2026-01-05T00:00:00.000Z'),\n\t\t\t});\n\t\t\tconst plain = sessionRecord({ userId });\n\t\t\tconst revoked = sessionRecord({\n\t\t\t\tuserId,\n\t\t\t\trevokedAt: at('2026-01-02T00:00:00.000Z'),\n\t\t\t});\n\t\t\tconst lapsed = sessionRecord({\n\t\t\t\tuserId,\n\t\t\t\texpiresAt: at('2026-01-10T00:00:00.000Z'),\n\t\t\t});\n\t\t\tconst edge = sessionRecord({\n\t\t\t\tuserId,\n\t\t\t\texpiresAt: at('2026-01-15T00:00:00.000Z'),\n\t\t\t});\n\t\t\tconst stranger = sessionRecord();\n\t\t\tfor (const record of [standing, plain, revoked, lapsed, edge, stranger]) {\n\t\t\t\tawait stores.sessions.insertSession(record);\n\t\t\t}\n\n\t\t\tconst listed = await list(userId, at('2026-01-15T00:00:00.000Z'));\n\n\t\t\tequal(\n\t\t\t\t[...listed].sort((a, b) => a.id.localeCompare(b.id)),\n\t\t\t\t[standing, plain].sort((a, b) => a.id.localeCompare(b.id)),\n\t\t\t\t'listUserSessions: only the standing sessions of the user, records verbatim (an expiresAt equal to now has lapsed)',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait list(mintId(), at('2026-01-15T00:00:00.000Z')),\n\t\t\t\t[],\n\t\t\t\t'listUserSessions for a user with none answers [], not a failure',\n\t\t\t);\n\t\t},\n\t},\n];\n",
27
+ "import { equal, isNull } from '../../assert';\nimport { at, sessionRecord } from '../../fixtures';\nimport type { ConformanceCase } from '../../types';\n\nconst group = 'sessions';\n\n/** What a lookup by token hash answers: a stored session verbatim, never a changed one. */\nexport const sessionReadCases: readonly ConformanceCase[] = [\n\t{\n\t\tid: 'sessions.verbatim',\n\t\tgroup,\n\t\tname: 'answers a stored session verbatim — revoked or lapsed — or null once lapsed, and never a changed record',\n\t\tasync run({ stores }) {\n\t\t\tconst standing = sessionRecord();\n\t\t\tconst revoked = sessionRecord({\n\t\t\t\trevokedAt: at('2026-01-02T00:00:00.000Z'),\n\t\t\t});\n\t\t\tconst lapsed = sessionRecord({\n\t\t\t\texpiresAt: at('2020-01-01T00:00:00.000Z'),\n\t\t\t});\n\t\t\tfor (const record of [standing, revoked, lapsed]) {\n\t\t\t\tawait stores.sessions.insertSession(record);\n\t\t\t}\n\n\t\t\tequal(\n\t\t\t\tawait stores.sessions.findSessionByTokenHash(standing.tokenHash),\n\t\t\t\tstanding,\n\t\t\t\t'findSessionByTokenHash for a standing session',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait stores.sessions.findSessionByTokenHash(revoked.tokenHash),\n\t\t\t\trevoked,\n\t\t\t\t'findSessionByTokenHash for a revoked session should answer it verbatim — revocation is the core’s to read',\n\t\t\t);\n\n\t\t\t// A TTL index may already have dropped it: null is allowed, a changed\n\t\t\t// record is not.\n\t\t\tconst found = await stores.sessions.findSessionByTokenHash(\n\t\t\t\tlapsed.tokenHash,\n\t\t\t);\n\t\t\tif (found !== null) {\n\t\t\t\tequal(\n\t\t\t\t\tfound,\n\t\t\t\t\tlapsed,\n\t\t\t\t\t'findSessionByTokenHash for a lapsed session should answer it verbatim, or null',\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tisNull(\n\t\t\t\tawait stores.sessions.findSessionByTokenHash('f'.repeat(64)),\n\t\t\t\t'findSessionByTokenHash for an unknown hash',\n\t\t\t);\n\t\t},\n\t},\n];\n",
28
+ "import { mintId } from '../../../ids/id';\nimport { equal, isNull } from '../../assert';\nimport { at, sessionRecord } from '../../fixtures';\nimport type { ConformanceCase } from '../../types';\n\nconst group = 'sessions';\n\n/** What a step-up moves on a session, and the revoked session it never brings back. */\nexport const sessionReauthenticationCases: readonly ConformanceCase[] = [\n\t{\n\t\tid: 'sessions.reauthenticate',\n\t\tgroup,\n\t\tname: 'moves authenticatedAt on a standing session, and never brings back a revoked one',\n\t\tasync run({ stores }) {\n\t\t\tconst standing = sessionRecord();\n\t\t\tconst revoked = sessionRecord({\n\t\t\t\trevokedAt: at('2026-01-02T00:00:00.000Z'),\n\t\t\t});\n\t\t\tawait stores.sessions.insertSession(standing);\n\t\t\tawait stores.sessions.insertSession(revoked);\n\t\t\tconst now = at('2026-02-01T00:00:00.000Z');\n\n\t\t\tequal(\n\t\t\t\tawait stores.sessions.reauthenticateSession(standing.id, now),\n\t\t\t\t{ ...standing, authenticatedAt: now },\n\t\t\t\t'reauthenticateSession should answer the session with its new authenticatedAt, and every other field as it was',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait stores.sessions.findSessionByTokenHash(standing.tokenHash),\n\t\t\t\t{ ...standing, authenticatedAt: now },\n\t\t\t\t'reauthenticateSession should have written authenticatedAt, and read back the same',\n\t\t\t);\n\t\t\tisNull(\n\t\t\t\tawait stores.sessions.reauthenticateSession(revoked.id, now),\n\t\t\t\t'reauthenticateSession on a revoked session — a confirmation racing a revocation must never bring it back',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait stores.sessions.findSessionByTokenHash(revoked.tokenHash),\n\t\t\t\trevoked,\n\t\t\t\t'reauthenticateSession refused on a revoked session should have written nothing',\n\t\t\t);\n\t\t\tisNull(\n\t\t\t\tawait stores.sessions.reauthenticateSession(mintId(), now),\n\t\t\t\t'reauthenticateSession on an unknown session',\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tid: 'sessions.amr',\n\t\tgroup,\n\t\tname: 'keeps the methods a session proved, and replaces them only when a step-up gives them',\n\t\tasync run({ stores }) {\n\t\t\tconst record = sessionRecord({ amr: ['hwk', 'user'] });\n\t\t\tawait stores.sessions.insertSession(record);\n\t\t\tequal(\n\t\t\t\t(await stores.sessions.findSessionByTokenHash(record.tokenHash))?.amr,\n\t\t\t\t['hwk', 'user'],\n\t\t\t\t'insertSession should have written amr, and read it back in order',\n\t\t\t);\n\t\t\tconst now = at('2026-02-01T00:00:00.000Z');\n\t\t\tequal(\n\t\t\t\t(await stores.sessions.reauthenticateSession(record.id, now))?.amr,\n\t\t\t\t['hwk', 'user'],\n\t\t\t\t'reauthenticateSession without amr should leave amr as it was',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\t(\n\t\t\t\t\tawait stores.sessions.reauthenticateSession(record.id, now, [\n\t\t\t\t\t\t'hwk',\n\t\t\t\t\t\t'user',\n\t\t\t\t\t\t'otp',\n\t\t\t\t\t\t'mfa',\n\t\t\t\t\t])\n\t\t\t\t)?.amr,\n\t\t\t\t['hwk', 'user', 'otp', 'mfa'],\n\t\t\t\t'reauthenticateSession with amr should replace it',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\t(await stores.sessions.findSessionByTokenHash(record.tokenHash))?.amr,\n\t\t\t\t['hwk', 'user', 'otp', 'mfa'],\n\t\t\t\t'the replaced amr should read back the same',\n\t\t\t);\n\n\t\t\tconst legacy = sessionRecord();\n\t\t\tawait stores.sessions.insertSession(legacy);\n\t\t\tequal(\n\t\t\t\t(await stores.sessions.findSessionByTokenHash(legacy.tokenHash))?.amr ??\n\t\t\t\t\t[],\n\t\t\t\t[],\n\t\t\t\t'a session written without amr reads as none',\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tid: 'sessions.reauthenticateRace',\n\t\tgroup,\n\t\tname: 'never brings back a session whose revocation races its confirmation',\n\t\tasync run({ stores }) {\n\t\t\tconst now = at('2026-02-01T00:00:00.000Z');\n\t\t\tfor (let round = 0; round < 10; round += 1) {\n\t\t\t\tconst record = sessionRecord();\n\t\t\t\tawait stores.sessions.insertSession(record);\n\n\t\t\t\tawait Promise.all([\n\t\t\t\t\tstores.sessions.reauthenticateSession(record.id, now),\n\t\t\t\t\tstores.sessions.revokeSession(record.id, now),\n\t\t\t\t]);\n\n\t\t\t\tequal(\n\t\t\t\t\t(await stores.sessions.findSessionByTokenHash(record.tokenHash))\n\t\t\t\t\t\t?.revokedAt,\n\t\t\t\t\tnow,\n\t\t\t\t\t'reauthenticateSession racing revokeSession: the session should stay revoked — one conditional write, never a read then a write',\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t},\n];\n",
29
+ "import { mintId } from '../../../ids/id';\nimport { equal, isNull } from '../../assert';\nimport { at, sessionRecord } from '../../fixtures';\nimport type { ConformanceCase } from '../../types';\n\nconst group = 'sessions';\n\n/** What a revocation marks — one session, or every one of a user — and what it keeps. */\nexport const sessionRevocationCases: readonly ConformanceCase[] = [\n\t{\n\t\tid: 'sessions.revoke',\n\t\tgroup,\n\t\tname: 'revokes once and keeps the first revokedAt; answers false only when there is no session',\n\t\tasync run({ stores }) {\n\t\t\tconst record = sessionRecord();\n\t\t\tawait stores.sessions.insertSession(record);\n\t\t\tconst first = at('2026-02-01T00:00:00.000Z');\n\n\t\t\tequal(\n\t\t\t\tawait stores.sessions.revokeSession(record.id, first),\n\t\t\t\ttrue,\n\t\t\t\t'revokeSession on a standing session',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait stores.sessions.revokeSession(\n\t\t\t\t\trecord.id,\n\t\t\t\t\tat('2026-03-01T00:00:00.000Z'),\n\t\t\t\t),\n\t\t\t\ttrue,\n\t\t\t\t'revokeSession on a revoked session still answers true: the session exists',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\t(await stores.sessions.findSessionByTokenHash(record.tokenHash))\n\t\t\t\t\t?.revokedAt,\n\t\t\t\tfirst,\n\t\t\t\t'revokeSession twice should keep the first revokedAt',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait stores.sessions.revokeSession(mintId(), first),\n\t\t\t\tfalse,\n\t\t\t\t'revokeSession on an unknown session',\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tid: 'sessions.revokeUser',\n\t\tgroup,\n\t\tname: 'revokes every standing session of one user but the one excepted, and counts only what it revoked',\n\t\tasync run({ stores }) {\n\t\t\tconst userId = mintId();\n\t\t\tconst current = sessionRecord({ userId });\n\t\t\tconst other = sessionRecord({ userId });\n\t\t\tconst already = sessionRecord({\n\t\t\t\tuserId,\n\t\t\t\trevokedAt: at('2026-01-02T00:00:00.000Z'),\n\t\t\t});\n\t\t\tconst stranger = sessionRecord();\n\t\t\tfor (const record of [current, other, already, stranger]) {\n\t\t\t\tawait stores.sessions.insertSession(record);\n\t\t\t}\n\t\t\tconst now = at('2026-02-01T00:00:00.000Z');\n\n\t\t\tequal(\n\t\t\t\tawait stores.sessions.revokeUserSessions(userId, now, current.id),\n\t\t\t\t1,\n\t\t\t\t'revokeUserSessions with except: how many this call revoked',\n\t\t\t);\n\t\t\tisNull(\n\t\t\t\t(await stores.sessions.findSessionByTokenHash(current.tokenHash))\n\t\t\t\t\t?.revokedAt ?? null,\n\t\t\t\t'revokeUserSessions should spare the excepted session',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\t(await stores.sessions.findSessionByTokenHash(already.tokenHash))\n\t\t\t\t\t?.revokedAt,\n\t\t\t\talready.revokedAt,\n\t\t\t\t'revokeUserSessions should keep an earlier revokedAt',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait stores.sessions.findSessionByTokenHash(stranger.tokenHash),\n\t\t\t\tstranger,\n\t\t\t\t'revokeUserSessions should not touch another user',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait stores.sessions.revokeUserSessions(userId, now),\n\t\t\t\t1,\n\t\t\t\t'revokeUserSessions without except',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait stores.sessions.revokeUserSessions(mintId(), now),\n\t\t\t\t0,\n\t\t\t\t'revokeUserSessions for a user with none answers 0, not a failure',\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tid: 'sessions.revokeUserIssuedBefore',\n\t\tgroup,\n\t\tname: 'revokes only the sessions created strictly before issuedBefore, and still spares the one excepted',\n\t\tasync run({ stores }) {\n\t\t\tconst userId = mintId();\n\t\t\tconst cutoff = at('2026-01-10T00:00:00.000Z');\n\t\t\tconst older = sessionRecord({\n\t\t\t\tuserId,\n\t\t\t\tcreatedAt: at('2026-01-09T23:59:59.999Z'),\n\t\t\t});\n\t\t\tconst olderSpared = sessionRecord({\n\t\t\t\tuserId,\n\t\t\t\tcreatedAt: at('2026-01-05T00:00:00.000Z'),\n\t\t\t});\n\t\t\tconst atCutoff = sessionRecord({ userId, createdAt: cutoff });\n\t\t\tconst newer = sessionRecord({\n\t\t\t\tuserId,\n\t\t\t\tcreatedAt: at('2026-01-11T00:00:00.000Z'),\n\t\t\t});\n\t\t\tfor (const record of [older, olderSpared, atCutoff, newer]) {\n\t\t\t\tawait stores.sessions.insertSession(record);\n\t\t\t}\n\t\t\tconst now = at('2026-02-01T00:00:00.000Z');\n\n\t\t\tequal(\n\t\t\t\tawait stores.sessions.revokeUserSessions(\n\t\t\t\t\tuserId,\n\t\t\t\t\tnow,\n\t\t\t\t\tolderSpared.id,\n\t\t\t\t\tcutoff,\n\t\t\t\t),\n\t\t\t\t1,\n\t\t\t\t'revokeUserSessions with issuedBefore and except: how many this call revoked',\n\t\t\t);\n\t\t\tconst revokedAt = async (record: typeof older) =>\n\t\t\t\t(await stores.sessions.findSessionByTokenHash(record.tokenHash))\n\t\t\t\t\t?.revokedAt ?? null;\n\t\t\tequal(\n\t\t\t\tawait revokedAt(older),\n\t\t\t\tnow,\n\t\t\t\t'a session created before the cut-off goes',\n\t\t\t);\n\t\t\tisNull(await revokedAt(olderSpared), 'the excepted session stands');\n\t\t\tisNull(\n\t\t\t\tawait revokedAt(atCutoff),\n\t\t\t\t'a session created at the cut-off stands',\n\t\t\t);\n\t\t\tisNull(\n\t\t\t\tawait revokedAt(newer),\n\t\t\t\t'a session created after the cut-off stands',\n\t\t\t);\n\n\t\t\t// Without an except, the older session that was spared goes too.\n\t\t\tequal(\n\t\t\t\tawait stores.sessions.revokeUserSessions(\n\t\t\t\t\tuserId,\n\t\t\t\t\tnow,\n\t\t\t\t\tundefined,\n\t\t\t\t\tcutoff,\n\t\t\t\t),\n\t\t\t\t1,\n\t\t\t\t'revokeUserSessions with issuedBefore and no except: only the older session left',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait revokedAt(olderSpared),\n\t\t\t\tnow,\n\t\t\t\t'without an except, the older session goes as well',\n\t\t\t);\n\t\t\tisNull(await revokedAt(atCutoff), 'still standing at the cut-off');\n\t\t},\n\t},\n];\n",
30
+ "import type { ConformanceCase } from '../../types';\nimport { sessionDeletionCases } from './deletion';\nimport { sessionExtensionCases } from './extension';\nimport { sessionInsertCases } from './inserts';\nimport { sessionListCases } from './list';\nimport { sessionReadCases } from './reads';\nimport { sessionReauthenticationCases } from './reauthentication';\nimport { sessionRevocationCases } from './revocation';\n\n/** Every case of the session store, in the order they are described. */\nexport const sessionStoreCases: readonly ConformanceCase[] = [\n\t...sessionReadCases,\n\t...sessionInsertCases,\n\t...sessionExtensionCases,\n\t...sessionListCases,\n\t...sessionReauthenticationCases,\n\t...sessionRevocationCases,\n\t...sessionDeletionCases,\n];\n",
31
+ "import { mintId } from '../../../ids/id';\nimport { equal, isNull, ok } from '../../assert';\nimport { socialLinkRecord, socialLinksOf } from '../../fixtures';\nimport type { ConformanceCase } from '../../types';\n\nconst group = 'socialLinks';\nconst needs = 'socialLinks';\n\n/** What a deletion removes, and what it leaves. */\nexport const socialLinkDeletionCases: readonly ConformanceCase[] = [\n\t{\n\t\tid: 'socialLinks.deleteOwner',\n\t\tgroup,\n\t\tneeds,\n\t\tname: 'deletes a link only for its owner: a wrong owner is false and keeps it, a repeat is false',\n\t\tasync run({ stores }) {\n\t\t\tconst links = socialLinksOf(stores);\n\t\t\tconst record = socialLinkRecord();\n\t\t\tawait links.insertSocialLink(record);\n\t\t\tconst { provider, accountId } = record;\n\n\t\t\tok(\n\t\t\t\t(await links.deleteSocialLink(mintId(), provider, accountId)) === false,\n\t\t\t\t'deleteSocialLink by another user should answer false',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait links.findSocialLink(provider, accountId),\n\t\t\t\trecord,\n\t\t\t\t'deleteSocialLink by another user should keep the link',\n\t\t\t);\n\t\t\tok(\n\t\t\t\t(await links.deleteSocialLink(record.userId, provider, accountId)) ===\n\t\t\t\t\ttrue,\n\t\t\t\t'deleteSocialLink by the owner should answer true',\n\t\t\t);\n\t\t\tisNull(\n\t\t\t\tawait links.findSocialLink(provider, accountId),\n\t\t\t\t'findSocialLink after deleteSocialLink',\n\t\t\t);\n\t\t\tok(\n\t\t\t\t(await links.deleteSocialLink(record.userId, provider, accountId)) ===\n\t\t\t\t\tfalse,\n\t\t\t\t'deleteSocialLink repeated should answer false',\n\t\t\t);\n\t\t\tok(\n\t\t\t\t(await links.deleteSocialLink(\n\t\t\t\t\trecord.userId,\n\t\t\t\t\tprovider,\n\t\t\t\t\t`${accountId}-unknown`,\n\t\t\t\t)) === false,\n\t\t\t\t'deleteSocialLink of an unknown pair should answer false',\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tid: 'socialLinks.deleteUser',\n\t\tgroup,\n\t\tneeds,\n\t\tname: 'deletes every link of one user and counts them, 0 for a user with none, and leaves other users’ links',\n\t\tasync run({ stores }) {\n\t\t\tconst links = socialLinksOf(stores);\n\t\t\tconst userId = mintId();\n\t\t\tconst own = [\n\t\t\t\tsocialLinkRecord({ userId }),\n\t\t\t\tsocialLinkRecord({ userId, provider: 'github' }),\n\t\t\t\tsocialLinkRecord({ userId, provider: 'microsoft' }),\n\t\t\t];\n\t\t\tconst stranger = socialLinkRecord();\n\t\t\tfor (const record of [...own, stranger]) {\n\t\t\t\tawait links.insertSocialLink(record);\n\t\t\t}\n\n\t\t\tequal(\n\t\t\t\tawait links.deleteUserSocialLinks(userId),\n\t\t\t\t3,\n\t\t\t\t'deleteUserSocialLinks should answer how many it deleted',\n\t\t\t);\n\t\t\tfor (const record of own) {\n\t\t\t\tisNull(\n\t\t\t\t\tawait links.findSocialLink(record.provider, record.accountId),\n\t\t\t\t\t'findSocialLink after deleteUserSocialLinks',\n\t\t\t\t);\n\t\t\t}\n\t\t\tequal(\n\t\t\t\tawait links.findSocialLink(stranger.provider, stranger.accountId),\n\t\t\t\tstranger,\n\t\t\t\t'deleteUserSocialLinks should not touch another user',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait links.deleteUserSocialLinks(userId),\n\t\t\t\t0,\n\t\t\t\t'deleteUserSocialLinks for a user with none answers 0, not a failure',\n\t\t\t);\n\t\t},\n\t},\n];\n",
32
+ "import { mintId } from '../../../ids/id';\nimport { equal, ok } from '../../assert';\nimport { socialLinkRecord, socialLinksOf } from '../../fixtures';\nimport type { ConformanceCase } from '../../types';\n\nconst group = 'socialLinks';\nconst needs = 'socialLinks';\n\n/** Insert-if-absent: the pair is unique, and the loser is answered the holder. */\nexport const socialLinkInsertCases: readonly ConformanceCase[] = [\n\t{\n\t\tid: 'socialLinks.insertIdempotent',\n\t\tgroup,\n\t\tneeds,\n\t\tname: 'answers the stored record when the same user inserts the same pair again, and writes nothing',\n\t\tasync run({ stores }) {\n\t\t\tconst links = socialLinksOf(stores);\n\t\t\tconst first = socialLinkRecord();\n\t\t\tawait links.insertSocialLink(first);\n\n\t\t\tconst again = {\n\t\t\t\t...first,\n\t\t\t\temail: 'changed@example.test',\n\t\t\t\tcreatedAt: new Date('2027-01-01T00:00:00.000Z'),\n\t\t\t};\n\t\t\tequal(\n\t\t\t\tawait links.insertSocialLink(again),\n\t\t\t\tfirst,\n\t\t\t\t'insertSocialLink of a pair its user already holds should answer the stored record, not the new one',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait links.findSocialLink(first.provider, first.accountId),\n\t\t\t\tfirst,\n\t\t\t\t'insertSocialLink of a pair already held should not write',\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tid: 'socialLinks.insertTaken',\n\t\tgroup,\n\t\tneeds,\n\t\tname: 'answers the holder’s record, and writes nothing, when another user inserts a linked pair',\n\t\tasync run({ stores }) {\n\t\t\tconst links = socialLinksOf(stores);\n\t\t\tconst holder = socialLinkRecord();\n\t\t\tawait links.insertSocialLink(holder);\n\t\t\tconst rival = socialLinkRecord({\n\t\t\t\tprovider: holder.provider,\n\t\t\t\taccountId: holder.accountId,\n\t\t\t\tuserId: mintId(),\n\t\t\t});\n\n\t\t\tequal(\n\t\t\t\tawait links.insertSocialLink(rival),\n\t\t\t\tholder,\n\t\t\t\t'insertSocialLink of another user’s pair should answer the holder’s record: the core compares userId to learn it lost',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait links.findSocialLink(holder.provider, holder.accountId),\n\t\t\t\tholder,\n\t\t\t\t'insertSocialLink of another user’s pair should not replace the holder',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait links.listUserSocialLinks(rival.userId),\n\t\t\t\t[],\n\t\t\t\t'insertSocialLink of another user’s pair should leave the rival with no link',\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tid: 'socialLinks.insertConcurrent',\n\t\tgroup,\n\t\tneeds,\n\t\tname: 'stores one record when twenty users insert one pair at once, and answers all of them that record',\n\t\tasync run({ stores }) {\n\t\t\tconst links = socialLinksOf(stores);\n\t\t\tconst base = socialLinkRecord();\n\t\t\tconst attempts = Array.from({ length: 20 }, () => ({\n\t\t\t\t...base,\n\t\t\t\tuserId: mintId(),\n\t\t\t}));\n\n\t\t\tconst answers = await Promise.all(\n\t\t\t\tattempts.map((record) => links.insertSocialLink(record)),\n\t\t\t);\n\n\t\t\tconst stored = await links.findSocialLink(base.provider, base.accountId);\n\t\t\tok(\n\t\t\t\tstored !== null && attempts.some((a) => a.userId === stored.userId),\n\t\t\t\t'one of the twenty inserts should be the stored record',\n\t\t\t);\n\t\t\tfor (const answer of answers) {\n\t\t\t\tequal(\n\t\t\t\t\tanswer,\n\t\t\t\t\tstored,\n\t\t\t\t\t'every concurrent insertSocialLink should answer the one stored record: a unique key, never a read then a write',\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tlet held = 0;\n\t\t\tfor (const record of attempts) {\n\t\t\t\theld += (await links.listUserSocialLinks(record.userId)).length;\n\t\t\t}\n\t\t\tequal(held, 1, 'exactly one of the twenty users should hold the link');\n\t\t},\n\t},\n];\n",
33
+ "import { mintId } from '../../../ids/id';\nimport { equal, isNull } from '../../assert';\nimport { socialLinkRecord, socialLinksOf } from '../../fixtures';\nimport type { ConformanceCase } from '../../types';\n\nconst group = 'socialLinks';\nconst needs = 'socialLinks';\n\n/** What a link's reads answer: the record verbatim, nothing as `null` or `[]`. */\nexport const socialLinkReadCases: readonly ConformanceCase[] = [\n\t{\n\t\tid: 'socialLinks.findVerbatim',\n\t\tgroup,\n\t\tneeds,\n\t\tname: 'answers a stored link verbatim by its pair, and null for an unknown pair',\n\t\tasync run({ stores }) {\n\t\t\tconst links = socialLinksOf(stores);\n\t\t\tconst record = socialLinkRecord({\n\t\t\t\temail: null,\n\t\t\t\tcreatedAt: new Date('2026-01-05T10:20:30.456Z'),\n\t\t\t});\n\t\t\tequal(\n\t\t\t\tawait links.insertSocialLink(record),\n\t\t\t\trecord,\n\t\t\t\t'insertSocialLink should answer the record as written: a null e-mail kept null, createdAt to the millisecond',\n\t\t\t);\n\n\t\t\tequal(\n\t\t\t\tawait links.findSocialLink(record.provider, record.accountId),\n\t\t\t\trecord,\n\t\t\t\t'findSocialLink should answer the stored record verbatim',\n\t\t\t);\n\t\t\tisNull(\n\t\t\t\tawait links.findSocialLink(record.provider, `${record.accountId}-x`),\n\t\t\t\t'findSocialLink for an unknown accountId',\n\t\t\t);\n\t\t\tisNull(\n\t\t\t\tawait links.findSocialLink('github', record.accountId),\n\t\t\t\t'findSocialLink for the same accountId under another provider',\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tid: 'socialLinks.countByProvider',\n\t\tgroup,\n\t\tneeds,\n\t\tname: 'counts the links of one provider (when the store counts), 0 for none, and follows a delete',\n\t\tasync run({ stores }) {\n\t\t\tconst links = socialLinksOf(stores);\n\t\t\tif (links.countSocialLinks === undefined) return;\n\t\t\tconst tag = mintId();\n\t\t\tconst provider = `count-${tag}`;\n\t\t\tconst first = socialLinkRecord({ provider, accountId: `a-${tag}` });\n\t\t\tconst second = socialLinkRecord({\n\t\t\t\tprovider,\n\t\t\t\taccountId: `b-${tag}`,\n\t\t\t\tuserId: mintId(),\n\t\t\t});\n\t\t\tconst other = socialLinkRecord({\n\t\t\t\tprovider: `other-${tag}`,\n\t\t\t\taccountId: `a-${tag}`,\n\t\t\t});\n\n\t\t\tequal(\n\t\t\t\tawait links.countSocialLinks(provider),\n\t\t\t\t0,\n\t\t\t\t'countSocialLinks of none',\n\t\t\t);\n\t\t\tawait links.insertSocialLink(first);\n\t\t\tawait links.insertSocialLink(second);\n\t\t\tawait links.insertSocialLink(other);\n\t\t\tequal(\n\t\t\t\tawait links.countSocialLinks(provider),\n\t\t\t\t2,\n\t\t\t\t'countSocialLinks of two',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait links.countSocialLinks(provider.toUpperCase()),\n\t\t\t\t0,\n\t\t\t\t'countSocialLinks compares the provider case-sensitively',\n\t\t\t);\n\t\t\tawait links.deleteSocialLink(first.userId, provider, first.accountId);\n\t\t\tequal(\n\t\t\t\tawait links.countSocialLinks(provider),\n\t\t\t\t1,\n\t\t\t\t'countSocialLinks after a delete',\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tid: 'socialLinks.bytesRoundTrip',\n\t\tgroup,\n\t\tneeds,\n\t\tname: 'round-trips unicode, and compares provider and accountId case-sensitively',\n\t\tasync run({ stores }) {\n\t\t\tconst links = socialLinksOf(stores);\n\t\t\tconst tag = mintId();\n\t\t\tconst lower = socialLinkRecord({ accountId: `abc-${tag}` });\n\t\t\tconst upper = socialLinkRecord({\n\t\t\t\taccountId: `ABC-${tag}`,\n\t\t\t\tuserId: mintId(),\n\t\t\t});\n\t\t\tconst unicode = socialLinkRecord({\n\t\t\t\taccountId: `ünï-日本-😀-${tag}`,\n\t\t\t\temail: 'ada@exämple.test',\n\t\t\t});\n\t\t\tconst otherProvider = socialLinkRecord({\n\t\t\t\tprovider: 'Google',\n\t\t\t\taccountId: lower.accountId,\n\t\t\t\tuserId: mintId(),\n\t\t\t});\n\t\t\tfor (const record of [lower, upper, unicode, otherProvider]) {\n\t\t\t\tequal(\n\t\t\t\t\tawait links.insertSocialLink(record),\n\t\t\t\t\trecord,\n\t\t\t\t\t`insertSocialLink of \"${record.provider}\"/\"${record.accountId}\" should write a pair of its own: case is a difference`,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tfor (const record of [lower, upper, unicode, otherProvider]) {\n\t\t\t\tequal(\n\t\t\t\t\tawait links.findSocialLink(record.provider, record.accountId),\n\t\t\t\t\trecord,\n\t\t\t\t\t`findSocialLink of \"${record.provider}\"/\"${record.accountId}\" should answer it as written`,\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t},\n\t{\n\t\tid: 'socialLinks.listIsolation',\n\t\tgroup,\n\t\tneeds,\n\t\tname: 'lists one user’s links and only theirs, and an empty list — never null — for a user with none',\n\t\tasync run({ stores }) {\n\t\t\tconst links = socialLinksOf(stores);\n\t\t\tconst userId = mintId();\n\t\t\tconst own = [\n\t\t\t\tsocialLinkRecord({ userId }),\n\t\t\t\tsocialLinkRecord({ userId, provider: 'github' }),\n\t\t\t];\n\t\t\tconst stranger = socialLinkRecord();\n\t\t\tfor (const record of [...own, stranger]) {\n\t\t\t\tawait links.insertSocialLink(record);\n\t\t\t}\n\n\t\t\tconst listed = [...(await links.listUserSocialLinks(userId))].sort(\n\t\t\t\t(a, b) => a.provider.localeCompare(b.provider),\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tlisted,\n\t\t\t\t[...own].sort((a, b) => a.provider.localeCompare(b.provider)),\n\t\t\t\t'listUserSocialLinks should answer the user’s own links, verbatim, and no one else’s',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait links.listUserSocialLinks(mintId()),\n\t\t\t\t[],\n\t\t\t\t'listUserSocialLinks for a user with none answers [], not null',\n\t\t\t);\n\t\t},\n\t},\n];\n",
34
+ "import type { ConformanceCase } from '../../types';\nimport { socialLinkDeletionCases } from './deletion';\nimport { socialLinkInsertCases } from './inserts';\nimport { socialLinkReadCases } from './reads';\n\n/**\n * Every case of the optional social link store, in the order they are\n * described. Each needs `stores.socialLinks`, and is skipped — with its\n * reason — when the harness opens stores without it.\n */\nexport const socialLinkStoreCases: readonly ConformanceCase[] = [\n\t...socialLinkReadCases,\n\t...socialLinkInsertCases,\n\t...socialLinkDeletionCases,\n];\n",
35
+ "import { equal, isNull } from '../../assert';\nimport { at, tokenRecord } from '../../fixtures';\nimport type { ConformanceCase } from '../../types';\n\nconst group = 'tokens';\n\n/**\n * How an attempt at a code is counted: once per call, never on a spent token,\n * and never lost to a race with the redemption.\n */\nexport const tokenAttemptCases: readonly ConformanceCase[] = [\n\t{\n\t\tid: 'tokens.countAttempt',\n\t\tgroup,\n\t\tname: 'counts an attempt at a code, and answers the token as it is after the call',\n\t\tasync run({ stores }) {\n\t\t\tconst record = tokenRecord({\n\t\t\t\tkind: 'signInCode',\n\t\t\t\tcodeHash: 'c'.repeat(64),\n\t\t\t});\n\t\t\tawait stores.tokens.insertToken(record);\n\n\t\t\tequal(\n\t\t\t\tawait stores.tokens.countAttempt(record.tokenHash, 'signInCode'),\n\t\t\t\t{ ...record, attempts: 1 },\n\t\t\t\t'countAttempt the first time should answer the token with attempts 1, codeHash as written',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait stores.tokens.countAttempt(record.tokenHash, 'signInCode'),\n\t\t\t\t{ ...record, attempts: 2 },\n\t\t\t\t'countAttempt the second time should answer attempts 2',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait stores.tokens.consumeToken(\n\t\t\t\t\trecord.tokenHash,\n\t\t\t\t\t'signInCode',\n\t\t\t\t\tat('2026-02-01T00:00:00.000Z'),\n\t\t\t\t),\n\t\t\t\t{ ...record, attempts: 2 },\n\t\t\t\t'consumeToken should answer the attempts counted, and spend the token',\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tid: 'tokens.countAttemptConcurrency',\n\t\tgroup,\n\t\tname: 'gives twenty concurrent attempts twenty distinct counts — one conditional write, never a read then a write',\n\t\tasync run({ stores }) {\n\t\t\tconst record = tokenRecord({ kind: 'secondFactor' });\n\t\t\tawait stores.tokens.insertToken(record);\n\n\t\t\tconst answers = await Promise.all(\n\t\t\t\tArray.from({ length: 20 }, () =>\n\t\t\t\t\tstores.tokens.countAttempt(record.tokenHash, 'secondFactor'),\n\t\t\t\t),\n\t\t\t);\n\n\t\t\tequal(\n\t\t\t\tanswers\n\t\t\t\t\t.map((answer) => answer?.attempts)\n\t\t\t\t\t.sort((a, b) => (a ?? 0) - (b ?? 0)),\n\t\t\t\tArray.from({ length: 20 }, (_, index) => index + 1),\n\t\t\t\t'countAttempt: twenty concurrent calls should answer 1 to 20, each once — two guesses reading one count is a guess for free',\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tid: 'tokens.countAttemptRace',\n\t\tgroup,\n\t\tname: 'never counts an attempt once the token is spent, when attempts and a redemption race',\n\t\tasync run({ stores }) {\n\t\t\tconst record = tokenRecord({ kind: 'signInCode' });\n\t\t\tawait stores.tokens.insertToken(record);\n\t\t\tconst now = at('2026-02-01T00:00:00.000Z');\n\t\t\tconst count = () =>\n\t\t\t\tstores.tokens.countAttempt(record.tokenHash, 'signInCode');\n\n\t\t\tconst answers = await Promise.all([\n\t\t\t\t...Array.from({ length: 10 }, count),\n\t\t\t\tstores.tokens.consumeToken(record.tokenHash, 'signInCode', now),\n\t\t\t\t...Array.from({ length: 10 }, count),\n\t\t\t]);\n\t\t\tconst final = await stores.tokens.consumeToken(\n\t\t\t\trecord.tokenHash,\n\t\t\t\t'signInCode',\n\t\t\t\tnow,\n\t\t\t);\n\t\t\tif (final === null) {\n\t\t\t\tthrow new Error('consumeToken after the race should answer the token');\n\t\t\t}\n\t\t\tconst counted = answers\n\t\t\t\t.slice(0, 10)\n\t\t\t\t.concat(answers.slice(11))\n\t\t\t\t.filter((answer) => answer !== null && answer.spentAt === null)\n\t\t\t\t.map((answer) => answer?.attempts ?? 0)\n\t\t\t\t.sort((a, b) => a - b);\n\n\t\t\tequal(\n\t\t\t\tcounted,\n\t\t\t\tArray.from({ length: final.attempts }, (_, index) => index + 1),\n\t\t\t\t'countAttempt: the attempts answered unspent should be 1 to the final count, each once',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tanswers\n\t\t\t\t\t.filter((answer) => answer !== null && answer.spentAt !== null)\n\t\t\t\t\t.every((answer) => answer?.attempts === final.attempts),\n\t\t\t\ttrue,\n\t\t\t\t'countAttempt: every answer after the spend should carry the final count — an attempt counted on a spent token is one the limit never saw',\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tid: 'tokens.countAttemptSpent',\n\t\tgroup,\n\t\tname: 'does not count an attempt at a spent token, nor at a token of another kind, nor at none',\n\t\tasync run({ stores }) {\n\t\t\tconst spent = tokenRecord({\n\t\t\t\tkind: 'signInCode',\n\t\t\t\tattempts: 3,\n\t\t\t\tspentAt: at('2026-01-02T00:00:00.000Z'),\n\t\t\t});\n\t\t\tconst other = tokenRecord({ kind: 'resetPassword' });\n\t\t\tawait stores.tokens.insertToken(spent);\n\t\t\tawait stores.tokens.insertToken(other);\n\n\t\t\tfor (const call of ['first', 'second']) {\n\t\t\t\tequal(\n\t\t\t\t\tawait stores.tokens.countAttempt(spent.tokenHash, 'signInCode'),\n\t\t\t\t\tspent,\n\t\t\t\t\t`countAttempt on a spent token, the ${call} time, should answer it as it is: attempts still 3, nothing written`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tisNull(\n\t\t\t\tawait stores.tokens.countAttempt(other.tokenHash, 'signInCode'),\n\t\t\t\t'countAttempt for a resetPassword token counted as signInCode',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait stores.tokens.consumeToken(\n\t\t\t\t\tother.tokenHash,\n\t\t\t\t\t'resetPassword',\n\t\t\t\t\tat('2026-02-01T00:00:00.000Z'),\n\t\t\t\t),\n\t\t\t\tother,\n\t\t\t\t'countAttempt of the other kind should not have counted: attempts still 0',\n\t\t\t);\n\t\t\tisNull(\n\t\t\t\tawait stores.tokens.countAttempt('0'.repeat(64), 'signInCode'),\n\t\t\t\t'countAttempt for an unknown hash',\n\t\t\t);\n\t\t},\n\t},\n];\n",
36
+ "import { mintId } from '../../../ids/id';\nimport { equal, isNull } from '../../assert';\nimport { at, tokenRecord } from '../../fixtures';\nimport type { ConformanceCase } from '../../types';\n\nconst group = 'tokens';\n\n/**\n * A change of e-mail's token kept apart from a verification's: the two can\n * sit in the store for one user and one address, and neither is counted,\n * spent or answered as the other.\n */\nexport const tokenChangeEmailCases: readonly ConformanceCase[] = [\n\t{\n\t\tid: 'tokens.changeEmailKind',\n\t\tgroup,\n\t\tname: 'keeps an e-mail change apart from a verification, and keeps the address it replaces in codeHash',\n\t\tasync run({ stores }) {\n\t\t\tconst userId = mintId();\n\t\t\tconst address = 'new@example.test';\n\t\t\tconst change = tokenRecord({\n\t\t\t\tuserId,\n\t\t\t\taddress,\n\t\t\t\tkind: 'changeEmail',\n\t\t\t\tcodeHash: 'f'.repeat(64),\n\t\t\t});\n\t\t\tconst verification = tokenRecord({\n\t\t\t\tuserId,\n\t\t\t\taddress,\n\t\t\t\tkind: 'verifyEmail',\n\t\t\t});\n\t\t\tawait stores.tokens.insertToken(change);\n\t\t\tawait stores.tokens.insertToken(verification);\n\t\t\tconst now = at('2026-02-01T00:00:00.000Z');\n\n\t\t\t// A verification link proves the address the user holds; redeemed as a\n\t\t\t// change it would move the user to whatever address its token names.\n\t\t\tisNull(\n\t\t\t\tawait stores.tokens.consumeToken(\n\t\t\t\t\tverification.tokenHash,\n\t\t\t\t\t'changeEmail',\n\t\t\t\t\tnow,\n\t\t\t\t),\n\t\t\t\t'consumeToken for a verifyEmail token redeemed as changeEmail',\n\t\t\t);\n\t\t\tisNull(\n\t\t\t\tawait stores.tokens.consumeToken(change.tokenHash, 'verifyEmail', now),\n\t\t\t\t'consumeToken for a changeEmail token redeemed as verifyEmail',\n\t\t\t);\n\t\t\tisNull(\n\t\t\t\tawait stores.tokens.countAttempt(change.tokenHash, 'verifyEmail'),\n\t\t\t\t'countAttempt for a changeEmail token counted as verifyEmail',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait stores.tokens.spendUserTokens(userId, 'changeEmail', now),\n\t\t\t\t1,\n\t\t\t\t'spendUserTokens of changeEmail: the change only',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait stores.tokens.consumeToken(\n\t\t\t\t\tverification.tokenHash,\n\t\t\t\t\t'verifyEmail',\n\t\t\t\t\tnow,\n\t\t\t\t),\n\t\t\t\tverification,\n\t\t\t\t'spendUserTokens of changeEmail should not touch a verification, nor anything else have counted it',\n\t\t\t);\n\t\t},\n\t},\n];\n",
37
+ "import { mintId } from '../../../ids/id';\nimport { equal, isNull, ok } from '../../assert';\nimport { at, tokenRecord } from '../../fixtures';\nimport type { ConformanceCase } from '../../types';\n\nconst group = 'tokens';\n\n/** What a deletion of a user's tokens removes, and what it leaves. */\nexport const tokenDeletionCases: readonly ConformanceCase[] = [\n\t{\n\t\tid: 'tokens.deleteUser',\n\t\tgroup,\n\t\tname: 'deletes every token of one user, spent or not, of either kind, and counts them',\n\t\tasync run({ stores }) {\n\t\t\tconst userId = mintId();\n\t\t\tconst records = [\n\t\t\t\ttokenRecord({ userId }),\n\t\t\t\ttokenRecord({ userId, kind: 'verifyEmail' }),\n\t\t\t\ttokenRecord({ userId, spentAt: at('2026-01-02T00:00:00.000Z') }),\n\t\t\t];\n\t\t\tconst stranger = tokenRecord();\n\t\t\tfor (const record of [...records, stranger]) {\n\t\t\t\tawait stores.tokens.insertToken(record);\n\t\t\t}\n\t\t\tconst now = at('2026-02-01T00:00:00.000Z');\n\n\t\t\tequal(\n\t\t\t\tawait stores.tokens.deleteUserTokens(userId),\n\t\t\t\t3,\n\t\t\t\t'deleteUserTokens: how many it deleted',\n\t\t\t);\n\t\t\tfor (const record of records) {\n\t\t\t\tisNull(\n\t\t\t\t\tawait stores.tokens.consumeToken(record.tokenHash, record.kind, now),\n\t\t\t\t\t'consumeToken after deleteUserTokens',\n\t\t\t\t);\n\t\t\t}\n\t\t\tequal(\n\t\t\t\tawait stores.tokens.consumeToken(\n\t\t\t\t\tstranger.tokenHash,\n\t\t\t\t\tstranger.kind,\n\t\t\t\t\tnow,\n\t\t\t\t),\n\t\t\t\tstranger,\n\t\t\t\t'deleteUserTokens should not touch another user',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait stores.tokens.deleteUserTokens(userId),\n\t\t\t\t0,\n\t\t\t\t'deleteUserTokens for a user with none answers 0, not a failure',\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tid: 'tokens.deleteExpired',\n\t\tgroup,\n\t\tname: 'deletes tokens whose expiry is at or before the instant, spent or not, and only those',\n\t\tneeds: 'deleteExpiredTokens',\n\t\tasync run({ stores }) {\n\t\t\tconst collect = stores.tokens.deleteExpiredTokens;\n\t\t\tok(collect !== undefined, 'deleteExpiredTokens should be present');\n\t\t\tconst lapsedAt = at('2026-01-10T00:00:00.000Z');\n\t\t\tconst laterAt = at('2026-01-10T00:00:00.001Z');\n\t\t\tconst spentAt = at('2026-01-05T00:00:00.000Z');\n\t\t\tconst lapsed = tokenRecord({ expiresAt: lapsedAt });\n\t\t\tconst lapsedSpent = tokenRecord({ expiresAt: lapsedAt, spentAt });\n\t\t\tconst living = tokenRecord({ expiresAt: laterAt });\n\t\t\tconst livingSpent = tokenRecord({ expiresAt: laterAt, spentAt });\n\t\t\tfor (const record of [lapsed, lapsedSpent, living, livingSpent]) {\n\t\t\t\tawait stores.tokens.insertToken(record);\n\t\t\t}\n\n\t\t\tequal(\n\t\t\t\tawait collect?.call(stores.tokens, lapsedAt),\n\t\t\t\t2,\n\t\t\t\t'deleteExpiredTokens: how many it deleted, spent ones included',\n\t\t\t);\n\t\t\tfor (const record of [lapsed, lapsedSpent]) {\n\t\t\t\tisNull(\n\t\t\t\t\tawait stores.tokens.countAttempt(record.tokenHash, record.kind),\n\t\t\t\t\t'countAttempt after deleteExpiredTokens',\n\t\t\t\t);\n\t\t\t}\n\t\t\tequal(\n\t\t\t\tawait stores.tokens.countAttempt(living.tokenHash, living.kind),\n\t\t\t\t{ ...living, attempts: 1 },\n\t\t\t\t'deleteExpiredTokens should keep a token one millisecond short of lapsing',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait stores.tokens.countAttempt(\n\t\t\t\t\tlivingSpent.tokenHash,\n\t\t\t\t\tlivingSpent.kind,\n\t\t\t\t),\n\t\t\t\tlivingSpent,\n\t\t\t\t'deleteExpiredTokens should keep a spent token until it lapses, still spent',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait collect?.call(stores.tokens, lapsedAt),\n\t\t\t\t0,\n\t\t\t\t'deleteExpiredTokens with nothing lapsed answers 0, not a failure',\n\t\t\t);\n\t\t},\n\t},\n];\n",
38
+ "import { equal } from '../../assert';\nimport { at, tokenRecord } from '../../fixtures';\nimport type { ConformanceCase } from '../../types';\n\nconst group = 'tokens';\n\n/**\n * What a store keeps of an inserted token: an empty address, an expiry it\n * leaves to the core, and the first write under a retry.\n */\nexport const tokenInsertCases: readonly ConformanceCase[] = [\n\t{\n\t\tid: 'tokens.challenge',\n\t\tgroup,\n\t\tname: \"keeps a second-factor challenge, whose address is '' — nothing was sent for it\",\n\t\tasync run({ stores }) {\n\t\t\tconst record = tokenRecord({ kind: 'secondFactor', address: '' });\n\t\t\tawait stores.tokens.insertToken(record);\n\n\t\t\tequal(\n\t\t\t\tawait stores.tokens.countAttempt(record.tokenHash, 'secondFactor'),\n\t\t\t\t{ ...record, attempts: 1 },\n\t\t\t\t\"countAttempt should answer a challenge with its empty address kept — a store that refuses '' refuses every sign-in with a second factor\",\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait stores.tokens.consumeToken(\n\t\t\t\t\trecord.tokenHash,\n\t\t\t\t\t'secondFactor',\n\t\t\t\t\tat('2026-02-01T00:00:00.000Z'),\n\t\t\t\t),\n\t\t\t\t{ ...record, attempts: 1 },\n\t\t\t\t'consumeToken should spend the challenge and answer it as it was',\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tid: 'tokens.lapsed',\n\t\tgroup,\n\t\tname: 'spends a lapsed token all the same: expiry is compared by the core, after the call',\n\t\tasync run({ stores }) {\n\t\t\tconst record = tokenRecord({ expiresAt: at('2020-01-01T00:00:00.000Z') });\n\t\t\tawait stores.tokens.insertToken(record);\n\t\t\tconst now = at('2026-02-01T00:00:00.000Z');\n\n\t\t\tconst first = await stores.tokens.consumeToken(\n\t\t\t\trecord.tokenHash,\n\t\t\t\t'resetPassword',\n\t\t\t\tnow,\n\t\t\t);\n\t\t\t// A store may have dropped a lapsed token already; if it answers, it\n\t\t\t// answers it unspent, and spends it.\n\t\t\tif (first !== null) {\n\t\t\t\tequal(\n\t\t\t\t\tfirst,\n\t\t\t\t\trecord,\n\t\t\t\t\t'consumeToken on a lapsed token should answer it as it was',\n\t\t\t\t);\n\t\t\t\tequal(\n\t\t\t\t\t(\n\t\t\t\t\t\tawait stores.tokens.consumeToken(\n\t\t\t\t\t\t\trecord.tokenHash,\n\t\t\t\t\t\t\t'resetPassword',\n\t\t\t\t\t\t\tnow,\n\t\t\t\t\t\t)\n\t\t\t\t\t)?.spentAt,\n\t\t\t\t\tnow,\n\t\t\t\t\t'consumeToken should have spent the lapsed token, so it can never be retried',\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t},\n\t{\n\t\tid: 'tokens.idempotentInsert',\n\t\tgroup,\n\t\tname: 'is idempotent under retry: inserting an existing token hash writes nothing',\n\t\tasync run({ stores }) {\n\t\t\tconst record = tokenRecord();\n\t\t\tawait stores.tokens.insertToken(record);\n\t\t\tawait stores.tokens.insertToken({\n\t\t\t\t...record,\n\t\t\t\taddress: 'other@example.test',\n\t\t\t});\n\n\t\t\tequal(\n\t\t\t\tawait stores.tokens.consumeToken(\n\t\t\t\t\trecord.tokenHash,\n\t\t\t\t\t'resetPassword',\n\t\t\t\t\tat('2026-02-01T00:00:00.000Z'),\n\t\t\t\t),\n\t\t\t\trecord,\n\t\t\t\t'insertToken retried with the same hash should write nothing',\n\t\t\t);\n\t\t},\n\t},\n];\n",
39
+ "import type { TokenKind } from '../../../auth/port/types';\nimport { mintId } from '../../../ids/id';\nimport { equal, isNull } from '../../assert';\nimport { at, tokenRecord } from '../../fixtures';\nimport type { ConformanceCase } from '../../types';\n\nconst group = 'tokens';\n\n/**\n * Every kind the port names. A store that lists them — a column's `CHECK`, a\n * schema's enum — refuses a kind it was not told of, and this is where that\n * shows. A record over the union, so a kind added to the port and not here\n * stops this file compiling.\n */\nconst KINDS = Object.keys({\n\tverifyEmail: true,\n\tresetPassword: true,\n\tsecondFactor: true,\n\tsignInCode: true,\n\tmagicLink: true,\n\tstepUp: true,\n\tchangeEmail: true,\n\tsocialFlow: true,\n\tpasskeyRegistration: true,\n} satisfies Record<TokenKind, true>) as TokenKind[];\n\n/**\n * Each kind stored and redeemed as itself, a step-up kept apart from a\n * sign-in code, and a sign-in link from both.\n */\nexport const tokenKindCases: readonly ConformanceCase[] = [\n\t{\n\t\tid: 'tokens.everyKind',\n\t\tgroup,\n\t\tname: 'stores, counts and spends a token of every kind the port names',\n\t\tasync run({ stores }) {\n\t\t\tconst now = at('2026-02-01T00:00:00.000Z');\n\t\t\tfor (const kind of KINDS) {\n\t\t\t\tconst record = tokenRecord({ kind, codeHash: 'c'.repeat(64) });\n\t\t\t\tawait stores.tokens.insertToken(record);\n\n\t\t\t\tequal(\n\t\t\t\t\tawait stores.tokens.countAttempt(record.tokenHash, kind),\n\t\t\t\t\t{ ...record, attempts: 1 },\n\t\t\t\t\t`countAttempt on a ${kind} token should answer it with one attempt`,\n\t\t\t\t);\n\t\t\t\tequal(\n\t\t\t\t\tawait stores.tokens.consumeToken(record.tokenHash, kind, now),\n\t\t\t\t\t{ ...record, attempts: 1 },\n\t\t\t\t\t`consumeToken on a ${kind} token should answer it as it was — spentAt null`,\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t},\n\t{\n\t\tid: 'tokens.stepUpKind',\n\t\tgroup,\n\t\tname: 'keeps a step-up apart from a sign-in code: neither is counted, spent nor answered as the other',\n\t\tasync run({ stores }) {\n\t\t\tconst userId = mintId();\n\t\t\tconst stepUp = tokenRecord({ userId, kind: 'stepUp' });\n\t\t\tconst signInCode = tokenRecord({ userId, kind: 'signInCode' });\n\t\t\tawait stores.tokens.insertToken(stepUp);\n\t\t\tawait stores.tokens.insertToken(signInCode);\n\t\t\tconst now = at('2026-02-01T00:00:00.000Z');\n\n\t\t\tisNull(\n\t\t\t\tawait stores.tokens.countAttempt(stepUp.tokenHash, 'signInCode'),\n\t\t\t\t'countAttempt for a stepUp token counted as signInCode',\n\t\t\t);\n\t\t\tisNull(\n\t\t\t\tawait stores.tokens.consumeToken(signInCode.tokenHash, 'stepUp', now),\n\t\t\t\t'consumeToken for a signInCode token redeemed as stepUp',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait stores.tokens.spendUserTokens(userId, 'stepUp', now),\n\t\t\t\t1,\n\t\t\t\t'spendUserTokens of stepUp: the step-up only',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait stores.tokens.consumeToken(\n\t\t\t\t\tsignInCode.tokenHash,\n\t\t\t\t\t'signInCode',\n\t\t\t\t\tnow,\n\t\t\t\t),\n\t\t\t\tsignInCode,\n\t\t\t\t'spendUserTokens of stepUp should not touch a sign-in code, nor anything else have counted it',\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tid: 'tokens.magicLinkKind',\n\t\tgroup,\n\t\tname: 'keeps a sign-in link apart from a sign-in code: neither is counted, spent nor answered as the other',\n\t\tasync run({ stores }) {\n\t\t\tconst userId = mintId();\n\t\t\tconst link = tokenRecord({ userId, kind: 'magicLink' });\n\t\t\tconst code = tokenRecord({\n\t\t\t\tuserId,\n\t\t\t\tkind: 'signInCode',\n\t\t\t\tcodeHash: 'c'.repeat(64),\n\t\t\t});\n\t\t\tawait stores.tokens.insertToken(link);\n\t\t\tawait stores.tokens.insertToken(code);\n\t\t\tconst now = at('2026-02-01T00:00:00.000Z');\n\n\t\t\t// A sign-in code's challenge is held by whoever asked for it: redeemed\n\t\t\t// as a link, it would sign them in with no code at all.\n\t\t\tisNull(\n\t\t\t\tawait stores.tokens.consumeToken(code.tokenHash, 'magicLink', now),\n\t\t\t\t'consumeToken for a signInCode token redeemed as magicLink',\n\t\t\t);\n\t\t\tisNull(\n\t\t\t\tawait stores.tokens.countAttempt(link.tokenHash, 'signInCode'),\n\t\t\t\t'countAttempt for a magicLink token counted as signInCode',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait stores.tokens.spendUserTokens(userId, 'magicLink', now),\n\t\t\t\t1,\n\t\t\t\t'spendUserTokens of magicLink: the link only',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait stores.tokens.consumeToken(code.tokenHash, 'signInCode', now),\n\t\t\t\tcode,\n\t\t\t\t'spendUserTokens of magicLink should not touch a sign-in code, nor anything else have counted it',\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tid: 'tokens.amr',\n\t\tgroup,\n\t\tname: 'keeps the methods a second-factor challenge carries, and answers none when none were given',\n\t\tasync run({ stores }) {\n\t\t\tconst now = at('2026-02-01T00:00:00.000Z');\n\t\t\tconst carrying = tokenRecord({\n\t\t\t\tkind: 'secondFactor',\n\t\t\t\tamr: ['hwk', 'user'],\n\t\t\t});\n\t\t\tconst plain = tokenRecord({ kind: 'secondFactor' });\n\t\t\tawait stores.tokens.insertToken(carrying);\n\t\t\tawait stores.tokens.insertToken(plain);\n\n\t\t\tequal(\n\t\t\t\tawait stores.tokens.consumeToken(\n\t\t\t\t\tcarrying.tokenHash,\n\t\t\t\t\t'secondFactor',\n\t\t\t\t\tnow,\n\t\t\t\t),\n\t\t\t\tcarrying,\n\t\t\t\t'consumeToken should answer the challenge with the methods it carried',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait stores.tokens.consumeToken(plain.tokenHash, 'secondFactor', now),\n\t\t\t\tplain,\n\t\t\t\t'a challenge written without amr should read back without one',\n\t\t\t);\n\t\t},\n\t},\n];\n",
40
+ "import { type Id, mintId } from '../../../ids/id';\nimport { equal, isNull } from '../../assert';\nimport { at, tokenRecord } from '../../fixtures';\nimport type { ConformanceCase } from '../../types';\n\nconst group = 'tokens';\n\n/**\n * How a token is redeemed: once, by one conditional write, and only as its own\n * kind.\n */\nexport const tokenRedemptionCases: readonly ConformanceCase[] = [\n\t{\n\t\tid: 'tokens.consume',\n\t\tgroup,\n\t\tname: 'answers the token as it was before the call: spentAt null means this call spent it',\n\t\tasync run({ stores }) {\n\t\t\tconst record = tokenRecord();\n\t\t\tawait stores.tokens.insertToken(record);\n\t\t\tconst first = at('2026-02-01T00:00:00.000Z');\n\n\t\t\tequal(\n\t\t\t\tawait stores.tokens.consumeToken(\n\t\t\t\t\trecord.tokenHash,\n\t\t\t\t\t'resetPassword',\n\t\t\t\t\tfirst,\n\t\t\t\t),\n\t\t\t\trecord,\n\t\t\t\t'consumeToken the first time should answer the token as it was — spentAt null',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait stores.tokens.consumeToken(\n\t\t\t\t\trecord.tokenHash,\n\t\t\t\t\t'resetPassword',\n\t\t\t\t\tat('2026-02-02T00:00:00.000Z'),\n\t\t\t\t),\n\t\t\t\t{ ...record, spentAt: first },\n\t\t\t\t'consumeToken the second time should answer it spent at the first call’s instant, and change nothing',\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tid: 'tokens.concurrency',\n\t\tgroup,\n\t\tname: 'lets exactly one of twenty concurrent redemptions spend a token — one conditional write, never a read then a write',\n\t\tasync run({ stores }) {\n\t\t\tconst record = tokenRecord();\n\t\t\tawait stores.tokens.insertToken(record);\n\t\t\tconst now = at('2026-02-01T00:00:00.000Z');\n\n\t\t\tconst answers = await Promise.all(\n\t\t\t\tArray.from({ length: 20 }, () =>\n\t\t\t\t\tstores.tokens.consumeToken(record.tokenHash, 'resetPassword', now),\n\t\t\t\t),\n\t\t\t);\n\n\t\t\tequal(\n\t\t\t\tanswers.filter((answer) => answer !== null && answer.spentAt === null)\n\t\t\t\t\t.length,\n\t\t\t\t1,\n\t\t\t\t'consumeToken: of twenty concurrent calls, exactly one should see spentAt null — a reset token redeemed twice is an account takeover',\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tid: 'tokens.kind',\n\t\tgroup,\n\t\tname: 'does not know, and does not spend, a token of the other kind',\n\t\tasync run({ stores }) {\n\t\t\tconst record = tokenRecord({ kind: 'verifyEmail' });\n\t\t\tawait stores.tokens.insertToken(record);\n\n\t\t\tisNull(\n\t\t\t\tawait stores.tokens.consumeToken(\n\t\t\t\t\trecord.tokenHash,\n\t\t\t\t\t'resetPassword',\n\t\t\t\t\tat('2026-02-01T00:00:00.000Z'),\n\t\t\t\t),\n\t\t\t\t'consumeToken for a verifyEmail token redeemed as resetPassword',\n\t\t\t);\n\t\t\tconst own = await stores.tokens.consumeToken(\n\t\t\t\trecord.tokenHash,\n\t\t\t\t'verifyEmail',\n\t\t\t\tat('2026-02-02T00:00:00.000Z'),\n\t\t\t);\n\t\t\tequal(\n\t\t\t\town,\n\t\t\t\trecord,\n\t\t\t\t'consumeToken of the other kind should not have spent the token: redeemed as its own kind, it is still unspent',\n\t\t\t);\n\t\t\tisNull(\n\t\t\t\tawait stores.tokens.consumeToken(\n\t\t\t\t\t'0'.repeat(64),\n\t\t\t\t\t'resetPassword',\n\t\t\t\t\tat('2026-02-01T00:00:00.000Z'),\n\t\t\t\t),\n\t\t\t\t'consumeToken for an unknown hash',\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tid: 'tokens.consumeBound',\n\t\tgroup,\n\t\tname: 'given a userId, answers null and does not spend a token of another user',\n\t\tasync run({ stores }) {\n\t\t\tconst record = tokenRecord({ kind: 'verifyEmail' });\n\t\t\tawait stores.tokens.insertToken(record);\n\n\t\t\tisNull(\n\t\t\t\tawait stores.tokens.consumeToken(\n\t\t\t\t\trecord.tokenHash,\n\t\t\t\t\t'verifyEmail',\n\t\t\t\t\tat('2026-02-01T00:00:00.000Z'),\n\t\t\t\t\tmintId(),\n\t\t\t\t),\n\t\t\t\t'consumeToken bound to another user',\n\t\t\t);\n\t\t\tisNull(\n\t\t\t\tawait stores.tokens.consumeToken(\n\t\t\t\t\trecord.tokenHash,\n\t\t\t\t\t'verifyEmail',\n\t\t\t\t\tat('2026-02-01T00:00:00.000Z'),\n\t\t\t\t\t'' as Id,\n\t\t\t\t),\n\t\t\t\t'consumeToken bound to an empty id should match no token, not any',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait stores.tokens.consumeToken(\n\t\t\t\t\trecord.tokenHash,\n\t\t\t\t\t'verifyEmail',\n\t\t\t\t\tat('2026-02-02T00:00:00.000Z'),\n\t\t\t\t\trecord.userId,\n\t\t\t\t),\n\t\t\t\trecord,\n\t\t\t\t'consumeToken bound to the token’s own user should answer it unspent: the other user’s call spent nothing',\n\t\t\t);\n\t\t},\n\t},\n];\n",
41
+ "import { mintId } from '../../../ids/id';\nimport { equal, isNull } from '../../assert';\nimport { at, tokenRecord } from '../../fixtures';\nimport type { ConformanceCase } from '../../types';\n\nconst group = 'tokens';\n\n/**\n * A social flow's token kept apart from an e-mailed one: the two can sit in\n * the store for one user, and neither is counted, spent or answered as the\n * other. A flow's secret sits in a cookie; it must never redeem as a link.\n */\nexport const tokenSocialFlowCases: readonly ConformanceCase[] = [\n\t{\n\t\tid: 'tokens.socialFlowKind',\n\t\tgroup,\n\t\tname: 'keeps a social flow apart from a verification, and keeps its binding hash in codeHash',\n\t\tasync run({ stores }) {\n\t\t\tconst userId = mintId();\n\t\t\tconst flow = tokenRecord({\n\t\t\t\tuserId,\n\t\t\t\taddress: '',\n\t\t\t\tkind: 'socialFlow',\n\t\t\t\tcodeHash: 'e'.repeat(64),\n\t\t\t});\n\t\t\tconst verification = tokenRecord({ userId, kind: 'verifyEmail' });\n\t\t\tawait stores.tokens.insertToken(flow);\n\t\t\tawait stores.tokens.insertToken(verification);\n\t\t\tconst now = at('2026-02-01T00:00:00.000Z');\n\n\t\t\tisNull(\n\t\t\t\tawait stores.tokens.consumeToken(\n\t\t\t\t\tverification.tokenHash,\n\t\t\t\t\t'socialFlow',\n\t\t\t\t\tnow,\n\t\t\t\t),\n\t\t\t\t'consumeToken for a verifyEmail token redeemed as socialFlow',\n\t\t\t);\n\t\t\tisNull(\n\t\t\t\tawait stores.tokens.consumeToken(flow.tokenHash, 'verifyEmail', now),\n\t\t\t\t'consumeToken for a socialFlow token redeemed as verifyEmail',\n\t\t\t);\n\t\t\tisNull(\n\t\t\t\tawait stores.tokens.countAttempt(flow.tokenHash, 'magicLink'),\n\t\t\t\t'countAttempt for a socialFlow token counted as magicLink',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait stores.tokens.spendUserTokens(userId, 'socialFlow', now),\n\t\t\t\t1,\n\t\t\t\t'spendUserTokens of socialFlow: the flow only',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait stores.tokens.consumeToken(\n\t\t\t\t\tverification.tokenHash,\n\t\t\t\t\t'verifyEmail',\n\t\t\t\t\tnow,\n\t\t\t\t),\n\t\t\t\tverification,\n\t\t\t\t'spendUserTokens of socialFlow should not touch a verification',\n\t\t\t);\n\t\t},\n\t},\n];\n",
42
+ "import { mintId } from '../../../ids/id';\nimport { equal } from '../../assert';\nimport { at, tokenRecord } from '../../fixtures';\nimport type { ConformanceCase } from '../../types';\n\nconst group = 'tokens';\n\n/**\n * How the tokens of one user and one kind are spent together: all but the one\n * named, each once, even against a redemption.\n */\nexport const tokenSpendingCases: readonly ConformanceCase[] = [\n\t{\n\t\tid: 'tokens.spendUserTokens',\n\t\tgroup,\n\t\tname: 'spends every unspent token of one user and one kind, and counts them, leaving the rest as they were',\n\t\tasync run({ stores }) {\n\t\t\tconst userId = mintId();\n\t\t\tconst first = tokenRecord({ userId, kind: 'signInCode' });\n\t\t\tconst second = tokenRecord({ userId, kind: 'signInCode', attempts: 2 });\n\t\t\tconst spentBefore = at('2026-01-02T00:00:00.000Z');\n\t\t\tconst spent = tokenRecord({\n\t\t\t\tuserId,\n\t\t\t\tkind: 'signInCode',\n\t\t\t\tspentAt: spentBefore,\n\t\t\t});\n\t\t\tconst otherKind = tokenRecord({ userId, kind: 'resetPassword' });\n\t\t\tconst otherUser = tokenRecord({ kind: 'signInCode' });\n\t\t\tfor (const record of [first, second, spent, otherKind, otherUser]) {\n\t\t\t\tawait stores.tokens.insertToken(record);\n\t\t\t}\n\t\t\tconst now = at('2026-02-01T00:00:00.000Z');\n\n\t\t\tequal(\n\t\t\t\tawait stores.tokens.spendUserTokens(userId, 'signInCode', now),\n\t\t\t\t2,\n\t\t\t\t'spendUserTokens: how many it spent — the two unspent signInCode tokens, not the one already spent',\n\t\t\t);\n\t\t\tfor (const record of [first, second]) {\n\t\t\t\tequal(\n\t\t\t\t\tawait stores.tokens.consumeToken(record.tokenHash, 'signInCode', now),\n\t\t\t\t\t{ ...record, spentAt: now },\n\t\t\t\t\t'spendUserTokens should have spent it at `at`, keeping its attempts',\n\t\t\t\t);\n\t\t\t}\n\t\t\tequal(\n\t\t\t\tawait stores.tokens.consumeToken(spent.tokenHash, 'signInCode', now),\n\t\t\t\tspent,\n\t\t\t\t'spendUserTokens should keep the spentAt of a token already spent',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait stores.tokens.consumeToken(\n\t\t\t\t\totherKind.tokenHash,\n\t\t\t\t\t'resetPassword',\n\t\t\t\t\tnow,\n\t\t\t\t),\n\t\t\t\totherKind,\n\t\t\t\t'spendUserTokens should not touch a token of another kind',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait stores.tokens.consumeToken(\n\t\t\t\t\totherUser.tokenHash,\n\t\t\t\t\t'signInCode',\n\t\t\t\t\tnow,\n\t\t\t\t),\n\t\t\t\totherUser,\n\t\t\t\t'spendUserTokens should not touch another user',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait stores.tokens.spendUserTokens(userId, 'signInCode', now),\n\t\t\t\t0,\n\t\t\t\t'spendUserTokens for a user with none left unspent answers 0, not a failure',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait stores.tokens.spendUserTokens(mintId(), 'signInCode', now),\n\t\t\t\t0,\n\t\t\t\t'spendUserTokens for a user with no token at all answers 0',\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tid: 'tokens.spendUserTokensExcept',\n\t\tgroup,\n\t\tname: 'spares the token named by except, and spends the rest',\n\t\tasync run({ stores }) {\n\t\t\tconst userId = mintId();\n\t\t\tconst kept = tokenRecord({ userId, kind: 'signInCode' });\n\t\t\tconst others = [\n\t\t\t\ttokenRecord({ userId, kind: 'signInCode' }),\n\t\t\t\ttokenRecord({ userId, kind: 'signInCode' }),\n\t\t\t];\n\t\t\tfor (const record of [kept, ...others]) {\n\t\t\t\tawait stores.tokens.insertToken(record);\n\t\t\t}\n\t\t\tconst now = at('2026-02-01T00:00:00.000Z');\n\n\t\t\tequal(\n\t\t\t\tawait stores.tokens.spendUserTokens(\n\t\t\t\t\tuserId,\n\t\t\t\t\t'signInCode',\n\t\t\t\t\tnow,\n\t\t\t\t\tkept.tokenHash,\n\t\t\t\t),\n\t\t\t\t2,\n\t\t\t\t'spendUserTokens with except: how many it spent — every token but the one named',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait stores.tokens.consumeToken(kept.tokenHash, 'signInCode', now),\n\t\t\t\tkept,\n\t\t\t\t'spendUserTokens should not spend the token named by except',\n\t\t\t);\n\t\t\tfor (const record of others) {\n\t\t\t\tequal(\n\t\t\t\t\t(\n\t\t\t\t\t\tawait stores.tokens.consumeToken(\n\t\t\t\t\t\t\trecord.tokenHash,\n\t\t\t\t\t\t\t'signInCode',\n\t\t\t\t\t\t\tnow,\n\t\t\t\t\t\t)\n\t\t\t\t\t)?.spentAt,\n\t\t\t\t\tnow,\n\t\t\t\t\t'spendUserTokens with except should spend every other token',\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t},\n\t{\n\t\tid: 'tokens.spendUserTokensRace',\n\t\tgroup,\n\t\tname: \"spends a token once, when spending a user's tokens races a redemption\",\n\t\tasync run({ stores }) {\n\t\t\tconst now = at('2026-02-01T00:00:00.000Z');\n\t\t\tfor (let round = 0; round < 10; round += 1) {\n\t\t\t\tconst record = tokenRecord({ kind: 'signInCode' });\n\t\t\t\tawait stores.tokens.insertToken(record);\n\n\t\t\t\tconst [counted, redeemed] = await Promise.all([\n\t\t\t\t\tstores.tokens.spendUserTokens(record.userId, 'signInCode', now),\n\t\t\t\t\tstores.tokens.consumeToken(record.tokenHash, 'signInCode', now),\n\t\t\t\t]);\n\n\t\t\t\tequal(\n\t\t\t\t\tcounted + (redeemed?.spentAt === null ? 1 : 0),\n\t\t\t\t\t1,\n\t\t\t\t\t'spendUserTokens and consumeToken: exactly one of the two should have spent the token',\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t},\n];\n",
43
+ "import type { ConformanceCase } from '../../types';\nimport { tokenAttemptCases } from './attempts';\nimport { tokenChangeEmailCases } from './change-email';\nimport { tokenDeletionCases } from './deletion';\nimport { tokenInsertCases } from './inserts';\nimport { tokenKindCases } from './kinds';\nimport { tokenRedemptionCases } from './redemption';\nimport { tokenSocialFlowCases } from './social-flow';\nimport { tokenSpendingCases } from './spending';\n\n/** Every case of the token store, in the order they are described. */\nexport const tokenStoreCases: readonly ConformanceCase[] = [\n\t...tokenRedemptionCases,\n\t...tokenAttemptCases,\n\t...tokenSpendingCases,\n\t...tokenInsertCases,\n\t...tokenKindCases,\n\t...tokenChangeEmailCases,\n\t...tokenSocialFlowCases,\n\t...tokenDeletionCases,\n];\n",
44
+ "import { mintId } from '../../../ids/id';\nimport { equal, ok } from '../../assert';\nimport { userRecord } from '../../fixtures';\nimport type { ConformanceCase } from '../../types';\n\nconst group = 'users';\n\nconst byId = (a: { id: string }, b: { id: string }) =>\n\ta.id < b.id ? -1 : a.id > b.id ? 1 : 0;\n\n/**\n * The optional `findUsers`: several users in one query. Skipped, with the\n * reason, for a store that does not implement it — the core then reads with\n * `findUser`.\n */\nexport const userBatchCases: readonly ConformanceCase[] = [\n\t{\n\t\tid: 'users.findUsers',\n\t\tgroup,\n\t\tname: 'findUsers answers each stored user once, byte for byte and whatever its type, and leaves out an id nobody holds',\n\t\tneeds: 'findUsers',\n\t\tasync run({ stores }) {\n\t\t\tconst findUsers = stores.users.findUsers;\n\t\t\tok(findUsers !== undefined, 'findUsers should be present');\n\t\t\tconst patient = userRecord({ type: 'patient' });\n\t\t\tconst staff = userRecord({ type: 'staff' });\n\t\t\tconst other = userRecord();\n\t\t\tfor (const record of [patient, staff, other]) {\n\t\t\t\tawait stores.users.insertUser(record);\n\t\t\t}\n\n\t\t\tconst answer = await findUsers?.call(stores.users, [\n\t\t\t\tstaff.id,\n\t\t\t\tmintId(),\n\t\t\t\tpatient.id,\n\t\t\t]);\n\n\t\t\tok(\n\t\t\t\tArray.isArray(answer),\n\t\t\t\t'findUsers should answer a list — an absence is a shorter list, never null',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\t[...(answer ?? [])].sort(byId),\n\t\t\t\t[patient, staff].sort(byId),\n\t\t\t\t'findUsers should answer the two stored users exactly as written, and only them',\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tid: 'users.findUsersNone',\n\t\tgroup,\n\t\tname: 'findUsers answers an empty list, not null, when no id is held',\n\t\tneeds: 'findUsers',\n\t\tasync run({ stores }) {\n\t\t\tawait stores.users.insertUser(userRecord());\n\n\t\t\tequal(\n\t\t\t\tawait stores.users.findUsers?.call(stores.users, [mintId(), mintId()]),\n\t\t\t\t[],\n\t\t\t\t'findUsers for ids nobody holds should answer []',\n\t\t\t);\n\t\t},\n\t},\n];\n",
45
+ "import { equal, isNull } from '../../assert';\nimport { userRecord } from '../../fixtures';\nimport type { ConformanceCase } from '../../types';\n\nconst group = 'users';\n\n/** What a deletion removes, and what it leaves. */\nexport const userDeletionCases: readonly ConformanceCase[] = [\n\t{\n\t\tid: 'users.delete',\n\t\tgroup,\n\t\tname: 'deletes a user and frees their logins, answers false for nobody, and touches no other user',\n\t\tasync run({ stores }) {\n\t\t\tconst record = userRecord();\n\t\t\tconst other = userRecord();\n\t\t\tawait stores.users.insertUser(record);\n\t\t\tawait stores.users.insertUser(other);\n\t\t\tconst [login] = record.logins;\n\n\t\t\tequal(\n\t\t\t\tawait stores.users.deleteUser(record.id),\n\t\t\t\ttrue,\n\t\t\t\t'deleteUser for a stored user should answer true',\n\t\t\t);\n\t\t\tisNull(\n\t\t\t\tawait stores.users.findUser(record.id),\n\t\t\t\t'findUser after deleteUser',\n\t\t\t);\n\t\t\tisNull(\n\t\t\t\tawait stores.users.findUserByLogin(record.type, login ?? ''),\n\t\t\t\t'findUserByLogin for a deleted user’s login',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait stores.users.deleteUser(record.id),\n\t\t\t\tfalse,\n\t\t\t\t'deleteUser replayed should answer false, not fail: a deletion interrupted half-way is replayed',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait stores.users.findUser(other.id),\n\t\t\t\tother,\n\t\t\t\t'deleteUser should not touch another user',\n\t\t\t);\n\t\t\t// The login is free for a new account: the index forgot it.\n\t\t\tconst successor = userRecord({ logins: [login ?? ''] });\n\t\t\tequal(\n\t\t\t\tawait stores.users.insertUser(successor),\n\t\t\t\tsuccessor,\n\t\t\t\t'insertUser onto a deleted user’s login should succeed',\n\t\t\t);\n\t\t},\n\t},\n];\n",
46
+ "import { StoreConflict } from '../../../errors/janus-error';\nimport { equal, isOurs, ok } from '../../assert';\nimport { userRecord } from '../../fixtures';\nimport type { ConformanceCase } from '../../types';\n\nconst group = 'users';\n\n/** What an insert does twice: nothing under a retry, one winner under a race. */\nexport const userInsertCases: readonly ConformanceCase[] = [\n\t{\n\t\tid: 'users.idempotentInsert',\n\t\tgroup,\n\t\tname: 'is idempotent under retry: inserting an existing id answers the stored record and writes nothing',\n\t\tasync run({ stores }) {\n\t\t\tconst record = userRecord();\n\t\t\tawait stores.users.insertUser(record);\n\n\t\t\tconst retried = await stores.users.insertUser({\n\t\t\t\t...record,\n\t\t\t\tfields: { email: 'changed@example.test' },\n\t\t\t});\n\n\t\t\tequal(\n\t\t\t\tretried,\n\t\t\t\trecord,\n\t\t\t\t'insertUser retried with the same id should answer the stored record',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait stores.users.findUser(record.id),\n\t\t\t\trecord,\n\t\t\t\t'insertUser retried should write nothing',\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tid: 'users.uniqueness',\n\t\tgroup,\n\t\tname: 'lets exactly one of twenty concurrent inserts hold a login: uniqueness is a constraint, not a read',\n\t\tasync run({ stores }) {\n\t\t\tconst records = Array.from({ length: 20 }, () =>\n\t\t\t\tuserRecord({ logins: ['contested@example.test'] }),\n\t\t\t);\n\n\t\t\tconst outcomes = await Promise.allSettled(\n\t\t\t\trecords.map((record) => stores.users.insertUser(record)),\n\t\t\t);\n\t\t\tconst accepted = outcomes.filter((o) => o.status === 'fulfilled');\n\t\t\tconst refused = outcomes.flatMap((o) =>\n\t\t\t\to.status === 'rejected' ? [o.reason as unknown] : [],\n\t\t\t);\n\n\t\t\tequal(\n\t\t\t\taccepted.length,\n\t\t\t\t1,\n\t\t\t\t'insertUser: of twenty concurrent inserts of one login, exactly one should be accepted — a read followed by a write lets several through',\n\t\t\t);\n\t\t\tfor (const error of refused) {\n\t\t\t\tisOurs(\n\t\t\t\t\terror,\n\t\t\t\t\tStoreConflict,\n\t\t\t\t\t'StoreConflict',\n\t\t\t\t\t'insertUser should refuse a taken login with StoreConflict',\n\t\t\t\t);\n\t\t\t\tequal(error.code, 'LOGIN_TAKEN', 'insertUser: the conflict code');\n\t\t\t\tequal(\n\t\t\t\t\terror.login,\n\t\t\t\t\t'contested@example.test',\n\t\t\t\t\t'insertUser: the conflict should name the login',\n\t\t\t\t);\n\t\t\t\tok(\n\t\t\t\t\t!error.message.includes('contested@example.test'),\n\t\t\t\t\t`insertUser: the conflict's message should not quote the login — a message never carries a value; got ${JSON.stringify(error.message)}`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tlet stored = 0;\n\t\t\tfor (const record of records) {\n\t\t\t\tif ((await stores.users.findUser(record.id)) !== null) stored += 1;\n\t\t\t}\n\t\t\tequal(stored, 1, 'insertUser: a refused insert should write nothing');\n\t\t},\n\t},\n];\n",
47
+ "import { mintId } from '../../../ids/id';\nimport { equal, ok } from '../../assert';\nimport { userRecord } from '../../fixtures';\nimport type { ConformanceCase } from '../../types';\n\nconst group = 'users';\n\n/** How the users of one type are paged. */\nexport const userListingCases: readonly ConformanceCase[] = [\n\t{\n\t\tid: 'users.pagination',\n\t\tgroup,\n\t\tname: 'pages 25 users of one type by 10 in ascending id order, with no gap, no repeat and no other type, and ends on a null cursor',\n\t\tasync run({ stores }) {\n\t\t\tconst records = Array.from({ length: 25 }, () => userRecord());\n\t\t\tconst others = Array.from({ length: 5 }, () =>\n\t\t\t\tuserRecord({ type: 'staff' }),\n\t\t\t);\n\t\t\t// Written newest first, and interleaved with another type, so neither\n\t\t\t// insertion order nor the whole collection is the answer.\n\t\t\tfor (const [index, record] of [...records].reverse().entries()) {\n\t\t\t\tawait stores.users.insertUser(record);\n\t\t\t\tconst other = others[index];\n\t\t\t\tif (other !== undefined) await stores.users.insertUser(other);\n\t\t\t}\n\t\t\tconst expected = records.map((record) => record.id).sort();\n\n\t\t\tconst seen: string[] = [];\n\t\t\tconst sizes: number[] = [];\n\t\t\tlet after: string | null = null;\n\t\t\tfor (let page = 0; page < 10; page += 1) {\n\t\t\t\tconst answer = await stores.users.listUsers({\n\t\t\t\t\ttype: 'user',\n\t\t\t\t\tafter,\n\t\t\t\t\tlimit: 10,\n\t\t\t\t});\n\t\t\t\tseen.push(...answer.items.map((item) => item.id));\n\t\t\t\tsizes.push(answer.items.length);\n\t\t\t\tafter = answer.nextCursor;\n\t\t\t\tif (after === null) break;\n\t\t\t}\n\n\t\t\tequal(sizes, [10, 10, 5], 'listUsers: page sizes for 25 users by 10');\n\t\t\tequal(\n\t\t\t\tseen,\n\t\t\t\texpected,\n\t\t\t\t'listUsers: every id of the type once, in ascending order',\n\t\t\t);\n\n\t\t\t// The cursor need not name a stored user.\n\t\t\tconst between = await stores.users.listUsers({\n\t\t\t\ttype: 'user',\n\t\t\t\tafter: '00000000-0000-7000-8000-000000000000',\n\t\t\t\tlimit: 3,\n\t\t\t});\n\t\t\tok(\n\t\t\t\tbetween.items[0]?.id === expected[0],\n\t\t\t\t'listUsers: a cursor naming no stored user should start after it, not fail',\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tid: 'users.loginPrefix',\n\t\tgroup,\n\t\tname: 'lists and counts only the users of the type holding a login that starts with the prefix, byte for byte, with no gap or repeat across pages',\n\t\tasync run({ stores }) {\n\t\t\tconst stamp = mintId();\n\t\t\tconst mine = `pfx-${stamp}`;\n\t\t\tconst named = (login: string, overrides = {}) =>\n\t\t\t\tuserRecord({ logins: [login], ...overrides });\n\t\t\tconst matching = [\n\t\t\t\tnamed(`${mine}-a@example.test`),\n\t\t\t\tnamed(`${mine}-b@example.test`),\n\t\t\t\tnamed(`${mine}-c@example.test`),\n\t\t\t];\n\t\t\tconst recordsOf = [\n\t\t\t\t...matching,\n\t\t\t\t// Same prefix, another type: never listed, never counted.\n\t\t\t\tnamed(`${mine}-staff@example.test`, { type: 'staff' }),\n\t\t\t\t// Another prefix.\n\t\t\t\tnamed(`other-${stamp}@example.test`),\n\t\t\t\t// Not at the start: a prefix is not a substring.\n\t\t\t\tnamed(`x-${mine}@example.test`),\n\t\t\t\t// Case is the core's to fold: the store compares bytes.\n\t\t\t\tnamed(`${mine.toUpperCase()}-upper@example.test`),\n\t\t\t];\n\t\t\t// A second login of the user counts, as any of a user's logins does.\n\t\t\tconst twoLogins = named(`zz-${stamp}@example.test`);\n\t\t\tconst withOther = {\n\t\t\t\t...twoLogins,\n\t\t\t\tlogins: [`zz-${stamp}@example.test`, `${mine}-second@example.test`],\n\t\t\t};\n\t\t\tfor (const record of [...recordsOf, withOther]) {\n\t\t\t\tawait stores.users.insertUser(record);\n\t\t\t}\n\t\t\tconst expected = [...matching, withOther].map((r) => r.id).sort();\n\n\t\t\tconst seen: string[] = [];\n\t\t\tlet after: string | null = null;\n\t\t\tfor (let page = 0; page < 10; page += 1) {\n\t\t\t\tconst answer = await stores.users.listUsers({\n\t\t\t\t\ttype: 'user',\n\t\t\t\t\tloginPrefix: mine,\n\t\t\t\t\tafter,\n\t\t\t\t\tlimit: 2,\n\t\t\t\t});\n\t\t\t\tseen.push(...answer.items.map((item) => item.id));\n\t\t\t\tafter = answer.nextCursor;\n\t\t\t\tif (after === null) break;\n\t\t\t}\n\t\t\tequal(\n\t\t\t\tseen,\n\t\t\t\texpected,\n\t\t\t\t'listUsers: a loginPrefix should list the users of the type with a login starting with it, in id order across pages',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait stores.users.countUsers({ type: 'user', loginPrefix: mine }),\n\t\t\t\texpected.length,\n\t\t\t\t'countUsers: a loginPrefix should count what listUsers lists',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait stores.users.countUsers({\n\t\t\t\t\ttype: 'staff',\n\t\t\t\t\tloginPrefix: mine,\n\t\t\t\t}),\n\t\t\t\t1,\n\t\t\t\t'countUsers: the type is part of the filter',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait stores.users.countUsers({\n\t\t\t\t\ttype: 'user',\n\t\t\t\t\tloginPrefix: `${mine}-zzz`,\n\t\t\t\t}),\n\t\t\t\t0,\n\t\t\t\t'countUsers: no match should answer 0',\n\t\t\t);\n\t\t\tok(\n\t\t\t\t(await stores.users.countUsers({ type: 'user' })) >=\n\t\t\t\t\trecordsOf.length - 1,\n\t\t\t\t'countUsers: without a prefix, every user of the type is counted',\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tid: 'users.loginPrefix.literal',\n\t\tgroup,\n\t\tname: 'treats the prefix as text: \".\", \"+\", \"%\", \"_\", \"\\\\\" and \"*\" match themselves and nothing else',\n\t\tasync run({ stores }) {\n\t\t\tconst stamp = mintId();\n\t\t\tconst base = `lit-${stamp}`;\n\t\t\tconst holders = {\n\t\t\t\tdot: `${base}.a@example.test`,\n\t\t\t\tplus: `${base}+a@example.test`,\n\t\t\t\tpercent: `${base}%a@example.test`,\n\t\t\t\tunderscore: `${base}_a@example.test`,\n\t\t\t\tbackslash: `${base}\\\\a@example.test`,\n\t\t\t\tstar: `${base}*a@example.test`,\n\t\t\t\tbang: `${base}!a@example.test`,\n\t\t\t\tparen: `${base}(a@example.test`,\n\t\t\t\t// What a pattern reading these as wildcards would match too.\n\t\t\t\tanyChar: `${base}Xa@example.test`,\n\t\t\t\tdashed: `${base}-a@example.test`,\n\t\t\t};\n\t\t\tconst byName = new Map<string, string>();\n\t\t\tfor (const [name, login] of Object.entries(holders)) {\n\t\t\t\tconst record = userRecord({ logins: [login] });\n\t\t\t\tbyName.set(name, record.id);\n\t\t\t\tawait stores.users.insertUser(record);\n\t\t\t}\n\n\t\t\tfor (const [name, symbol] of [\n\t\t\t\t['dot', '.'],\n\t\t\t\t['plus', '+'],\n\t\t\t\t['percent', '%'],\n\t\t\t\t['underscore', '_'],\n\t\t\t\t['backslash', '\\\\'],\n\t\t\t\t['star', '*'],\n\t\t\t\t['bang', '!'],\n\t\t\t\t['paren', '('],\n\t\t\t] as const) {\n\t\t\t\tconst answer = await stores.users.listUsers({\n\t\t\t\t\ttype: 'user',\n\t\t\t\t\tloginPrefix: `${base}${symbol}`,\n\t\t\t\t\tafter: null,\n\t\t\t\t\tlimit: 10,\n\t\t\t\t});\n\t\t\t\tequal(\n\t\t\t\t\tanswer.items.map((item) => item.id),\n\t\t\t\t\t[byName.get(name)],\n\t\t\t\t\t`listUsers: the prefix \"${symbol}\" should match only its own login`,\n\t\t\t\t);\n\t\t\t\tequal(\n\t\t\t\t\tawait stores.users.countUsers({\n\t\t\t\t\t\ttype: 'user',\n\t\t\t\t\t\tloginPrefix: `${base}${symbol}`,\n\t\t\t\t\t}),\n\t\t\t\t\t1,\n\t\t\t\t\t`countUsers: the prefix \"${symbol}\" should count only its own login`,\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t},\n\t{\n\t\tid: 'users.namePrefix',\n\t\tgroup,\n\t\tname: 'lists and counts only the users of the type whose name key starts with the prefix, byte for byte, combined with a loginPrefix, with no gap or repeat across pages',\n\t\tasync run({ stores }) {\n\t\t\tconst stamp = mintId();\n\t\t\tconst mine = `nm-${stamp}`;\n\t\t\tconst named = (nameKey: string | undefined, overrides = {}) =>\n\t\t\t\tuserRecord({\n\t\t\t\t\t...(nameKey === undefined ? {} : { nameKey }),\n\t\t\t\t\t...overrides,\n\t\t\t\t});\n\t\t\tconst matching = [\n\t\t\t\tnamed(`${mine} a`),\n\t\t\t\tnamed(`${mine} b`),\n\t\t\t\tnamed(`${mine} c`),\n\t\t\t];\n\t\t\tconst withLogin = named(`${mine} d`, {\n\t\t\t\tlogins: [`pair-${stamp}@example.test`],\n\t\t\t});\n\t\t\tfor (const record of [\n\t\t\t\t...matching,\n\t\t\t\twithLogin,\n\t\t\t\t// Another type: never listed, never counted.\n\t\t\t\tnamed(`${mine} staff`, { type: 'staff' }),\n\t\t\t\t// Not at the start: a prefix is not a substring.\n\t\t\t\tnamed(`x ${mine}`),\n\t\t\t\t// No name key: never matches.\n\t\t\t\tnamed(undefined),\n\t\t\t\t// Case is the core's to fold: the store compares bytes.\n\t\t\t\tnamed(mine.toUpperCase()),\n\t\t\t]) {\n\t\t\t\tawait stores.users.insertUser(record);\n\t\t\t}\n\t\t\tconst expected = [...matching, withLogin].map((r) => r.id).sort();\n\n\t\t\tconst seen: string[] = [];\n\t\t\tlet after: string | null = null;\n\t\t\tfor (let page = 0; page < 10; page += 1) {\n\t\t\t\tconst answer = await stores.users.listUsers({\n\t\t\t\t\ttype: 'user',\n\t\t\t\t\tnamePrefix: mine,\n\t\t\t\t\tafter,\n\t\t\t\t\tlimit: 2,\n\t\t\t\t});\n\t\t\t\tseen.push(...answer.items.map((item) => item.id));\n\t\t\t\tafter = answer.nextCursor;\n\t\t\t\tif (after === null) break;\n\t\t\t}\n\t\t\tequal(\n\t\t\t\tseen,\n\t\t\t\texpected,\n\t\t\t\t'listUsers: a namePrefix should list the users of the type whose name key starts with it, in id order across pages',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait stores.users.countUsers({ type: 'user', namePrefix: mine }),\n\t\t\t\texpected.length,\n\t\t\t\t'countUsers: a namePrefix should count what listUsers lists',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait stores.users.countUsers({ type: 'staff', namePrefix: mine }),\n\t\t\t\t1,\n\t\t\t\t'countUsers: the type is part of the filter',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait stores.users.countUsers({\n\t\t\t\t\ttype: 'user',\n\t\t\t\t\tnamePrefix: `${mine} zzz`,\n\t\t\t\t}),\n\t\t\t\t0,\n\t\t\t\t'countUsers: no match should answer 0',\n\t\t\t);\n\t\t\tconst both = await stores.users.listUsers({\n\t\t\t\ttype: 'user',\n\t\t\t\tnamePrefix: mine,\n\t\t\t\tloginPrefix: `pair-${stamp}`,\n\t\t\t\tafter: null,\n\t\t\t\tlimit: 10,\n\t\t\t});\n\t\t\tequal(\n\t\t\t\tboth.items.map((item) => item.id),\n\t\t\t\t[withLogin.id],\n\t\t\t\t'listUsers: a namePrefix and a loginPrefix should both hold',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait stores.users.countUsers({\n\t\t\t\t\ttype: 'user',\n\t\t\t\t\tnamePrefix: mine,\n\t\t\t\t\tloginPrefix: `pair-${stamp}`,\n\t\t\t\t}),\n\t\t\t\t1,\n\t\t\t\t'countUsers: a namePrefix and a loginPrefix should both hold',\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tid: 'users.namePrefix.literal',\n\t\tgroup,\n\t\tname: 'treats the name prefix as text: \".\", \"+\", \"%\", \"_\", \"\\\\\" and \"*\" match themselves and nothing else',\n\t\tasync run({ stores }) {\n\t\t\tconst base = `ln-${mintId()}`;\n\t\t\tconst holders = [\n\t\t\t\t['.', `${base}.a`],\n\t\t\t\t['+', `${base}+a`],\n\t\t\t\t['%', `${base}%a`],\n\t\t\t\t['_', `${base}_a`],\n\t\t\t\t['\\\\', `${base}\\\\a`],\n\t\t\t\t['*', `${base}*a`],\n\t\t\t\t// What a pattern reading these as wildcards would match too.\n\t\t\t\t['X', `${base}Xa`],\n\t\t\t\t['-', `${base}-a`],\n\t\t\t] as const;\n\t\t\tconst ids = new Map<string, string>();\n\t\t\tfor (const [symbol, nameKey] of holders) {\n\t\t\t\tconst record = userRecord({ nameKey });\n\t\t\t\tids.set(symbol, record.id);\n\t\t\t\tawait stores.users.insertUser(record);\n\t\t\t}\n\n\t\t\tfor (const symbol of ['.', '+', '%', '_', '\\\\', '*']) {\n\t\t\t\tconst answer = await stores.users.listUsers({\n\t\t\t\t\ttype: 'user',\n\t\t\t\t\tnamePrefix: `${base}${symbol}`,\n\t\t\t\t\tafter: null,\n\t\t\t\t\tlimit: 10,\n\t\t\t\t});\n\t\t\t\tequal(\n\t\t\t\t\tanswer.items.map((item) => item.id),\n\t\t\t\t\t[ids.get(symbol)],\n\t\t\t\t\t`listUsers: the name prefix \"${symbol}\" should match only its own name`,\n\t\t\t\t);\n\t\t\t\tequal(\n\t\t\t\t\tawait stores.users.countUsers({\n\t\t\t\t\t\ttype: 'user',\n\t\t\t\t\t\tnamePrefix: `${base}${symbol}`,\n\t\t\t\t\t}),\n\t\t\t\t\t1,\n\t\t\t\t\t`countUsers: the name prefix \"${symbol}\" should count only its own name`,\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t},\n];\n",
48
+ "import type { AvatarRecord } from '../../../auth/port/types';\nimport { equal, isNull } from '../../assert';\nimport { at, userRecord } from '../../fixtures';\nimport type { ConformanceCase } from '../../types';\n\n/** An avatar as the core writes it: an opaque id and the moment it was set. */\nconst avatar: AvatarRecord = {\n\tid: 'avatars/ada.3f9c1d',\n\tupdatedAt: at('2026-01-05T10:20:30.456Z'),\n};\n\n/** The `updatedAt` of the write under `version`: one day later per version. */\nconst writtenAt = (version: number): Date =>\n\tnew Date(Date.UTC(2026, 1, 2 + version));\n\n/**\n * An avatar round-trips whole — its id verbatim, its date to the millisecond —\n * a patch that does not name it keeps it, one that names it replaces it, and\n * `null` removes it.\n */\nexport const avatarSlotCase: ConformanceCase = {\n\tid: 'users.avatarSlot',\n\tgroup: 'users',\n\tname: 'round-trips an avatar, keeps it when a patch does not name it, replaces it whole when one does, and removes it when the patch names null',\n\tasync run({ stores }) {\n\t\tconst record = userRecord({ avatar });\n\t\tequal(\n\t\t\tawait stores.users.insertUser(record),\n\t\t\trecord,\n\t\t\t'insertUser should answer an avatar as written: its id verbatim and its updatedAt to the millisecond',\n\t\t);\n\t\tequal(\n\t\t\t(await stores.users.findUser(record.id))?.avatar,\n\t\t\tavatar,\n\t\t\t'findUser should answer the avatar insertUser wrote',\n\t\t);\n\n\t\tconst kept = await stores.users.updateUser(\n\t\t\trecord.id,\n\t\t\t{ updatedAt: writtenAt(0) },\n\t\t\t0,\n\t\t);\n\t\tequal(kept.avatar, avatar, 'updateUser not naming avatar should keep it');\n\n\t\tconst replacement: AvatarRecord = {\n\t\t\tid: 'avatars/ada.b7e204',\n\t\t\tupdatedAt: at('2026-02-03T04:05:06.789Z'),\n\t\t};\n\t\tconst replaced = await stores.users.updateUser(\n\t\t\trecord.id,\n\t\t\t{ updatedAt: writtenAt(1), avatar: replacement },\n\t\t\t1,\n\t\t);\n\t\tequal(\n\t\t\treplaced.avatar,\n\t\t\treplacement,\n\t\t\t'updateUser naming avatar should replace it whole',\n\t\t);\n\t\tequal(\n\t\t\t(await stores.users.findUser(record.id))?.avatar,\n\t\t\treplacement,\n\t\t\t'findUser after updateUser naming avatar should answer it as written',\n\t\t);\n\n\t\tisNull(\n\t\t\t(\n\t\t\t\tawait stores.users.updateUser(\n\t\t\t\t\trecord.id,\n\t\t\t\t\t{ updatedAt: writtenAt(2), avatar: null },\n\t\t\t\t\t2,\n\t\t\t\t)\n\t\t\t).avatar,\n\t\t\t'updateUser with avatar: null should remove the avatar',\n\t\t);\n\t\tisNull(\n\t\t\t(await stores.users.findUser(record.id))?.avatar,\n\t\t\t'findUser after updateUser with avatar: null should answer no avatar',\n\t\t);\n\n\t\tconst absent = userRecord();\n\t\tisNull(\n\t\t\t(await stores.users.insertUser(absent)).avatar,\n\t\t\t'insertUser should answer a user with no avatar as avatar: null',\n\t\t);\n\t},\n};\n",
49
+ "import type { JanusStores, SecondFactorRecord } from '../../../auth/port/types';\nimport type { Id } from '../../../ids/id';\nimport { equal, isNull, ok } from '../../assert';\nimport { at, userRecord } from '../../fixtures';\nimport type { ConformanceCase } from '../../types';\n\n/** A second factor as the core writes it: the secret sealed, opaque to a store. */\nexport const secondFactor: SecondFactorRecord = {\n\tmethod: 'totp',\n\tsecret: 'v1.2026-09.aXY.Y2lwaGVydGV4dA',\n\tconfirmedAt: null,\n\tlastStep: null,\n\trecoveryCodes: [],\n};\n\n/**\n * Recovery codes as the core writes them: keyed hashes, opaque to a store,\n * and deliberately **not** in sorted order, so a store that sorts is caught.\n */\nexport const recoveryCodes: readonly string[] = [\n\t'v1.2026-09.zHc0dGhpcmQ',\n\t'v1.2026-09.Yg2ZpcnN0',\n\t'v1.2026-09.mc2Vjb25k',\n];\n\n/**\n * A second factor round-trips whole — its recovery codes in order, `[]` as\n * `[]` — a patch that does not name it keeps it, one that names it replaces\n * it, codes included, and `null` removes it, codes included.\n */\nexport const secondFactorSlotCase: ConformanceCase = {\n\tid: 'users.secondFactorSlot',\n\tgroup: 'users',\n\tname: 'round-trips a second factor and its recovery codes in order, keeps it when a patch does not name it, replaces it whole when one does, and removes it, codes included, when the patch names null',\n\tasync run({ stores }) {\n\t\tconst record = userRecord({ secondFactor });\n\t\tequal(\n\t\t\tawait stores.users.insertUser(record),\n\t\t\trecord,\n\t\t\t'insertUser should answer a pending second factor as written: confirmedAt and lastStep null, recoveryCodes []',\n\t\t);\n\t\tawait noCodesIsNotNoFactor(stores, record.id);\n\n\t\tconst confirmed: SecondFactorRecord = {\n\t\t\t...secondFactor,\n\t\t\tconfirmedAt: at('2026-02-01T00:00:00.000Z'),\n\t\t\tlastStep: 59_000_000,\n\t\t\trecoveryCodes,\n\t\t};\n\t\tawait patchFactor(stores, record.id, confirmed, 0, 'secondFactor');\n\t\tequal(\n\t\t\t(await stores.users.updateUser(record.id, { updatedAt: writtenAt(1) }, 1))\n\t\t\t\t.secondFactor,\n\t\t\tconfirmed,\n\t\t\t'updateUser not naming secondFactor should keep it, recovery codes included',\n\t\t);\n\n\t\tawait replacesCodesWhole(stores, record.id, confirmed);\n\t\tawait nullClearsCodes(stores, record.id);\n\t},\n};\n\n/** The `updatedAt` of the write under `version`: one day later per version. */\nconst writtenAt = (version: number): Date =>\n\tnew Date(Date.UTC(2026, 1, 2 + version));\n\n/** `[]` is a factor with no codes: never `null`, never a missing field. */\nasync function noCodesIsNotNoFactor(stores: JanusStores, id: Id) {\n\tconst user = await stores.users.findUser(id);\n\tok(user !== null, 'findUser should answer the user insertUser wrote');\n\tconst found = user?.secondFactor;\n\tok(\n\t\tfound !== null && found !== undefined,\n\t\t'findUser should answer a second factor with recoveryCodes [] as a factor, not as null — no codes is not no factor',\n\t);\n\tequal(\n\t\tfound?.recoveryCodes,\n\t\t[],\n\t\t'findUser should answer recoveryCodes [] as [] — never null, never undefined',\n\t);\n}\n\n/** Writes `factor` under `version`, and checks both answers: the write's and a read's. */\nasync function patchFactor(\n\tstores: JanusStores,\n\tid: Id,\n\tfactor: SecondFactorRecord,\n\tversion: number,\n\twhat: string,\n) {\n\tconst written = await stores.users.updateUser(\n\t\tid,\n\t\t{\n\t\t\tupdatedAt: writtenAt(version),\n\t\t\tsecondFactor: factor,\n\t\t},\n\t\tversion,\n\t);\n\tequal(\n\t\twritten.secondFactor,\n\t\tfactor,\n\t\t`updateUser naming ${what} should replace the second factor whole, its recovery codes in the order written`,\n\t);\n\tequal(\n\t\t(await stores.users.findUser(id))?.secondFactor,\n\t\tfactor,\n\t\t`findUser after updateUser naming ${what} should answer it as written, its recovery codes in the order written`,\n\t);\n}\n\n/** A patch's codes replace the stored ones: never appended, never merged. */\nasync function replacesCodesWhole(\n\tstores: JanusStores,\n\tid: Id,\n\tconfirmed: SecondFactorRecord,\n) {\n\tconst kept = recoveryCodes.filter((_, index) => index !== 1);\n\tawait patchFactor(\n\t\tstores,\n\t\tid,\n\t\t{ ...confirmed, recoveryCodes: kept },\n\t\t2,\n\t\t'secondFactor with one recovery code fewer',\n\t);\n\tawait patchFactor(\n\t\tstores,\n\t\tid,\n\t\t{ ...confirmed, recoveryCodes: [] },\n\t\t3,\n\t\t'secondFactor with recoveryCodes []',\n\t);\n}\n\n/** `secondFactor: null` removes the codes with the factor: a new factor starts with none. */\nasync function nullClearsCodes(stores: JanusStores, id: Id) {\n\tawait patchFactor(\n\t\tstores,\n\t\tid,\n\t\t{ ...secondFactor, recoveryCodes },\n\t\t4,\n\t\t'secondFactor with recovery codes',\n\t);\n\tisNull(\n\t\t(\n\t\t\tawait stores.users.updateUser(\n\t\t\t\tid,\n\t\t\t\t{ updatedAt: writtenAt(5), secondFactor: null },\n\t\t\t\t5,\n\t\t\t)\n\t\t).secondFactor,\n\t\t'updateUser with secondFactor: null should remove the second factor',\n\t);\n\tisNull(\n\t\t(await stores.users.findUser(id))?.secondFactor,\n\t\t'findUser after updateUser with secondFactor: null should answer no second factor',\n\t);\n\tawait patchFactor(\n\t\tstores,\n\t\tid,\n\t\tsecondFactor,\n\t\t6,\n\t\t'a new secondFactor after null, with recoveryCodes [] — the removed codes must not come back',\n\t);\n}\n",
50
+ "import { StoreConflict } from '../../../errors/janus-error';\nimport { equal, isNull, isOurs, rejects } from '../../assert';\nimport { at, userRecord } from '../../fixtures';\nimport type { ConformanceCase } from '../../types';\nimport { avatarSlotCase } from './avatar';\nimport {\n\trecoveryCodes,\n\tsecondFactor,\n\tsecondFactorSlotCase,\n} from './second-factor';\n\nconst group = 'users';\n\n/**\n * What a patch writes: the fields it names, and nothing else — a field left\n * out is kept, a slot named `null` is removed, a login moved away is freed.\n */\nexport const userPatchCases: readonly ConformanceCase[] = [\n\t{\n\t\tid: 'users.omission',\n\t\tgroup,\n\t\tname: 'omission — the Kratos PUT trap: an update leaves every field it does not name exactly as it was',\n\t\tasync run({ stores }) {\n\t\t\tconst record = userRecord({\n\t\t\t\tfields: { email: 'kept@example.test', plan: 'pro' },\n\t\t\t\tsecondFactor: {\n\t\t\t\t\t...secondFactor,\n\t\t\t\t\tconfirmedAt: at('2026-01-03T00:00:00.000Z'),\n\t\t\t\t\tlastStep: 59_000_000,\n\t\t\t\t\trecoveryCodes: recoveryCodes.slice(0, 2),\n\t\t\t\t},\n\t\t\t\temailVerifiedAt: at('2026-01-02T00:00:00.000Z'),\n\t\t\t});\n\t\t\tawait stores.users.insertUser(record);\n\n\t\t\tconst written = await stores.users.updateUser(\n\t\t\t\trecord.id,\n\t\t\t\t{ updatedAt: at('2026-02-01T00:00:00.000Z'), schemaVersion: '2' },\n\t\t\t\t0,\n\t\t\t);\n\n\t\t\tequal(\n\t\t\t\twritten,\n\t\t\t\t{\n\t\t\t\t\t...record,\n\t\t\t\t\tschemaVersion: '2',\n\t\t\t\t\tversion: 1,\n\t\t\t\t\tupdatedAt: at('2026-02-01T00:00:00.000Z'),\n\t\t\t\t},\n\t\t\t\t'updateUser naming only schemaVersion should leave active, fields, logins, password, secondFactor and emailVerifiedAt untouched',\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tid: 'users.nameKeySlot',\n\t\tgroup,\n\t\tname: 'keeps a name key the patch does not name, replaces one it names, and removes one it names null',\n\t\tasync run({ stores }) {\n\t\t\tconst record = userRecord({ nameKey: 'ada lovelace' });\n\t\t\tawait stores.users.insertUser(record);\n\n\t\t\tconst kept = await stores.users.updateUser(\n\t\t\t\trecord.id,\n\t\t\t\t{ updatedAt: at('2026-02-01T00:00:00.000Z'), schemaVersion: '2' },\n\t\t\t\t0,\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tkept.nameKey,\n\t\t\t\t'ada lovelace',\n\t\t\t\t'updateUser not naming nameKey should keep it',\n\t\t\t);\n\n\t\t\tconst replaced = await stores.users.updateUser(\n\t\t\t\trecord.id,\n\t\t\t\t{ updatedAt: at('2026-02-02T00:00:00.000Z'), nameKey: 'grace hopper' },\n\t\t\t\t1,\n\t\t\t);\n\t\t\tequal(\n\t\t\t\treplaced.nameKey,\n\t\t\t\t'grace hopper',\n\t\t\t\t'updateUser naming nameKey should replace it',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait stores.users.countUsers({ type: 'user', namePrefix: 'grace' }),\n\t\t\t\t1,\n\t\t\t\t'countUsers: the replaced name key should be the one searched',\n\t\t\t);\n\n\t\t\tconst removed = await stores.users.updateUser(\n\t\t\t\trecord.id,\n\t\t\t\t{ updatedAt: at('2026-02-03T00:00:00.000Z'), nameKey: null },\n\t\t\t\t2,\n\t\t\t);\n\t\t\tequal(\n\t\t\t\t'nameKey' in removed,\n\t\t\t\tfalse,\n\t\t\t\t'updateUser naming nameKey null should leave the record with no nameKey',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait stores.users.countUsers({ type: 'user', namePrefix: 'grace' }),\n\t\t\t\t0,\n\t\t\t\t'countUsers: a removed name key should match no prefix',\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tid: 'users.passwordSlot',\n\t\tgroup,\n\t\tname: 'keeps a password the patch does not name, and removes one the patch names null',\n\t\tasync run({ stores }) {\n\t\t\tconst record = userRecord();\n\t\t\tawait stores.users.insertUser(record);\n\n\t\t\tconst kept = await stores.users.updateUser(\n\t\t\t\trecord.id,\n\t\t\t\t{ updatedAt: at('2026-02-01T00:00:00.000Z') },\n\t\t\t\t0,\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tkept.password,\n\t\t\t\trecord.password,\n\t\t\t\t'updateUser not naming password should keep it',\n\t\t\t);\n\n\t\t\tconst removed = await stores.users.updateUser(\n\t\t\t\trecord.id,\n\t\t\t\t{ updatedAt: at('2026-02-02T00:00:00.000Z'), password: null },\n\t\t\t\t1,\n\t\t\t);\n\t\t\tisNull(\n\t\t\t\tremoved.password,\n\t\t\t\t'updateUser with password: null should remove the password',\n\t\t\t);\n\t\t},\n\t},\n\tsecondFactorSlotCase,\n\tavatarSlotCase,\n\t{\n\t\tid: 'users.loginsMove',\n\t\tgroup,\n\t\tname: 'moves logins on update: the old one is free, the new one found, one held elsewhere refused',\n\t\tasync run({ stores }) {\n\t\t\tconst record = userRecord();\n\t\t\tconst other = userRecord();\n\t\t\tawait stores.users.insertUser(record);\n\t\t\tawait stores.users.insertUser(other);\n\t\t\tconst [old] = record.logins;\n\t\t\tconst moved = 'moved@example.test';\n\n\t\t\tawait stores.users.updateUser(\n\t\t\t\trecord.id,\n\t\t\t\t{ updatedAt: at('2026-02-01T00:00:00.000Z'), logins: [moved] },\n\t\t\t\t0,\n\t\t\t);\n\n\t\t\tisNull(\n\t\t\t\tawait stores.users.findUserByLogin('user', old ?? ''),\n\t\t\t\t'findUserByLogin for a login the update replaced',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\t(await stores.users.findUserByLogin('user', moved))?.id,\n\t\t\t\trecord.id,\n\t\t\t\t'findUserByLogin for the login the update wrote',\n\t\t\t);\n\n\t\t\tconst error = await rejects(\n\t\t\t\tstores.users.updateUser(\n\t\t\t\t\tother.id,\n\t\t\t\t\t{ updatedAt: at('2026-02-02T00:00:00.000Z'), logins: [moved] },\n\t\t\t\t\t0,\n\t\t\t\t),\n\t\t\t\t'updateUser onto a login another user holds should reject',\n\t\t\t);\n\t\t\tisOurs(\n\t\t\t\terror,\n\t\t\t\tStoreConflict,\n\t\t\t\t'StoreConflict',\n\t\t\t\t'updateUser onto a held login should reject with StoreConflict',\n\t\t\t);\n\t\t\tequal(error.code, 'LOGIN_TAKEN', 'updateUser: the conflict code');\n\t\t\tequal(\n\t\t\t\tawait stores.users.findUser(other.id),\n\t\t\t\tother,\n\t\t\t\t'updateUser refused for a login should have written nothing',\n\t\t\t);\n\t\t},\n\t},\n];\n",
51
+ "import { mintId } from '../../../ids/id';\nimport { equal, isNull } from '../../assert';\nimport { at, userRecord } from '../../fixtures';\nimport type { ConformanceCase } from '../../types';\n\nconst group = 'users';\n\n/**\n * What a read answers: the record exactly as written, `null` for an absence,\n * and a login found by its bytes alone.\n */\nexport const userReadCases: readonly ConformanceCase[] = [\n\t{\n\t\tid: 'users.roundTrip',\n\t\tgroup,\n\t\tname: 'round-trips a record byte for byte: nested fields, a 1 that stays a number, a \"1\" that stays a string',\n\t\tasync run({ stores }) {\n\t\t\tconst record = userRecord({\n\t\t\t\tfields: {\n\t\t\t\t\temail: 'Ada@Example.test',\n\t\t\t\t\tname: { first: 'Ada', last: 'Lovelace' },\n\t\t\t\t\tcount: 1,\n\t\t\t\t\tcode: '1',\n\t\t\t\t\tzero: 0,\n\t\t\t\t\tflags: [true, false, null],\n\t\t\t\t\tnote: ' spaced ',\n\t\t\t\t\tunicode: 'Bob — ÿ',\n\t\t\t\t\tnested: { deep: { deeper: [1, { two: 2 }] } },\n\t\t\t\t\ttags: ['a', 'b'],\n\t\t\t\t},\n\t\t\t\temailVerifiedAt: at('2026-01-02T00:00:00.000Z'),\n\t\t\t});\n\n\t\t\tequal(\n\t\t\t\tawait stores.users.insertUser(record),\n\t\t\t\trecord,\n\t\t\t\t'insertUser should answer the record as stored',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait stores.users.findUser(record.id),\n\t\t\t\trecord,\n\t\t\t\t'findUser should answer the record exactly as it was written',\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tid: 'users.edgeCharacters',\n\t\tgroup,\n\t\tname: 'round-trips every character the core lets through: control characters, U+FFFF and a surrogate pair',\n\t\tasync run({ stores }) {\n\t\t\tconst edge = 'a\\u0001\\u001f\\u007f\\uFFFF 😀 z';\n\t\t\tconst record = userRecord({\n\t\t\t\tlogins: [edge],\n\t\t\t\tfields: { email: 'ada@example.test', [edge]: [edge, { [edge]: edge }] },\n\t\t\t});\n\n\t\t\tawait stores.users.insertUser(record);\n\t\t\tequal(\n\t\t\t\tawait stores.users.findUser(record.id),\n\t\t\t\trecord,\n\t\t\t\t'findUser should answer every edge character exactly as written',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\t(await stores.users.findUserByLogin('user', edge))?.id,\n\t\t\t\trecord.id,\n\t\t\t\t'findUserByLogin should find a login made of edge characters',\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tid: 'users.absence',\n\t\tgroup,\n\t\tname: 'answers null for an absence, never undefined, and an empty page for an empty store',\n\t\tasync run({ stores }) {\n\t\t\tisNull(\n\t\t\t\tawait stores.users.findUser(mintId()),\n\t\t\t\t'findUser for an unknown id',\n\t\t\t);\n\t\t\tisNull(\n\t\t\t\tawait stores.users.findUserByLogin('user', 'nobody@example.test'),\n\t\t\t\t'findUserByLogin for an unknown login',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait stores.users.listUsers({ type: 'user', after: null, limit: 10 }),\n\t\t\t\t{ items: [], nextCursor: null },\n\t\t\t\t'listUsers on an empty store should answer an empty page',\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tid: 'users.loginBytes',\n\t\tgroup,\n\t\tname: 'compares logins as bytes, within one type: no case folding, no trimming, no collation',\n\t\tasync run({ stores }) {\n\t\t\tconst upper = userRecord({ logins: ['Ada@Example.test'] });\n\t\t\tconst lower = userRecord({ logins: ['ada@example.test'] });\n\t\t\tconst staff = userRecord({ type: 'staff', logins: ['ada@example.test'] });\n\n\t\t\tfor (const record of [upper, lower, staff]) {\n\t\t\t\tawait stores.users.insertUser(record);\n\t\t\t}\n\n\t\t\tequal(\n\t\t\t\t(await stores.users.findUserByLogin('user', 'Ada@Example.test'))?.id,\n\t\t\t\tupper.id,\n\t\t\t\t'findUserByLogin should find the login with its exact bytes',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\t(await stores.users.findUserByLogin('user', 'ada@example.test'))?.id,\n\t\t\t\tlower.id,\n\t\t\t\t'findUserByLogin should tell \"Ada@…\" from \"ada@…\": normalisation is the core’s',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\t(await stores.users.findUserByLogin('staff', 'ada@example.test'))?.id,\n\t\t\t\tstaff.id,\n\t\t\t\t'uniqueness is of (type, login): the same login under another type is another user',\n\t\t\t);\n\t\t},\n\t},\n];\n",
52
+ "import type { UserRecord } from '../../../auth/port/types';\nimport { NotFoundError, StoreConflict } from '../../../errors/janus-error';\nimport { mintId } from '../../../ids/id';\nimport { equal, isOurs, rejects } from '../../assert';\nimport { at, userRecord } from '../../fixtures';\nimport type { ConformanceCase } from '../../types';\n\nconst group = 'users';\n\n/**\n * How an update is guarded: applied at the expected version, refused at a\n * stale one, and refused apart from both for an id nobody holds.\n */\nexport const userVersionCases: readonly ConformanceCase[] = [\n\t{\n\t\tid: 'users.versionIncrements',\n\t\tgroup,\n\t\tname: 'applies an update at the expected version, and answers the record written with its version one higher',\n\t\tasync run({ stores }) {\n\t\t\tconst record = userRecord();\n\t\t\tawait stores.users.insertUser(record);\n\n\t\t\tconst written = await stores.users.updateUser(\n\t\t\t\trecord.id,\n\t\t\t\t{ updatedAt: at('2026-02-01T00:00:00.000Z'), active: false },\n\t\t\t\t0,\n\t\t\t);\n\t\t\tconst expected: UserRecord = {\n\t\t\t\t...record,\n\t\t\t\tactive: false,\n\t\t\t\tversion: 1,\n\t\t\t\tupdatedAt: at('2026-02-01T00:00:00.000Z'),\n\t\t\t};\n\n\t\t\tequal(\n\t\t\t\twritten,\n\t\t\t\texpected,\n\t\t\t\t'updateUser should answer the record as written',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait stores.users.findUser(record.id),\n\t\t\t\texpected,\n\t\t\t\t'findUser after updateUser',\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tid: 'users.versionConflict',\n\t\tgroup,\n\t\tname: 'refuses a stale version with both versions, and leaves the record identical byte for byte',\n\t\tasync run({ stores }) {\n\t\t\tconst record = userRecord();\n\t\t\tawait stores.users.insertUser(record);\n\t\t\tawait stores.users.updateUser(\n\t\t\t\trecord.id,\n\t\t\t\t{ updatedAt: at('2026-02-01T00:00:00.000Z'), active: false },\n\t\t\t\t0,\n\t\t\t);\n\t\t\tconst before = await stores.users.findUser(record.id);\n\n\t\t\tconst error = await rejects(\n\t\t\t\tstores.users.updateUser(\n\t\t\t\t\trecord.id,\n\t\t\t\t\t{\n\t\t\t\t\t\tupdatedAt: at('2026-03-01T00:00:00.000Z'),\n\t\t\t\t\t\tactive: true,\n\t\t\t\t\t\tfields: { email: 'overwritten@example.test' },\n\t\t\t\t\t},\n\t\t\t\t\t0,\n\t\t\t\t),\n\t\t\t\t'updateUser at a stale version should reject',\n\t\t\t);\n\n\t\t\tisOurs(\n\t\t\t\terror,\n\t\t\t\tStoreConflict,\n\t\t\t\t'StoreConflict',\n\t\t\t\t'updateUser at a stale version should reject with StoreConflict',\n\t\t\t);\n\t\t\tequal(error.code, 'VERSION_CONFLICT', 'updateUser: the conflict code');\n\t\t\tequal(error.expectedVersion, 0, 'updateUser: expectedVersion');\n\t\t\tequal(error.actualVersion, 1, 'updateUser: actualVersion');\n\t\t\t// A partial write that also reports a conflict is the worst of both.\n\t\t\tequal(\n\t\t\t\tawait stores.users.findUser(record.id),\n\t\t\t\tbefore,\n\t\t\t\t'updateUser refused for its version should have written nothing',\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tid: 'users.unknownUpdate',\n\t\tgroup,\n\t\tname: 'refuses an update to an unknown id with NotFoundError, told apart from a version conflict',\n\t\tasync run({ stores }) {\n\t\t\tconst error = await rejects(\n\t\t\t\tstores.users.updateUser(\n\t\t\t\t\tmintId(),\n\t\t\t\t\t{ updatedAt: at('2026-02-01T00:00:00.000Z') },\n\t\t\t\t\t0,\n\t\t\t\t),\n\t\t\t\t'updateUser on an unknown id should reject',\n\t\t\t);\n\n\t\t\tisOurs(\n\t\t\t\terror,\n\t\t\t\tNotFoundError,\n\t\t\t\t'NotFoundError',\n\t\t\t\t'updateUser on an unknown id should reject with NotFoundError, not a version conflict',\n\t\t\t);\n\t\t},\n\t},\n];\n",
53
+ "import type { ConformanceCase } from '../../types';\nimport { userBatchCases } from './batch';\nimport { userDeletionCases } from './deletion';\nimport { userInsertCases } from './inserts';\nimport { userListingCases } from './listing';\nimport { userPatchCases } from './patches';\nimport { userReadCases } from './reads';\nimport { userVersionCases } from './versions';\n\n/** Every case of the user store, in the order they are described. */\nexport const userStoreCases: readonly ConformanceCase[] = [\n\t...userReadCases,\n\t...userBatchCases,\n\t...userInsertCases,\n\t...userVersionCases,\n\t...userPatchCases,\n\t...userListingCases,\n\t...userDeletionCases,\n];\n",
54
+ "import { outageCases } from './cases/outage';\nimport { passkeyStoreCases } from './cases/passkeys';\nimport { sessionStoreCases } from './cases/sessions';\nimport { socialLinkStoreCases } from './cases/social-links';\nimport { tokenStoreCases } from './cases/tokens';\nimport { userStoreCases } from './cases/users';\nimport type {\n\tCaseNeed,\n\tConformanceCase,\n\tConformanceHarness,\n\tConformanceRunner,\n\tOpenedStores,\n} from './types';\n\n/** Every case, in the order they are described. */\nexport const allCases: readonly ConformanceCase[] = [\n\t...userStoreCases,\n\t...sessionStoreCases,\n\t...tokenStoreCases,\n\t...socialLinkStoreCases,\n\t...passkeyStoreCases,\n\t...outageCases,\n];\n\n/** Why a case did not run. A skip is always reported with its reason, never silent. */\nexport const SKIP_REASONS = {\n\tfaults:\n\t\t'faults not provided: the outage invariant is not proven for this adapter',\n\tdeleteExpiredSessions:\n\t\t'stores.sessions does not implement the optional deleteExpiredSessions',\n\tlistUserSessions:\n\t\t'stores.sessions does not implement the optional listUserSessions',\n\tdeleteExpiredTokens:\n\t\t'stores.tokens does not implement the optional deleteExpiredTokens',\n\tfindUsers:\n\t\t'stores.users does not implement the optional findUsers: findMany reads with findUser instead',\n\tsocialLinks:\n\t\t'stores.socialLinks is not provided: the slot is optional, needed only for social sign-in',\n\tpasskeys:\n\t\t'stores.passkeys is not provided: the slot is optional, needed only for passkeys',\n\tapiKeysBound:\n\t\t'the API key store does not implement the optional listBoundApiKeys and revokeBoundApiKeys: keys cannot be scoped or bound',\n\tapiKeysUserBound:\n\t\t'the API key store does not implement the optional listUserBoundApiKeys: apiKeys.list filters on a bound object by reading the user’s keys',\n\tapiKeysExpiryNotice:\n\t\t'the API key store does not implement the optional listExpiringApiKeys and markApiKeyExpiryNotified',\n} as const;\n\n/**\n * Runs one case against one freshly opened set of stores, and closes them,\n * pass or fail. Answers the reason when the case cannot run on these stores.\n *\n * The runner-less layer: a loop over `allCases` calling this is a conformance\n * run with no test framework at all.\n */\nexport async function runCase(\n\tconformanceCase: ConformanceCase,\n\tharness: ConformanceHarness,\n): Promise<{ readonly skipped: string } | { readonly passed: true }> {\n\tconst opened: OpenedStores = await harness.open();\n\n\ttry {\n\t\tconst missing = needsOf(conformanceCase).find(\n\t\t\t(need) => !provides(opened, need),\n\t\t);\n\t\tif (missing !== undefined) return { skipped: SKIP_REASONS[missing] };\n\n\t\tawait conformanceCase.run({\n\t\t\tstores: opened.stores,\n\t\t\tfaults: opened.faults ?? null,\n\t\t});\n\t\treturn { passed: true };\n\t} finally {\n\t\tawait opened.close?.();\n\t}\n}\n\n/** What a case needs, as a list, whether it declared one thing or several. */\nfunction needsOf(conformanceCase: ConformanceCase): readonly CaseNeed[] {\n\tconst { needs } = conformanceCase;\n\treturn needs === undefined ? [] : typeof needs === 'string' ? [needs] : needs;\n}\n\n/** Whether these stores, as opened, provide what a case needs. */\nfunction provides(opened: OpenedStores, need: CaseNeed): boolean {\n\tswitch (need) {\n\t\tcase 'faults':\n\t\t\treturn opened.faults !== undefined;\n\t\tcase 'listUserSessions':\n\t\t\treturn opened.stores.sessions.listUserSessions !== undefined;\n\t\tcase 'deleteExpiredSessions':\n\t\t\treturn opened.stores.sessions.deleteExpiredSessions !== undefined;\n\t\tcase 'deleteExpiredTokens':\n\t\t\treturn opened.stores.tokens.deleteExpiredTokens !== undefined;\n\t\tcase 'findUsers':\n\t\t\treturn opened.stores.users.findUsers !== undefined;\n\t\tcase 'socialLinks':\n\t\t\treturn opened.stores.socialLinks !== undefined;\n\t\tcase 'passkeys':\n\t\t\treturn opened.stores.passkeys !== undefined;\n\t}\n}\n\n/**\n * Describes the whole suite under the adapter's test runner.\n *\n * ```ts\n * import { describe, it } from 'bun:test';\n * describeJanusStores({ name: 'my adapter', harness, runner: { describe, it } });\n * ```\n *\n * `runner` may be left out under jest, or vitest with `globals: true`: the\n * suite then reads `describe` and `it` from `globalThis`. **Not under `bun\n * test`**, measured: Bun gives a test file `describe` and `it` as bare\n * identifiers, and not as properties of `globalThis` — so pass them.\n *\n * Whether a case can run depends on the stores its harness opens, which is only\n * known once they are open. So every case is described as a test; one that\n * cannot run passes **and says so in its name**, and a run without `faults`\n * is written above the suite, where it cannot be scrolled past.\n */\nexport function describeJanusStores(options: {\n\treadonly name: string;\n\treadonly harness: ConformanceHarness;\n\treadonly runner?: ConformanceRunner;\n\t/** Case ids to skip, each with the reason — reported, never silent. */\n\treadonly skip?: Readonly<Record<string, string>>;\n\t/** Declared up front, so the report can say so before the first case runs. */\n\treadonly faults?: boolean;\n}): void {\n\tdescribeSuite({\n\t\ttitle: `${options.name} — @softistx/janus conformance`,\n\t\tcases: allCases,\n\t\trun: (conformanceCase) => runCase(conformanceCase, options.harness),\n\t\trunner: options.runner ?? fromGlobals('describeJanusStores'),\n\t\tskip: options.skip ?? {},\n\t\tfaults: options.faults,\n\t});\n}\n\n/** What any suite's case declares, as far as describing it goes. */\ninterface DescribedCase {\n\treadonly id: string;\n\treadonly group: string;\n\treadonly name: string;\n\treadonly needs?: string | readonly string[];\n}\n\n/** What a described case needs, as a list, whether it named one thing or several. */\nfunction needsList(described: DescribedCase): readonly string[] {\n\tconst { needs } = described;\n\treturn needs === undefined ? [] : typeof needs === 'string' ? [needs] : needs;\n}\n\n/**\n * Describes one suite's cases, grouped, under a runner. Shared by every suite\n * this module exports, so a skip, an unproven outage and a missing runner read\n * the same in each.\n */\nexport function describeSuite<C extends DescribedCase>(options: {\n\treadonly title: string;\n\treadonly cases: readonly C[];\n\treadonly run: (\n\t\tconformanceCase: C,\n\t) => Promise<{ readonly skipped: string } | { readonly passed: true }>;\n\treadonly runner: ConformanceRunner;\n\treadonly skip: Readonly<Record<string, string>>;\n\treadonly faults: boolean | undefined;\n}): void {\n\tconst { runner, skip, cases } = options;\n\tconst groups = [...new Set(cases.map((c) => c.group))];\n\n\tconst title =\n\t\toptions.faults === false\n\t\t\t? `${options.title} (WITHOUT faults: ${SKIP_REASONS.faults})`\n\t\t\t: options.title;\n\n\trunner.describe(title, () => {\n\t\tfor (const group of groups) {\n\t\t\trunner.describe(group, () => {\n\t\t\t\tfor (const conformanceCase of cases.filter((c) => c.group === group)) {\n\t\t\t\t\tconst reason = skip[conformanceCase.id];\n\t\t\t\t\tif (reason !== undefined) {\n\t\t\t\t\t\trunner.it.skip(\n\t\t\t\t\t\t\t`${conformanceCase.name} — skipped: ${reason}`,\n\t\t\t\t\t\t\tasync () => {},\n\t\t\t\t\t\t);\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tif (\n\t\t\t\t\t\tneedsList(conformanceCase).includes('faults') &&\n\t\t\t\t\t\toptions.faults === false\n\t\t\t\t\t) {\n\t\t\t\t\t\trunner.it.skip(\n\t\t\t\t\t\t\t`${conformanceCase.name} — skipped: ${SKIP_REASONS.faults}`,\n\t\t\t\t\t\t\tasync () => {},\n\t\t\t\t\t\t);\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\trunner.it(conformanceCase.name, async () => {\n\t\t\t\t\t\tconst outcome = await options.run(conformanceCase);\n\t\t\t\t\t\tif ('skipped' in outcome) {\n\t\t\t\t\t\t\tprocess.emitWarning(\n\t\t\t\t\t\t\t\t`${conformanceCase.id} skipped: ${outcome.skipped}`,\n\t\t\t\t\t\t\t\t{ code: 'JANUS_CONFORMANCE_SKIPPED' },\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t});\n}\n\nexport function fromGlobals(where: string): ConformanceRunner {\n\tconst globals = globalThis as {\n\t\tdescribe?: ConformanceRunner['describe'];\n\t\tit?: ConformanceRunner['it'];\n\t};\n\n\tif (\n\t\ttypeof globals.describe !== 'function' ||\n\t\ttypeof globals.it !== 'function'\n\t) {\n\t\tthrow new TypeError(\n\t\t\t`${where}: no test runner on globalThis — pass runner: { describe, it } (under bun test: import them from 'bun:test')`,\n\t\t);\n\t}\n\n\treturn { describe: globals.describe, it: globals.it };\n}\n",
55
+ "import { describeSuite, fromGlobals, SKIP_REASONS } from '../describe';\nimport type { ConformanceRunner } from '../types';\nimport { apiKeyStoreCases } from './cases';\nimport { apiKeyOutageCases } from './cases/outage';\nimport type {\n\tApiKeyCase,\n\tApiKeyHarness,\n\tApiKeyNeed,\n\tOpenedApiKeys,\n} from './types';\n\n/** Every case, in the order they are described. */\nexport const allApiKeyCases: readonly ApiKeyCase[] = [\n\t...apiKeyStoreCases,\n\t...apiKeyOutageCases,\n];\n\n/** Runs one case against a freshly opened store, and closes it, pass or fail. */\nexport async function runApiKeyCase(\n\tapiKeyCase: ApiKeyCase,\n\tharness: ApiKeyHarness,\n): Promise<{ readonly skipped: string } | { readonly passed: true }> {\n\tconst opened = await harness.open();\n\n\ttry {\n\t\tconst missing = missingNeed(apiKeyCase, opened);\n\t\tif (missing !== null) return { skipped: SKIP_REASONS[missing] };\n\t\tawait apiKeyCase.run({\n\t\t\tstore: opened.store,\n\t\t\tfaults: opened.faults ?? null,\n\t\t});\n\t\treturn { passed: true };\n\t} finally {\n\t\tawait opened.close?.();\n\t}\n}\n\n/** The first thing the case needs that this store or harness lacks, or `null`. */\nfunction missingNeed(\n\tapiKeyCase: ApiKeyCase,\n\topened: OpenedApiKeys,\n):\n\t| 'faults'\n\t| 'apiKeysBound'\n\t| 'apiKeysUserBound'\n\t| 'apiKeysExpiryNotice'\n\t| null {\n\tconst needs: readonly ApiKeyNeed[] =\n\t\tapiKeyCase.needs === undefined\n\t\t\t? []\n\t\t\t: typeof apiKeyCase.needs === 'string'\n\t\t\t\t? [apiKeyCase.needs]\n\t\t\t\t: apiKeyCase.needs;\n\tconst { store } = opened;\n\tfor (const need of needs) {\n\t\tif (need === 'faults' && opened.faults === undefined) return 'faults';\n\t\tif (need === 'bound' && store.listBoundApiKeys === undefined) {\n\t\t\treturn 'apiKeysBound';\n\t\t}\n\t\tif (need === 'userBound' && store.listUserBoundApiKeys === undefined) {\n\t\t\treturn 'apiKeysUserBound';\n\t\t}\n\t\tif (need === 'expiryNotice' && store.listExpiringApiKeys === undefined) {\n\t\t\treturn 'apiKeysExpiryNotice';\n\t\t}\n\t}\n\treturn null;\n}\n\n/** Describes the whole API key suite under the adapter's test runner. */\nexport function describeApiKeyStores(options: {\n\treadonly name: string;\n\treadonly harness: ApiKeyHarness;\n\treadonly runner?: ConformanceRunner;\n\t/** Case ids to skip, each with the reason — reported, never silent. */\n\treadonly skip?: Readonly<Record<string, string>>;\n\treadonly faults?: boolean;\n}): void {\n\tdescribeSuite({\n\t\ttitle: `${options.name} — @softistx/janus API key conformance`,\n\t\tcases: allApiKeyCases,\n\t\trun: (apiKeyCase) => runApiKeyCase(apiKeyCase, options.harness),\n\t\trunner: options.runner ?? fromGlobals('describeApiKeyStores'),\n\t\tskip: options.skip ?? {},\n\t\tfaults: options.faults,\n\t});\n}\n",
56
+ "import { createMemoryApiKeys } from '../../auth/port/memory';\nimport type { ApiKeyStore } from '../../auth/port/types';\nimport { StoreFailure } from '../../errors/janus-error';\nimport type { ApiKeyHarness } from './types';\n\n/** The reference store, with faults: what the suite proves itself against. */\nexport function referenceApiKeyHarness(): ApiKeyHarness {\n\treturn {\n\t\tasync open() {\n\t\t\tconst failing = new Set<string>();\n\t\t\tconst inner = createMemoryApiKeys();\n\t\t\tconst store = Object.fromEntries(\n\t\t\t\tObject.entries(inner).map(([method, fn]) => [\n\t\t\t\t\tmethod,\n\t\t\t\t\t(...args: unknown[]) =>\n\t\t\t\t\t\tfailing.has(method)\n\t\t\t\t\t\t\t? Promise.reject(\n\t\t\t\t\t\t\t\t\tnew StoreFailure(\n\t\t\t\t\t\t\t\t\t\t`apiKeys.${method}: the store could not answer`,\n\t\t\t\t\t\t\t\t\t\t{ slot: 'apiKeys', operation: method },\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t: (fn as (...a: unknown[]) => unknown).apply(inner, args),\n\t\t\t\t]),\n\t\t\t) as unknown as ApiKeyStore;\n\n\t\t\treturn {\n\t\t\t\tstore,\n\t\t\t\tfaults: {\n\t\t\t\t\tasync fail(method) {\n\t\t\t\t\t\tfailing.add(method);\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t};\n\t\t},\n\t};\n}\n",
57
+ "import type { InvitationRecord } from '../../auth/port/types';\nimport { mintId } from '../../ids/id';\n\n/** A pending invitation; override what a case is about. Each call gets its own address and code. */\nexport function invitation(\n\toverrides: Partial<InvitationRecord> = {},\n): InvitationRecord {\n\tconst id = overrides.id ?? mintId();\n\treturn {\n\t\tid,\n\t\tscope: 'org-1',\n\t\temail: `${id}@example.com`,\n\t\tname: 'Ada',\n\t\trole: 'member',\n\t\tlocale: null,\n\t\tref: null,\n\t\ttype: null,\n\t\tcodeHash: id.replaceAll('-', '').padEnd(64, 'a'),\n\t\tinvitedBy: mintId(),\n\t\tstatus: 'pending',\n\t\tversion: 0,\n\t\tcreatedAt: new Date('2026-01-01T00:00:00.000Z'),\n\t\tupdatedAt: new Date('2026-01-01T00:00:00.000Z'),\n\t\texpiresAt: new Date('2027-01-01T00:00:00.000Z'),\n\t\tacceptedBy: null,\n\t\tacceptedAt: null,\n\t\trevokedAt: null,\n\t\trevokedBy: null,\n\t\tresentBy: null,\n\t\t...overrides,\n\t};\n}\n",
58
+ "import { mintId } from '../../../ids/id';\nimport { equal } from '../../assert';\nimport { invitation } from '../fixtures';\nimport type { InvitationCase } from '../types';\n\nconst group = 'invitations';\nconst t = new Date('2026-03-01T00:00:00.000Z');\n\nexport const invitationActorCases: readonly InvitationCase[] = [\n\t{\n\t\tid: 'invitations.update.actors',\n\t\tgroup,\n\t\tname: 'updateInvitation stores revokedBy and resentBy, a record without them reads as absent or null, and null erases a resender',\n\t\tasync run({ store }) {\n\t\t\t// A record written before the fields existed: the keys are absent.\n\t\t\tconst { revokedBy: _r, resentBy: _s, ...bare } = invitation();\n\t\t\tawait store.insertInvitation(bare);\n\t\t\tconst found = await store.findInvitation(bare.id);\n\t\t\tequal(\n\t\t\t\tfound?.revokedBy ?? null,\n\t\t\t\tnull,\n\t\t\t\t'findInvitation: a record without revokedBy reads as absent or null',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tfound?.resentBy ?? null,\n\t\t\t\tnull,\n\t\t\t\t'findInvitation: a record without resentBy reads as absent or null',\n\t\t\t);\n\t\t\tconst resender = mintId();\n\t\t\tconst revoker = mintId();\n\n\t\t\tconst resent = await store.updateInvitation(bare.id, 0, {\n\t\t\t\tupdatedAt: t,\n\t\t\t\tresentBy: resender,\n\t\t\t});\n\t\t\tequal(\n\t\t\t\tresent?.resentBy,\n\t\t\t\tresender,\n\t\t\t\t'updateInvitation: resentBy is stored and answered',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tresent?.revokedBy ?? null,\n\t\t\t\tnull,\n\t\t\t\t'updateInvitation: revokedBy stays null until it is written',\n\t\t\t);\n\n\t\t\tconst revoked = await store.updateInvitation(bare.id, 1, {\n\t\t\t\tupdatedAt: t,\n\t\t\t\tstatus: 'revoked',\n\t\t\t\trevokedAt: t,\n\t\t\t\trevokedBy: revoker,\n\t\t\t\tresentBy: null,\n\t\t\t});\n\t\t\tequal(revoked?.revokedBy, revoker, 'updateInvitation: revokedBy');\n\t\t\tequal(revoked?.resentBy, null, 'updateInvitation: null erases resentBy');\n\t\t\tconst read = await store.findInvitation(bare.id);\n\t\t\tequal(read?.revokedBy, revoker, 'findInvitation reads revokedBy');\n\t\t\tequal(read?.resentBy, null, 'findInvitation reads resentBy as null');\n\t\t},\n\t},\n];\n",
59
+ "import { mintId } from '../../../ids/id';\nimport { equal, isNull } from '../../assert';\nimport { invitation } from '../fixtures';\nimport type { InvitationCase } from '../types';\n\nconst group = 'invitations';\nconst lapsedAt = new Date('2026-05-01T00:00:00.000Z');\nconst t = new Date('2026-03-01T00:00:00.000Z');\n\nexport const invitationFindPendingCases: readonly InvitationCase[] = [\n\t{\n\t\tid: 'invitations.find-pending',\n\t\tgroup,\n\t\tname: 'findPendingInvitation answers the pending invitation of an address in a scope, lapsed or not, and null for none',\n\t\tasync run({ store }) {\n\t\t\tif (store.findPendingInvitation === undefined) return;\n\t\t\tconst scope = `org-${mintId()}`;\n\t\t\tconst standing = invitation({ scope });\n\t\t\tconst lapsed = invitation({ scope, expiresAt: lapsedAt });\n\t\t\tconst revoked = invitation({ scope });\n\t\t\tconst accepted = invitation({ scope });\n\t\t\tfor (const record of [standing, lapsed, revoked, accepted]) {\n\t\t\t\tawait store.insertInvitation(record);\n\t\t\t}\n\t\t\tconst otherScope = `other-${mintId()}`;\n\t\t\tconst elsewhere = invitation({\n\t\t\t\tscope: otherScope,\n\t\t\t\temail: standing.email,\n\t\t\t});\n\t\t\tawait store.insertInvitation(elsewhere);\n\t\t\tawait store.updateInvitation(revoked.id, 0, {\n\t\t\t\tupdatedAt: t,\n\t\t\t\tstatus: 'revoked',\n\t\t\t\trevokedAt: t,\n\t\t\t});\n\t\t\tawait store.updateInvitation(accepted.id, 0, {\n\t\t\t\tupdatedAt: t,\n\t\t\t\tstatus: 'accepted',\n\t\t\t\tacceptedAt: t,\n\t\t\t\tacceptedBy: mintId(),\n\t\t\t});\n\n\t\t\tequal(\n\t\t\t\tawait store.findPendingInvitation(scope, standing.email),\n\t\t\t\tstanding,\n\t\t\t\t'findPendingInvitation: the pending invitation, verbatim',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait store.findPendingInvitation(scope, lapsed.email),\n\t\t\t\tlapsed,\n\t\t\t\t'findPendingInvitation: a lapsed pending invitation is still pending',\n\t\t\t);\n\t\t\tisNull(\n\t\t\t\tawait store.findPendingInvitation(scope, revoked.email),\n\t\t\t\t'findPendingInvitation: a revoked invitation is not pending',\n\t\t\t);\n\t\t\tisNull(\n\t\t\t\tawait store.findPendingInvitation(scope, accepted.email),\n\t\t\t\t'findPendingInvitation: an accepted invitation is not pending',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait store.findPendingInvitation(otherScope, standing.email),\n\t\t\t\telsewhere,\n\t\t\t\t'findPendingInvitation: another scope answers its own record',\n\t\t\t);\n\t\t\tisNull(\n\t\t\t\tawait store.findPendingInvitation(scope, standing.email.toUpperCase()),\n\t\t\t\t'findPendingInvitation: the address is compared exactly, as stored',\n\t\t\t);\n\t\t\tisNull(\n\t\t\t\tawait store.findPendingInvitation(`none-${mintId()}`, standing.email),\n\t\t\t\t'findPendingInvitation: another scope is null',\n\t\t\t);\n\t\t\tisNull(\n\t\t\t\tawait store.findPendingInvitation(\n\t\t\t\t\tscope,\n\t\t\t\t\t`nobody-${mintId()}@example.com`,\n\t\t\t\t),\n\t\t\t\t'findPendingInvitation: another address is null',\n\t\t\t);\n\t\t},\n\t},\n];\n",
60
+ "import { mintId } from '../../../ids/id';\nimport { equal } from '../../assert';\nimport { invitation } from '../fixtures';\nimport type { InvitationCase } from '../types';\n\nconst group = 'invitations';\n\nexport const invitationImportedCases: readonly InvitationCase[] = [\n\t{\n\t\tid: 'invitations.insert.imported',\n\t\tgroup,\n\t\tname: 'insertInvitation stores an imported accepted record and a revoked one with a codeHash that is not hex (\"import:…\") verbatim, and findInvitationByCodeHash finds each by it',\n\t\tasync run({ store }) {\n\t\t\tconst accepted = invitation({\n\t\t\t\tstatus: 'accepted',\n\t\t\t\tcodeHash: `import:${'a1'.repeat(32)}`,\n\t\t\t\tacceptedBy: mintId(),\n\t\t\t\tacceptedAt: new Date('2026-02-01T00:00:00.000Z'),\n\t\t\t\texpiresAt: new Date('2026-01-08T00:00:00.000Z'),\n\t\t\t});\n\t\t\tconst revoked = invitation({\n\t\t\t\tstatus: 'revoked',\n\t\t\t\tcodeHash: `import:${'b2'.repeat(32)}`,\n\t\t\t\trevokedAt: new Date('2026-02-02T00:00:00.000Z'),\n\t\t\t\trevokedBy: mintId(),\n\t\t\t\texpiresAt: new Date('2026-01-08T00:00:00.000Z'),\n\t\t\t});\n\t\t\tfor (const record of [accepted, revoked]) {\n\t\t\t\tequal(\n\t\t\t\t\tawait store.insertInvitation(record),\n\t\t\t\t\ttrue,\n\t\t\t\t\t'insertInvitation: an imported record answers true',\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tfor (const record of [accepted, revoked]) {\n\t\t\t\tequal(\n\t\t\t\t\tawait store.findInvitation(record.id),\n\t\t\t\t\trecord,\n\t\t\t\t\t`findInvitation: the ${record.status} record as written`,\n\t\t\t\t);\n\t\t\t\tequal(\n\t\t\t\t\tawait store.findInvitationByCodeHash(record.codeHash),\n\t\t\t\t\trecord,\n\t\t\t\t\t`findInvitationByCodeHash: the ${record.status} record, found by its \"import:\" hash`,\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t},\n];\n",
61
+ "import { mintId } from '../../../ids/id';\nimport { equal, isNull } from '../../assert';\nimport { invitation } from '../fixtures';\nimport type { InvitationCase } from '../types';\n\nconst group = 'invitations';\nconst at = (iso: string) => new Date(iso);\n\nexport const invitationInsertCases: readonly InvitationCase[] = [\n\t{\n\t\tid: 'invitations.insert',\n\t\tgroup,\n\t\tname: 'insertInvitation stores an invitation that findInvitation and findInvitationByCodeHash answer verbatim, and null for an unknown id or hash',\n\t\tasync run({ store }) {\n\t\t\tconst record = invitation({\n\t\t\t\tlocale: 'fr',\n\t\t\t\tname: 'Zoë “Z” Ünal',\n\t\t\t\tacceptedBy: mintId(),\n\t\t\t\tacceptedAt: at('2026-02-01T00:00:00.000Z'),\n\t\t\t\trevokedAt: at('2026-02-02T00:00:00.000Z'),\n\t\t\t\tstatus: 'revoked',\n\t\t\t});\n\t\t\tequal(\n\t\t\t\tawait store.insertInvitation(record),\n\t\t\t\ttrue,\n\t\t\t\t'insertInvitation: a new invitation answers true',\n\t\t\t);\n\n\t\t\tequal(\n\t\t\t\tawait store.findInvitation(record.id),\n\t\t\t\trecord,\n\t\t\t\t'findInvitation: the invitation as written',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait store.findInvitationByCodeHash(record.codeHash),\n\t\t\t\trecord,\n\t\t\t\t'findInvitationByCodeHash: the invitation as written, whatever its status',\n\t\t\t);\n\t\t\tisNull(\n\t\t\t\tawait store.findInvitation(mintId()),\n\t\t\t\t'findInvitation: an unknown id is null, not undefined',\n\t\t\t);\n\t\t\tisNull(\n\t\t\t\tawait store.findInvitationByCodeHash('f'.repeat(64)),\n\t\t\t\t'findInvitationByCodeHash: an unknown hash is null, not undefined',\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tid: 'invitations.insert.system',\n\t\tgroup,\n\t\tname: 'insertInvitation stores an invitation issued by the system (invitedBy: null) and reads it back as null, not as a missing field or a placeholder',\n\t\tasync run({ store }) {\n\t\t\tconst record = invitation({ invitedBy: null });\n\t\t\tequal(\n\t\t\t\tawait store.insertInvitation(record),\n\t\t\t\ttrue,\n\t\t\t\t'insertInvitation: a system invitation answers true',\n\t\t\t);\n\n\t\t\tequal(\n\t\t\t\t(await store.findInvitation(record.id))?.invitedBy,\n\t\t\t\tnull,\n\t\t\t\t'findInvitation: invitedBy is null',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\t(await store.findInvitationByCodeHash(record.codeHash))?.invitedBy,\n\t\t\t\tnull,\n\t\t\t\t'findInvitationByCodeHash: invitedBy is null',\n\t\t\t);\n\t\t\tconst page = await store.listScopeInvitations(record.scope, {\n\t\t\t\tstatus: null,\n\t\t\t\tfirst: 10,\n\t\t\t\tafter: null,\n\t\t\t});\n\t\t\tequal(\n\t\t\t\tpage.items.find((item) => item.id === record.id)?.invitedBy,\n\t\t\t\tnull,\n\t\t\t\t'listScopeInvitations: invitedBy is null',\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tid: 'invitations.insert.type',\n\t\tgroup,\n\t\tname: 'insertInvitation keeps the user type as stored: a name stays that name and null stays null',\n\t\tasync run({ store }) {\n\t\t\tconst named = invitation({ type: 'guardian' });\n\t\t\tconst legacy = invitation({ type: null });\n\t\t\tawait store.insertInvitation(named);\n\t\t\tawait store.insertInvitation(legacy);\n\n\t\t\tequal(\n\t\t\t\t(await store.findInvitation(named.id))?.type,\n\t\t\t\t'guardian',\n\t\t\t\t'findInvitation: the type as written',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\t(await store.findInvitationByCodeHash(named.codeHash))?.type,\n\t\t\t\t'guardian',\n\t\t\t\t'findInvitationByCodeHash: the type as written',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\t(await store.findInvitation(legacy.id))?.type,\n\t\t\t\tnull,\n\t\t\t\t'findInvitation: a null type is returned as null, not dropped or filled in',\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tid: 'invitations.insert.idempotent',\n\t\tgroup,\n\t\tname: 'insertInvitation is idempotent by id: a retry writes nothing, answers true and does not throw',\n\t\tasync run({ store }) {\n\t\t\tconst record = invitation();\n\t\t\tawait store.insertInvitation(record);\n\t\t\tawait store.updateInvitation(record.id, 0, {\n\t\t\t\tupdatedAt: at('2026-03-01T00:00:00.000Z'),\n\t\t\t\tstatus: 'revoked',\n\t\t\t\trevokedAt: at('2026-03-01T00:00:00.000Z'),\n\t\t\t});\n\n\t\t\tequal(\n\t\t\t\tawait store.insertInvitation({ ...record, name: 'replayed' }),\n\t\t\t\ttrue,\n\t\t\t\t'insertInvitation: a replay of a stored id answers true',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\t(await store.findInvitation(record.id))?.name,\n\t\t\t\trecord.name,\n\t\t\t\t'insertInvitation replayed should leave the stored invitation untouched',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\t(await store.findInvitation(record.id))?.status,\n\t\t\t\t'revoked',\n\t\t\t\t'insertInvitation replayed should not bring a revoked invitation back',\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tid: 'invitations.insert.one-pending',\n\t\tgroup,\n\t\tname: 'insertInvitation answers false when the scope and address already hold a pending invitation, and writes nothing',\n\t\tasync run({ store }) {\n\t\t\tconst first = invitation({ email: 'ada@example.com' });\n\t\t\tconst second = invitation({ email: 'ada@example.com' });\n\t\t\tawait store.insertInvitation(first);\n\n\t\t\tequal(\n\t\t\t\tawait store.insertInvitation(second),\n\t\t\t\tfalse,\n\t\t\t\t'insertInvitation: a second pending invitation for the same scope and address is false',\n\t\t\t);\n\t\t\tisNull(\n\t\t\t\tawait store.findInvitation(second.id),\n\t\t\t\t'insertInvitation: a refused invitation is not stored',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait store.insertInvitation(\n\t\t\t\t\tinvitation({ email: 'ada@example.com', scope: 'org-2' }),\n\t\t\t\t),\n\t\t\t\ttrue,\n\t\t\t\t'insertInvitation: the same address in another scope is allowed',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait store.insertInvitation(invitation({ email: 'Ada@example.com' })),\n\t\t\t\ttrue,\n\t\t\t\t'insertInvitation: addresses are compared as stored bytes, the core normalises',\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tid: 'invitations.insert.one-pending.concurrent',\n\t\tgroup,\n\t\tname: 'of 20 concurrent insertInvitation calls for one scope and address exactly one answers true and the others false, leaving one pending invitation',\n\t\tasync run({ store }) {\n\t\t\tconst records = Array.from({ length: 20 }, () =>\n\t\t\t\tinvitation({ email: 'race@example.com' }),\n\t\t\t);\n\n\t\t\tconst results = await Promise.all(\n\t\t\t\trecords.map((record) => store.insertInvitation(record)),\n\t\t\t);\n\n\t\t\tequal(\n\t\t\t\tresults.filter((won) => won).length,\n\t\t\t\t1,\n\t\t\t\t'insertInvitation: exactly one concurrent insert for a held scope and address should win',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait store.countPendingInvitations(\n\t\t\t\t\trecords[0]?.scope ?? '',\n\t\t\t\t\tnew Date(0),\n\t\t\t\t),\n\t\t\t\t1,\n\t\t\t\t'countPendingInvitations: one pending invitation should remain',\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tid: 'invitations.insert.after-final',\n\t\tgroup,\n\t\tname: 'a revoked or accepted invitation frees its scope and address for a new pending one',\n\t\tasync run({ store }) {\n\t\t\tconst old = invitation({ email: 'ada@example.com' });\n\t\t\tawait store.insertInvitation(old);\n\t\t\tawait store.updateInvitation(old.id, 0, {\n\t\t\t\tupdatedAt: at('2026-03-01T00:00:00.000Z'),\n\t\t\t\tstatus: 'revoked',\n\t\t\t\trevokedAt: at('2026-03-01T00:00:00.000Z'),\n\t\t\t});\n\n\t\t\tconst fresh = invitation({ email: 'ada@example.com' });\n\t\t\tequal(\n\t\t\t\tawait store.insertInvitation(fresh),\n\t\t\t\ttrue,\n\t\t\t\t'insertInvitation: a revoked invitation no longer holds the address',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\t(await store.findInvitation(old.id))?.status,\n\t\t\t\t'revoked',\n\t\t\t\t'insertInvitation: the revoked one is kept',\n\t\t\t);\n\t\t},\n\t},\n];\n",
62
+ "import { mintId } from '../../../ids/id';\nimport { equal } from '../../assert';\nimport { invitation } from '../fixtures';\nimport type { InvitationCase } from '../types';\n\nconst group = 'invitations';\n\nexport const invitationListCases: readonly InvitationCase[] = [\n\t{\n\t\tid: 'invitations.list',\n\t\tgroup,\n\t\tname: 'listScopeInvitations pages one scope’s invitations in id order with a cursor, and leaves other scopes out',\n\t\tasync run({ store }) {\n\t\t\tconst scope = `org-${mintId()}`;\n\t\t\tconst [a, b, c] = [mintId(), mintId(), mintId()].sort() as [\n\t\t\t\tstring,\n\t\t\t\tstring,\n\t\t\t\tstring,\n\t\t\t];\n\t\t\t// Inserted out of order: the page is id order, not insertion order.\n\t\t\tawait store.insertInvitation(invitation({ id: c, scope }));\n\t\t\tawait store.insertInvitation(invitation({ id: a, scope }));\n\t\t\tawait store.insertInvitation(invitation({ id: b, scope }));\n\t\t\tawait store.insertInvitation(invitation({ scope: 'elsewhere' }));\n\n\t\t\tconst first = await store.listScopeInvitations(scope, {\n\t\t\t\tstatus: null,\n\t\t\t\tfirst: 2,\n\t\t\t\tafter: null,\n\t\t\t});\n\t\t\tequal(\n\t\t\t\tfirst.items.map((item) => item.id),\n\t\t\t\t[a, b],\n\t\t\t\t'listScopeInvitations: the first page',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tfirst.nextCursor,\n\t\t\t\tb,\n\t\t\t\t'listScopeInvitations: nextCursor is the last id',\n\t\t\t);\n\n\t\t\tconst second = await store.listScopeInvitations(scope, {\n\t\t\t\tstatus: null,\n\t\t\t\tfirst: 2,\n\t\t\t\tafter: first.nextCursor,\n\t\t\t});\n\t\t\tequal(\n\t\t\t\tsecond.items.map((item) => item.id),\n\t\t\t\t[c],\n\t\t\t\t'listScopeInvitations: the last page',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tsecond.nextCursor,\n\t\t\t\tnull,\n\t\t\t\t'listScopeInvitations: the last page ends with null',\n\t\t\t);\n\n\t\t\tequal(\n\t\t\t\t(\n\t\t\t\t\tawait store.listScopeInvitations(scope, {\n\t\t\t\t\t\tstatus: null,\n\t\t\t\t\t\tfirst: 3,\n\t\t\t\t\t\tafter: null,\n\t\t\t\t\t})\n\t\t\t\t).nextCursor,\n\t\t\t\tnull,\n\t\t\t\t'listScopeInvitations: a page that ends exactly has no cursor',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait store.listScopeInvitations(scope, {\n\t\t\t\t\tstatus: null,\n\t\t\t\t\tfirst: 5,\n\t\t\t\t\tafter: b,\n\t\t\t\t}),\n\t\t\t\t{ items: [await store.findInvitation(c)], nextCursor: null },\n\t\t\t\t'listScopeInvitations: a cursor past a stored id pages past it',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait store.listScopeInvitations(`none-${mintId()}`, {\n\t\t\t\t\tstatus: null,\n\t\t\t\t\tfirst: 5,\n\t\t\t\t\tafter: null,\n\t\t\t\t}),\n\t\t\t\t{ items: [], nextCursor: null },\n\t\t\t\t'listScopeInvitations: a scope without invitations has an empty page, never null',\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tid: 'invitations.list-filters',\n\t\tgroup,\n\t\tname: 'listScopeInvitations filters by role and ref, pages newest first with order desc, and stores the ref verbatim',\n\t\tasync run({ store }) {\n\t\t\tconst scope = `org-${mintId()}`;\n\t\t\tconst [a, b, c, d] = [mintId(), mintId(), mintId(), mintId()].sort() as [\n\t\t\t\tstring,\n\t\t\t\tstring,\n\t\t\t\tstring,\n\t\t\t\tstring,\n\t\t\t];\n\t\t\tawait store.insertInvitation(\n\t\t\t\tinvitation({ id: c, scope, ref: 'p1', role: 'member' }),\n\t\t\t);\n\t\t\tawait store.insertInvitation(\n\t\t\t\tinvitation({ id: a, scope, ref: 'p1', role: 'admin' }),\n\t\t\t);\n\t\t\tawait store.insertInvitation(\n\t\t\t\tinvitation({ id: d, scope, ref: 'p2', role: 'member' }),\n\t\t\t);\n\t\t\tawait store.insertInvitation(invitation({ id: b, scope }));\n\t\t\tawait store.insertInvitation(\n\t\t\t\tinvitation({ scope: 'elsewhere', ref: 'p1' }),\n\t\t\t);\n\n\t\t\tequal(\n\t\t\t\t(await store.findInvitation(a))?.ref,\n\t\t\t\t'p1',\n\t\t\t\t'findInvitation: the ref is stored as given',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\t(await store.findInvitation(b))?.ref ?? null,\n\t\t\t\tnull,\n\t\t\t\t'findInvitation: no ref reads as null',\n\t\t\t);\n\n\t\t\tconst ids = async (\n\t\t\t\tquery: Partial<Parameters<typeof store.listScopeInvitations>[1]>,\n\t\t\t) =>\n\t\t\t\t(\n\t\t\t\t\tawait store.listScopeInvitations(scope, {\n\t\t\t\t\t\tstatus: null,\n\t\t\t\t\t\tfirst: 10,\n\t\t\t\t\t\tafter: null,\n\t\t\t\t\t\t...query,\n\t\t\t\t\t})\n\t\t\t\t).items.map((item) => item.id);\n\t\t\tequal(await ids({ ref: 'p1' }), [a, c], 'listScopeInvitations: by ref');\n\t\t\tequal(\n\t\t\t\tawait ids({ role: 'member' }),\n\t\t\t\t[b, c, d],\n\t\t\t\t'listScopeInvitations: by role',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait ids({ ref: 'p1', role: 'member' }),\n\t\t\t\t[c],\n\t\t\t\t'listScopeInvitations: by ref and role',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait ids({ ref: 'none' }),\n\t\t\t\t[],\n\t\t\t\t'listScopeInvitations: an unknown ref is an empty page',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait ids({ order: 'desc' }),\n\t\t\t\t[d, c, b, a],\n\t\t\t\t'listScopeInvitations: newest first',\n\t\t\t);\n\n\t\t\tconst first = await store.listScopeInvitations(scope, {\n\t\t\t\tstatus: null,\n\t\t\t\tfirst: 3,\n\t\t\t\tafter: null,\n\t\t\t\torder: 'desc',\n\t\t\t});\n\t\t\tequal(\n\t\t\t\tfirst.nextCursor,\n\t\t\t\tb,\n\t\t\t\t'listScopeInvitations: desc nextCursor is the last id of the page',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait store.listScopeInvitations(scope, {\n\t\t\t\t\tstatus: null,\n\t\t\t\t\tfirst: 3,\n\t\t\t\t\tafter: first.nextCursor,\n\t\t\t\t\torder: 'desc',\n\t\t\t\t}),\n\t\t\t\t{ items: [await store.findInvitation(a)], nextCursor: null },\n\t\t\t\t'listScopeInvitations: desc pages past the cursor to smaller ids',\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tid: 'invitations.count',\n\t\tgroup,\n\t\tname: 'countScopeInvitations counts one scope by status, role and ref, whatever the page',\n\t\tasync run({ store }) {\n\t\t\tif (store.countScopeInvitations === undefined) return;\n\t\t\tconst scope = `org-${mintId()}`;\n\t\t\tawait store.insertInvitation(\n\t\t\t\tinvitation({ scope, ref: 'p1', role: 'admin' }),\n\t\t\t);\n\t\t\tawait store.insertInvitation(\n\t\t\t\tinvitation({ scope, ref: 'p1', status: 'revoked' }),\n\t\t\t);\n\t\t\tawait store.insertInvitation(invitation({ scope }));\n\t\t\tawait store.insertInvitation(\n\t\t\t\tinvitation({ scope: 'elsewhere', ref: 'p1' }),\n\t\t\t);\n\n\t\t\tconst count = (\n\t\t\t\tfilter: Partial<{\n\t\t\t\t\tstatus: 'pending' | 'revoked' | null;\n\t\t\t\t\trole: string | null;\n\t\t\t\t\tref: string | null;\n\t\t\t\t}>,\n\t\t\t) =>\n\t\t\t\tstore.countScopeInvitations?.(scope, {\n\t\t\t\t\tstatus: null,\n\t\t\t\t\trole: null,\n\t\t\t\t\tref: null,\n\t\t\t\t\t...filter,\n\t\t\t\t});\n\t\t\tequal(await count({}), 3, 'countScopeInvitations: all');\n\t\t\tequal(\n\t\t\t\tawait count({ status: 'pending' }),\n\t\t\t\t2,\n\t\t\t\t'countScopeInvitations: by status',\n\t\t\t);\n\t\t\tequal(await count({ ref: 'p1' }), 2, 'countScopeInvitations: by ref');\n\t\t\tequal(\n\t\t\t\tawait count({ ref: 'p1', role: 'admin' }),\n\t\t\t\t1,\n\t\t\t\t'countScopeInvitations: by ref and role',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait count({ ref: 'p1', status: 'revoked' }),\n\t\t\t\t1,\n\t\t\t\t'countScopeInvitations: by ref and status',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait store.countScopeInvitations(`none-${mintId()}`, {\n\t\t\t\t\tstatus: null,\n\t\t\t\t\trole: null,\n\t\t\t\t\tref: null,\n\t\t\t\t}),\n\t\t\t\t0,\n\t\t\t\t'countScopeInvitations: an empty scope is 0',\n\t\t\t);\n\t\t},\n\t},\n];\n",
63
+ "import { mintId } from '../../../ids/id';\nimport { equal } from '../../assert';\nimport { invitation } from '../fixtures';\nimport type { InvitationCase } from '../types';\n\nconst group = 'invitations';\nconst now = new Date('2026-06-01T00:00:00.000Z');\nconst before = new Date('2026-05-01T00:00:00.000Z');\nconst after = new Date('2026-07-01T00:00:00.000Z');\n\n/** Five records: live, lapsed, lapsed exactly at `now`, accepted past its expiry, revoked past its expiry. */\nasync function seed(\n\tstore: Parameters<InvitationCase['run']>[0]['store'],\n): Promise<{\n\tscope: string;\n\tids: {\n\t\tlive: string;\n\t\tlapsed: string;\n\t\tboundary: string;\n\t\taccepted: string;\n\t\trevoked: string;\n\t};\n}> {\n\tconst scope = `org-${mintId()}`;\n\tconst ids = {\n\t\tlive: mintId(),\n\t\tlapsed: mintId(),\n\t\tboundary: mintId(),\n\t\taccepted: mintId(),\n\t\trevoked: mintId(),\n\t};\n\tawait store.insertInvitation(\n\t\tinvitation({ id: ids.live, scope, expiresAt: after }),\n\t);\n\tawait store.insertInvitation(\n\t\tinvitation({ id: ids.lapsed, scope, expiresAt: before }),\n\t);\n\tawait store.insertInvitation(\n\t\tinvitation({ id: ids.boundary, scope, expiresAt: now }),\n\t);\n\tfor (const [id, status] of [\n\t\t[ids.accepted, 'accepted'],\n\t\t[ids.revoked, 'revoked'],\n\t] as const) {\n\t\tawait store.insertInvitation(\n\t\t\tinvitation({ id, scope, status, expiresAt: before }),\n\t\t);\n\t}\n\treturn { scope, ids };\n}\n\nexport const invitationListLapsedCases: readonly InvitationCase[] = [\n\t{\n\t\tid: 'invitations.list.lapsed',\n\t\tgroup,\n\t\tname: 'listScopeInvitations leaves lapsed pending invitations out or keeps only them, the boundary lapsed, accepted and revoked never',\n\t\tasync run({ store }) {\n\t\t\tconst { scope, ids } = await seed(store);\n\t\t\tconst ofMode = async (\n\t\t\t\tmode: 'exclude' | 'only' | null,\n\t\t\t\tstatus: 'pending' | 'accepted' | null = null,\n\t\t\t) =>\n\t\t\t\t(\n\t\t\t\t\tawait store.listScopeInvitations(scope, {\n\t\t\t\t\t\tstatus,\n\t\t\t\t\t\tfirst: 10,\n\t\t\t\t\t\tafter: null,\n\t\t\t\t\t\tlapsed: mode === null ? null : { mode, now },\n\t\t\t\t\t})\n\t\t\t\t).items\n\t\t\t\t\t.map((item) => item.id)\n\t\t\t\t\t.sort();\n\t\t\tconst sorted = (...list: string[]) => list.sort();\n\n\t\t\tequal(\n\t\t\t\tawait ofMode('only'),\n\t\t\t\tsorted(ids.lapsed, ids.boundary),\n\t\t\t\t'listScopeInvitations: only keeps the lapsed, expiresAt === now included',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait ofMode('exclude'),\n\t\t\t\tsorted(ids.live, ids.accepted, ids.revoked),\n\t\t\t\t'listScopeInvitations: exclude keeps every other record, of any status',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\t(await ofMode(null)).length,\n\t\t\t\t5,\n\t\t\t\t'listScopeInvitations: null is no filter',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait ofMode('only', 'accepted'),\n\t\t\t\t[],\n\t\t\t\t'listScopeInvitations: an accepted record is never lapsed',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait ofMode('exclude', 'accepted'),\n\t\t\t\t[ids.accepted],\n\t\t\t\t'listScopeInvitations: exclude with a status intersects',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait ofMode('only', 'pending'),\n\t\t\t\tsorted(ids.lapsed, ids.boundary),\n\t\t\t\t'listScopeInvitations: only with pending',\n\t\t\t);\n\n\t\t\tconst page = await store.listScopeInvitations(scope, {\n\t\t\t\tstatus: null,\n\t\t\t\tfirst: 1,\n\t\t\t\tafter: null,\n\t\t\t\tlapsed: { mode: 'exclude', now },\n\t\t\t});\n\t\t\tequal(\n\t\t\t\tpage.items.length === 1 && page.nextCursor !== null,\n\t\t\t\ttrue,\n\t\t\t\t'listScopeInvitations: a page of the filter has a cursor while more match',\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tid: 'invitations.count.lapsed',\n\t\tgroup,\n\t\tname: 'countScopeInvitations follows the lapsed filter, alone and with a status',\n\t\tasync run({ store }) {\n\t\t\tif (store.countScopeInvitations === undefined) return;\n\t\t\tconst { scope } = await seed(store);\n\t\t\tconst count = (\n\t\t\t\tmode: 'exclude' | 'only' | null,\n\t\t\t\tstatus: 'pending' | 'accepted' | null = null,\n\t\t\t) =>\n\t\t\t\tstore.countScopeInvitations?.(scope, {\n\t\t\t\t\tstatus,\n\t\t\t\t\trole: null,\n\t\t\t\t\tref: null,\n\t\t\t\t\tlapsed: mode === null ? null : { mode, now },\n\t\t\t\t});\n\t\t\tequal(await count(null), 5, 'countScopeInvitations: no filter');\n\t\t\tequal(await count('only'), 2, 'countScopeInvitations: only');\n\t\t\tequal(await count('exclude'), 3, 'countScopeInvitations: exclude');\n\t\t\tequal(\n\t\t\t\tawait count('only', 'accepted'),\n\t\t\t\t0,\n\t\t\t\t'countScopeInvitations: accepted is never lapsed',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait count('exclude', 'pending'),\n\t\t\t\t1,\n\t\t\t\t'countScopeInvitations: exclude with pending',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait count('only', 'pending'),\n\t\t\t\t2,\n\t\t\t\t'countScopeInvitations: only with pending',\n\t\t\t);\n\t\t},\n\t},\n];\n",
64
+ "import { mintId } from '../../../ids/id';\nimport { equal } from '../../assert';\nimport { invitation } from '../fixtures';\nimport type { InvitationCase } from '../types';\n\nconst group = 'invitations';\nconst at = (iso: string) => new Date(iso);\nconst t = at('2026-03-01T00:00:00.000Z');\n\nexport const invitationListStatusCases: readonly InvitationCase[] = [\n\t{\n\t\tid: 'invitations.list.status',\n\t\tgroup,\n\t\tname: 'listScopeInvitations filters by status, and the cursor pages within the filter',\n\t\tasync run({ store }) {\n\t\t\tconst scope = `org-${mintId()}`;\n\t\t\tconst ids = [mintId(), mintId(), mintId(), mintId()].sort() as [\n\t\t\t\tstring,\n\t\t\t\tstring,\n\t\t\t\tstring,\n\t\t\t\tstring,\n\t\t\t];\n\t\t\tfor (const id of ids)\n\t\t\t\tawait store.insertInvitation(invitation({ id, scope }));\n\t\t\tawait store.updateInvitation(ids[1], 0, {\n\t\t\t\tupdatedAt: t,\n\t\t\t\tstatus: 'revoked',\n\t\t\t\trevokedAt: t,\n\t\t\t});\n\t\t\tawait store.updateInvitation(ids[2], 0, {\n\t\t\t\tupdatedAt: t,\n\t\t\t\tstatus: 'accepted',\n\t\t\t\tacceptedBy: mintId(),\n\t\t\t\tacceptedAt: t,\n\t\t\t});\n\n\t\t\tconst ofStatus = async (status: 'pending' | 'accepted' | 'revoked') =>\n\t\t\t\t(\n\t\t\t\t\tawait store.listScopeInvitations(scope, {\n\t\t\t\t\t\tstatus,\n\t\t\t\t\t\tfirst: 10,\n\t\t\t\t\t\tafter: null,\n\t\t\t\t\t})\n\t\t\t\t).items.map((item) => item.id);\n\n\t\t\tequal(\n\t\t\t\tawait ofStatus('pending'),\n\t\t\t\t[ids[0], ids[3]],\n\t\t\t\t'listScopeInvitations: pending only',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait ofStatus('revoked'),\n\t\t\t\t[ids[1]],\n\t\t\t\t'listScopeInvitations: revoked only',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait ofStatus('accepted'),\n\t\t\t\t[ids[2]],\n\t\t\t\t'listScopeInvitations: accepted only',\n\t\t\t);\n\n\t\t\tconst page = await store.listScopeInvitations(scope, {\n\t\t\t\tstatus: 'pending',\n\t\t\t\tfirst: 1,\n\t\t\t\tafter: null,\n\t\t\t});\n\t\t\tequal(\n\t\t\t\tpage.nextCursor,\n\t\t\t\tids[0],\n\t\t\t\t'listScopeInvitations: a filtered page has a cursor while more match',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\t(\n\t\t\t\t\tawait store.listScopeInvitations(scope, {\n\t\t\t\t\t\tstatus: 'pending',\n\t\t\t\t\t\tfirst: 1,\n\t\t\t\t\t\tafter: page.nextCursor,\n\t\t\t\t\t})\n\t\t\t\t).items.map((item) => item.id),\n\t\t\t\t[ids[3]],\n\t\t\t\t'listScopeInvitations: the cursor skips what the filter excludes',\n\t\t\t);\n\t\t},\n\t},\n];\n",
65
+ "import { mintId } from '../../../ids/id';\nimport { equal, isNull } from '../../assert';\nimport { invitation } from '../fixtures';\nimport type { InvitationCase } from '../types';\n\nconst group = 'invitations';\nconst at = (iso: string) => new Date(iso);\nconst t = at('2026-03-01T00:00:00.000Z');\n\nexport const invitationScopeCases: readonly InvitationCase[] = [\n\t{\n\t\tid: 'invitations.get',\n\t\tgroup,\n\t\tname: 'findInvitation answers the invitation with the scope it was stored in, and null for an id nobody stored',\n\t\tasync run({ store }) {\n\t\t\tconst scope = `org-${mintId()}`;\n\t\t\tconst mine = invitation({ scope });\n\t\t\tconst theirs = invitation({ scope: `other-${mintId()}` });\n\t\t\tawait store.insertInvitation(mine);\n\t\t\tawait store.insertInvitation(theirs);\n\n\t\t\tconst found = await store.findInvitation(mine.id);\n\t\t\tequal(found, mine, 'findInvitation: the invitation as written');\n\t\t\tequal(found?.scope, scope, 'findInvitation: it carries its scope');\n\t\t\tequal(\n\t\t\t\t(await store.findInvitation(theirs.id))?.scope === scope,\n\t\t\t\tfalse,\n\t\t\t\t'findInvitation: an invitation of another scope is not of this one',\n\t\t\t);\n\t\t\tisNull(\n\t\t\t\tawait store.findInvitation(mintId()),\n\t\t\t\t'findInvitation: an unknown id is null',\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tid: 'invitations.count-pending',\n\t\tgroup,\n\t\tname: 'countPendingInvitations counts one scope’s pending invitations that have not lapsed, and 0 for none',\n\t\tasync run({ store }) {\n\t\t\tconst scope = `org-${mintId()}`;\n\t\t\tconst now = at('2026-06-01T00:00:00.000Z');\n\t\t\tconst standing = invitation({ scope });\n\t\t\tconst lapsed = invitation({\n\t\t\t\tscope,\n\t\t\t\texpiresAt: at('2026-05-01T00:00:00.000Z'),\n\t\t\t});\n\t\t\tconst atNow = invitation({ scope, expiresAt: now });\n\t\t\tconst revoked = invitation({ scope });\n\t\t\tawait store.insertInvitation(standing);\n\t\t\tawait store.insertInvitation(lapsed);\n\t\t\tawait store.insertInvitation(atNow);\n\t\t\tawait store.insertInvitation(revoked);\n\t\t\tawait store.insertInvitation(invitation({ scope: 'elsewhere' }));\n\t\t\tawait store.updateInvitation(revoked.id, 0, {\n\t\t\t\tupdatedAt: t,\n\t\t\t\tstatus: 'revoked',\n\t\t\t\trevokedAt: t,\n\t\t\t});\n\n\t\t\tequal(\n\t\t\t\tawait store.countPendingInvitations(scope, now),\n\t\t\t\t1,\n\t\t\t\t'countPendingInvitations: only the standing pending invitation, one expiring exactly now is lapsed',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait store.countPendingInvitations(`none-${mintId()}`, now),\n\t\t\t\t0,\n\t\t\t\t'countPendingInvitations: a scope without invitations is 0',\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tid: 'invitations.delete-scope',\n\t\tgroup,\n\t\tname: 'deleteScopeInvitations deletes every invitation of one scope, whatever its status, and answers how many',\n\t\tasync run({ store }) {\n\t\t\tconst scope = `org-${mintId()}`;\n\t\t\tconst kept = invitation({ scope: 'elsewhere' });\n\t\t\tconst revoked = invitation({ scope });\n\t\t\tawait store.insertInvitation(invitation({ scope }));\n\t\t\tawait store.insertInvitation(revoked);\n\t\t\tawait store.insertInvitation(kept);\n\t\t\tawait store.updateInvitation(revoked.id, 0, {\n\t\t\t\tupdatedAt: t,\n\t\t\t\tstatus: 'revoked',\n\t\t\t\trevokedAt: t,\n\t\t\t});\n\n\t\t\tequal(\n\t\t\t\tawait store.deleteScopeInvitations(scope),\n\t\t\t\t2,\n\t\t\t\t'deleteScopeInvitations: both are deleted',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait store.deleteScopeInvitations(scope),\n\t\t\t\t0,\n\t\t\t\t'deleteScopeInvitations: a replay answers 0',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait store.findInvitation(kept.id),\n\t\t\t\tkept,\n\t\t\t\t'deleteScopeInvitations: another scope is left alone',\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tid: 'invitations.delete-expired',\n\t\tgroup,\n\t\tname: 'deleteExpiredInvitations, when implemented, deletes invitations expiring at or before the instant and answers how many',\n\t\tasync run({ store }) {\n\t\t\tif (store.deleteExpiredInvitations === undefined) return;\n\t\t\tconst old = invitation({ expiresAt: at('2026-01-10T00:00:00.000Z') });\n\t\t\tconst edge = invitation({ expiresAt: at('2026-02-01T00:00:00.000Z') });\n\t\t\tconst live = invitation({ expiresAt: at('2026-03-01T00:00:00.000Z') });\n\t\t\tawait store.insertInvitation(old);\n\t\t\tawait store.insertInvitation(edge);\n\t\t\tawait store.insertInvitation(live);\n\n\t\t\tequal(\n\t\t\t\tawait store.deleteExpiredInvitations(at('2026-02-01T00:00:00.000Z')),\n\t\t\t\t2,\n\t\t\t\t'deleteExpiredInvitations: at or before the instant',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait store.findInvitation(live.id),\n\t\t\t\tlive,\n\t\t\t\t'deleteExpiredInvitations: a later one is kept',\n\t\t\t);\n\t\t},\n\t},\n];\n",
66
+ "import { StoreConflict } from '../../../errors/janus-error';\nimport { mintId } from '../../../ids/id';\nimport { equal, isNull, isOurs, rejects } from '../../assert';\nimport { invitation } from '../fixtures';\nimport type { InvitationCase } from '../types';\n\nconst group = 'invitations';\nconst at = (iso: string) => new Date(iso);\nconst t = at('2026-03-01T00:00:00.000Z');\n\nexport const invitationUpdateCases: readonly InvitationCase[] = [\n\t{\n\t\tid: 'invitations.update',\n\t\tgroup,\n\t\tname: 'updateInvitation applies a patch under ifVersion, answers the record as written with version + 1, and leaves unnamed fields alone',\n\t\tasync run({ store }) {\n\t\t\tconst record = invitation({ locale: 'fr' });\n\t\t\tawait store.insertInvitation(record);\n\t\t\tconst by = mintId();\n\n\t\t\tconst written = await store.updateInvitation(record.id, 0, {\n\t\t\t\tupdatedAt: t,\n\t\t\t\tstatus: 'accepted',\n\t\t\t\tacceptedBy: by,\n\t\t\t\tacceptedAt: t,\n\t\t\t});\n\t\t\tconst expected = {\n\t\t\t\t...record,\n\t\t\t\tversion: 1,\n\t\t\t\tupdatedAt: t,\n\t\t\t\tstatus: 'accepted',\n\t\t\t\tacceptedBy: by,\n\t\t\t\tacceptedAt: t,\n\t\t\t};\n\t\t\tequal(written, expected, 'updateInvitation: the record as written');\n\t\t\tequal(\n\t\t\t\tawait store.findInvitation(record.id),\n\t\t\t\texpected,\n\t\t\t\t'updateInvitation: findInvitation reads the write',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait store.findInvitationByCodeHash(record.codeHash),\n\t\t\t\texpected,\n\t\t\t\t'updateInvitation: the code hash still finds it',\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tid: 'invitations.update.fields',\n\t\tgroup,\n\t\tname: 'updateInvitation replaces codeHash, expiresAt and locale whole, and a null locale erases it',\n\t\tasync run({ store }) {\n\t\t\tconst record = invitation({ locale: 'fr' });\n\t\t\tawait store.insertInvitation(record);\n\t\t\tconst codeHash = 'c'.repeat(64);\n\t\t\tconst expiresAt = at('2028-01-01T00:00:00.000Z');\n\n\t\t\tawait store.updateInvitation(record.id, 0, {\n\t\t\t\tupdatedAt: t,\n\t\t\t\tcodeHash,\n\t\t\t\texpiresAt,\n\t\t\t\tlocale: null,\n\t\t\t});\n\n\t\t\tequal(\n\t\t\t\tawait store.findInvitation(record.id),\n\t\t\t\t{\n\t\t\t\t\t...record,\n\t\t\t\t\tversion: 1,\n\t\t\t\t\tupdatedAt: t,\n\t\t\t\t\tcodeHash,\n\t\t\t\t\texpiresAt,\n\t\t\t\t\tlocale: null,\n\t\t\t\t},\n\t\t\t\t'updateInvitation: the new code hash, expiry and locale',\n\t\t\t);\n\t\t\tisNull(\n\t\t\t\tawait store.findInvitationByCodeHash(record.codeHash),\n\t\t\t\t'updateInvitation: the old code hash finds nothing',\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tid: 'invitations.update.absent',\n\t\tgroup,\n\t\tname: 'updateInvitation answers null, writing nothing, for an id that is not stored',\n\t\tasync run({ store }) {\n\t\t\tisNull(\n\t\t\t\tawait store.updateInvitation(mintId(), 0, {\n\t\t\t\t\tupdatedAt: t,\n\t\t\t\t\tstatus: 'revoked',\n\t\t\t\t\trevokedAt: t,\n\t\t\t\t}),\n\t\t\t\t'updateInvitation: an absent invitation is null, not undefined and not a throw',\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tid: 'invitations.update.version',\n\t\tgroup,\n\t\tname: 'updateInvitation throws StoreConflict on a version that moved, writing nothing',\n\t\tasync run({ store }) {\n\t\t\tconst record = invitation();\n\t\t\tawait store.insertInvitation(record);\n\t\t\tawait store.updateInvitation(record.id, 0, {\n\t\t\t\tupdatedAt: t,\n\t\t\t\tname: 'first',\n\t\t\t});\n\n\t\t\tconst error = await rejects(\n\t\t\t\tstore.updateInvitation(record.id, 0, { updatedAt: t, name: 'stale' }),\n\t\t\t\t'updateInvitation with a stale version should reject',\n\t\t\t);\n\t\t\tisOurs(\n\t\t\t\terror,\n\t\t\t\tStoreConflict,\n\t\t\t\t'StoreConflict',\n\t\t\t\t'updateInvitation under a moved version',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\terror.on,\n\t\t\t\t'version',\n\t\t\t\t'updateInvitation: the conflict is on the version',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\t(await store.findInvitation(record.id))?.name,\n\t\t\t\t'first',\n\t\t\t\t'a refused update should have changed nothing',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\t(await store.findInvitation(record.id))?.version,\n\t\t\t\t1,\n\t\t\t\t'a refused update should not move the version',\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tid: 'invitations.update.concurrent',\n\t\tgroup,\n\t\tname: 'updateInvitation: of 20 concurrent claims on one version exactly one wins and the others throw StoreConflict',\n\t\tasync run({ store }) {\n\t\t\tconst record = invitation();\n\t\t\tawait store.insertInvitation(record);\n\n\t\t\tconst settled = await Promise.allSettled(\n\t\t\t\tArray.from({ length: 20 }, () =>\n\t\t\t\t\tstore.updateInvitation(record.id, 0, {\n\t\t\t\t\t\tupdatedAt: t,\n\t\t\t\t\t\tstatus: 'accepted',\n\t\t\t\t\t\tacceptedBy: mintId(),\n\t\t\t\t\t\tacceptedAt: t,\n\t\t\t\t\t}),\n\t\t\t\t),\n\t\t\t);\n\n\t\t\tequal(\n\t\t\t\tsettled.filter((result) => result.status === 'fulfilled').length,\n\t\t\t\t1,\n\t\t\t\t'updateInvitation: exactly one of twenty concurrent claims should have won',\n\t\t\t);\n\t\t\tconst losers = settled.filter((result) => result.status === 'rejected');\n\t\t\tfor (const loser of losers) {\n\t\t\t\tisOurs(loser.reason, StoreConflict, 'StoreConflict', 'a losing claim');\n\t\t\t}\n\t\t\tequal(\n\t\t\t\tlosers.length,\n\t\t\t\t19,\n\t\t\t\t'updateInvitation: the other nineteen should have thrown',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\t(await store.findInvitation(record.id))?.version,\n\t\t\t\t1,\n\t\t\t\t'updateInvitation: one write, one version',\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tid: 'invitations.update.release',\n\t\tgroup,\n\t\tname: 'updateInvitation can release a claim to pending, but throws StoreConflict when another pending invitation holds the address',\n\t\tasync run({ store }) {\n\t\t\tconst record = invitation({ email: 'ada@example.com' });\n\t\t\tawait store.insertInvitation(record);\n\t\t\tawait store.updateInvitation(record.id, 0, {\n\t\t\t\tupdatedAt: t,\n\t\t\t\tstatus: 'accepted',\n\t\t\t\tacceptedBy: mintId(),\n\t\t\t\tacceptedAt: t,\n\t\t\t});\n\n\t\t\tconst released = await store.updateInvitation(record.id, 1, {\n\t\t\t\tupdatedAt: t,\n\t\t\t\tstatus: 'pending',\n\t\t\t\tacceptedBy: null,\n\t\t\t\tacceptedAt: null,\n\t\t\t});\n\t\t\tequal(\n\t\t\t\treleased?.status,\n\t\t\t\t'pending',\n\t\t\t\t'updateInvitation: a claim is released to pending',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\treleased?.acceptedBy,\n\t\t\t\tnull,\n\t\t\t\t'updateInvitation: and its acceptor is cleared',\n\t\t\t);\n\n\t\t\t// Claim again, then another pending invitation takes the address.\n\t\t\tawait store.updateInvitation(record.id, 2, {\n\t\t\t\tupdatedAt: t,\n\t\t\t\tstatus: 'accepted',\n\t\t\t\tacceptedBy: mintId(),\n\t\t\t\tacceptedAt: t,\n\t\t\t});\n\t\t\tequal(\n\t\t\t\tawait store.insertInvitation(invitation({ email: 'ada@example.com' })),\n\t\t\t\ttrue,\n\t\t\t\t'insertInvitation: the claimed invitation no longer holds the address',\n\t\t\t);\n\t\t\tconst error = await rejects(\n\t\t\t\tstore.updateInvitation(record.id, 3, {\n\t\t\t\t\tupdatedAt: t,\n\t\t\t\t\tstatus: 'pending',\n\t\t\t\t}),\n\t\t\t\t'releasing onto a held address should reject',\n\t\t\t);\n\t\t\tisOurs(\n\t\t\t\terror,\n\t\t\t\tStoreConflict,\n\t\t\t\t'StoreConflict',\n\t\t\t\t'a release onto a held address',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\terror.on,\n\t\t\t\t'pending',\n\t\t\t\t'the conflict is on the pending slot, not the version',\n\t\t\t);\n\t\t\tequal(error.code, 'INVITATION_PENDING', 'the conflict code');\n\t\t\tequal(\n\t\t\t\t(await store.findInvitation(record.id))?.status,\n\t\t\t\t'accepted',\n\t\t\t\t'a refused release should have changed nothing',\n\t\t\t);\n\t\t},\n\t},\n];\n",
67
+ "import type { InvitationCase } from '../types';\nimport { invitationActorCases } from './actors';\nimport { invitationFindPendingCases } from './find-pending';\nimport { invitationImportedCases } from './imported';\nimport { invitationInsertCases } from './insert';\nimport { invitationListCases } from './list';\nimport { invitationListLapsedCases } from './list-lapsed';\nimport { invitationListStatusCases } from './list-status';\nimport { invitationScopeCases } from './scope';\nimport { invitationUpdateCases } from './update';\n\n/** Every case of the invitation store, outages aside, in the order they are described. */\nexport const invitationStoreCases: readonly InvitationCase[] = [\n\t...invitationInsertCases,\n\t...invitationImportedCases,\n\t...invitationFindPendingCases,\n\t...invitationListCases,\n\t...invitationListLapsedCases,\n\t...invitationListStatusCases,\n\t...invitationScopeCases,\n\t...invitationUpdateCases,\n\t...invitationActorCases,\n];\n",
68
+ "import type { InvitationStore } from '../../../auth/port/types';\nimport { JanusError, StoreFailure } from '../../../errors/janus-error';\nimport { equal, isOurs, ok, rejects } from '../../assert';\nimport { invitation } from '../fixtures';\nimport type { InvitationCase, InvitationMethod } from '../types';\n\nconst seeded = invitation({ id: '00000000-0000-7000-8000-000000000001' });\nconst when = new Date('2026-09-01T00:00:00.000Z');\n\n/**\n * For each method, a store that cannot answer must **reject** — never `null`,\n * `false`, `0` or an empty page. An invitation store that answers `null` for\n * an outage tells an invitee that a valid code does not exist; one that\n * answers `false` for an insert tells the inviter the address is taken.\n */\nfunction outage(\n\tmethod: InvitationMethod,\n\tcall: (store: InvitationStore) => Promise<unknown>,\n\tafter?: (store: InvitationStore) => Promise<void>,\n): InvitationCase {\n\treturn {\n\t\tid: `outage.${method}`,\n\t\tgroup: 'outage',\n\t\tname: `invitations.${method} rejects when the store cannot answer — never null, false, 0 or an empty page`,\n\t\tneeds: 'faults',\n\t\tasync run({ store, faults }) {\n\t\t\tawait store.insertInvitation(seeded);\n\t\t\tawait faults?.fail(method);\n\n\t\t\tconst error = await rejects(\n\t\t\t\tcall(store),\n\t\t\t\t`invitations.${method} under an outage should reject`,\n\t\t\t);\n\t\t\tif (\n\t\t\t\terror instanceof JanusError ||\n\t\t\t\t(error as { name?: unknown })?.name === 'StoreFailure'\n\t\t\t) {\n\t\t\t\tisOurs(\n\t\t\t\t\terror,\n\t\t\t\t\tStoreFailure,\n\t\t\t\t\t'StoreFailure',\n\t\t\t\t\t`invitations.${method} under an outage`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tok(\n\t\t\t\t(error as { code?: unknown } | null)?.code !== 'NOT_FOUND',\n\t\t\t\t`invitations.${method} under an outage rejected with NOT_FOUND: an outage is never an absence`,\n\t\t\t);\n\t\t\tawait after?.(store);\n\t\t},\n\t};\n}\n\n/** A case about an optional method: passes for a store that does not have it. */\nfunction optional(invitationCase: InvitationCase): InvitationCase {\n\tconst method = invitationCase.id.slice('outage.'.length) as InvitationMethod;\n\treturn {\n\t\t...invitationCase,\n\t\tasync run(context) {\n\t\t\tif (context.store[method] === undefined) return;\n\t\t\tawait invitationCase.run(context);\n\t\t},\n\t};\n}\n\n/** A rejected write is one that did nothing. */\nconst unchanged = async (store: InvitationStore) =>\n\tequal(\n\t\tawait store.findInvitation(seeded.id),\n\t\tseeded,\n\t\t'a rejected write should have changed nothing',\n\t);\n\nexport const invitationOutageCases: readonly InvitationCase[] = [\n\toutage('insertInvitation', (store) => store.insertInvitation(invitation())),\n\toutage('findInvitation', (store) => store.findInvitation(seeded.id)),\n\toutage('findInvitationByCodeHash', (store) =>\n\t\tstore.findInvitationByCodeHash(seeded.codeHash),\n\t),\n\toutage('listScopeInvitations', (store) =>\n\t\tstore.listScopeInvitations(seeded.scope, {\n\t\t\tstatus: null,\n\t\t\tfirst: 10,\n\t\t\tafter: null,\n\t\t}),\n\t),\n\toutage('countPendingInvitations', (store) =>\n\t\tstore.countPendingInvitations(seeded.scope, when),\n\t),\n\toutage(\n\t\t'updateInvitation',\n\t\t(store) =>\n\t\t\tstore.updateInvitation(seeded.id, 0, {\n\t\t\t\tupdatedAt: when,\n\t\t\t\tstatus: 'revoked',\n\t\t\t\trevokedAt: when,\n\t\t\t}),\n\t\tunchanged,\n\t),\n\toutage(\n\t\t'deleteScopeInvitations',\n\t\t(store) => store.deleteScopeInvitations(seeded.scope),\n\t\tasync (store) =>\n\t\t\tequal(\n\t\t\t\t(await store.findInvitation(seeded.id))?.id,\n\t\t\t\tseeded.id,\n\t\t\t\t'a rejected deletion should have deleted nothing',\n\t\t\t),\n\t),\n\toptional(\n\t\toutage('deleteExpiredInvitations', (store) =>\n\t\t\t(\n\t\t\t\tstore.deleteExpiredInvitations as NonNullable<\n\t\t\t\t\ttypeof store.deleteExpiredInvitations\n\t\t\t\t>\n\t\t\t)(new Date('2100-01-01T00:00:00.000Z')),\n\t\t),\n\t),\n\toptional(\n\t\toutage('countScopeInvitations', (store) =>\n\t\t\t(\n\t\t\t\tstore.countScopeInvitations as NonNullable<\n\t\t\t\t\ttypeof store.countScopeInvitations\n\t\t\t\t>\n\t\t\t)(seeded.scope, { status: null, role: null, ref: null, lapsed: null }),\n\t\t),\n\t),\n\toptional(\n\t\toutage('findPendingInvitation', (store) =>\n\t\t\t(\n\t\t\t\tstore.findPendingInvitation as NonNullable<\n\t\t\t\t\ttypeof store.findPendingInvitation\n\t\t\t\t>\n\t\t\t)(seeded.scope, 'someone@example.com'),\n\t\t),\n\t),\n];\n",
69
+ "import { describeSuite, fromGlobals, SKIP_REASONS } from '../describe';\nimport type { ConformanceRunner } from '../types';\nimport { invitationStoreCases } from './cases';\nimport { invitationOutageCases } from './cases/outage';\nimport type { InvitationCase, InvitationHarness } from './types';\n\n/** Every case, in the order they are described. */\nexport const allInvitationCases: readonly InvitationCase[] = [\n\t...invitationStoreCases,\n\t...invitationOutageCases,\n];\n\n/** Runs one case against a freshly opened store, and closes it, pass or fail. */\nexport async function runInvitationCase(\n\tinvitationCase: InvitationCase,\n\tharness: InvitationHarness,\n): Promise<{ readonly skipped: string } | { readonly passed: true }> {\n\tconst opened = await harness.open();\n\n\ttry {\n\t\tif (invitationCase.needs === 'faults' && opened.faults === undefined) {\n\t\t\treturn { skipped: SKIP_REASONS.faults };\n\t\t}\n\t\tawait invitationCase.run({\n\t\t\tstore: opened.store,\n\t\t\tfaults: opened.faults ?? null,\n\t\t});\n\t\treturn { passed: true };\n\t} finally {\n\t\tawait opened.close?.();\n\t}\n}\n\n/** Describes the whole invitation suite under the adapter's test runner. */\nexport function describeInvitationStores(options: {\n\treadonly name: string;\n\treadonly harness: InvitationHarness;\n\treadonly runner?: ConformanceRunner;\n\t/** Case ids to skip, each with the reason — reported, never silent. */\n\treadonly skip?: Readonly<Record<string, string>>;\n\treadonly faults?: boolean;\n}): void {\n\tdescribeSuite({\n\t\ttitle: `${options.name} — @softistx/janus invitation conformance`,\n\t\tcases: allInvitationCases,\n\t\trun: (invitationCase) => runInvitationCase(invitationCase, options.harness),\n\t\trunner: options.runner ?? fromGlobals('describeInvitationStores'),\n\t\tskip: options.skip ?? {},\n\t\tfaults: options.faults,\n\t});\n}\n",
70
+ "import { createMemoryInvitations } from '../../auth/port/memory';\nimport type { InvitationStore } from '../../auth/port/types';\nimport { StoreFailure } from '../../errors/janus-error';\nimport type { InvitationHarness } from './types';\n\n/** The reference store, with faults: what the suite proves itself against. */\nexport function referenceInvitationHarness(): InvitationHarness {\n\treturn {\n\t\tasync open() {\n\t\t\tconst failing = new Set<string>();\n\t\t\tconst inner = createMemoryInvitations();\n\t\t\tconst store = Object.fromEntries(\n\t\t\t\tObject.entries(inner).map(([method, fn]) => [\n\t\t\t\t\tmethod,\n\t\t\t\t\t(...args: unknown[]) =>\n\t\t\t\t\t\tfailing.has(method)\n\t\t\t\t\t\t\t? Promise.reject(\n\t\t\t\t\t\t\t\t\tnew StoreFailure(\n\t\t\t\t\t\t\t\t\t\t`invitations.${method}: the store could not answer`,\n\t\t\t\t\t\t\t\t\t\t{ slot: 'invitations', operation: method },\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t: (fn as (...a: unknown[]) => unknown).apply(inner, args),\n\t\t\t\t]),\n\t\t\t) as unknown as InvitationStore;\n\n\t\t\treturn {\n\t\t\t\tstore,\n\t\t\t\tfaults: {\n\t\t\t\t\tasync fail(method) {\n\t\t\t\t\t\tfailing.add(method);\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t};\n\t\t},\n\t};\n}\n",
71
+ "import { createMemoryStores } from '../auth/port/memory';\nimport type { JanusStores } from '../auth/port/types';\nimport { StoreFailure } from '../errors/janus-error';\nimport type { ConformanceHarness, StoreFaults } from './types';\n\n/**\n * The harness for the reference store: what `self.spec.ts` runs the suite\n * against, and **the example an adapter author copies**.\n *\n * Its faults are a wrapper, because an in-memory map has no network to cut —\n * which is exactly why the doc on `StoreFaults` says an adapter must not do\n * this: a wrapper proves the wrapper. For the reference store there is nothing\n * underneath to prove, and it fails the way a correct adapter does, with\n * `StoreFailure`.\n */\nexport function referenceHarness(): ConformanceHarness {\n\treturn {\n\t\tasync open() {\n\t\t\tconst failing = new Set<string>();\n\t\t\tconst stores = withFaults(createMemoryStores(), failing);\n\n\t\t\tconst faults: StoreFaults = {\n\t\t\t\tasync fail(slot, method) {\n\t\t\t\t\tfailing.add(`${slot}.${method}`);\n\t\t\t\t},\n\t\t\t};\n\n\t\t\treturn { stores, faults };\n\t\t},\n\t};\n}\n\nfunction withFaults(\n\tstores: JanusStores,\n\tfailing: ReadonlySet<string>,\n): JanusStores {\n\tconst wrap = <S extends object>(slot: string, store: S): S => {\n\t\tconst wrapped: Record<string, unknown> = {};\n\t\tfor (const [method, fn] of Object.entries(store)) {\n\t\t\twrapped[method] = (...args: unknown[]) => {\n\t\t\t\tif (failing.has(`${slot}.${method}`)) {\n\t\t\t\t\treturn Promise.reject(\n\t\t\t\t\t\tnew StoreFailure(`${slot}.${method}: the store could not answer`, {\n\t\t\t\t\t\t\tslot: slot as keyof JanusStores,\n\t\t\t\t\t\t\toperation: method,\n\t\t\t\t\t\t}),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\treturn (fn as (...a: unknown[]) => unknown).apply(store, args);\n\t\t\t};\n\t\t}\n\t\treturn wrapped as S;\n\t};\n\n\treturn {\n\t\tusers: wrap('users', stores.users),\n\t\tsessions: wrap('sessions', stores.sessions),\n\t\ttokens: wrap('tokens', stores.tokens),\n\t\t...(stores.socialLinks === undefined\n\t\t\t? {}\n\t\t\t: { socialLinks: wrap('socialLinks', stores.socialLinks) }),\n\t\t...(stores.passkeys === undefined\n\t\t\t? {}\n\t\t\t: { passkeys: wrap('passkeys', stores.passkeys) }),\n\t};\n}\n",
72
+ "import { mintId } from '../../ids/id';\nimport { formatSubject } from '../../subjects/notation';\nimport type {\n\tEntity,\n\tRelationTuple,\n\tSubject,\n\tSubjectSet,\n} from '../../subjects/subject';\n\n/** The tuples the relation cases write, and how they compare what comes back. */\n\nexport const entity = (type: string, id: string = mintId()): Entity => ({\n\ttype,\n\tid,\n});\nexport const set = (\n\ttype: string,\n\tid: string,\n\trelation: string,\n): SubjectSet => ({\n\ttype,\n\tid,\n\trelation,\n});\nexport const tuple = (\n\tobject: Entity,\n\trelation: string,\n\tsubject: Subject,\n): RelationTuple => ({ object, relation, subject });\n\n/** Order-free, so a store may answer in any order. */\nexport const sorted = (subjects: readonly Subject[]) =>\n\tsubjects.map(formatSubject).sort();\n",
73
+ "import { equal } from '../../assert';\nimport { entity, set, tuple } from '../fixtures';\nimport type { RelationCase } from '../types';\n\nconst group = 'relations';\n\n/** What deleting an entity removes, and what it leaves. */\nexport const relationDeletionCases: readonly RelationCase[] = [\n\t{\n\t\tid: 'relations.deleteEntity',\n\t\tgroup,\n\t\tname: 'deletes every tuple naming an entity — as object, as subject, as a set’s entity — and counts them',\n\t\tasync run({ store }) {\n\t\t\tconst team = entity('team');\n\t\t\tconst other = entity('team');\n\t\t\tconst kept = [\n\t\t\t\ttuple(other, 'member', entity('staff')),\n\t\t\t\ttuple(entity('record'), 'viewer', set('team', other.id, 'member')),\n\t\t\t];\n\t\t\tawait store.write({\n\t\t\t\tadd: [\n\t\t\t\t\ttuple(team, 'member', entity('staff')),\n\t\t\t\t\ttuple(entity('record'), 'team', team),\n\t\t\t\t\ttuple(entity('record'), 'viewer', set('team', team.id, 'member')),\n\t\t\t\t\t...kept,\n\t\t\t\t],\n\t\t\t});\n\n\t\t\tequal(\n\t\t\t\tawait store.deleteEntity(team),\n\t\t\t\t3,\n\t\t\t\t'deleteEntity: how many it deleted',\n\t\t\t);\n\t\t\tfor (const survivor of kept) {\n\t\t\t\tequal(\n\t\t\t\t\tawait store.has(survivor),\n\t\t\t\t\ttrue,\n\t\t\t\t\t'deleteEntity should not touch another entity',\n\t\t\t\t);\n\t\t\t}\n\t\t\tequal(\n\t\t\t\tawait store.deleteEntity(team),\n\t\t\t\t0,\n\t\t\t\t'deleteEntity replayed answers 0, not a failure',\n\t\t\t);\n\t\t},\n\t},\n];\n",
74
+ "import { InvalidCursorError } from '../../../errors/janus-error';\nimport { holderCursor } from '../../../permissions/port/holders';\nimport type { RelationStore } from '../../../permissions/port/types';\nimport type { Entity } from '../../../subjects/subject';\nimport { equal, isOurs, rejects } from '../../assert';\nimport { entity, set, tuple } from '../fixtures';\nimport type { RelationCase } from '../types';\n\nconst group = 'relations';\n\ntype FindHolders = NonNullable<RelationStore['findHolders']>;\n\n/**\n * `findHolders` is **optional on the port**: a store that does not have it is\n * served by the core, and these cases pass for it without asking anything.\n * A store that has it answers pages ordered by type then id, cut by a\n * case-insensitive literal `search` on the id, and refuses a foreign cursor.\n */\nexport const relationHolderCases: readonly RelationCase[] = [\n\t{\n\t\tid: 'relations.findHolders',\n\t\tgroup,\n\t\tname: 'findHolders pages the single entities of one object and relation in type then id order, with a cursor, and leaves out subject sets and other relations',\n\t\tasync run({ store }) {\n\t\t\tif (store.findHolders === undefined) return;\n\t\t\tconst findHolders: FindHolders = store.findHolders.bind(store);\n\t\t\tconst record = entity('record', 'holders');\n\t\t\tconst staff = ['b2', 'a1', 'c3'].map((id) => entity('staff', id));\n\t\t\tconst other = entity('patient', 'a1');\n\t\t\tawait store.write({\n\t\t\t\tadd: [\n\t\t\t\t\t...staff.map((holder) => tuple(record, 'viewer', holder)),\n\t\t\t\t\ttuple(record, 'viewer', other),\n\t\t\t\t\ttuple(record, 'viewer', set('team', 't1', 'member')),\n\t\t\t\t\ttuple(record, 'owner', entity('staff', 'zz')),\n\t\t\t\t\ttuple(entity('record', 'else'), 'viewer', entity('staff', 'yy')),\n\t\t\t\t],\n\t\t\t});\n\t\t\tconst read = (after: string | null, limit: number) =>\n\t\t\t\tfindHolders({\n\t\t\t\t\tobject: record,\n\t\t\t\t\trelation: 'viewer',\n\t\t\t\t\tafter,\n\t\t\t\t\tlimit,\n\t\t\t\t\tsearch: null,\n\t\t\t\t});\n\n\t\t\tconst first = await read(null, 3);\n\t\t\tequal(\n\t\t\t\tfirst.items,\n\t\t\t\t[other, entity('staff', 'a1'), entity('staff', 'b2')],\n\t\t\t\t'findHolders: the first page, by type then id',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tfirst.nextCursor,\n\t\t\t\tholderCursor(entity('staff', 'b2')),\n\t\t\t\t'findHolders: nextCursor follows the last item',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait read(first.nextCursor, 3),\n\t\t\t\t{ items: [entity('staff', 'c3')], nextCursor: null },\n\t\t\t\t'findHolders: the last page ends with a null nextCursor',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait read(holderCursor(entity('staff', 'a1')), 1),\n\t\t\t\t{\n\t\t\t\t\titems: [entity('staff', 'b2')],\n\t\t\t\t\tnextCursor: holderCursor(entity('staff', 'b2')),\n\t\t\t\t},\n\t\t\t\t'findHolders: a cursor need not name a stored holder',\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tid: 'relations.findHolders.search',\n\t\tgroup,\n\t\tname: 'findHolders search keeps the holders whose id contains the text, ignoring case, and takes % _ . and \\\\ literally',\n\t\tasync run({ store }) {\n\t\t\tif (store.findHolders === undefined) return;\n\t\t\tconst findHolders: FindHolders = store.findHolders.bind(store);\n\t\t\tconst record = entity('record', 'search');\n\t\t\tconst ids = ['Ana', 'banana', 'a.b', 'a_b', 'a%b', 'a\\\\b', 'axb', 'zed'];\n\t\t\tawait store.write({\n\t\t\t\tadd: ids.map((id) => tuple(record, 'viewer', entity('staff', id))),\n\t\t\t});\n\t\t\tconst found = async (search: string): Promise<string[]> => {\n\t\t\t\tconst all: Entity[] = [];\n\t\t\t\tlet after: string | null = null;\n\t\t\t\tdo {\n\t\t\t\t\tconst page = await findHolders({\n\t\t\t\t\t\tobject: record,\n\t\t\t\t\t\trelation: 'viewer',\n\t\t\t\t\t\tafter,\n\t\t\t\t\t\tlimit: 2,\n\t\t\t\t\t\tsearch,\n\t\t\t\t\t});\n\t\t\t\t\tall.push(...page.items);\n\t\t\t\t\tafter = page.nextCursor;\n\t\t\t\t} while (after !== null);\n\t\t\t\treturn all.map((holder) => holder.id).sort();\n\t\t\t};\n\n\t\t\tequal(await found('ANA'), ['Ana', 'banana'], 'findHolders: ignores case');\n\t\t\tequal(await found('a.b'), ['a.b'], 'findHolders: \".\" is not a wildcard');\n\t\t\tequal(await found('a_b'), ['a_b'], 'findHolders: \"_\" is not a wildcard');\n\t\t\tequal(await found('a%b'), ['a%b'], 'findHolders: \"%\" is not a wildcard');\n\t\t\tequal(await found('a\\\\b'), ['a\\\\b'], 'findHolders: \"\\\\\" is no escape');\n\t\t\tequal(\n\t\t\t\tawait found('nobody'),\n\t\t\t\t[],\n\t\t\t\t'findHolders: no match is an empty page',\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tid: 'relations.findHolders.cursor',\n\t\tgroup,\n\t\tname: 'findHolders refuses a cursor it did not mint with InvalidCursorError, never the first page',\n\t\tasync run({ store }) {\n\t\t\tif (store.findHolders === undefined) return;\n\t\t\tconst findHolders: FindHolders = store.findHolders.bind(store);\n\t\t\tconst record = entity('record', 'cursor');\n\t\t\tawait store.write({\n\t\t\t\tadd: [tuple(record, 'viewer', entity('staff', 'u1'))],\n\t\t\t});\n\t\t\tconst error = await rejects(\n\t\t\t\tfindHolders({\n\t\t\t\t\tobject: record,\n\t\t\t\t\trelation: 'viewer',\n\t\t\t\t\tafter: 'not a cursor of this store',\n\t\t\t\t\tlimit: 5,\n\t\t\t\t\tsearch: null,\n\t\t\t\t}),\n\t\t\t\t'findHolders should refuse a foreign cursor',\n\t\t\t);\n\t\t\tisOurs(error, InvalidCursorError, 'InvalidCursorError', 'findHolders');\n\t\t},\n\t},\n];\n",
75
+ "import type { Subject } from '../../../subjects/subject';\nimport { equal } from '../../assert';\nimport { entity, set, tuple } from '../fixtures';\nimport type { RelationCase } from '../types';\n\nconst group = 'relations';\n\n/**\n * What a read answers: the tuples exactly as written — a subject's type, a\n * set's relation and every character of an id are part of it — and `false`,\n * `[]`, an empty page or `0` for an absence.\n */\nexport const relationReadCases: readonly RelationCase[] = [\n\t{\n\t\tid: 'relations.roundTrip',\n\t\tgroup,\n\t\tname: 'holds exactly the tuples written, byte for byte: staff:u1 is not patient:u1, and a set is not its entity',\n\t\tasync run({ store }) {\n\t\t\tconst record = entity('record', 'R:1 — ÿ');\n\t\t\tconst direct = tuple(record, 'viewer', entity('staff', 'u1'));\n\t\t\tconst inherited = tuple(record, 'viewer', set('team', 't1', 'member'));\n\t\t\tawait store.write({ add: [direct, inherited] });\n\n\t\t\tequal(await store.has(direct), true, 'has for a written tuple');\n\t\t\tequal(await store.has(inherited), true, 'has for a written subject set');\n\t\t\tequal(\n\t\t\t\tawait store.has(tuple(record, 'viewer', entity('patient', 'u1'))),\n\t\t\t\tfalse,\n\t\t\t\t'has for the same id under another subject type: types are part of the subject',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait store.has(tuple(record, 'viewer', entity('team', 't1'))),\n\t\t\t\tfalse,\n\t\t\t\t'has for the entity of a stored subject set: a set is not its entity',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait store.has(\n\t\t\t\t\ttuple(entity('record', 'r:1 — ÿ'), 'viewer', direct.subject),\n\t\t\t\t),\n\t\t\t\tfalse,\n\t\t\t\t'has for an id differing in one character: ids are compared as written',\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tid: 'relations.edgeCharacters',\n\t\tgroup,\n\t\tname: 'round-trips every character the core lets through in an id: control characters, U+FFFF and a surrogate pair',\n\t\tasync run({ store }) {\n\t\t\t// The core refuses a NUL and a lone surrogate before a store is\n\t\t\t// asked; everything else must come back exactly as written.\n\t\t\tconst edge = 'a\\u0001\\u001f\\u007f\\uFFFF 😀 z';\n\t\t\tconst record = entity('record', edge);\n\t\t\tconst written = tuple(record, 'viewer', set('team', edge, 'member'));\n\t\t\tconst direct = tuple(record, 'viewer', entity('staff', edge));\n\t\t\tawait store.write({ add: [written, direct] });\n\n\t\t\tequal(await store.has(written), true, 'has for ids of edge characters');\n\t\t\t// Read back through every index: an adapter that mangles an id the\n\t\t\t// same way on write and on lookup still fails here.\n\t\t\tequal(\n\t\t\t\tawait store.findSubjectSets(record, 'viewer'),\n\t\t\t\t[set('team', edge, 'member')],\n\t\t\t\t'findSubjectSets answers the set id as written',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait store.findEntities(record, 'viewer'),\n\t\t\t\t[entity('staff', edge)],\n\t\t\t\t'findEntities answers the entity id as written',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait store.findObjects({\n\t\t\t\t\ttype: 'record',\n\t\t\t\t\trelation: 'viewer',\n\t\t\t\t\tsubject: direct.subject,\n\t\t\t\t\tafter: null,\n\t\t\t\t\tlimit: 10,\n\t\t\t\t}),\n\t\t\t\t{ items: [edge], nextCursor: null },\n\t\t\t\t'findObjects answers the object id as written',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait store.has(\n\t\t\t\t\ttuple(\n\t\t\t\t\t\tentity('record', edge.replace('😀', '😁')),\n\t\t\t\t\t\t'viewer',\n\t\t\t\t\t\twritten.subject,\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t\tfalse,\n\t\t\t\t'has for an id differing in one astral character',\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tid: 'relations.undefinedRelation',\n\t\tgroup,\n\t\tname: 'reads a subject whose relation is undefined as its entity, not as a set',\n\t\tasync run({ store }) {\n\t\t\tconst record = entity('record');\n\t\t\tconst staff = entity('staff');\n\t\t\t// A caller that spreads an optional field hands the port this shape.\n\t\t\tconst spread = { ...staff, relation: undefined } as unknown as Subject;\n\t\t\tawait store.write({ add: [tuple(record, 'viewer', spread)] });\n\n\t\t\tequal(\n\t\t\t\tawait store.has(tuple(record, 'viewer', staff)),\n\t\t\t\ttrue,\n\t\t\t\t'has for the entity, after writing it with relation: undefined',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait store.findEntities(record, 'viewer'),\n\t\t\t\t[staff],\n\t\t\t\t'findEntities: the tuple names an entity',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait store.findSubjectSets(record, 'viewer'),\n\t\t\t\t[],\n\t\t\t\t'findSubjectSets: relation: undefined is no set',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait store.findObjects({\n\t\t\t\t\ttype: 'record',\n\t\t\t\t\trelation: 'viewer',\n\t\t\t\t\tsubject: spread,\n\t\t\t\t\tafter: null,\n\t\t\t\t\tlimit: 10,\n\t\t\t\t}),\n\t\t\t\t{ items: [record.id], nextCursor: null },\n\t\t\t\t'findObjects for the subject written with relation: undefined',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait store.findObjects({\n\t\t\t\t\ttype: 'record',\n\t\t\t\t\trelation: 'viewer',\n\t\t\t\t\tsubject: set('staff', staff.id, 'x'),\n\t\t\t\t\tafter: null,\n\t\t\t\t\tlimit: 10,\n\t\t\t\t}),\n\t\t\t\t{ items: [], nextCursor: null },\n\t\t\t\t'findObjects for a set of that entity: the entity is not a set',\n\t\t\t);\n\t\t\tawait store.write({ remove: [tuple(record, 'viewer', spread)] });\n\t\t\tequal(\n\t\t\t\tawait store.has(tuple(record, 'viewer', staff)),\n\t\t\t\tfalse,\n\t\t\t\t'has after removing it with relation: undefined',\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tid: 'relations.absence',\n\t\tgroup,\n\t\tname: 'answers false, [], an empty page and 0 for an empty store — never null or undefined',\n\t\tasync run({ store }) {\n\t\t\tconst record = entity('record');\n\t\t\tconst staff = entity('staff');\n\n\t\t\tequal(await store.has(tuple(record, 'viewer', staff)), false, 'has');\n\t\t\tequal(\n\t\t\t\tawait store.findSubjectSets(record, 'viewer'),\n\t\t\t\t[],\n\t\t\t\t'findSubjectSets',\n\t\t\t);\n\t\t\tequal(await store.findEntities(record, 'viewer'), [], 'findEntities');\n\t\t\tequal(\n\t\t\t\tawait store.findObjects({\n\t\t\t\t\ttype: 'record',\n\t\t\t\t\trelation: 'viewer',\n\t\t\t\t\tsubject: staff,\n\t\t\t\t\tafter: null,\n\t\t\t\t\tlimit: 10,\n\t\t\t\t}),\n\t\t\t\t{ items: [], nextCursor: null },\n\t\t\t\t'findObjects on an empty store',\n\t\t\t);\n\t\t\tequal(await store.deleteEntity(staff), 0, 'deleteEntity');\n\t\t},\n\t},\n];\n",
76
+ "import { equal } from '../../assert';\nimport { entity, set, sorted, tuple } from '../fixtures';\nimport type { RelationCase } from '../types';\n\nconst group = 'relations';\n\n/**\n * The two directions a check walks: one hop down from an object, and the\n * objects one subject holds a relation on, paged.\n */\nexport const relationTraversalCases: readonly RelationCase[] = [\n\t{\n\t\tid: 'relations.oneHop',\n\t\tgroup,\n\t\tname: 'answers one hop: the subject sets and the entities holding one relation on one object, and nothing else',\n\t\tasync run({ store }) {\n\t\t\tconst record = entity('record');\n\t\t\tconst staff = entity('staff');\n\t\t\tconst team = entity('team');\n\t\t\tconst members = set('team', team.id, 'member');\n\t\t\tconst leads = set('team', team.id, 'lead');\n\t\t\tawait store.write({\n\t\t\t\tadd: [\n\t\t\t\t\ttuple(record, 'viewer', staff),\n\t\t\t\t\ttuple(record, 'viewer', team),\n\t\t\t\t\ttuple(record, 'viewer', members),\n\t\t\t\t\ttuple(record, 'viewer', leads),\n\t\t\t\t\t// Another relation, and another object: neither is an answer.\n\t\t\t\t\ttuple(record, 'editor', set('team', team.id, 'admin')),\n\t\t\t\t\ttuple(entity('record'), 'viewer', set('team', 'other', 'member')),\n\t\t\t\t],\n\t\t\t});\n\n\t\t\tequal(\n\t\t\t\tsorted(await store.findSubjectSets(record, 'viewer')),\n\t\t\t\tsorted([members, leads]),\n\t\t\t\t'findSubjectSets: the sets only, of this object and this relation',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tsorted(await store.findEntities(record, 'viewer')),\n\t\t\t\tsorted([staff, team]),\n\t\t\t\t'findEntities: the single entities only, of this object and this relation',\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tid: 'relations.objects',\n\t\tgroup,\n\t\tname: 'pages 25 objects by 10 in ascending id order, for one type, relation and exact subject, and ends on a null cursor',\n\t\tasync run({ store }) {\n\t\t\tconst staff = entity('staff');\n\t\t\tconst ids = Array.from(\n\t\t\t\t{ length: 25 },\n\t\t\t\t(_, n) => `r${String(n).padStart(2, '0')}`,\n\t\t\t);\n\t\t\t// Written newest first, beside noise the answer must leave out.\n\t\t\tfor (const id of [...ids].reverse()) {\n\t\t\t\tawait store.write({\n\t\t\t\t\tadd: [\n\t\t\t\t\t\ttuple(entity('record', id), 'viewer', staff),\n\t\t\t\t\t\ttuple(entity('record', `${id}x`), 'editor', staff),\n\t\t\t\t\t\ttuple(entity('folder', id), 'viewer', staff),\n\t\t\t\t\t\ttuple(\n\t\t\t\t\t\t\tentity('record', `${id}y`),\n\t\t\t\t\t\t\t'viewer',\n\t\t\t\t\t\t\tset('staff', staff.id, 'x'),\n\t\t\t\t\t\t),\n\t\t\t\t\t],\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tconst seen: string[] = [];\n\t\t\tconst sizes: number[] = [];\n\t\t\tlet after: string | null = null;\n\t\t\tfor (let page = 0; page < 10; page += 1) {\n\t\t\t\tconst answer = await store.findObjects({\n\t\t\t\t\ttype: 'record',\n\t\t\t\t\trelation: 'viewer',\n\t\t\t\t\tsubject: staff,\n\t\t\t\t\tafter,\n\t\t\t\t\tlimit: 10,\n\t\t\t\t});\n\t\t\t\tseen.push(...answer.items);\n\t\t\t\tsizes.push(answer.items.length);\n\t\t\t\tafter = answer.nextCursor;\n\t\t\t\tif (after === null) break;\n\t\t\t}\n\n\t\t\tequal(sizes, [10, 10, 5], 'findObjects: page sizes for 25 objects by 10');\n\t\t\tequal(seen, ids, 'findObjects: every id once, in ascending order');\n\t\t\tconst between = await store.findObjects({\n\t\t\t\ttype: 'record',\n\t\t\t\trelation: 'viewer',\n\t\t\t\tsubject: staff,\n\t\t\t\tafter: 'r04a',\n\t\t\t\tlimit: 2,\n\t\t\t});\n\t\t\tequal(\n\t\t\t\tbetween.items,\n\t\t\t\t['r05', 'r06'],\n\t\t\t\t'findObjects: a cursor naming no stored object should start after it',\n\t\t\t);\n\t\t},\n\t},\n];\n",
77
+ "import { equal } from '../../assert';\nimport { entity, tuple } from '../fixtures';\nimport type { RelationCase } from '../types';\n\nconst group = 'relations';\n\n/** What a write does twice, or at once: nothing under a retry, one tuple under a race. */\nexport const relationWriteCases: readonly RelationCase[] = [\n\t{\n\t\tid: 'relations.idempotentWrite',\n\t\tgroup,\n\t\tname: 'is idempotent under retry: adding a stored tuple and removing an absent one write nothing',\n\t\tasync run({ store }) {\n\t\t\tconst record = entity('record');\n\t\t\tconst viewer = tuple(record, 'viewer', entity('team'));\n\t\t\tawait store.write({ add: [viewer] });\n\t\t\tawait store.write({ add: [viewer] });\n\t\t\tawait store.write({ remove: [tuple(record, 'viewer', entity('team'))] });\n\n\t\t\tequal(\n\t\t\t\t(await store.findEntities(record, 'viewer')).length,\n\t\t\t\t1,\n\t\t\t\t'findEntities after the same tuple was added twice',\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tid: 'relations.uniqueness',\n\t\tgroup,\n\t\tname: 'keeps one tuple when twenty concurrent writes add it: uniqueness is a constraint, not a read',\n\t\tasync run({ store }) {\n\t\t\tconst record = entity('record');\n\t\t\tconst parent = entity('folder');\n\t\t\tawait Promise.all(\n\t\t\t\tArray.from({ length: 20 }, () =>\n\t\t\t\t\tstore.write({ add: [tuple(record, 'parent', parent)] }),\n\t\t\t\t),\n\t\t\t);\n\n\t\t\tequal(\n\t\t\t\tawait store.findEntities(record, 'parent'),\n\t\t\t\t[parent],\n\t\t\t\t'findEntities after twenty concurrent adds of one tuple',\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tid: 'relations.removeThenAdd',\n\t\tgroup,\n\t\tname: 'applies one write’s removals and additions together',\n\t\tasync run({ store }) {\n\t\t\tconst record = entity('record');\n\t\t\tconst before = tuple(record, 'owner', entity('staff', 'a'));\n\t\t\tconst after = tuple(record, 'owner', entity('staff', 'b'));\n\t\t\tawait store.write({ add: [before] });\n\n\t\t\tawait store.write({ remove: [before], add: [after] });\n\n\t\t\tequal(await store.has(before), false, 'the removed tuple');\n\t\t\tequal(await store.has(after), true, 'the added tuple');\n\t\t},\n\t},\n];\n",
78
+ "import type { RelationCase } from '../types';\nimport { relationDeletionCases } from './deletion';\nimport { relationHolderCases } from './holders';\nimport { relationReadCases } from './reads';\nimport { relationTraversalCases } from './traversal';\nimport { relationWriteCases } from './writes';\n\n/** Every case of the relation store, outages aside, in the order they are described. */\nexport const relationStoreCases: readonly RelationCase[] = [\n\t...relationReadCases,\n\t...relationHolderCases,\n\t...relationWriteCases,\n\t...relationTraversalCases,\n\t...relationDeletionCases,\n];\n",
79
+ "import { JanusError, StoreFailure } from '../../../errors/janus-error';\nimport type { RelationStore } from '../../../permissions/port/types';\nimport type { Entity } from '../../../subjects/subject';\nimport { equal, isOurs, ok, rejects } from '../../assert';\nimport { tuple } from '../fixtures';\nimport type { RelationCase, RelationMethod } from '../types';\n\n/**\n * For each method, a store that cannot answer must **reject** — never\n * `false`, `[]`, an empty page or `0`. A relation store that answers `false`\n * for an outage denies everybody everything and says nothing; one that\n * resolves a write it did not make leaves a revoked access standing.\n */\nfunction outage(\n\tmethod: RelationMethod,\n\tcall: (store: RelationStore) => Promise<unknown>,\n\tafter?: (store: RelationStore) => Promise<void>,\n): RelationCase {\n\treturn {\n\t\tid: `outage.${method}`,\n\t\tgroup: 'outage',\n\t\tname: `relations.${method} rejects when the store cannot answer — never false, [], an empty page or 0`,\n\t\tneeds: 'faults',\n\t\tasync run({ store, faults }) {\n\t\t\tawait store.write({ add: [seeded] });\n\t\t\tawait faults?.fail(method);\n\n\t\t\tconst error = await rejects(\n\t\t\t\tcall(store),\n\t\t\t\t`relations.${method} under an outage should reject`,\n\t\t\t);\n\t\t\tif (\n\t\t\t\terror instanceof JanusError ||\n\t\t\t\t(error as { name?: unknown })?.name === 'StoreFailure'\n\t\t\t) {\n\t\t\t\tisOurs(\n\t\t\t\t\terror,\n\t\t\t\t\tStoreFailure,\n\t\t\t\t\t'StoreFailure',\n\t\t\t\t\t`relations.${method} under an outage`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tok(\n\t\t\t\t(error as { code?: unknown } | null)?.code !== 'NOT_FOUND',\n\t\t\t\t`relations.${method} under an outage rejected with NOT_FOUND: an outage is never an absence`,\n\t\t\t);\n\t\t\tawait after?.(store);\n\t\t},\n\t};\n}\n\n/** A case about an optional method: passes for a store that does not have it. */\nfunction optional(relationCase: RelationCase): RelationCase {\n\tconst method = relationCase.id.slice('outage.'.length) as RelationMethod;\n\treturn {\n\t\t...relationCase,\n\t\tasync run(context) {\n\t\t\tif (context.store[method] === undefined) return;\n\t\t\tawait relationCase.run(context);\n\t\t},\n\t};\n}\n\nconst seededObject: Entity = { type: 'record', id: 'seeded' };\nconst seededSubject: Entity = { type: 'staff', id: 'seeded' };\nconst seeded = tuple(seededObject, 'viewer', seededSubject);\n\nexport const relationOutageCases: readonly RelationCase[] = [\n\toutage(\n\t\t'write',\n\t\t(store) =>\n\t\t\tstore.write({\n\t\t\t\tremove: [seeded],\n\t\t\t\tadd: [tuple(seededObject, 'owner', seededSubject)],\n\t\t\t}),\n\t\t// A rejected write is one that did nothing: all of it, or none of it.\n\t\tasync (store) => {\n\t\t\tequal(\n\t\t\t\tawait store.has(seeded),\n\t\t\t\ttrue,\n\t\t\t\t'relations.write rejected, and still removed a tuple: a write is all or nothing',\n\t\t\t);\n\t\t\tequal(\n\t\t\t\tawait store.has(tuple(seededObject, 'owner', seededSubject)),\n\t\t\t\tfalse,\n\t\t\t\t'relations.write rejected, and still added a tuple: a write is all or nothing',\n\t\t\t);\n\t\t},\n\t),\n\toutage('has', (store) => store.has(seeded)),\n\toutage('findSubjectSets', (store) =>\n\t\tstore.findSubjectSets(seededObject, 'viewer'),\n\t),\n\toutage('findEntities', (store) => store.findEntities(seededObject, 'viewer')),\n\toptional(\n\t\toutage('findHolders', (store) =>\n\t\t\t(store.findHolders as NonNullable<typeof store.findHolders>)({\n\t\t\t\tobject: seededObject,\n\t\t\t\trelation: 'viewer',\n\t\t\t\tafter: null,\n\t\t\t\tlimit: 10,\n\t\t\t\tsearch: null,\n\t\t\t}),\n\t\t),\n\t),\n\toutage('findObjects', (store) =>\n\t\tstore.findObjects({\n\t\t\ttype: 'record',\n\t\t\trelation: 'viewer',\n\t\t\tsubject: seededSubject,\n\t\t\tafter: null,\n\t\t\tlimit: 10,\n\t\t}),\n\t),\n\toutage('deleteEntity', (store) => store.deleteEntity(seededSubject)),\n];\n",
80
+ "import { describeSuite, fromGlobals, SKIP_REASONS } from '../describe';\nimport type { ConformanceRunner } from '../types';\nimport { relationStoreCases } from './cases';\nimport { relationOutageCases } from './cases/outage';\nimport type { RelationCase, RelationHarness } from './types';\n\n/** Every case, in the order they are described. */\nexport const allRelationCases: readonly RelationCase[] = [\n\t...relationStoreCases,\n\t...relationOutageCases,\n];\n\n/** Runs one case against a freshly opened store, and closes it, pass or fail. */\nexport async function runRelationCase(\n\trelationCase: RelationCase,\n\tharness: RelationHarness,\n): Promise<{ readonly skipped: string } | { readonly passed: true }> {\n\tconst opened = await harness.open();\n\n\ttry {\n\t\tif (relationCase.needs === 'faults' && opened.faults === undefined) {\n\t\t\treturn { skipped: SKIP_REASONS.faults };\n\t\t}\n\t\tawait relationCase.run({\n\t\t\tstore: opened.store,\n\t\t\tfaults: opened.faults ?? null,\n\t\t});\n\t\treturn { passed: true };\n\t} finally {\n\t\tawait opened.close?.();\n\t}\n}\n\n/** Describes the whole relation suite under the adapter's test runner. */\nexport function describeRelationStores(options: {\n\treadonly name: string;\n\treadonly harness: RelationHarness;\n\treadonly runner?: ConformanceRunner;\n\t/** Case ids to skip, each with the reason — reported, never silent. */\n\treadonly skip?: Readonly<Record<string, string>>;\n\treadonly faults?: boolean;\n}): void {\n\tdescribeSuite({\n\t\ttitle: `${options.name} — @softistx/janus relation conformance`,\n\t\tcases: allRelationCases,\n\t\trun: (relationCase) => runRelationCase(relationCase, options.harness),\n\t\trunner: options.runner ?? fromGlobals('describeRelationStores'),\n\t\tskip: options.skip ?? {},\n\t\tfaults: options.faults,\n\t});\n}\n",
81
+ "import { StoreFailure } from '../../errors/janus-error';\nimport { createMemoryRelations } from '../../permissions/port/memory';\nimport type { RelationStore } from '../../permissions/port/types';\nimport type { RelationHarness } from './types';\n\n/** The reference store, with faults: what the suite proves itself against. */\nexport function referenceRelationHarness(): RelationHarness {\n\treturn {\n\t\tasync open() {\n\t\t\tconst failing = new Set<string>();\n\t\t\tconst inner = createMemoryRelations();\n\t\t\tconst store = Object.fromEntries(\n\t\t\t\tObject.entries(inner).map(([method, fn]) => [\n\t\t\t\t\tmethod,\n\t\t\t\t\t(...args: unknown[]) =>\n\t\t\t\t\t\tfailing.has(method)\n\t\t\t\t\t\t\t? Promise.reject(\n\t\t\t\t\t\t\t\t\tnew StoreFailure(\n\t\t\t\t\t\t\t\t\t\t`relations.${method}: the store could not answer`,\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tslot: 'relations',\n\t\t\t\t\t\t\t\t\t\t\toperation: method,\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t: (fn as (...a: unknown[]) => unknown).apply(inner, args),\n\t\t\t\t]),\n\t\t\t) as unknown as RelationStore;\n\n\t\t\treturn {\n\t\t\t\tstore,\n\t\t\t\tfaults: {\n\t\t\t\t\tasync fail(method) {\n\t\t\t\t\t\tfailing.add(method);\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t};\n\t\t},\n\t};\n}\n"
82
+ ],
83
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAWO,SAAS,KAAK,CAAC,QAAiB,UAAmB,MAAoB;AAAA,EAC7E,MAAM,aAAa,OAAO,QAAQ,UAAU,EAAE;AAAA,EAC9C,IAAI,eAAe,MAAM;AAAA,IACxB,MAAM,IAAI,MACT,GAAG;AAAA,OAAc,WAAW,QAAQ,sBAAsB,KAAK,WAAW,QAAQ,UAAU,KAAK,WAAW,MAAM,GACnH;AAAA,EACD;AAAA;AAIM,SAAS,MAAM,CAAC,QAAiB,MAAoB;AAAA,EAC3D,IAAI,WAAW,MAAM;AAAA,IACpB,MAAM,IAAI,MACT,GAAG;AAAA,uBAA8B,WAAW,YAAY,+EAA+E,KAAK,MAAM,GACnJ;AAAA,EACD;AAAA;AAIM,SAAS,EAAE,CAAC,WAAoB,MAAoB;AAAA,EAC1D,IAAI,CAAC;AAAA,IAAW,MAAM,IAAI,MAAM,IAAI;AAAA;AAW9B,SAAS,OAAO,CACtB,SACA,MACmB;AAAA,EACnB,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