@robelest/convex-auth 0.0.4-preview.18 → 0.0.4-preview.19

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 (541) hide show
  1. package/README.md +6 -3
  2. package/dist/authorization/index.d.ts +46 -0
  3. package/dist/authorization/index.d.ts.map +1 -1
  4. package/dist/authorization/index.js +46 -0
  5. package/dist/authorization/index.js.map +1 -1
  6. package/dist/bin.cjs +21 -13
  7. package/dist/client/core/types.d.ts +20 -0
  8. package/dist/client/core/types.d.ts.map +1 -0
  9. package/dist/client/index.d.ts +2 -16
  10. package/dist/client/index.d.ts.map +1 -1
  11. package/dist/client/index.js +67 -565
  12. package/dist/client/index.js.map +1 -1
  13. package/dist/component/_generated/api.d.ts +40 -12
  14. package/dist/component/_generated/api.d.ts.map +1 -1
  15. package/dist/component/_generated/api.js.map +1 -1
  16. package/dist/component/_generated/component.d.ts +1306 -1344
  17. package/dist/component/_generated/component.d.ts.map +1 -1
  18. package/dist/component/client/core/types.d.ts +2 -0
  19. package/dist/component/client/index.d.ts +2 -2
  20. package/dist/component/model.d.ts +80 -80
  21. package/dist/component/model.d.ts.map +1 -1
  22. package/dist/component/model.js +5 -1
  23. package/dist/component/model.js.map +1 -1
  24. package/dist/component/providers/credentials.d.ts +3 -2
  25. package/dist/component/providers/credentials.d.ts.map +1 -1
  26. package/dist/component/providers/email.d.ts +30 -0
  27. package/dist/component/providers/email.d.ts.map +1 -1
  28. package/dist/component/providers/phone.d.ts +28 -0
  29. package/dist/component/providers/phone.d.ts.map +1 -1
  30. package/dist/component/public/enterprise/audit.d.ts +73 -0
  31. package/dist/component/public/enterprise/audit.d.ts.map +1 -0
  32. package/dist/component/public/enterprise/audit.js +108 -0
  33. package/dist/component/public/enterprise/audit.js.map +1 -0
  34. package/dist/component/public/enterprise/core.d.ts +176 -0
  35. package/dist/component/public/enterprise/core.d.ts.map +1 -0
  36. package/dist/component/public/enterprise/core.js +292 -0
  37. package/dist/component/public/enterprise/core.js.map +1 -0
  38. package/dist/component/public/enterprise/domains.d.ts +174 -0
  39. package/dist/component/public/enterprise/domains.d.ts.map +1 -0
  40. package/dist/component/public/enterprise/domains.js +271 -0
  41. package/dist/component/public/enterprise/domains.js.map +1 -0
  42. package/dist/component/public/enterprise/scim.d.ts +245 -0
  43. package/dist/component/public/enterprise/scim.d.ts.map +1 -0
  44. package/dist/component/public/enterprise/scim.js +344 -0
  45. package/dist/component/public/enterprise/scim.js.map +1 -0
  46. package/dist/component/public/enterprise/secrets.d.ts +78 -0
  47. package/dist/component/public/enterprise/secrets.d.ts.map +1 -0
  48. package/dist/component/public/enterprise/secrets.js +118 -0
  49. package/dist/component/public/enterprise/secrets.js.map +1 -0
  50. package/dist/component/public/enterprise/webhooks.d.ts +211 -0
  51. package/dist/component/public/enterprise/webhooks.d.ts.map +1 -0
  52. package/dist/component/public/enterprise/webhooks.js +300 -0
  53. package/dist/component/public/enterprise/webhooks.js.map +1 -0
  54. package/dist/component/public/factors/devices.d.ts +157 -0
  55. package/dist/component/public/factors/devices.d.ts.map +1 -0
  56. package/dist/component/public/factors/devices.js +216 -0
  57. package/dist/component/public/factors/devices.js.map +1 -0
  58. package/dist/component/public/factors/passkeys.d.ts +175 -0
  59. package/dist/component/public/factors/passkeys.d.ts.map +1 -0
  60. package/dist/component/public/factors/passkeys.js +238 -0
  61. package/dist/component/public/factors/passkeys.js.map +1 -0
  62. package/dist/component/public/factors/totp.d.ts +189 -0
  63. package/dist/component/public/factors/totp.d.ts.map +1 -0
  64. package/dist/component/public/factors/totp.js +254 -0
  65. package/dist/component/public/factors/totp.js.map +1 -0
  66. package/dist/component/public/groups/core.d.ts +137 -0
  67. package/dist/component/public/groups/core.d.ts.map +1 -0
  68. package/dist/component/public/groups/core.js +321 -0
  69. package/dist/component/public/groups/core.js.map +1 -0
  70. package/dist/component/public/groups/invites.d.ts +217 -0
  71. package/dist/component/public/groups/invites.d.ts.map +1 -0
  72. package/dist/component/public/groups/invites.js +457 -0
  73. package/dist/component/public/groups/invites.js.map +1 -0
  74. package/dist/component/public/groups/members.d.ts +204 -0
  75. package/dist/component/public/groups/members.d.ts.map +1 -0
  76. package/dist/component/public/groups/members.js +355 -0
  77. package/dist/component/public/groups/members.js.map +1 -0
  78. package/dist/component/public/identity/accounts.d.ts +147 -0
  79. package/dist/component/public/identity/accounts.d.ts.map +1 -0
  80. package/dist/component/public/identity/accounts.js +200 -0
  81. package/dist/component/public/identity/accounts.js.map +1 -0
  82. package/dist/component/public/identity/codes.d.ts +104 -0
  83. package/dist/component/public/identity/codes.d.ts.map +1 -0
  84. package/dist/component/public/identity/codes.js +140 -0
  85. package/dist/component/public/identity/codes.js.map +1 -0
  86. package/dist/component/public/identity/sessions.d.ts +128 -0
  87. package/dist/component/public/identity/sessions.d.ts.map +1 -0
  88. package/dist/component/public/identity/sessions.js +192 -0
  89. package/dist/component/public/identity/sessions.js.map +1 -0
  90. package/dist/component/public/identity/tokens.d.ts +169 -0
  91. package/dist/component/public/identity/tokens.d.ts.map +1 -0
  92. package/dist/component/public/identity/tokens.js +227 -0
  93. package/dist/component/public/identity/tokens.js.map +1 -0
  94. package/dist/component/public/identity/users.d.ts +212 -0
  95. package/dist/component/public/identity/users.d.ts.map +1 -0
  96. package/dist/component/public/identity/users.js +311 -0
  97. package/dist/component/public/identity/users.js.map +1 -0
  98. package/dist/component/public/identity/verifiers.d.ts +116 -0
  99. package/dist/component/public/identity/verifiers.d.ts.map +1 -0
  100. package/dist/component/public/identity/verifiers.js +154 -0
  101. package/dist/component/public/identity/verifiers.js.map +1 -0
  102. package/dist/component/public/security/keys.d.ts +209 -0
  103. package/dist/component/public/security/keys.d.ts.map +1 -0
  104. package/dist/component/public/security/keys.js +319 -0
  105. package/dist/component/public/security/keys.js.map +1 -0
  106. package/dist/component/public/security/limits.d.ts +114 -0
  107. package/dist/component/public/security/limits.d.ts.map +1 -0
  108. package/dist/component/public/security/limits.js +169 -0
  109. package/dist/component/public/security/limits.js.map +1 -0
  110. package/dist/component/public.d.ts +22 -7
  111. package/dist/component/public.js +21 -6
  112. package/dist/component/schema.d.ts +288 -288
  113. package/dist/component/server/auth.d.ts +212 -25
  114. package/dist/component/server/auth.d.ts.map +1 -1
  115. package/dist/component/server/auth.js +68 -4
  116. package/dist/component/server/auth.js.map +1 -1
  117. package/dist/component/server/authError.js +34 -0
  118. package/dist/component/server/authError.js.map +1 -0
  119. package/dist/component/server/{providers.js → config.js} +2 -2
  120. package/dist/component/server/config.js.map +1 -0
  121. package/dist/component/server/{domains/core.js → core.js} +107 -88
  122. package/dist/component/server/core.js.map +1 -0
  123. package/dist/component/server/{provider.js → crypto.js} +3 -3
  124. package/dist/component/server/crypto.js.map +1 -0
  125. package/dist/component/server/device.js +1 -1
  126. package/dist/component/server/device.js.map +1 -1
  127. package/dist/component/server/enterprise/config.js +46 -0
  128. package/dist/component/server/enterprise/config.js.map +1 -0
  129. package/dist/component/server/{domains/sso.js → enterprise/domain.js} +6 -5
  130. package/dist/component/server/enterprise/domain.js.map +1 -0
  131. package/dist/component/server/enterprise/http.js +766 -0
  132. package/dist/component/server/enterprise/http.js.map +1 -0
  133. package/dist/component/server/enterprise/oidc.js +248 -0
  134. package/dist/component/server/enterprise/oidc.js.map +1 -0
  135. package/dist/component/server/enterprise/policy.js +85 -0
  136. package/dist/component/server/enterprise/policy.js.map +1 -0
  137. package/dist/component/server/enterprise/saml.js +338 -0
  138. package/dist/component/server/enterprise/saml.js.map +1 -0
  139. package/dist/component/server/enterprise/scim.js +97 -0
  140. package/dist/component/server/enterprise/scim.js.map +1 -0
  141. package/dist/component/server/enterprise/shared.js +51 -0
  142. package/dist/component/server/enterprise/shared.js.map +1 -0
  143. package/dist/component/server/errors.js.map +1 -1
  144. package/dist/component/server/http.js +2 -1
  145. package/dist/component/server/http.js.map +1 -1
  146. package/dist/component/server/identity.js +1 -1
  147. package/dist/component/server/identity.js.map +1 -1
  148. package/dist/component/server/{ratelimit.js → limits.js} +3 -3
  149. package/dist/component/server/limits.js.map +1 -0
  150. package/dist/component/server/mutations/account.js +3 -3
  151. package/dist/component/server/mutations/account.js.map +1 -1
  152. package/dist/component/server/mutations/code.js +2 -2
  153. package/dist/component/server/mutations/code.js.map +1 -1
  154. package/dist/component/server/mutations/invalidate.js +1 -1
  155. package/dist/component/server/mutations/invalidate.js.map +1 -1
  156. package/dist/component/server/mutations/oauth.js +5 -3
  157. package/dist/component/server/mutations/oauth.js.map +1 -1
  158. package/dist/component/server/mutations/refresh.js +1 -1
  159. package/dist/component/server/mutations/refresh.js.map +1 -1
  160. package/dist/component/server/mutations/register.js +3 -3
  161. package/dist/component/server/mutations/register.js.map +1 -1
  162. package/dist/component/server/mutations/retrieve.js +4 -4
  163. package/dist/component/server/mutations/retrieve.js.map +1 -1
  164. package/dist/component/server/mutations/signature.js +2 -2
  165. package/dist/component/server/mutations/signature.js.map +1 -1
  166. package/dist/component/server/mutations/signin.js +1 -1
  167. package/dist/component/server/mutations/signin.js.map +1 -1
  168. package/dist/component/server/mutations/signout.js +1 -1
  169. package/dist/component/server/mutations/signout.js.map +1 -1
  170. package/dist/component/server/mutations/store/refs.js +15 -0
  171. package/dist/component/server/mutations/store/refs.js.map +1 -0
  172. package/dist/component/server/mutations/store.js +80 -10
  173. package/dist/component/server/mutations/store.js.map +1 -1
  174. package/dist/component/server/mutations/verifier.js +1 -1
  175. package/dist/component/server/mutations/verifier.js.map +1 -1
  176. package/dist/component/server/mutations/verify.js +4 -3
  177. package/dist/component/server/mutations/verify.js.map +1 -1
  178. package/dist/component/server/oauth.js +1 -1
  179. package/dist/component/server/oauth.js.map +1 -1
  180. package/dist/component/server/passkey.js +2 -1
  181. package/dist/component/server/passkey.js.map +1 -1
  182. package/dist/component/server/redirects.js +1 -1
  183. package/dist/component/server/redirects.js.map +1 -1
  184. package/dist/component/server/refresh.js +1 -1
  185. package/dist/component/server/refresh.js.map +1 -1
  186. package/dist/component/server/{factory.d.ts → runtime.d.ts} +2 -2
  187. package/dist/component/server/runtime.d.ts.map +1 -0
  188. package/dist/component/server/runtime.js +413 -0
  189. package/dist/component/server/runtime.js.map +1 -0
  190. package/dist/component/server/signin.js +2 -1
  191. package/dist/component/server/signin.js.map +1 -1
  192. package/dist/component/server/totp.js +2 -1
  193. package/dist/component/server/totp.js.map +1 -1
  194. package/dist/component/server/types.d.ts +225 -41
  195. package/dist/component/server/types.d.ts.map +1 -1
  196. package/dist/component/server/types.js.map +1 -1
  197. package/dist/component/server/users.js +1 -1
  198. package/dist/component/server/users.js.map +1 -1
  199. package/dist/component/server/utils.js +1 -1
  200. package/dist/component/server/utils.js.map +1 -1
  201. package/dist/core/types.d.ts +369 -0
  202. package/dist/core/types.d.ts.map +1 -0
  203. package/dist/factors/device.js +105 -0
  204. package/dist/factors/device.js.map +1 -0
  205. package/dist/factors/passkey.js +181 -0
  206. package/dist/factors/passkey.js.map +1 -0
  207. package/dist/factors/totp.js +122 -0
  208. package/dist/factors/totp.js.map +1 -0
  209. package/dist/providers/credentials.d.ts +5 -2
  210. package/dist/providers/credentials.d.ts.map +1 -1
  211. package/dist/providers/credentials.js +2 -0
  212. package/dist/providers/credentials.js.map +1 -1
  213. package/dist/providers/email.d.ts +30 -0
  214. package/dist/providers/email.d.ts.map +1 -1
  215. package/dist/providers/email.js +24 -0
  216. package/dist/providers/email.js.map +1 -1
  217. package/dist/providers/phone.d.ts +28 -0
  218. package/dist/providers/phone.d.ts.map +1 -1
  219. package/dist/providers/phone.js +22 -0
  220. package/dist/providers/phone.js.map +1 -1
  221. package/dist/runtime/browser.js +68 -0
  222. package/dist/runtime/browser.js.map +1 -0
  223. package/dist/runtime/invite.js +51 -0
  224. package/dist/runtime/invite.js.map +1 -0
  225. package/dist/runtime/proxy.js +70 -0
  226. package/dist/runtime/proxy.js.map +1 -0
  227. package/dist/runtime/storage.js +37 -0
  228. package/dist/runtime/storage.js.map +1 -0
  229. package/dist/server/auth.d.ts +218 -28
  230. package/dist/server/auth.d.ts.map +1 -1
  231. package/dist/server/auth.js +68 -4
  232. package/dist/server/auth.js.map +1 -1
  233. package/dist/server/{fx.d.ts → authError.d.ts} +25 -15
  234. package/dist/server/authError.d.ts.map +1 -0
  235. package/dist/server/authError.js +34 -0
  236. package/dist/server/authError.js.map +1 -0
  237. package/dist/server/{providers.js → config.js} +2 -2
  238. package/dist/server/config.js.map +1 -0
  239. package/dist/server/core.d.ts +1436 -0
  240. package/dist/server/core.d.ts.map +1 -0
  241. package/dist/server/{domains/core.js → core.js} +107 -88
  242. package/dist/server/core.js.map +1 -0
  243. package/dist/server/{provider.d.ts → crypto.d.ts} +2 -2
  244. package/dist/server/crypto.d.ts.map +1 -0
  245. package/dist/server/{provider.js → crypto.js} +3 -3
  246. package/dist/{component/server/provider.js.map → server/crypto.js.map} +1 -1
  247. package/dist/server/device.js +1 -1
  248. package/dist/server/device.js.map +1 -1
  249. package/dist/server/enterprise/config.js +46 -0
  250. package/dist/server/enterprise/config.js.map +1 -0
  251. package/dist/server/{domains/sso.d.ts → enterprise/domain.d.ts} +4 -4
  252. package/dist/server/enterprise/domain.d.ts.map +1 -0
  253. package/dist/server/{domains/sso.js → enterprise/domain.js} +6 -5
  254. package/dist/server/enterprise/domain.js.map +1 -0
  255. package/dist/server/enterprise/http.d.ts +26 -0
  256. package/dist/server/enterprise/http.d.ts.map +1 -0
  257. package/dist/server/enterprise/http.js +766 -0
  258. package/dist/server/enterprise/http.js.map +1 -0
  259. package/dist/server/enterprise/oidc.js +248 -0
  260. package/dist/server/enterprise/oidc.js.map +1 -0
  261. package/dist/server/enterprise/policy.js +85 -0
  262. package/dist/server/enterprise/policy.js.map +1 -0
  263. package/dist/server/enterprise/saml.d.ts +1 -0
  264. package/dist/server/enterprise/saml.js +338 -0
  265. package/dist/server/enterprise/saml.js.map +1 -0
  266. package/dist/server/enterprise/scim.d.ts +1 -0
  267. package/dist/server/enterprise/scim.js +97 -0
  268. package/dist/server/enterprise/scim.js.map +1 -0
  269. package/dist/server/enterprise/shared.d.ts +5 -0
  270. package/dist/server/enterprise/shared.d.ts.map +1 -0
  271. package/dist/server/enterprise/shared.js +51 -0
  272. package/dist/server/enterprise/shared.js.map +1 -0
  273. package/dist/server/enterprise/validators.d.ts +1 -0
  274. package/dist/server/{enterpriseValidators.js → enterprise/validators.js} +2 -2
  275. package/dist/server/enterprise/validators.js.map +1 -0
  276. package/dist/server/errors.d.ts +2 -0
  277. package/dist/server/errors.d.ts.map +1 -1
  278. package/dist/server/errors.js +2 -0
  279. package/dist/server/errors.js.map +1 -1
  280. package/dist/server/http.d.ts +2 -2
  281. package/dist/server/http.d.ts.map +1 -1
  282. package/dist/server/http.js +2 -1
  283. package/dist/server/http.js.map +1 -1
  284. package/dist/server/identity.js +1 -1
  285. package/dist/server/identity.js.map +1 -1
  286. package/dist/server/index.d.ts +4 -705
  287. package/dist/server/index.js +4 -1367
  288. package/dist/server/limits.d.ts +1 -0
  289. package/dist/server/{ratelimit.js → limits.js} +3 -3
  290. package/dist/server/limits.js.map +1 -0
  291. package/dist/server/mounts.d.ts +647 -0
  292. package/dist/server/mounts.d.ts.map +1 -0
  293. package/dist/server/mounts.js +643 -0
  294. package/dist/server/mounts.js.map +1 -0
  295. package/dist/server/mutations/account.d.ts +8 -8
  296. package/dist/server/mutations/account.js +3 -3
  297. package/dist/server/mutations/account.js.map +1 -1
  298. package/dist/server/mutations/code.d.ts +13 -13
  299. package/dist/server/mutations/code.js +2 -2
  300. package/dist/server/mutations/code.js.map +1 -1
  301. package/dist/server/mutations/index.d.ts +8 -312
  302. package/dist/server/mutations/index.js +14 -84
  303. package/dist/server/mutations/invalidate.d.ts +5 -5
  304. package/dist/server/mutations/invalidate.d.ts.map +1 -1
  305. package/dist/server/mutations/invalidate.js +1 -1
  306. package/dist/server/mutations/invalidate.js.map +1 -1
  307. package/dist/server/mutations/oauth.d.ts +9 -9
  308. package/dist/server/mutations/oauth.d.ts.map +1 -1
  309. package/dist/server/mutations/oauth.js +5 -3
  310. package/dist/server/mutations/oauth.js.map +1 -1
  311. package/dist/server/mutations/refresh.d.ts +4 -4
  312. package/dist/server/mutations/refresh.js +1 -1
  313. package/dist/server/mutations/refresh.js.map +1 -1
  314. package/dist/server/mutations/register.d.ts +10 -10
  315. package/dist/server/mutations/register.d.ts.map +1 -1
  316. package/dist/server/mutations/register.js +3 -3
  317. package/dist/server/mutations/register.js.map +1 -1
  318. package/dist/server/mutations/retrieve.d.ts +8 -10
  319. package/dist/server/mutations/retrieve.d.ts.map +1 -1
  320. package/dist/server/mutations/retrieve.js +5 -7
  321. package/dist/server/mutations/retrieve.js.map +1 -1
  322. package/dist/server/mutations/signature.d.ts +6 -6
  323. package/dist/server/mutations/signature.d.ts.map +1 -1
  324. package/dist/server/mutations/signature.js +2 -2
  325. package/dist/server/mutations/signature.js.map +1 -1
  326. package/dist/server/mutations/signin.d.ts +1 -1
  327. package/dist/server/mutations/signin.js +1 -1
  328. package/dist/server/mutations/signin.js.map +1 -1
  329. package/dist/server/mutations/signout.d.ts +1 -1
  330. package/dist/server/mutations/signout.js +1 -1
  331. package/dist/server/mutations/signout.js.map +1 -1
  332. package/dist/server/mutations/store/refs.d.ts +12 -0
  333. package/dist/server/mutations/store/refs.d.ts.map +1 -0
  334. package/dist/server/mutations/store/refs.js +15 -0
  335. package/dist/server/mutations/store/refs.js.map +1 -0
  336. package/dist/server/mutations/store.d.ts +303 -9
  337. package/dist/server/mutations/store.d.ts.map +1 -1
  338. package/dist/server/mutations/store.js +80 -10
  339. package/dist/server/mutations/store.js.map +1 -1
  340. package/dist/server/mutations/verifier.d.ts +1 -1
  341. package/dist/server/mutations/verifier.js +1 -1
  342. package/dist/server/mutations/verifier.js.map +1 -1
  343. package/dist/server/mutations/verify.d.ts +8 -8
  344. package/dist/server/mutations/verify.d.ts.map +1 -1
  345. package/dist/server/mutations/verify.js +4 -3
  346. package/dist/server/mutations/verify.js.map +1 -1
  347. package/dist/server/oauth.js +1 -1
  348. package/dist/server/oauth.js.map +1 -1
  349. package/dist/server/passkey.d.ts +2 -2
  350. package/dist/server/passkey.d.ts.map +1 -1
  351. package/dist/server/passkey.js +3 -2
  352. package/dist/server/passkey.js.map +1 -1
  353. package/dist/server/redirects.js +1 -1
  354. package/dist/server/redirects.js.map +1 -1
  355. package/dist/server/refresh.js +1 -1
  356. package/dist/server/refresh.js.map +1 -1
  357. package/dist/server/{factory.d.ts → runtime.d.ts} +16 -16
  358. package/dist/server/runtime.d.ts.map +1 -0
  359. package/dist/server/runtime.js +413 -0
  360. package/dist/server/runtime.js.map +1 -0
  361. package/dist/server/signin.js +3 -2
  362. package/dist/server/signin.js.map +1 -1
  363. package/dist/server/ssr.d.ts +226 -0
  364. package/dist/server/ssr.d.ts.map +1 -0
  365. package/dist/server/ssr.js +786 -0
  366. package/dist/server/ssr.js.map +1 -0
  367. package/dist/server/totp.js +2 -1
  368. package/dist/server/totp.js.map +1 -1
  369. package/dist/server/types.d.ts +242 -42
  370. package/dist/server/types.d.ts.map +1 -1
  371. package/dist/server/types.js +12 -1
  372. package/dist/server/types.js.map +1 -1
  373. package/dist/server/users.js +1 -1
  374. package/dist/server/users.js.map +1 -1
  375. package/dist/server/utils.js +1 -1
  376. package/dist/server/utils.js.map +1 -1
  377. package/package.json +3 -4
  378. package/src/authorization/index.ts +46 -0
  379. package/src/cli/index.ts +38 -20
  380. package/src/client/core/types.ts +437 -0
  381. package/src/client/factors/device.ts +160 -0
  382. package/src/client/factors/passkey.ts +282 -0
  383. package/src/client/factors/totp.ts +150 -0
  384. package/src/client/index.ts +133 -1267
  385. package/src/client/runtime/browser.ts +112 -0
  386. package/src/client/runtime/invite.ts +65 -0
  387. package/src/client/runtime/proxy.ts +111 -0
  388. package/src/client/runtime/storage.ts +79 -0
  389. package/src/component/_generated/api.ts +40 -12
  390. package/src/component/_generated/component.ts +1772 -1798
  391. package/src/component/model.ts +6 -0
  392. package/src/component/public/enterprise/audit.ts +120 -0
  393. package/src/component/public/enterprise/core.ts +354 -0
  394. package/src/component/public/enterprise/domains.ts +323 -0
  395. package/src/component/public/enterprise/scim.ts +396 -0
  396. package/src/component/public/enterprise/secrets.ts +132 -0
  397. package/src/component/public/enterprise/webhooks.ts +306 -0
  398. package/src/component/public/factors/devices.ts +223 -0
  399. package/src/component/public/factors/passkeys.ts +242 -0
  400. package/src/component/public/factors/totp.ts +258 -0
  401. package/src/component/public/groups/core.ts +481 -0
  402. package/src/component/public/groups/invites.ts +602 -0
  403. package/src/component/public/groups/members.ts +409 -0
  404. package/src/component/public/identity/accounts.ts +206 -0
  405. package/src/component/public/identity/codes.ts +148 -0
  406. package/src/component/public/identity/sessions.ts +209 -0
  407. package/src/component/public/identity/tokens.ts +250 -0
  408. package/src/component/public/identity/users.ts +354 -0
  409. package/src/component/public/identity/verifiers.ts +157 -0
  410. package/src/component/public/security/keys.ts +365 -0
  411. package/src/component/public/security/limits.ts +173 -0
  412. package/src/component/public.ts +27 -5
  413. package/src/providers/credentials.ts +4 -5
  414. package/src/providers/email.ts +30 -0
  415. package/src/providers/phone.ts +28 -0
  416. package/src/server/auth.ts +282 -28
  417. package/src/server/authError.ts +44 -0
  418. package/src/server/core.ts +2095 -0
  419. package/src/server/{provider.ts → crypto.ts} +1 -1
  420. package/src/server/device.ts +1 -1
  421. package/src/server/enterprise/config.ts +51 -0
  422. package/src/server/{domains/sso.ts → enterprise/domain.ts} +4 -2
  423. package/src/server/enterprise/http.ts +1324 -0
  424. package/src/server/enterprise/oidc.ts +500 -0
  425. package/src/server/enterprise/policy.ts +128 -0
  426. package/src/server/enterprise/saml.ts +578 -0
  427. package/src/server/enterprise/scim.ts +135 -0
  428. package/src/server/enterprise/shared.ts +134 -0
  429. package/src/server/errors.ts +2 -0
  430. package/src/server/http.ts +3 -1
  431. package/src/server/identity.ts +1 -1
  432. package/src/server/index.ts +32 -2605
  433. package/src/server/{ratelimit.ts → limits.ts} +1 -1
  434. package/src/server/mounts.ts +948 -0
  435. package/src/server/mutations/account.ts +4 -4
  436. package/src/server/mutations/code.ts +3 -3
  437. package/src/server/mutations/index.ts +8 -148
  438. package/src/server/mutations/invalidate.ts +2 -2
  439. package/src/server/mutations/oauth.ts +8 -6
  440. package/src/server/mutations/refresh.ts +3 -3
  441. package/src/server/mutations/register.ts +3 -3
  442. package/src/server/mutations/retrieve.ts +4 -8
  443. package/src/server/mutations/signature.ts +3 -3
  444. package/src/server/mutations/signin.ts +2 -2
  445. package/src/server/mutations/signout.ts +2 -2
  446. package/src/server/mutations/store/refs.ts +10 -0
  447. package/src/server/mutations/store.ts +137 -9
  448. package/src/server/mutations/verifier.ts +2 -2
  449. package/src/server/mutations/verify.ts +5 -5
  450. package/src/server/oauth.ts +1 -1
  451. package/src/server/passkey.ts +3 -4
  452. package/src/server/redirects.ts +1 -1
  453. package/src/server/refresh.ts +1 -1
  454. package/src/server/runtime.ts +880 -0
  455. package/src/server/signin.ts +3 -1
  456. package/src/server/ssr.ts +1764 -0
  457. package/src/server/totp.ts +3 -1
  458. package/src/server/types.ts +254 -43
  459. package/src/server/users.ts +1 -1
  460. package/src/server/utils.ts +1 -1
  461. package/src/test.ts +25 -0
  462. package/dist/component/public/enterprise.d.ts +0 -54
  463. package/dist/component/public/enterprise.d.ts.map +0 -1
  464. package/dist/component/public/enterprise.js +0 -515
  465. package/dist/component/public/enterprise.js.map +0 -1
  466. package/dist/component/public/factors.d.ts +0 -52
  467. package/dist/component/public/factors.d.ts.map +0 -1
  468. package/dist/component/public/factors.js +0 -285
  469. package/dist/component/public/factors.js.map +0 -1
  470. package/dist/component/public/groups.d.ts +0 -124
  471. package/dist/component/public/groups.d.ts.map +0 -1
  472. package/dist/component/public/groups.js +0 -680
  473. package/dist/component/public/groups.js.map +0 -1
  474. package/dist/component/public/identity.d.ts +0 -93
  475. package/dist/component/public/identity.d.ts.map +0 -1
  476. package/dist/component/public/identity.js +0 -426
  477. package/dist/component/public/identity.js.map +0 -1
  478. package/dist/component/public/keys.d.ts +0 -41
  479. package/dist/component/public/keys.d.ts.map +0 -1
  480. package/dist/component/public/keys.js +0 -157
  481. package/dist/component/public/keys.js.map +0 -1
  482. package/dist/component/public/shared.d.ts +0 -26
  483. package/dist/component/public/shared.d.ts.map +0 -1
  484. package/dist/component/public/shared.js +0 -32
  485. package/dist/component/public/shared.js.map +0 -1
  486. package/dist/component/server/domains/core.js.map +0 -1
  487. package/dist/component/server/domains/sso.js.map +0 -1
  488. package/dist/component/server/factory.d.ts.map +0 -1
  489. package/dist/component/server/factory.js +0 -1134
  490. package/dist/component/server/factory.js.map +0 -1
  491. package/dist/component/server/fx.js +0 -66
  492. package/dist/component/server/fx.js.map +0 -1
  493. package/dist/component/server/mutations/index.js +0 -85
  494. package/dist/component/server/mutations/index.js.map +0 -1
  495. package/dist/component/server/providers.js.map +0 -1
  496. package/dist/component/server/ratelimit.js.map +0 -1
  497. package/dist/component/server/sso.js +0 -830
  498. package/dist/component/server/sso.js.map +0 -1
  499. package/dist/server/domains/core.d.ts +0 -449
  500. package/dist/server/domains/core.d.ts.map +0 -1
  501. package/dist/server/domains/core.js.map +0 -1
  502. package/dist/server/domains/sso.d.ts.map +0 -1
  503. package/dist/server/domains/sso.js.map +0 -1
  504. package/dist/server/enterpriseValidators.js.map +0 -1
  505. package/dist/server/factory.d.ts.map +0 -1
  506. package/dist/server/factory.js +0 -1134
  507. package/dist/server/factory.js.map +0 -1
  508. package/dist/server/fx.d.ts.map +0 -1
  509. package/dist/server/fx.js +0 -66
  510. package/dist/server/fx.js.map +0 -1
  511. package/dist/server/index.d.ts.map +0 -1
  512. package/dist/server/index.js.map +0 -1
  513. package/dist/server/mutations/index.d.ts.map +0 -1
  514. package/dist/server/mutations/index.js.map +0 -1
  515. package/dist/server/provider.d.ts.map +0 -1
  516. package/dist/server/provider.js.map +0 -1
  517. package/dist/server/providers.js.map +0 -1
  518. package/dist/server/ratelimit.js.map +0 -1
  519. package/dist/server/sso.js +0 -830
  520. package/dist/server/sso.js.map +0 -1
  521. package/dist/server/version.d.ts +0 -5
  522. package/dist/server/version.d.ts.map +0 -1
  523. package/dist/server/version.js +0 -6
  524. package/dist/server/version.js.map +0 -1
  525. package/src/component/public/enterprise.ts +0 -753
  526. package/src/component/public/factors.ts +0 -333
  527. package/src/component/public/groups.ts +0 -1066
  528. package/src/component/public/identity.ts +0 -569
  529. package/src/component/public/keys.ts +0 -209
  530. package/src/component/public/shared.ts +0 -119
  531. package/src/server/domains/core.ts +0 -1096
  532. package/src/server/factory.ts +0 -2181
  533. package/src/server/fx.ts +0 -152
  534. package/src/server/sso.ts +0 -1516
  535. package/src/server/version.ts +0 -2
  536. /package/dist/server/{enterpriseValidators.d.ts → config.d.ts} +0 -0
  537. /package/dist/server/{providers.d.ts → enterprise/config.d.ts} +0 -0
  538. /package/dist/server/{ratelimit.d.ts → enterprise/oidc.d.ts} +0 -0
  539. /package/dist/server/{sso.d.ts → enterprise/policy.d.ts} +0 -0
  540. /package/src/server/{providers.ts → config.ts} +0 -0
  541. /package/src/server/{enterpriseValidators.ts → enterprise/validators.ts} +0 -0
@@ -3,12 +3,12 @@ import type { GenericActionCtx, GenericDataModel } from "convex/server";
3
3
  import { Infer, v } from "convex/values";
4
4
 
5
5
  import { authDb } from "../db";
6
- import { AuthError } from "../fx";
7
- import { GetProviderOrThrowFunc, hash } from "../provider";
8
- import * as Provider from "../provider";
6
+ import { AuthError } from "../authError";
7
+ import { GetProviderOrThrowFunc, hash } from "../crypto";
8
+ import * as Provider from "../crypto";
9
9
  import { MutationCtx } from "../types";
10
10
  import { LOG_LEVELS, logWithLevel, maybeRedact } from "../utils";
11
- import { AUTH_STORE_REF } from "./store";
11
+ import { AUTH_STORE_REF } from "./store/refs";
12
12
 
13
13
  export const modifyAccountArgs = v.object({
14
14
  provider: v.string(),
@@ -2,14 +2,14 @@ import type { GenericActionCtx, GenericDataModel } from "convex/server";
2
2
  import { GenericId, Infer, v } from "convex/values";
3
3
 
4
4
  import { authDb } from "../db";
5
- import { AuthError } from "../fx";
6
- import * as Provider from "../provider";
5
+ import { AuthError } from "../authError";
6
+ import * as Provider from "../crypto";
7
7
  import { getAuthSessionId } from "../sessions";
8
8
  import { MutationCtx } from "../types";
9
9
  import { EmailConfig, PhoneConfig } from "../types";
10
10
  import { upsertUserAndAccount } from "../users";
11
11
  import { LOG_LEVELS, logWithLevel, sha256 } from "../utils";
12
- import { AUTH_STORE_REF } from "./store";
12
+ import { AUTH_STORE_REF } from "./store/refs";
13
13
 
14
14
  export const createVerificationCodeArgs = v.object({
15
15
  accountId: v.optional(v.string()),
@@ -1,153 +1,13 @@
1
- import { Fx } from "@robelest/fx";
2
- import { Infer, v } from "convex/values";
3
-
4
- import * as Provider from "../provider";
5
- import { MutationCtx } from "../types";
6
- import { LOG_LEVELS, logWithLevel } from "../utils";
7
- import { modifyAccountArgs, modifyAccountImpl } from "./account";
8
- import { createVerificationCodeArgs, createVerificationCodeImpl } from "./code";
9
- import { invalidateSessionsArgs, invalidateSessionsImpl } from "./invalidate";
10
- import { userOAuthArgs, userOAuthImpl } from "./oauth";
11
- import { refreshSessionArgs, refreshSessionImpl } from "./refresh";
12
- import {
13
- createAccountFromCredentialsArgs,
14
- createAccountFromCredentialsImpl,
15
- } from "./register";
16
- import {
17
- retrieveAccountWithCredentialsArgs,
18
- retrieveAccountWithCredentialsImpl,
19
- } from "./retrieve";
20
- import { verifierSignatureArgs, verifierSignatureImpl } from "./signature";
21
- import { signInArgs, signInImpl } from "./signin";
22
- import { signOutImpl } from "./signout";
23
- import { verifierImpl } from "./verifier";
24
- import { verifyCodeAndSignInArgs, verifyCodeAndSignInImpl } from "./verify";
25
- export { callInvalidateSessions } from "./invalidate";
26
1
  export { callModifyAccount } from "./account";
27
- export {
28
- callRetrieveAccountWithCredentials,
29
- callRetreiveAccountWithCredentials,
30
- } from "./retrieve";
31
- export { callCreateAccountFromCredentials } from "./register";
32
2
  export { callCreateVerificationCode } from "./code";
3
+ export { callInvalidateSessions } from "./invalidate";
33
4
  export { callUserOAuth } from "./oauth";
34
- export { callVerifierSignature } from "./signature";
35
- export { callVerifyCodeAndSignIn } from "./verify";
36
- export { callVerifier } from "./verifier";
37
5
  export { callRefreshSession } from "./refresh";
38
- export { callSignOut } from "./signout";
6
+ export { callCreateAccountFromCredentials } from "./register";
7
+ export { callRetrieveAccountWithCredentials } from "./retrieve";
8
+ export { callVerifierSignature } from "./signature";
39
9
  export { callSignIn } from "./signin";
40
-
41
- export const storeArgs = v.object({
42
- args: v.union(
43
- v.object({
44
- type: v.literal("signIn"),
45
- ...signInArgs.fields,
46
- }),
47
- v.object({
48
- type: v.literal("signOut"),
49
- }),
50
- v.object({
51
- type: v.literal("refreshSession"),
52
- ...refreshSessionArgs.fields,
53
- }),
54
- v.object({
55
- type: v.literal("verifyCodeAndSignIn"),
56
- ...verifyCodeAndSignInArgs.fields,
57
- }),
58
- v.object({
59
- type: v.literal("verifier"),
60
- }),
61
- v.object({
62
- type: v.literal("verifierSignature"),
63
- ...verifierSignatureArgs.fields,
64
- }),
65
- v.object({
66
- type: v.literal("userOAuth"),
67
- ...userOAuthArgs.fields,
68
- }),
69
- v.object({
70
- type: v.literal("createVerificationCode"),
71
- ...createVerificationCodeArgs.fields,
72
- }),
73
- v.object({
74
- type: v.literal("createAccountFromCredentials"),
75
- ...createAccountFromCredentialsArgs.fields,
76
- }),
77
- v.object({
78
- type: v.literal("retrieveAccountWithCredentials"),
79
- ...retrieveAccountWithCredentialsArgs.fields,
80
- }),
81
- v.object({
82
- type: v.literal("modifyAccount"),
83
- ...modifyAccountArgs.fields,
84
- }),
85
- v.object({
86
- type: v.literal("invalidateSessions"),
87
- ...invalidateSessionsArgs.fields,
88
- }),
89
- ),
90
- });
91
-
92
- export const storeImpl = async (
93
- ctx: MutationCtx,
94
- fnArgs: Infer<typeof storeArgs>,
95
- getProviderOrThrow: Provider.GetProviderOrThrowFunc,
96
- config: Provider.Config,
97
- ) => {
98
- const args = fnArgs.args;
99
- logWithLevel(LOG_LEVELS.INFO, `\`auth:store\` type: ${args.type}`);
100
- return Fx.run(
101
- Fx.match(args, args.type, {
102
- signIn: (a) =>
103
- Fx.from({
104
- ok: () => signInImpl(ctx, a, config),
105
- err: (e) => e as never,
106
- }),
107
- signOut: () => signOutImpl(ctx, config),
108
- refreshSession: (a) =>
109
- Fx.from({
110
- ok: () => refreshSessionImpl(ctx, a, getProviderOrThrow, config),
111
- err: (e) => e as never,
112
- }),
113
- verifyCodeAndSignIn: (a) =>
114
- Fx.from({
115
- ok: () => verifyCodeAndSignInImpl(ctx, a, getProviderOrThrow, config),
116
- err: (e) => e as never,
117
- }),
118
- verifier: () => verifierImpl(ctx, config),
119
- verifierSignature: (a) =>
120
- verifierSignatureImpl(ctx, a, config).pipe(
121
- Fx.recover((e) => Fx.fatal(e.toConvexError())),
122
- ),
123
- userOAuth: (a) =>
124
- userOAuthImpl(ctx, a, getProviderOrThrow, config).pipe(
125
- Fx.recover((e) => Fx.fatal(e.toConvexError())),
126
- ),
127
- createVerificationCode: (a) =>
128
- Fx.from({
129
- ok: () =>
130
- createVerificationCodeImpl(ctx, a, getProviderOrThrow, config),
131
- err: (e) => e as never,
132
- }),
133
- createAccountFromCredentials: (a) =>
134
- Fx.from({
135
- ok: () =>
136
- createAccountFromCredentialsImpl(
137
- ctx,
138
- a,
139
- getProviderOrThrow,
140
- config,
141
- ),
142
- err: (e) => e as never,
143
- }),
144
- retrieveAccountWithCredentials: (a) =>
145
- retrieveAccountWithCredentialsImpl(ctx, a, getProviderOrThrow, config),
146
- modifyAccount: (a) =>
147
- modifyAccountImpl(ctx, a, getProviderOrThrow, config).pipe(
148
- Fx.recover((e) => Fx.fatal(e.toConvexError())),
149
- ),
150
- invalidateSessions: (a) => invalidateSessionsImpl(ctx, a, config),
151
- }),
152
- );
153
- };
10
+ export { callSignOut } from "./signout";
11
+ export { storeArgs, storeImpl } from "./store";
12
+ export { callVerifier } from "./verifier";
13
+ export { callVerifyCodeAndSignIn } from "./verify";
@@ -3,11 +3,11 @@ import type { GenericActionCtx, GenericDataModel } from "convex/server";
3
3
  import { GenericId, Infer, v } from "convex/values";
4
4
 
5
5
  import { authDb } from "../db";
6
- import * as Provider from "../provider";
6
+ import * as Provider from "../crypto";
7
7
  import { deleteSession } from "../sessions";
8
8
  import { Doc, MutationCtx } from "../types";
9
9
  import { LOG_LEVELS, logWithLevel } from "../utils";
10
- import { AUTH_STORE_REF } from "./store";
10
+ import { AUTH_STORE_REF } from "./store/refs";
11
11
 
12
12
  export const invalidateSessionsArgs = v.object({
13
13
  userId: v.string(),
@@ -3,20 +3,22 @@ import type { GenericActionCtx, GenericDataModel } from "convex/server";
3
3
  import { Infer, v } from "convex/values";
4
4
 
5
5
  import { authDb } from "../db";
6
- import { AuthError } from "../fx";
7
- import * as Provider from "../provider";
6
+ import { AuthError } from "../authError";
7
+ import * as Provider from "../crypto";
8
+ import {
9
+ createSyntheticOAuthMaterializedConfig,
10
+ } from "../enterprise/oidc";
11
+ import { normalizeEnterprisePolicy } from "../enterprise/policy";
8
12
  import {
9
13
  ENTERPRISE_OIDC_PROVIDER_PREFIX,
10
14
  ENTERPRISE_SAML_PROVIDER_PREFIX,
11
- createSyntheticOAuthMaterializedConfig,
12
15
  isEnterpriseProviderId,
13
- normalizeEnterprisePolicy,
14
- } from "../sso";
16
+ } from "../enterprise/shared";
15
17
  import { MutationCtx } from "../types";
16
18
  import type { AuthProviderMaterializedConfig } from "../types";
17
19
  import { upsertUserAndAccount } from "../users";
18
20
  import { generateRandomString, logWithLevel, sha256 } from "../utils";
19
- import { AUTH_STORE_REF } from "./store";
21
+ import { AUTH_STORE_REF } from "./store/refs";
20
22
 
21
23
  const OAUTH_SIGN_IN_EXPIRATION_MS = 1000 * 60 * 2; // 2 minutes
22
24
 
@@ -3,8 +3,8 @@ import type { GenericActionCtx, GenericDataModel } from "convex/server";
3
3
  import { Infer, v } from "convex/values";
4
4
 
5
5
  import { authDb } from "../db";
6
- import { AuthError } from "../fx";
7
- import * as Provider from "../provider";
6
+ import { AuthError } from "../authError";
7
+ import * as Provider from "../crypto";
8
8
  import {
9
9
  invalidateRefreshTokensInSubtree,
10
10
  parseRefreshToken,
@@ -14,7 +14,7 @@ import {
14
14
  import { generateTokensForSession } from "../sessions";
15
15
  import { MutationCtx } from "../types";
16
16
  import { logWithLevel, maybeRedact } from "../utils";
17
- import { AUTH_STORE_REF } from "./store";
17
+ import { AUTH_STORE_REF } from "./store/refs";
18
18
 
19
19
  export const refreshSessionArgs = v.object({
20
20
  refreshToken: v.string(),
@@ -3,14 +3,14 @@ import type { GenericActionCtx, GenericDataModel } from "convex/server";
3
3
  import { Infer, v } from "convex/values";
4
4
 
5
5
  import { authDb } from "../db";
6
- import { AuthError } from "../fx";
7
- import * as Provider from "../provider";
6
+ import { AuthError } from "../authError";
7
+ import * as Provider from "../crypto";
8
8
  import { getAuthSessionId } from "../sessions";
9
9
  import { Doc, MutationCtx } from "../types";
10
10
  import { ConvexCredentialsConfig } from "../types";
11
11
  import { upsertUserAndAccount } from "../users";
12
12
  import { LOG_LEVELS, logWithLevel, maybeRedact } from "../utils";
13
- import { AUTH_STORE_REF } from "./store";
13
+ import { AUTH_STORE_REF } from "./store/refs";
14
14
 
15
15
  export const createAccountFromCredentialsArgs = v.object({
16
16
  provider: v.string(),
@@ -3,16 +3,16 @@ import type { GenericActionCtx, GenericDataModel } from "convex/server";
3
3
  import { Infer, v } from "convex/values";
4
4
 
5
5
  import { authDb } from "../db";
6
- import { AuthError } from "../fx";
7
- import * as Provider from "../provider";
6
+ import { AuthError } from "../authError";
7
+ import * as Provider from "../crypto";
8
8
  import {
9
9
  isSignInRateLimited,
10
10
  recordFailedSignIn,
11
11
  resetSignInRateLimit,
12
- } from "../ratelimit";
12
+ } from "../limits";
13
13
  import { Doc, MutationCtx } from "../types";
14
14
  import { LOG_LEVELS, logWithLevel, maybeRedact } from "../utils";
15
- import { AUTH_STORE_REF } from "./store";
15
+ import { AUTH_STORE_REF } from "./store/refs";
16
16
 
17
17
  export const retrieveAccountWithCredentialsArgs = v.object({
18
18
  provider: v.string(),
@@ -107,7 +107,3 @@ export const callRetrieveAccountWithCredentials = async <
107
107
  },
108
108
  });
109
109
  };
110
-
111
- /** @deprecated Typo kept for backward compatibility. */
112
- export const callRetreiveAccountWithCredentials =
113
- callRetrieveAccountWithCredentials;
@@ -3,10 +3,10 @@ import type { GenericActionCtx, GenericDataModel } from "convex/server";
3
3
  import { GenericId, Infer, v } from "convex/values";
4
4
 
5
5
  import { authDb } from "../db";
6
- import { AuthError } from "../fx";
7
- import * as Provider from "../provider";
6
+ import { AuthError } from "../authError";
7
+ import * as Provider from "../crypto";
8
8
  import { MutationCtx } from "../types";
9
- import { AUTH_STORE_REF } from "./store";
9
+ import { AUTH_STORE_REF } from "./store/refs";
10
10
 
11
11
  export const verifierSignatureArgs = v.object({
12
12
  verifier: v.string(),
@@ -1,14 +1,14 @@
1
1
  import type { GenericActionCtx, GenericDataModel } from "convex/server";
2
2
  import { GenericId, Infer, v } from "convex/values";
3
3
 
4
- import * as Provider from "../provider";
4
+ import * as Provider from "../crypto";
5
5
  import {
6
6
  createNewAndDeleteExistingSession,
7
7
  maybeGenerateTokensForSession,
8
8
  } from "../sessions";
9
9
  import { MutationCtx, SessionInfo } from "../types";
10
10
  import { LOG_LEVELS, logWithLevel } from "../utils";
11
- import { AUTH_STORE_REF } from "./store";
11
+ import { AUTH_STORE_REF } from "./store/refs";
12
12
 
13
13
  export const signInArgs = v.object({
14
14
  userId: v.string(),
@@ -3,10 +3,10 @@ import type { GenericActionCtx, GenericDataModel } from "convex/server";
3
3
  import { GenericId } from "convex/values";
4
4
 
5
5
  import { authDb } from "../db";
6
- import * as Provider from "../provider";
6
+ import * as Provider from "../crypto";
7
7
  import { deleteSession, getAuthSessionId } from "../sessions";
8
8
  import { MutationCtx } from "../types";
9
- import { AUTH_STORE_REF } from "./store";
9
+ import { AUTH_STORE_REF } from "./store/refs";
10
10
 
11
11
  type ReturnType = {
12
12
  userId: GenericId<"User">;
@@ -0,0 +1,10 @@
1
+ import { makeFunctionReference } from "convex/server";
2
+
3
+ /**
4
+ * Internal function reference for the library's store dispatch mutation.
5
+ *
6
+ * The package cannot import the consumer app's generated `api` module,
7
+ * so it uses a canonical function reference name that matches the app-level
8
+ * `export const { store } = auth` surface.
9
+ */
10
+ export const AUTH_STORE_REF = makeFunctionReference("auth:store") as any;
@@ -1,10 +1,138 @@
1
- import { makeFunctionReference } from "convex/server";
1
+ import { Fx } from "@robelest/fx";
2
+ import { Infer, v } from "convex/values";
2
3
 
3
- /**
4
- * Internal function reference for the library's store dispatch mutation.
5
- *
6
- * The package cannot import the consumer app's generated `api` module,
7
- * so it uses a canonical function reference name that matches the app-level
8
- * `export const { store } = auth` surface.
9
- */
10
- export const AUTH_STORE_REF = makeFunctionReference("auth:store") as any;
4
+ import * as Provider from "../crypto";
5
+ import { MutationCtx } from "../types";
6
+ import { LOG_LEVELS, logWithLevel } from "../utils";
7
+ import { modifyAccountArgs, modifyAccountImpl } from "./account";
8
+ import { createVerificationCodeArgs, createVerificationCodeImpl } from "./code";
9
+ import { invalidateSessionsArgs, invalidateSessionsImpl } from "./invalidate";
10
+ import { userOAuthArgs, userOAuthImpl } from "./oauth";
11
+ import { refreshSessionArgs, refreshSessionImpl } from "./refresh";
12
+ import {
13
+ createAccountFromCredentialsArgs,
14
+ createAccountFromCredentialsImpl,
15
+ } from "./register";
16
+ import {
17
+ retrieveAccountWithCredentialsArgs,
18
+ retrieveAccountWithCredentialsImpl,
19
+ } from "./retrieve";
20
+ import { verifierSignatureArgs, verifierSignatureImpl } from "./signature";
21
+ import { signInArgs, signInImpl } from "./signin";
22
+ import { signOutImpl } from "./signout";
23
+ import { verifierImpl } from "./verifier";
24
+ import { verifyCodeAndSignInArgs, verifyCodeAndSignInImpl } from "./verify";
25
+
26
+ export const storeArgs = v.object({
27
+ args: v.union(
28
+ v.object({
29
+ type: v.literal("signIn"),
30
+ ...signInArgs.fields,
31
+ }),
32
+ v.object({
33
+ type: v.literal("signOut"),
34
+ }),
35
+ v.object({
36
+ type: v.literal("refreshSession"),
37
+ ...refreshSessionArgs.fields,
38
+ }),
39
+ v.object({
40
+ type: v.literal("verifyCodeAndSignIn"),
41
+ ...verifyCodeAndSignInArgs.fields,
42
+ }),
43
+ v.object({
44
+ type: v.literal("verifier"),
45
+ }),
46
+ v.object({
47
+ type: v.literal("verifierSignature"),
48
+ ...verifierSignatureArgs.fields,
49
+ }),
50
+ v.object({
51
+ type: v.literal("userOAuth"),
52
+ ...userOAuthArgs.fields,
53
+ }),
54
+ v.object({
55
+ type: v.literal("createVerificationCode"),
56
+ ...createVerificationCodeArgs.fields,
57
+ }),
58
+ v.object({
59
+ type: v.literal("createAccountFromCredentials"),
60
+ ...createAccountFromCredentialsArgs.fields,
61
+ }),
62
+ v.object({
63
+ type: v.literal("retrieveAccountWithCredentials"),
64
+ ...retrieveAccountWithCredentialsArgs.fields,
65
+ }),
66
+ v.object({
67
+ type: v.literal("modifyAccount"),
68
+ ...modifyAccountArgs.fields,
69
+ }),
70
+ v.object({
71
+ type: v.literal("invalidateSessions"),
72
+ ...invalidateSessionsArgs.fields,
73
+ }),
74
+ ),
75
+ });
76
+
77
+ export const storeImpl = async (
78
+ ctx: MutationCtx,
79
+ fnArgs: Infer<typeof storeArgs>,
80
+ getProviderOrThrow: Provider.GetProviderOrThrowFunc,
81
+ config: Provider.Config,
82
+ ) => {
83
+ const args = fnArgs.args;
84
+ logWithLevel(LOG_LEVELS.INFO, `\`auth:store\` type: ${args.type}`);
85
+ return Fx.run(
86
+ Fx.match(args, args.type, {
87
+ signIn: (a) =>
88
+ Fx.from({
89
+ ok: () => signInImpl(ctx, a, config),
90
+ err: (e) => e as never,
91
+ }),
92
+ signOut: () => signOutImpl(ctx, config),
93
+ refreshSession: (a) =>
94
+ Fx.from({
95
+ ok: () => refreshSessionImpl(ctx, a, getProviderOrThrow, config),
96
+ err: (e) => e as never,
97
+ }),
98
+ verifyCodeAndSignIn: (a) =>
99
+ Fx.from({
100
+ ok: () => verifyCodeAndSignInImpl(ctx, a, getProviderOrThrow, config),
101
+ err: (e) => e as never,
102
+ }),
103
+ verifier: () => verifierImpl(ctx, config),
104
+ verifierSignature: (a) =>
105
+ verifierSignatureImpl(ctx, a, config).pipe(
106
+ Fx.recover((e) => Fx.fatal(e.toConvexError())),
107
+ ),
108
+ userOAuth: (a) =>
109
+ userOAuthImpl(ctx, a, getProviderOrThrow, config).pipe(
110
+ Fx.recover((e) => Fx.fatal(e.toConvexError())),
111
+ ),
112
+ createVerificationCode: (a) =>
113
+ Fx.from({
114
+ ok: () =>
115
+ createVerificationCodeImpl(ctx, a, getProviderOrThrow, config),
116
+ err: (e) => e as never,
117
+ }),
118
+ createAccountFromCredentials: (a) =>
119
+ Fx.from({
120
+ ok: () =>
121
+ createAccountFromCredentialsImpl(
122
+ ctx,
123
+ a,
124
+ getProviderOrThrow,
125
+ config,
126
+ ),
127
+ err: (e) => e as never,
128
+ }),
129
+ retrieveAccountWithCredentials: (a) =>
130
+ retrieveAccountWithCredentialsImpl(ctx, a, getProviderOrThrow, config),
131
+ modifyAccount: (a) =>
132
+ modifyAccountImpl(ctx, a, getProviderOrThrow, config).pipe(
133
+ Fx.recover((e) => Fx.fatal(e.toConvexError())),
134
+ ),
135
+ invalidateSessions: (a) => invalidateSessionsImpl(ctx, a, config),
136
+ }),
137
+ );
138
+ };
@@ -3,10 +3,10 @@ import type { GenericActionCtx, GenericDataModel } from "convex/server";
3
3
  import { GenericId } from "convex/values";
4
4
 
5
5
  import { authDb } from "../db";
6
- import * as Provider from "../provider";
6
+ import * as Provider from "../crypto";
7
7
  import { getAuthSessionId } from "../sessions";
8
8
  import { MutationCtx } from "../types";
9
- import { AUTH_STORE_REF } from "./store";
9
+ import { AUTH_STORE_REF } from "./store/refs";
10
10
 
11
11
  type ReturnType = GenericId<"AuthVerifier">;
12
12
 
@@ -3,12 +3,12 @@ import type { GenericActionCtx, GenericDataModel } from "convex/server";
3
3
  import { Infer, v } from "convex/values";
4
4
 
5
5
  import { authDb } from "../db";
6
- import * as Provider from "../provider";
6
+ import * as Provider from "../crypto";
7
7
  import {
8
8
  isSignInRateLimited,
9
9
  recordFailedSignIn,
10
10
  resetSignInRateLimit,
11
- } from "../ratelimit";
11
+ } from "../limits";
12
12
  import {
13
13
  createNewAndDeleteExistingSession,
14
14
  getAuthSessionId,
@@ -16,13 +16,13 @@ import {
16
16
  } from "../sessions";
17
17
  import {
18
18
  createSyntheticOAuthMaterializedConfig,
19
- isEnterpriseProviderId,
20
- } from "../sso";
19
+ } from "../enterprise/oidc";
20
+ import { isEnterpriseProviderId } from "../enterprise/shared";
21
21
  import { MutationCtx, SessionInfo } from "../types";
22
22
  import { upsertUserAndAccount } from "../users";
23
23
  import { LOG_LEVELS, logWithLevel, sha256 } from "../utils";
24
24
  import { requireEnv } from "../utils";
25
- import { AUTH_STORE_REF } from "./store";
25
+ import { AUTH_STORE_REF } from "./store/refs";
26
26
 
27
27
  export const verifyCodeAndSignInArgs = v.object({
28
28
  params: v.any(),
@@ -13,7 +13,7 @@ import { Fx } from "@robelest/fx";
13
13
  import * as arctic from "arctic";
14
14
 
15
15
  import { SHARED_COOKIE_OPTIONS } from "./cookies";
16
- import { AuthError } from "./fx";
16
+ import { AuthError } from "./authError";
17
17
  import type { OAuthProfile } from "./types";
18
18
  import { logWithLevel } from "./utils";
19
19
  import { isLocalHost } from "./utils";
@@ -45,7 +45,9 @@ import {
45
45
  import type { Fx as FxType } from "@robelest/fx";
46
46
 
47
47
  import { authDb } from "./db";
48
- import { AuthError, Fx } from "./fx";
48
+ import { Fx } from "@robelest/fx";
49
+
50
+ import { AuthError } from "./authError";
49
51
  import { userIdFromIdentitySubject } from "./identity";
50
52
  import { callSignIn, callVerifier } from "./mutations/index";
51
53
  import { callVerifierSignature } from "./mutations/signature";
@@ -780,6 +782,3 @@ export function handlePasskeyFx(
780
782
  }),
781
783
  );
782
784
  }
783
-
784
- // Keep backward-compatible export name — callers can migrate to handlePasskeyFx
785
- export { handlePasskeyFx as handlePasskey };
@@ -1,4 +1,4 @@
1
- import { AuthError } from "./fx";
1
+ import { AuthError } from "./authError";
2
2
  import { ConvexAuthMaterializedConfig } from "./types";
3
3
  import { requireEnv } from "./utils";
4
4
 
@@ -2,7 +2,7 @@ import { Fx } from "@robelest/fx";
2
2
  import { GenericId } from "convex/values";
3
3
 
4
4
  import { authDb } from "./db";
5
- import { AuthError } from "./fx";
5
+ import { AuthError } from "./authError";
6
6
  import { Doc, MutationCtx } from "./types";
7
7
  import { ConvexAuthConfig } from "./types";
8
8
  import {