@entro314labs/entro-auth 0.0.0-stage → 1.8.0-beta.12

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 (476) hide show
  1. package/LICENSE.md +20 -0
  2. package/README.md +31 -2
  3. package/dist/_virtual/_rolldown/runtime.mjs +26 -0
  4. package/dist/adapters/drizzle-adapter/index.d.mts +1 -0
  5. package/dist/adapters/drizzle-adapter/index.mjs +2 -0
  6. package/dist/adapters/index.d.mts +19 -0
  7. package/dist/adapters/index.mjs +8 -0
  8. package/dist/adapters/kysely-adapter/index.d.mts +1 -0
  9. package/dist/adapters/kysely-adapter/index.mjs +2 -0
  10. package/dist/adapters/memory-adapter/index.d.mts +1 -0
  11. package/dist/adapters/memory-adapter/index.mjs +2 -0
  12. package/dist/api/dispatch.d.mts +31 -0
  13. package/dist/api/dispatch.mjs +318 -0
  14. package/dist/api/index.d.mts +4117 -0
  15. package/dist/api/index.mjs +227 -0
  16. package/dist/api/middlewares/authorization.d.mts +70 -0
  17. package/dist/api/middlewares/authorization.mjs +78 -0
  18. package/dist/api/middlewares/index.d.mts +3 -0
  19. package/dist/api/middlewares/origin-check.d.mts +12 -0
  20. package/dist/api/middlewares/origin-check.mjs +154 -0
  21. package/dist/api/rate-limiter/index.mjs +322 -0
  22. package/dist/api/routes/account.d.mts +407 -0
  23. package/dist/api/routes/account.mjs +642 -0
  24. package/dist/api/routes/callback.d.mts +27 -0
  25. package/dist/api/routes/callback.mjs +184 -0
  26. package/dist/api/routes/email-verification.d.mts +153 -0
  27. package/dist/api/routes/email-verification.mjs +315 -0
  28. package/dist/api/routes/error.d.mts +22 -0
  29. package/dist/api/routes/error.mjs +386 -0
  30. package/dist/api/routes/id-token-nonce.d.mts +83 -0
  31. package/dist/api/routes/id-token-nonce.mjs +79 -0
  32. package/dist/api/routes/index.d.mts +14 -0
  33. package/dist/api/routes/ok.d.mts +30 -0
  34. package/dist/api/routes/ok.mjs +26 -0
  35. package/dist/api/routes/password.d.mts +177 -0
  36. package/dist/api/routes/password.mjs +198 -0
  37. package/dist/api/routes/session.d.mts +446 -0
  38. package/dist/api/routes/session.mjs +488 -0
  39. package/dist/api/routes/sign-in.d.mts +182 -0
  40. package/dist/api/routes/sign-in.mjs +374 -0
  41. package/dist/api/routes/sign-out.d.mts +46 -0
  42. package/dist/api/routes/sign-out.mjs +101 -0
  43. package/dist/api/routes/sign-up.d.mts +155 -0
  44. package/dist/api/routes/sign-up.mjs +279 -0
  45. package/dist/api/routes/update-session.d.mts +70 -0
  46. package/dist/api/routes/update-session.mjs +56 -0
  47. package/dist/api/routes/update-user.d.mts +424 -0
  48. package/dist/api/routes/update-user.mjs +524 -0
  49. package/dist/api/state/oauth.d.mts +48 -0
  50. package/dist/api/state/oauth.mjs +38 -0
  51. package/dist/api/state/should-session-refresh.d.mts +10 -0
  52. package/dist/api/state/should-session-refresh.mjs +12 -0
  53. package/dist/api/to-auth-endpoints.mjs +59 -0
  54. package/dist/auth/base.mjs +60 -0
  55. package/dist/auth/full.d.mts +25 -0
  56. package/dist/auth/full.mjs +28 -0
  57. package/dist/auth/minimal.d.mts +8 -0
  58. package/dist/auth/minimal.mjs +10 -0
  59. package/dist/auth/trusted-origins.mjs +130 -0
  60. package/dist/client/broadcast-channel.d.mts +16 -0
  61. package/dist/client/broadcast-channel.mjs +44 -0
  62. package/dist/client/config.d.mts +84 -0
  63. package/dist/client/config.mjs +111 -0
  64. package/dist/client/equality.d.mts +15 -0
  65. package/dist/client/equality.mjs +41 -0
  66. package/dist/client/fetch-plugins.mjs +16 -0
  67. package/dist/client/focus-manager.d.mts +7 -0
  68. package/dist/client/focus-manager.mjs +30 -0
  69. package/dist/client/index.d.mts +35 -0
  70. package/dist/client/index.mjs +21 -0
  71. package/dist/client/lynx/index.d.mts +40 -0
  72. package/dist/client/lynx/index.mjs +22 -0
  73. package/dist/client/lynx/lynx-store.d.mts +43 -0
  74. package/dist/client/lynx/lynx-store.mjs +43 -0
  75. package/dist/client/online-manager.d.mts +8 -0
  76. package/dist/client/online-manager.mjs +33 -0
  77. package/dist/client/parser.d.mts +12 -0
  78. package/dist/client/parser.mjs +59 -0
  79. package/dist/client/path-to-object.d.mts +110 -0
  80. package/dist/client/plugins/index.d.mts +44 -0
  81. package/dist/client/plugins/index.mjs +30 -0
  82. package/dist/client/plugins/infer-plugin.d.mts +12 -0
  83. package/dist/client/plugins/infer-plugin.mjs +10 -0
  84. package/dist/client/proxy.mjs +70 -0
  85. package/dist/client/query-atom.mjs +12 -0
  86. package/dist/client/query.d.mts +19 -0
  87. package/dist/client/query.mjs +133 -0
  88. package/dist/client/react/index.d.mts +41 -0
  89. package/dist/client/react/index.mjs +22 -0
  90. package/dist/client/react/react-store.d.mts +43 -0
  91. package/dist/client/react/react-store.mjs +44 -0
  92. package/dist/client/session-atom.d.mts +9 -0
  93. package/dist/client/session-atom.mjs +179 -0
  94. package/dist/client/session-refresh.d.mts +16 -0
  95. package/dist/client/session-refresh.mjs +131 -0
  96. package/dist/client/solid/index.d.mts +41 -0
  97. package/dist/client/solid/index.mjs +22 -0
  98. package/dist/client/solid/solid-store.mjs +20 -0
  99. package/dist/client/svelte/index.d.mts +41 -0
  100. package/dist/client/svelte/index.mjs +18 -0
  101. package/dist/client/types.d.mts +49 -0
  102. package/dist/client/vanilla.d.mts +39 -0
  103. package/dist/client/vanilla.mjs +18 -0
  104. package/dist/client/vue/index.d.mts +64 -0
  105. package/dist/client/vue/index.mjs +60 -0
  106. package/dist/client/vue/vue-store.mjs +22 -0
  107. package/dist/context/create-context.mjs +229 -0
  108. package/dist/context/helpers.mjs +159 -0
  109. package/dist/context/init-minimal.mjs +15 -0
  110. package/dist/context/init.mjs +16 -0
  111. package/dist/context/secret-utils.mjs +52 -0
  112. package/dist/context/store-capabilities.mjs +11 -0
  113. package/dist/cookies/cache.mjs +33 -0
  114. package/dist/cookies/cookie-utils.d.mts +70 -0
  115. package/dist/cookies/cookie-utils.mjs +200 -0
  116. package/dist/cookies/index.d.mts +121 -0
  117. package/dist/cookies/index.mjs +356 -0
  118. package/dist/cookies/jwt.mjs +44 -0
  119. package/dist/cookies/session-store.d.mts +31 -0
  120. package/dist/cookies/session-store.mjs +183 -0
  121. package/dist/crypto/buffer.d.mts +4 -0
  122. package/dist/crypto/buffer.mjs +15 -0
  123. package/dist/crypto/index.d.mts +24 -0
  124. package/dist/crypto/index.mjs +70 -0
  125. package/dist/crypto/jwt.d.mts +5 -0
  126. package/dist/crypto/jwt.mjs +141 -0
  127. package/dist/crypto/password.d.mts +7 -0
  128. package/dist/crypto/password.mjs +13 -0
  129. package/dist/crypto/purpose.d.mts +12 -0
  130. package/dist/crypto/purpose.mjs +27 -0
  131. package/dist/crypto/random.d.mts +1 -0
  132. package/dist/crypto/random.mjs +4 -0
  133. package/dist/db/adapter-base.d.mts +3 -0
  134. package/dist/db/adapter-base.mjs +24 -0
  135. package/dist/db/adapter-kysely.d.mts +3 -0
  136. package/dist/db/adapter-kysely.mjs +16 -0
  137. package/dist/db/field-converter.d.mts +3 -0
  138. package/dist/db/field-converter.mjs +18 -0
  139. package/dist/db/field.d.mts +38 -0
  140. package/dist/db/get-migration.d.mts +50 -0
  141. package/dist/db/get-migration.mjs +685 -0
  142. package/dist/db/get-schema.d.mts +9 -0
  143. package/dist/db/get-schema.mjs +54 -0
  144. package/dist/db/index.d.mts +10 -0
  145. package/dist/db/index.mjs +34 -0
  146. package/dist/db/internal-adapter.d.mts +10 -0
  147. package/dist/db/internal-adapter.mjs +1083 -0
  148. package/dist/db/revoke-unproven-account-access.d.mts +18 -0
  149. package/dist/db/revoke-unproven-account-access.mjs +57 -0
  150. package/dist/db/schema.d.mts +59 -0
  151. package/dist/db/schema.mjs +172 -0
  152. package/dist/db/to-zod.d.mts +31 -0
  153. package/dist/db/to-zod.mjs +32 -0
  154. package/dist/db/verification-token-storage.mjs +24 -0
  155. package/dist/db/with-hooks.d.mts +33 -0
  156. package/dist/db/with-hooks.mjs +248 -0
  157. package/dist/index.d.mts +30 -0
  158. package/dist/index.mjs +16 -0
  159. package/dist/integrations/cookie-plugin-guard.mjs +17 -0
  160. package/dist/integrations/next-js.d.mts +23 -0
  161. package/dist/integrations/next-js.mjs +104 -0
  162. package/dist/integrations/node.d.mts +7 -0
  163. package/dist/integrations/node.mjs +14 -0
  164. package/dist/integrations/solid-start.d.mts +19 -0
  165. package/dist/integrations/solid-start.mjs +14 -0
  166. package/dist/integrations/svelte-kit.d.mts +28 -0
  167. package/dist/integrations/svelte-kit.mjs +56 -0
  168. package/dist/integrations/tanstack-start-solid.d.mts +27 -0
  169. package/dist/integrations/tanstack-start-solid.mjs +56 -0
  170. package/dist/integrations/tanstack-start.d.mts +27 -0
  171. package/dist/integrations/tanstack-start.mjs +56 -0
  172. package/dist/oauth2/account-fields.mjs +51 -0
  173. package/dist/oauth2/account-key.mjs +42 -0
  174. package/dist/oauth2/callback.mjs +67 -0
  175. package/dist/oauth2/dpop-client.d.mts +1 -0
  176. package/dist/oauth2/dpop-client.mjs +2 -0
  177. package/dist/oauth2/errors.mjs +48 -0
  178. package/dist/oauth2/index.d.mts +5 -0
  179. package/dist/oauth2/index.mjs +5 -0
  180. package/dist/oauth2/link-account.d.mts +126 -0
  181. package/dist/oauth2/link-account.mjs +429 -0
  182. package/dist/oauth2/state.d.mts +49 -0
  183. package/dist/oauth2/state.mjs +66 -0
  184. package/dist/oauth2/utils.d.mts +21 -0
  185. package/dist/oauth2/utils.mjs +44 -0
  186. package/dist/package.mjs +3 -0
  187. package/dist/plugins/access/access.d.mts +13 -0
  188. package/dist/plugins/access/access.mjs +77 -0
  189. package/dist/plugins/access/index.d.mts +3 -0
  190. package/dist/plugins/access/index.mjs +1 -0
  191. package/dist/plugins/access/types.d.mts +20 -0
  192. package/dist/plugins/additional-fields/client.d.mts +96 -0
  193. package/dist/plugins/additional-fields/client.mjs +10 -0
  194. package/dist/plugins/admin/access/index.d.mts +2 -0
  195. package/dist/plugins/admin/access/index.mjs +1 -0
  196. package/dist/plugins/admin/access/statement.d.mts +49 -0
  197. package/dist/plugins/admin/access/statement.mjs +53 -0
  198. package/dist/plugins/admin/admin.d.mts +908 -0
  199. package/dist/plugins/admin/admin.mjs +90 -0
  200. package/dist/plugins/admin/client.d.mts +84 -0
  201. package/dist/plugins/admin/client.mjs +38 -0
  202. package/dist/plugins/admin/error-codes.d.mts +30 -0
  203. package/dist/plugins/admin/error-codes.mjs +33 -0
  204. package/dist/plugins/admin/has-permission.mjs +11 -0
  205. package/dist/plugins/admin/index.d.mts +3 -0
  206. package/dist/plugins/admin/index.mjs +1 -0
  207. package/dist/plugins/admin/routes.mjs +940 -0
  208. package/dist/plugins/admin/schema.d.mts +37 -0
  209. package/dist/plugins/admin/schema.mjs +32 -0
  210. package/dist/plugins/admin/types.d.mts +89 -0
  211. package/dist/plugins/anonymous/client.d.mts +28 -0
  212. package/dist/plugins/anonymous/client.mjs +20 -0
  213. package/dist/plugins/anonymous/error-codes.d.mts +10 -0
  214. package/dist/plugins/anonymous/error-codes.mjs +13 -0
  215. package/dist/plugins/anonymous/index.d.mts +170 -0
  216. package/dist/plugins/anonymous/index.mjs +220 -0
  217. package/dist/plugins/anonymous/schema.d.mts +12 -0
  218. package/dist/plugins/anonymous/schema.mjs +8 -0
  219. package/dist/plugins/anonymous/types.d.mts +62 -0
  220. package/dist/plugins/bearer/index.d.mts +39 -0
  221. package/dist/plugins/bearer/index.mjs +73 -0
  222. package/dist/plugins/captcha/constants.d.mts +7 -0
  223. package/dist/plugins/captcha/constants.mjs +27 -0
  224. package/dist/plugins/captcha/error-codes.mjs +12 -0
  225. package/dist/plugins/captcha/index.d.mts +22 -0
  226. package/dist/plugins/captcha/index.mjs +93 -0
  227. package/dist/plugins/captcha/types.d.mts +90 -0
  228. package/dist/plugins/captcha/utils.mjs +18 -0
  229. package/dist/plugins/captcha/verify-handlers/captchafox.mjs +26 -0
  230. package/dist/plugins/captcha/verify-handlers/cloudflare-turnstile.mjs +46 -0
  231. package/dist/plugins/captcha/verify-handlers/google-recaptcha.mjs +31 -0
  232. package/dist/plugins/captcha/verify-handlers/h-captcha.mjs +26 -0
  233. package/dist/plugins/captcha/verify-handlers/vercel-botid.mjs +26 -0
  234. package/dist/plugins/custom-session/client.d.mts +13 -0
  235. package/dist/plugins/custom-session/client.mjs +6 -0
  236. package/dist/plugins/custom-session/index.d.mts +65 -0
  237. package/dist/plugins/custom-session/index.mjs +57 -0
  238. package/dist/plugins/device-authorization/client.d.mts +13 -0
  239. package/dist/plugins/device-authorization/client.mjs +17 -0
  240. package/dist/plugins/device-authorization/error-codes.mjs +18 -0
  241. package/dist/plugins/device-authorization/index.d.mts +550 -0
  242. package/dist/plugins/device-authorization/index.mjs +79 -0
  243. package/dist/plugins/device-authorization/routes.d.mts +96 -0
  244. package/dist/plugins/device-authorization/routes.mjs +734 -0
  245. package/dist/plugins/device-authorization/schema.d.mts +15 -0
  246. package/dist/plugins/device-authorization/schema.mjs +62 -0
  247. package/dist/plugins/email-otp/client.d.mts +17 -0
  248. package/dist/plugins/email-otp/client.mjs +16 -0
  249. package/dist/plugins/email-otp/error-codes.d.mts +5 -0
  250. package/dist/plugins/email-otp/error-codes.mjs +8 -0
  251. package/dist/plugins/email-otp/index.d.mts +542 -0
  252. package/dist/plugins/email-otp/index.mjs +144 -0
  253. package/dist/plugins/email-otp/otp-token.mjs +66 -0
  254. package/dist/plugins/email-otp/routes.mjs +774 -0
  255. package/dist/plugins/email-otp/types.d.mts +105 -0
  256. package/dist/plugins/email-otp/utils.mjs +16 -0
  257. package/dist/plugins/generic-oauth/error-codes.mjs +8 -0
  258. package/dist/plugins/generic-oauth/index.d.mts +57 -0
  259. package/dist/plugins/generic-oauth/index.mjs +459 -0
  260. package/dist/plugins/generic-oauth/providers/auth0.d.mts +32 -0
  261. package/dist/plugins/generic-oauth/providers/auth0.mjs +48 -0
  262. package/dist/plugins/generic-oauth/providers/gumroad.d.mts +27 -0
  263. package/dist/plugins/generic-oauth/providers/gumroad.mjs +61 -0
  264. package/dist/plugins/generic-oauth/providers/hubspot.d.mts +32 -0
  265. package/dist/plugins/generic-oauth/providers/hubspot.mjs +65 -0
  266. package/dist/plugins/generic-oauth/providers/index.d.mts +11 -0
  267. package/dist/plugins/generic-oauth/providers/keycloak.d.mts +32 -0
  268. package/dist/plugins/generic-oauth/providers/keycloak.mjs +46 -0
  269. package/dist/plugins/generic-oauth/providers/line.d.mts +50 -0
  270. package/dist/plugins/generic-oauth/providers/line.mjs +92 -0
  271. package/dist/plugins/generic-oauth/providers/microsoft-entra-id.d.mts +35 -0
  272. package/dist/plugins/generic-oauth/providers/microsoft-entra-id.mjs +104 -0
  273. package/dist/plugins/generic-oauth/providers/okta.d.mts +32 -0
  274. package/dist/plugins/generic-oauth/providers/okta.mjs +47 -0
  275. package/dist/plugins/generic-oauth/providers/patreon.d.mts +25 -0
  276. package/dist/plugins/generic-oauth/providers/patreon.mjs +60 -0
  277. package/dist/plugins/generic-oauth/providers/slack.d.mts +25 -0
  278. package/dist/plugins/generic-oauth/providers/slack.mjs +65 -0
  279. package/dist/plugins/generic-oauth/providers/token-endpoint-audience.mjs +15 -0
  280. package/dist/plugins/generic-oauth/providers/yandex.d.mts +25 -0
  281. package/dist/plugins/generic-oauth/providers/yandex.mjs +66 -0
  282. package/dist/plugins/generic-oauth/types.d.mts +328 -0
  283. package/dist/plugins/haveibeenpwned/index.d.mts +57 -0
  284. package/dist/plugins/haveibeenpwned/index.mjs +80 -0
  285. package/dist/plugins/index.d.mts +76 -0
  286. package/dist/plugins/index.mjs +53 -0
  287. package/dist/plugins/jwt/adapter.mjs +78 -0
  288. package/dist/plugins/jwt/client.d.mts +38 -0
  289. package/dist/plugins/jwt/client.mjs +18 -0
  290. package/dist/plugins/jwt/cookie-cache.mjs +71 -0
  291. package/dist/plugins/jwt/index.d.mts +241 -0
  292. package/dist/plugins/jwt/index.mjs +213 -0
  293. package/dist/plugins/jwt/schema.d.mts +30 -0
  294. package/dist/plugins/jwt/schema.mjs +28 -0
  295. package/dist/plugins/jwt/sign.d.mts +127 -0
  296. package/dist/plugins/jwt/sign.mjs +134 -0
  297. package/dist/plugins/jwt/types.d.mts +255 -0
  298. package/dist/plugins/jwt/utils.d.mts +36 -0
  299. package/dist/plugins/jwt/utils.mjs +63 -0
  300. package/dist/plugins/jwt/verify.d.mts +7 -0
  301. package/dist/plugins/jwt/verify.mjs +50 -0
  302. package/dist/plugins/last-login-method/client.d.mts +45 -0
  303. package/dist/plugins/last-login-method/client.mjs +47 -0
  304. package/dist/plugins/last-login-method/index.d.mts +121 -0
  305. package/dist/plugins/last-login-method/index.mjs +98 -0
  306. package/dist/plugins/magic-link/client.d.mts +6 -0
  307. package/dist/plugins/magic-link/client.mjs +10 -0
  308. package/dist/plugins/magic-link/index.d.mts +208 -0
  309. package/dist/plugins/magic-link/index.mjs +223 -0
  310. package/dist/plugins/magic-link/utils.mjs +8 -0
  311. package/dist/plugins/multi-session/client.d.mts +15 -0
  312. package/dist/plugins/multi-session/client.mjs +18 -0
  313. package/dist/plugins/multi-session/error-codes.d.mts +3 -0
  314. package/dist/plugins/multi-session/error-codes.mjs +4 -0
  315. package/dist/plugins/multi-session/index.d.mts +206 -0
  316. package/dist/plugins/multi-session/index.mjs +216 -0
  317. package/dist/plugins/oauth-popup/client.d.mts +74 -0
  318. package/dist/plugins/oauth-popup/client.mjs +204 -0
  319. package/dist/plugins/oauth-popup/constants.d.mts +8 -0
  320. package/dist/plugins/oauth-popup/constants.mjs +10 -0
  321. package/dist/plugins/oauth-popup/error-codes.d.mts +6 -0
  322. package/dist/plugins/oauth-popup/error-codes.mjs +9 -0
  323. package/dist/plugins/oauth-popup/index.d.mts +61 -0
  324. package/dist/plugins/oauth-popup/index.mjs +232 -0
  325. package/dist/plugins/oauth-popup/types.d.mts +26 -0
  326. package/dist/plugins/oauth-proxy/index.d.mts +123 -0
  327. package/dist/plugins/oauth-proxy/index.mjs +397 -0
  328. package/dist/plugins/oauth-proxy/utils.mjs +54 -0
  329. package/dist/plugins/one-tap/client.d.mts +187 -0
  330. package/dist/plugins/one-tap/client.mjs +208 -0
  331. package/dist/plugins/one-tap/index.d.mts +117 -0
  332. package/dist/plugins/one-tap/index.mjs +146 -0
  333. package/dist/plugins/one-time-token/client.d.mts +7 -0
  334. package/dist/plugins/one-time-token/client.mjs +10 -0
  335. package/dist/plugins/one-time-token/index.d.mts +128 -0
  336. package/dist/plugins/one-time-token/index.mjs +106 -0
  337. package/dist/plugins/one-time-token/utils.mjs +8 -0
  338. package/dist/plugins/open-api/generator.d.mts +124 -0
  339. package/dist/plugins/open-api/generator.mjs +557 -0
  340. package/dist/plugins/open-api/index.d.mts +93 -0
  341. package/dist/plugins/open-api/index.mjs +64 -0
  342. package/dist/plugins/open-api/logo.mjs +12 -0
  343. package/dist/plugins/organization/access/index.d.mts +2 -0
  344. package/dist/plugins/organization/access/index.mjs +1 -0
  345. package/dist/plugins/organization/access/statement.d.mts +111 -0
  346. package/dist/plugins/organization/access/statement.mjs +76 -0
  347. package/dist/plugins/organization/adapter.d.mts +786 -0
  348. package/dist/plugins/organization/adapter.mjs +821 -0
  349. package/dist/plugins/organization/call.mjs +14 -0
  350. package/dist/plugins/organization/client.d.mts +375 -0
  351. package/dist/plugins/organization/client.mjs +108 -0
  352. package/dist/plugins/organization/error-codes.d.mts +62 -0
  353. package/dist/plugins/organization/error-codes.mjs +65 -0
  354. package/dist/plugins/organization/has-permission.d.mts +12 -0
  355. package/dist/plugins/organization/has-permission.mjs +72 -0
  356. package/dist/plugins/organization/index.d.mts +7 -0
  357. package/dist/plugins/organization/index.mjs +5 -0
  358. package/dist/plugins/organization/organization.d.mts +418 -0
  359. package/dist/plugins/organization/organization.mjs +888 -0
  360. package/dist/plugins/organization/permission.d.mts +12 -0
  361. package/dist/plugins/organization/permission.mjs +13 -0
  362. package/dist/plugins/organization/roles.d.mts +6 -0
  363. package/dist/plugins/organization/roles.mjs +25 -0
  364. package/dist/plugins/organization/routes/crud-access-control.d.mts +509 -0
  365. package/dist/plugins/organization/routes/crud-access-control.mjs +674 -0
  366. package/dist/plugins/organization/routes/crud-invites.d.mts +1173 -0
  367. package/dist/plugins/organization/routes/crud-invites.mjs +619 -0
  368. package/dist/plugins/organization/routes/crud-members.d.mts +1010 -0
  369. package/dist/plugins/organization/routes/crud-members.mjs +515 -0
  370. package/dist/plugins/organization/routes/crud-org.d.mts +914 -0
  371. package/dist/plugins/organization/routes/crud-org.mjs +465 -0
  372. package/dist/plugins/organization/routes/crud-team.d.mts +1235 -0
  373. package/dist/plugins/organization/routes/crud-team.mjs +767 -0
  374. package/dist/plugins/organization/schema.d.mts +388 -0
  375. package/dist/plugins/organization/schema.mjs +64 -0
  376. package/dist/plugins/organization/types.d.mts +688 -0
  377. package/dist/plugins/phone-number/client.d.mts +29 -0
  378. package/dist/plugins/phone-number/client.mjs +18 -0
  379. package/dist/plugins/phone-number/error-codes.d.mts +16 -0
  380. package/dist/plugins/phone-number/error-codes.mjs +19 -0
  381. package/dist/plugins/phone-number/index.d.mts +376 -0
  382. package/dist/plugins/phone-number/index.mjs +72 -0
  383. package/dist/plugins/phone-number/routes.mjs +612 -0
  384. package/dist/plugins/phone-number/schema.d.mts +19 -0
  385. package/dist/plugins/phone-number/schema.mjs +17 -0
  386. package/dist/plugins/phone-number/types.d.mts +119 -0
  387. package/dist/plugins/siwe/client.d.mts +10 -0
  388. package/dist/plugins/siwe/client.mjs +14 -0
  389. package/dist/plugins/siwe/index.d.mts +58 -0
  390. package/dist/plugins/siwe/index.mjs +288 -0
  391. package/dist/plugins/siwe/parse-message.mjs +57 -0
  392. package/dist/plugins/siwe/schema.d.mts +32 -0
  393. package/dist/plugins/siwe/schema.mjs +29 -0
  394. package/dist/plugins/siwe/types.d.mts +41 -0
  395. package/dist/plugins/test-utils/auth-helpers.mjs +34 -0
  396. package/dist/plugins/test-utils/cookie-builder.mjs +54 -0
  397. package/dist/plugins/test-utils/db-helpers.mjs +64 -0
  398. package/dist/plugins/test-utils/factories.mjs +37 -0
  399. package/dist/plugins/test-utils/index.d.mts +69 -0
  400. package/dist/plugins/test-utils/index.mjs +96 -0
  401. package/dist/plugins/test-utils/otp-sink.mjs +20 -0
  402. package/dist/plugins/test-utils/types.d.mts +49 -0
  403. package/dist/plugins/two-factor/backup-codes/index.d.mts +286 -0
  404. package/dist/plugins/two-factor/backup-codes/index.mjs +354 -0
  405. package/dist/plugins/two-factor/claim.d.mts +86 -0
  406. package/dist/plugins/two-factor/claim.mjs +171 -0
  407. package/dist/plugins/two-factor/client.d.mts +76 -0
  408. package/dist/plugins/two-factor/client.mjs +40 -0
  409. package/dist/plugins/two-factor/constant.d.mts +7 -0
  410. package/dist/plugins/two-factor/constant.mjs +12 -0
  411. package/dist/plugins/two-factor/error-code.d.mts +20 -0
  412. package/dist/plugins/two-factor/error-code.mjs +23 -0
  413. package/dist/plugins/two-factor/index.d.mts +746 -0
  414. package/dist/plugins/two-factor/index.mjs +493 -0
  415. package/dist/plugins/two-factor/otp/index.d.mts +211 -0
  416. package/dist/plugins/two-factor/otp/index.mjs +262 -0
  417. package/dist/plugins/two-factor/passkey.mjs +47 -0
  418. package/dist/plugins/two-factor/schema.d.mts +66 -0
  419. package/dist/plugins/two-factor/schema.mjs +66 -0
  420. package/dist/plugins/two-factor/totp/index.d.mts +214 -0
  421. package/dist/plugins/two-factor/totp/index.mjs +295 -0
  422. package/dist/plugins/two-factor/types.d.mts +112 -0
  423. package/dist/plugins/two-factor/utils.mjs +8 -0
  424. package/dist/plugins/two-factor/verify-two-factor.d.mts +121 -0
  425. package/dist/plugins/two-factor/verify-two-factor.mjs +314 -0
  426. package/dist/plugins/username/client.d.mts +34 -0
  427. package/dist/plugins/username/client.mjs +16 -0
  428. package/dist/plugins/username/error-codes.d.mts +11 -0
  429. package/dist/plugins/username/error-codes.mjs +14 -0
  430. package/dist/plugins/username/index.d.mts +319 -0
  431. package/dist/plugins/username/index.mjs +304 -0
  432. package/dist/plugins/username/schema.d.mts +45 -0
  433. package/dist/plugins/username/schema.mjs +24 -0
  434. package/dist/social-providers/index.d.mts +1 -0
  435. package/dist/social-providers/index.mjs +2 -0
  436. package/dist/state.d.mts +48 -0
  437. package/dist/state.mjs +153 -0
  438. package/dist/test-utils/headers.d.mts +5 -0
  439. package/dist/test-utils/headers.mjs +16 -0
  440. package/dist/test-utils/http-test-instance.d.mts +420 -0
  441. package/dist/test-utils/http-test-instance.mjs +106 -0
  442. package/dist/test-utils/index.d.mts +4 -0
  443. package/dist/test-utils/index.mjs +4 -0
  444. package/dist/test-utils/test-instance.d.mts +55 -0
  445. package/dist/test-utils/test-instance.mjs +252 -0
  446. package/dist/types/adapter.d.mts +2 -0
  447. package/dist/types/api.d.mts +24 -0
  448. package/dist/types/auth.d.mts +28 -0
  449. package/dist/types/helper.d.mts +23 -0
  450. package/dist/types/index.d.mts +10 -0
  451. package/dist/types/index.mjs +1 -0
  452. package/dist/types/models.d.mts +7 -0
  453. package/dist/types/plugins.d.mts +16 -0
  454. package/dist/utils/constants.mjs +3 -0
  455. package/dist/utils/date.mjs +5 -0
  456. package/dist/utils/hashing.mjs +17 -0
  457. package/dist/utils/hide-metadata.d.mts +2 -0
  458. package/dist/utils/hide-metadata.mjs +1 -0
  459. package/dist/utils/index.d.mts +5 -0
  460. package/dist/utils/is-api-error.d.mts +2 -0
  461. package/dist/utils/is-api-error.mjs +1 -0
  462. package/dist/utils/is-atom.mjs +5 -0
  463. package/dist/utils/is-promise.mjs +5 -0
  464. package/dist/utils/middleware-response.mjs +9 -0
  465. package/dist/utils/password.mjs +90 -0
  466. package/dist/utils/plugin-helper.mjs +13 -0
  467. package/dist/utils/request.mjs +22 -0
  468. package/dist/utils/shim.mjs +21 -0
  469. package/dist/utils/time.d.mts +46 -0
  470. package/dist/utils/time.mjs +97 -0
  471. package/dist/utils/url.d.mts +74 -0
  472. package/dist/utils/url.mjs +237 -0
  473. package/dist/utils/validate-user-info.mjs +43 -0
  474. package/dist/utils/wildcard.mjs +107 -0
  475. package/dist/version.mjs +4 -0
  476. package/package.json +601 -3
@@ -0,0 +1,1173 @@
1
+ import { FieldAttributeToObject, InferAdditionalFieldsFromPluginOptions, RemoveFieldsWithReturnedFalse } from "../../../db/field.mjs";
2
+ import { Role } from "../../access/types.mjs";
3
+ import "../../index.mjs";
4
+ import "../index.mjs";
5
+ import "../../../db/index.mjs";
6
+ import { defaultRoles } from "../access/statement.mjs";
7
+ import { InferOrganizationRolesFromOption, InvitationStatus } from "../schema.mjs";
8
+ import { OrganizationOptions } from "../types.mjs";
9
+ import { LiteralString } from "@entro314labs/entro-auth-core";
10
+ import * as z from "zod";
11
+ type DynamicOrganizationRole<O extends OrganizationOptions> = O extends {
12
+ dynamicAccessControl: {
13
+ enabled: true;
14
+ };
15
+ } ? LiteralString : never;
16
+ type OrganizationInvitationRole<O extends OrganizationOptions> = InferOrganizationRolesFromOption<O> | DynamicOrganizationRole<O>;
17
+ export declare const createInvitation: <O extends OrganizationOptions>(option: O) => import("better-call").StrictEndpoint<"/organization/invite-member", {
18
+ method: "POST";
19
+ requireHeaders: true;
20
+ use: (import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
21
+ session: {
22
+ session: Record<string, any> & {
23
+ id: string;
24
+ createdAt: Date;
25
+ updatedAt: Date;
26
+ userId: string;
27
+ expiresAt: Date;
28
+ token: string;
29
+ ipAddress?: string | null | undefined;
30
+ userAgent?: string | null | undefined;
31
+ };
32
+ user: Record<string, any> & {
33
+ id: string;
34
+ createdAt: Date;
35
+ updatedAt: Date;
36
+ email: string;
37
+ emailVerified: boolean;
38
+ name: string;
39
+ image?: string | null | undefined;
40
+ };
41
+ };
42
+ }>> | import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
43
+ orgOptions: OrganizationOptions;
44
+ roles: typeof defaultRoles & {
45
+ [key: string]: Role<{}>;
46
+ };
47
+ getSession: (context: import("@entro314labs/entro-auth-core").GenericEndpointContext) => Promise<{
48
+ session: {
49
+ id: string;
50
+ createdAt: Date;
51
+ updatedAt: Date;
52
+ userId: string;
53
+ expiresAt: Date;
54
+ token: string;
55
+ ipAddress?: string | null | undefined;
56
+ userAgent?: string | null | undefined;
57
+ } & {
58
+ activeTeamId?: string | undefined;
59
+ activeOrganizationId?: string | undefined;
60
+ };
61
+ user: {
62
+ id: string;
63
+ createdAt: Date;
64
+ updatedAt: Date;
65
+ email: string;
66
+ emailVerified: boolean;
67
+ name: string;
68
+ image?: string | null | undefined;
69
+ };
70
+ }>;
71
+ }>> | import("better-call").Middleware<{
72
+ use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
73
+ session: {
74
+ session: Record<string, any> & {
75
+ id: string;
76
+ createdAt: Date;
77
+ updatedAt: Date;
78
+ userId: string;
79
+ expiresAt: Date;
80
+ token: string;
81
+ ipAddress?: string | null | undefined;
82
+ userAgent?: string | null | undefined;
83
+ };
84
+ user: Record<string, any> & {
85
+ id: string;
86
+ createdAt: Date;
87
+ updatedAt: Date;
88
+ email: string;
89
+ emailVerified: boolean;
90
+ name: string;
91
+ image?: string | null | undefined;
92
+ };
93
+ };
94
+ }>>[];
95
+ }, (inputContext: import("better-call").MiddlewareInputContext<{
96
+ use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
97
+ session: {
98
+ session: Record<string, any> & {
99
+ id: string;
100
+ createdAt: Date;
101
+ updatedAt: Date;
102
+ userId: string;
103
+ expiresAt: Date;
104
+ token: string;
105
+ ipAddress?: string | null | undefined;
106
+ userAgent?: string | null | undefined;
107
+ };
108
+ user: Record<string, any> & {
109
+ id: string;
110
+ createdAt: Date;
111
+ updatedAt: Date;
112
+ email: string;
113
+ emailVerified: boolean;
114
+ name: string;
115
+ image?: string | null | undefined;
116
+ };
117
+ };
118
+ }>>[];
119
+ }>) => Promise<{
120
+ session: {
121
+ session: {
122
+ id: string;
123
+ createdAt: Date;
124
+ updatedAt: Date;
125
+ userId: string;
126
+ expiresAt: Date;
127
+ token: string;
128
+ ipAddress?: string | null | undefined;
129
+ userAgent?: string | null | undefined;
130
+ } & {
131
+ activeTeamId?: string | undefined;
132
+ activeOrganizationId?: string | undefined;
133
+ };
134
+ user: {
135
+ id: string;
136
+ createdAt: Date;
137
+ updatedAt: Date;
138
+ email: string;
139
+ emailVerified: boolean;
140
+ name: string;
141
+ image?: string | null | undefined;
142
+ };
143
+ };
144
+ }>>)[];
145
+ body: z.ZodObject<{
146
+ email: z.ZodString;
147
+ role: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>;
148
+ organizationId: z.ZodOptional<z.ZodString>;
149
+ resend: z.ZodOptional<z.ZodBoolean>;
150
+ teamId: z.ZodUnion<readonly [z.ZodOptional<z.ZodString>, z.ZodOptional<z.ZodArray<z.ZodString>>]>;
151
+ }, z.core.$strip>;
152
+ metadata: {
153
+ $Infer: {
154
+ body: {
155
+ /**
156
+ * The email address of the user
157
+ * to invite
158
+ */
159
+ email: string;
160
+ /**
161
+ * The role to assign to the user
162
+ */
163
+ role: OrganizationInvitationRole<O> | OrganizationInvitationRole<O>[];
164
+ /**
165
+ * The organization ID to invite
166
+ * the user to
167
+ */
168
+ organizationId?: string | undefined;
169
+ /**
170
+ * Resend the invitation email, if
171
+ * the user is already invited
172
+ */
173
+ resend?: boolean | undefined;
174
+ } & (O extends {
175
+ teams: {
176
+ enabled: true;
177
+ };
178
+ } ? {
179
+ /**
180
+ * The team the user is
181
+ * being invited to.
182
+ */
183
+ teamId?: (string | string[]) | undefined;
184
+ } : {}) & InferAdditionalFieldsFromPluginOptions<"invitation", O, false>;
185
+ };
186
+ openapi: {
187
+ operationId: string;
188
+ description: string;
189
+ responses: {
190
+ "200": {
191
+ description: string;
192
+ content: {
193
+ "application/json": {
194
+ schema: {
195
+ type: "object";
196
+ properties: {
197
+ id: {
198
+ type: string;
199
+ };
200
+ email: {
201
+ type: string;
202
+ };
203
+ role: {
204
+ type: string;
205
+ };
206
+ organizationId: {
207
+ type: string;
208
+ };
209
+ inviterId: {
210
+ type: string;
211
+ };
212
+ status: {
213
+ type: string;
214
+ };
215
+ expiresAt: {
216
+ type: string;
217
+ };
218
+ createdAt: {
219
+ type: string;
220
+ };
221
+ };
222
+ required: string[];
223
+ };
224
+ };
225
+ };
226
+ };
227
+ };
228
+ };
229
+ };
230
+ }, ((O["teams"] extends {
231
+ enabled: true;
232
+ } ? {
233
+ id: string;
234
+ organizationId: string;
235
+ email: string;
236
+ role: InferOrganizationRolesFromOption<O>;
237
+ status: InvitationStatus;
238
+ inviterId: string;
239
+ expiresAt: Date;
240
+ createdAt: Date;
241
+ teamId?: string | undefined;
242
+ } : {
243
+ id: string;
244
+ organizationId: string;
245
+ email: string;
246
+ role: InferOrganizationRolesFromOption<O>;
247
+ status: InvitationStatus;
248
+ inviterId: string;
249
+ expiresAt: Date;
250
+ createdAt: Date;
251
+ }) & (O["schema"] extends {
252
+ invitation?: {
253
+ additionalFields: infer Field extends Record<string, import("@entro314labs/entro-auth-core/db").DBFieldAttribute>;
254
+ } | undefined;
255
+ } ? FieldAttributeToObject<Field> : {}) extends (infer T) ? { [K in keyof T]: T[K]; } : never) | ((O["teams"] extends {
256
+ enabled: true;
257
+ } ? {
258
+ id: string;
259
+ organizationId: string;
260
+ email: string;
261
+ role: InferOrganizationRolesFromOption<O>;
262
+ status: InvitationStatus;
263
+ inviterId: string;
264
+ expiresAt: Date;
265
+ createdAt: Date;
266
+ teamId?: string | undefined;
267
+ } : {
268
+ id: string;
269
+ organizationId: string;
270
+ email: string;
271
+ role: InferOrganizationRolesFromOption<O>;
272
+ status: InvitationStatus;
273
+ inviterId: string;
274
+ expiresAt: Date;
275
+ createdAt: Date;
276
+ }) & (O["schema"] extends {
277
+ invitation?: {
278
+ additionalFields: infer Field extends Record<string, import("@entro314labs/entro-auth-core/db").DBFieldAttribute>;
279
+ } | undefined;
280
+ } ? FieldAttributeToObject<RemoveFieldsWithReturnedFalse<Field>> : {}) extends (infer T_1) ? { [K_1 in keyof T_1]: T_1[K_1]; } : never)>;
281
+ export declare const acceptInvitation: <O extends OrganizationOptions>(options: O) => import("better-call").StrictEndpoint<"/organization/accept-invitation", {
282
+ method: "POST";
283
+ body: z.ZodObject<{
284
+ invitationId: z.ZodString;
285
+ }, z.core.$strip>;
286
+ requireHeaders: true;
287
+ use: (import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
288
+ orgOptions: OrganizationOptions;
289
+ roles: typeof defaultRoles & {
290
+ [key: string]: Role<{}>;
291
+ };
292
+ getSession: (context: import("@entro314labs/entro-auth-core").GenericEndpointContext) => Promise<{
293
+ session: {
294
+ id: string;
295
+ createdAt: Date;
296
+ updatedAt: Date;
297
+ userId: string;
298
+ expiresAt: Date;
299
+ token: string;
300
+ ipAddress?: string | null | undefined;
301
+ userAgent?: string | null | undefined;
302
+ } & {
303
+ activeTeamId?: string | undefined;
304
+ activeOrganizationId?: string | undefined;
305
+ };
306
+ user: {
307
+ id: string;
308
+ createdAt: Date;
309
+ updatedAt: Date;
310
+ email: string;
311
+ emailVerified: boolean;
312
+ name: string;
313
+ image?: string | null | undefined;
314
+ };
315
+ }>;
316
+ }>> | import("better-call").Middleware<{
317
+ use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
318
+ session: {
319
+ session: Record<string, any> & {
320
+ id: string;
321
+ createdAt: Date;
322
+ updatedAt: Date;
323
+ userId: string;
324
+ expiresAt: Date;
325
+ token: string;
326
+ ipAddress?: string | null | undefined;
327
+ userAgent?: string | null | undefined;
328
+ };
329
+ user: Record<string, any> & {
330
+ id: string;
331
+ createdAt: Date;
332
+ updatedAt: Date;
333
+ email: string;
334
+ emailVerified: boolean;
335
+ name: string;
336
+ image?: string | null | undefined;
337
+ };
338
+ };
339
+ }>>[];
340
+ }, (inputContext: import("better-call").MiddlewareInputContext<{
341
+ use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
342
+ session: {
343
+ session: Record<string, any> & {
344
+ id: string;
345
+ createdAt: Date;
346
+ updatedAt: Date;
347
+ userId: string;
348
+ expiresAt: Date;
349
+ token: string;
350
+ ipAddress?: string | null | undefined;
351
+ userAgent?: string | null | undefined;
352
+ };
353
+ user: Record<string, any> & {
354
+ id: string;
355
+ createdAt: Date;
356
+ updatedAt: Date;
357
+ email: string;
358
+ emailVerified: boolean;
359
+ name: string;
360
+ image?: string | null | undefined;
361
+ };
362
+ };
363
+ }>>[];
364
+ }>) => Promise<{
365
+ session: {
366
+ session: {
367
+ id: string;
368
+ createdAt: Date;
369
+ updatedAt: Date;
370
+ userId: string;
371
+ expiresAt: Date;
372
+ token: string;
373
+ ipAddress?: string | null | undefined;
374
+ userAgent?: string | null | undefined;
375
+ } & {
376
+ activeTeamId?: string | undefined;
377
+ activeOrganizationId?: string | undefined;
378
+ };
379
+ user: {
380
+ id: string;
381
+ createdAt: Date;
382
+ updatedAt: Date;
383
+ email: string;
384
+ emailVerified: boolean;
385
+ name: string;
386
+ image?: string | null | undefined;
387
+ };
388
+ };
389
+ }>>)[];
390
+ metadata: {
391
+ openapi: {
392
+ description: string;
393
+ responses: {
394
+ "200": {
395
+ description: string;
396
+ content: {
397
+ "application/json": {
398
+ schema: {
399
+ type: "object";
400
+ properties: {
401
+ invitation: {
402
+ type: string;
403
+ };
404
+ member: {
405
+ type: string;
406
+ };
407
+ };
408
+ };
409
+ };
410
+ };
411
+ };
412
+ };
413
+ };
414
+ };
415
+ }, {
416
+ invitation: (O["teams"] extends {
417
+ enabled: true;
418
+ } ? {
419
+ id: string;
420
+ organizationId: string;
421
+ email: string;
422
+ role: InferOrganizationRolesFromOption<O>;
423
+ status: InvitationStatus;
424
+ inviterId: string;
425
+ expiresAt: Date;
426
+ createdAt: Date;
427
+ teamId?: string | undefined;
428
+ } : {
429
+ id: string;
430
+ organizationId: string;
431
+ email: string;
432
+ role: InferOrganizationRolesFromOption<O>;
433
+ status: InvitationStatus;
434
+ inviterId: string;
435
+ expiresAt: Date;
436
+ createdAt: Date;
437
+ }) & (O["schema"] extends {
438
+ invitation?: {
439
+ additionalFields: infer Field extends Record<string, import("@entro314labs/entro-auth-core/db").DBFieldAttribute>;
440
+ } | undefined;
441
+ } ? FieldAttributeToObject<Field> : {}) extends (infer T) ? { [K in keyof T]: T[K]; } : never;
442
+ member: {
443
+ id: string;
444
+ organizationId: string;
445
+ userId: string;
446
+ role: string;
447
+ createdAt: Date;
448
+ } & InferAdditionalFieldsFromPluginOptions<"member", O, false>;
449
+ }>;
450
+ export declare const rejectInvitation: <O extends OrganizationOptions>(options: O) => import("better-call").StrictEndpoint<"/organization/reject-invitation", {
451
+ method: "POST";
452
+ body: z.ZodObject<{
453
+ invitationId: z.ZodString;
454
+ }, z.core.$strip>;
455
+ requireHeaders: true;
456
+ use: (import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
457
+ orgOptions: OrganizationOptions;
458
+ roles: typeof defaultRoles & {
459
+ [key: string]: Role<{}>;
460
+ };
461
+ getSession: (context: import("@entro314labs/entro-auth-core").GenericEndpointContext) => Promise<{
462
+ session: {
463
+ id: string;
464
+ createdAt: Date;
465
+ updatedAt: Date;
466
+ userId: string;
467
+ expiresAt: Date;
468
+ token: string;
469
+ ipAddress?: string | null | undefined;
470
+ userAgent?: string | null | undefined;
471
+ } & {
472
+ activeTeamId?: string | undefined;
473
+ activeOrganizationId?: string | undefined;
474
+ };
475
+ user: {
476
+ id: string;
477
+ createdAt: Date;
478
+ updatedAt: Date;
479
+ email: string;
480
+ emailVerified: boolean;
481
+ name: string;
482
+ image?: string | null | undefined;
483
+ };
484
+ }>;
485
+ }>> | import("better-call").Middleware<{
486
+ use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
487
+ session: {
488
+ session: Record<string, any> & {
489
+ id: string;
490
+ createdAt: Date;
491
+ updatedAt: Date;
492
+ userId: string;
493
+ expiresAt: Date;
494
+ token: string;
495
+ ipAddress?: string | null | undefined;
496
+ userAgent?: string | null | undefined;
497
+ };
498
+ user: Record<string, any> & {
499
+ id: string;
500
+ createdAt: Date;
501
+ updatedAt: Date;
502
+ email: string;
503
+ emailVerified: boolean;
504
+ name: string;
505
+ image?: string | null | undefined;
506
+ };
507
+ };
508
+ }>>[];
509
+ }, (inputContext: import("better-call").MiddlewareInputContext<{
510
+ use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
511
+ session: {
512
+ session: Record<string, any> & {
513
+ id: string;
514
+ createdAt: Date;
515
+ updatedAt: Date;
516
+ userId: string;
517
+ expiresAt: Date;
518
+ token: string;
519
+ ipAddress?: string | null | undefined;
520
+ userAgent?: string | null | undefined;
521
+ };
522
+ user: Record<string, any> & {
523
+ id: string;
524
+ createdAt: Date;
525
+ updatedAt: Date;
526
+ email: string;
527
+ emailVerified: boolean;
528
+ name: string;
529
+ image?: string | null | undefined;
530
+ };
531
+ };
532
+ }>>[];
533
+ }>) => Promise<{
534
+ session: {
535
+ session: {
536
+ id: string;
537
+ createdAt: Date;
538
+ updatedAt: Date;
539
+ userId: string;
540
+ expiresAt: Date;
541
+ token: string;
542
+ ipAddress?: string | null | undefined;
543
+ userAgent?: string | null | undefined;
544
+ } & {
545
+ activeTeamId?: string | undefined;
546
+ activeOrganizationId?: string | undefined;
547
+ };
548
+ user: {
549
+ id: string;
550
+ createdAt: Date;
551
+ updatedAt: Date;
552
+ email: string;
553
+ emailVerified: boolean;
554
+ name: string;
555
+ image?: string | null | undefined;
556
+ };
557
+ };
558
+ }>>)[];
559
+ metadata: {
560
+ openapi: {
561
+ description: string;
562
+ responses: {
563
+ "200": {
564
+ description: string;
565
+ content: {
566
+ "application/json": {
567
+ schema: {
568
+ type: "object";
569
+ properties: {
570
+ invitation: {
571
+ type: string;
572
+ };
573
+ member: {
574
+ type: string;
575
+ nullable: boolean;
576
+ };
577
+ };
578
+ };
579
+ };
580
+ };
581
+ };
582
+ };
583
+ };
584
+ };
585
+ }, {
586
+ invitation: {
587
+ id: string;
588
+ organizationId: string;
589
+ email: string;
590
+ role: "admin" | "member" | "owner";
591
+ status: InvitationStatus;
592
+ inviterId: string;
593
+ expiresAt: Date;
594
+ createdAt: Date;
595
+ } | null;
596
+ member: null;
597
+ }>;
598
+ export declare const cancelInvitation: <O extends OrganizationOptions>(options: O) => import("better-call").StrictEndpoint<"/organization/cancel-invitation", {
599
+ method: "POST";
600
+ body: z.ZodObject<{
601
+ invitationId: z.ZodString;
602
+ }, z.core.$strip>;
603
+ requireHeaders: true;
604
+ use: (import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
605
+ orgOptions: OrganizationOptions;
606
+ roles: typeof defaultRoles & {
607
+ [key: string]: Role<{}>;
608
+ };
609
+ getSession: (context: import("@entro314labs/entro-auth-core").GenericEndpointContext) => Promise<{
610
+ session: {
611
+ id: string;
612
+ createdAt: Date;
613
+ updatedAt: Date;
614
+ userId: string;
615
+ expiresAt: Date;
616
+ token: string;
617
+ ipAddress?: string | null | undefined;
618
+ userAgent?: string | null | undefined;
619
+ } & {
620
+ activeTeamId?: string | undefined;
621
+ activeOrganizationId?: string | undefined;
622
+ };
623
+ user: {
624
+ id: string;
625
+ createdAt: Date;
626
+ updatedAt: Date;
627
+ email: string;
628
+ emailVerified: boolean;
629
+ name: string;
630
+ image?: string | null | undefined;
631
+ };
632
+ }>;
633
+ }>> | import("better-call").Middleware<{
634
+ use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
635
+ session: {
636
+ session: Record<string, any> & {
637
+ id: string;
638
+ createdAt: Date;
639
+ updatedAt: Date;
640
+ userId: string;
641
+ expiresAt: Date;
642
+ token: string;
643
+ ipAddress?: string | null | undefined;
644
+ userAgent?: string | null | undefined;
645
+ };
646
+ user: Record<string, any> & {
647
+ id: string;
648
+ createdAt: Date;
649
+ updatedAt: Date;
650
+ email: string;
651
+ emailVerified: boolean;
652
+ name: string;
653
+ image?: string | null | undefined;
654
+ };
655
+ };
656
+ }>>[];
657
+ }, (inputContext: import("better-call").MiddlewareInputContext<{
658
+ use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
659
+ session: {
660
+ session: Record<string, any> & {
661
+ id: string;
662
+ createdAt: Date;
663
+ updatedAt: Date;
664
+ userId: string;
665
+ expiresAt: Date;
666
+ token: string;
667
+ ipAddress?: string | null | undefined;
668
+ userAgent?: string | null | undefined;
669
+ };
670
+ user: Record<string, any> & {
671
+ id: string;
672
+ createdAt: Date;
673
+ updatedAt: Date;
674
+ email: string;
675
+ emailVerified: boolean;
676
+ name: string;
677
+ image?: string | null | undefined;
678
+ };
679
+ };
680
+ }>>[];
681
+ }>) => Promise<{
682
+ session: {
683
+ session: {
684
+ id: string;
685
+ createdAt: Date;
686
+ updatedAt: Date;
687
+ userId: string;
688
+ expiresAt: Date;
689
+ token: string;
690
+ ipAddress?: string | null | undefined;
691
+ userAgent?: string | null | undefined;
692
+ } & {
693
+ activeTeamId?: string | undefined;
694
+ activeOrganizationId?: string | undefined;
695
+ };
696
+ user: {
697
+ id: string;
698
+ createdAt: Date;
699
+ updatedAt: Date;
700
+ email: string;
701
+ emailVerified: boolean;
702
+ name: string;
703
+ image?: string | null | undefined;
704
+ };
705
+ };
706
+ }>>)[];
707
+ openapi: {
708
+ operationId: string;
709
+ description: string;
710
+ responses: {
711
+ "200": {
712
+ description: string;
713
+ content: {
714
+ "application/json": {
715
+ schema: {
716
+ type: string;
717
+ properties: {
718
+ invitation: {
719
+ type: string;
720
+ };
721
+ };
722
+ };
723
+ };
724
+ };
725
+ };
726
+ };
727
+ };
728
+ }, ((O["teams"] extends {
729
+ enabled: true;
730
+ } ? {
731
+ id: string;
732
+ organizationId: string;
733
+ email: string;
734
+ role: InferOrganizationRolesFromOption<O>;
735
+ status: InvitationStatus;
736
+ inviterId: string;
737
+ expiresAt: Date;
738
+ createdAt: Date;
739
+ teamId?: string | undefined;
740
+ } : {
741
+ id: string;
742
+ organizationId: string;
743
+ email: string;
744
+ role: InferOrganizationRolesFromOption<O>;
745
+ status: InvitationStatus;
746
+ inviterId: string;
747
+ expiresAt: Date;
748
+ createdAt: Date;
749
+ }) & (O["schema"] extends {
750
+ invitation?: {
751
+ additionalFields: infer Field extends Record<string, import("@entro314labs/entro-auth-core/db").DBFieldAttribute>;
752
+ } | undefined;
753
+ } ? FieldAttributeToObject<Field> : {}) extends (infer T) ? { [K in keyof T]: T[K]; } : never) | null>;
754
+ export declare const getInvitation: <O extends OrganizationOptions>(options: O) => import("better-call").StrictEndpoint<"/organization/get-invitation", {
755
+ method: "GET";
756
+ use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
757
+ orgOptions: OrganizationOptions;
758
+ roles: typeof defaultRoles & {
759
+ [key: string]: Role<{}>;
760
+ };
761
+ getSession: (context: import("@entro314labs/entro-auth-core").GenericEndpointContext) => Promise<{
762
+ session: {
763
+ id: string;
764
+ createdAt: Date;
765
+ updatedAt: Date;
766
+ userId: string;
767
+ expiresAt: Date;
768
+ token: string;
769
+ ipAddress?: string | null | undefined;
770
+ userAgent?: string | null | undefined;
771
+ } & {
772
+ activeTeamId?: string | undefined;
773
+ activeOrganizationId?: string | undefined;
774
+ };
775
+ user: {
776
+ id: string;
777
+ createdAt: Date;
778
+ updatedAt: Date;
779
+ email: string;
780
+ emailVerified: boolean;
781
+ name: string;
782
+ image?: string | null | undefined;
783
+ };
784
+ }>;
785
+ }>>[];
786
+ requireHeaders: true;
787
+ query: z.ZodObject<{
788
+ id: z.ZodString;
789
+ }, z.core.$strip>;
790
+ metadata: {
791
+ openapi: {
792
+ description: string;
793
+ responses: {
794
+ "200": {
795
+ description: string;
796
+ content: {
797
+ "application/json": {
798
+ schema: {
799
+ type: "object";
800
+ properties: {
801
+ id: {
802
+ type: string;
803
+ };
804
+ email: {
805
+ type: string;
806
+ };
807
+ role: {
808
+ type: string;
809
+ };
810
+ organizationId: {
811
+ type: string;
812
+ };
813
+ inviterId: {
814
+ type: string;
815
+ };
816
+ status: {
817
+ type: string;
818
+ };
819
+ expiresAt: {
820
+ type: string;
821
+ };
822
+ organizationName: {
823
+ type: string;
824
+ };
825
+ organizationSlug: {
826
+ type: string;
827
+ };
828
+ inviterEmail: {
829
+ type: string;
830
+ };
831
+ };
832
+ required: string[];
833
+ };
834
+ };
835
+ };
836
+ };
837
+ };
838
+ };
839
+ };
840
+ }, ((O["teams"] extends {
841
+ enabled: true;
842
+ } ? {
843
+ id: string;
844
+ organizationId: string;
845
+ email: string;
846
+ role: InferOrganizationRolesFromOption<O>;
847
+ status: InvitationStatus;
848
+ inviterId: string;
849
+ expiresAt: Date;
850
+ createdAt: Date;
851
+ teamId?: string | undefined;
852
+ } : {
853
+ id: string;
854
+ organizationId: string;
855
+ email: string;
856
+ role: InferOrganizationRolesFromOption<O>;
857
+ status: InvitationStatus;
858
+ inviterId: string;
859
+ expiresAt: Date;
860
+ createdAt: Date;
861
+ }) & (O["schema"] extends {
862
+ invitation?: {
863
+ additionalFields: infer Field extends Record<string, import("@entro314labs/entro-auth-core/db").DBFieldAttribute>;
864
+ } | undefined;
865
+ } ? FieldAttributeToObject<Field> : {}) extends (infer T) ? { [K in keyof T]: T[K]; } : never) & {
866
+ organizationName: ({
867
+ id: string;
868
+ name: string;
869
+ slug: string;
870
+ createdAt: Date;
871
+ logo?: string | null | undefined;
872
+ metadata?: any;
873
+ } & (O["schema"] extends {
874
+ organization?: {
875
+ additionalFields: infer Field extends Record<string, import("@entro314labs/entro-auth-core/db").DBFieldAttribute>;
876
+ } | undefined;
877
+ } ? FieldAttributeToObject<RemoveFieldsWithReturnedFalse<Field>> : {}))["name"];
878
+ organizationSlug: ({
879
+ id: string;
880
+ name: string;
881
+ slug: string;
882
+ createdAt: Date;
883
+ logo?: string | null | undefined;
884
+ metadata?: any;
885
+ } & (O["schema"] extends {
886
+ organization?: {
887
+ additionalFields: infer Field extends Record<string, import("@entro314labs/entro-auth-core/db").DBFieldAttribute>;
888
+ } | undefined;
889
+ } ? FieldAttributeToObject<RemoveFieldsWithReturnedFalse<Field>> : {}))["slug"];
890
+ inviterEmail: string;
891
+ }>;
892
+ export declare const listInvitations: <O extends OrganizationOptions>(options: O) => import("better-call").StrictEndpoint<"/organization/list-invitations", {
893
+ method: "GET";
894
+ requireHeaders: true;
895
+ use: (import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
896
+ orgOptions: OrganizationOptions;
897
+ roles: typeof defaultRoles & {
898
+ [key: string]: Role<{}>;
899
+ };
900
+ getSession: (context: import("@entro314labs/entro-auth-core").GenericEndpointContext) => Promise<{
901
+ session: {
902
+ id: string;
903
+ createdAt: Date;
904
+ updatedAt: Date;
905
+ userId: string;
906
+ expiresAt: Date;
907
+ token: string;
908
+ ipAddress?: string | null | undefined;
909
+ userAgent?: string | null | undefined;
910
+ } & {
911
+ activeTeamId?: string | undefined;
912
+ activeOrganizationId?: string | undefined;
913
+ };
914
+ user: {
915
+ id: string;
916
+ createdAt: Date;
917
+ updatedAt: Date;
918
+ email: string;
919
+ emailVerified: boolean;
920
+ name: string;
921
+ image?: string | null | undefined;
922
+ };
923
+ }>;
924
+ }>> | import("better-call").Middleware<{
925
+ use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
926
+ session: {
927
+ session: Record<string, any> & {
928
+ id: string;
929
+ createdAt: Date;
930
+ updatedAt: Date;
931
+ userId: string;
932
+ expiresAt: Date;
933
+ token: string;
934
+ ipAddress?: string | null | undefined;
935
+ userAgent?: string | null | undefined;
936
+ };
937
+ user: Record<string, any> & {
938
+ id: string;
939
+ createdAt: Date;
940
+ updatedAt: Date;
941
+ email: string;
942
+ emailVerified: boolean;
943
+ name: string;
944
+ image?: string | null | undefined;
945
+ };
946
+ };
947
+ }>>[];
948
+ }, (inputContext: import("better-call").MiddlewareInputContext<{
949
+ use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
950
+ session: {
951
+ session: Record<string, any> & {
952
+ id: string;
953
+ createdAt: Date;
954
+ updatedAt: Date;
955
+ userId: string;
956
+ expiresAt: Date;
957
+ token: string;
958
+ ipAddress?: string | null | undefined;
959
+ userAgent?: string | null | undefined;
960
+ };
961
+ user: Record<string, any> & {
962
+ id: string;
963
+ createdAt: Date;
964
+ updatedAt: Date;
965
+ email: string;
966
+ emailVerified: boolean;
967
+ name: string;
968
+ image?: string | null | undefined;
969
+ };
970
+ };
971
+ }>>[];
972
+ }>) => Promise<{
973
+ session: {
974
+ session: {
975
+ id: string;
976
+ createdAt: Date;
977
+ updatedAt: Date;
978
+ userId: string;
979
+ expiresAt: Date;
980
+ token: string;
981
+ ipAddress?: string | null | undefined;
982
+ userAgent?: string | null | undefined;
983
+ } & {
984
+ activeTeamId?: string | undefined;
985
+ activeOrganizationId?: string | undefined;
986
+ };
987
+ user: {
988
+ id: string;
989
+ createdAt: Date;
990
+ updatedAt: Date;
991
+ email: string;
992
+ emailVerified: boolean;
993
+ name: string;
994
+ image?: string | null | undefined;
995
+ };
996
+ };
997
+ }>>)[];
998
+ query: z.ZodOptional<z.ZodObject<{
999
+ organizationId: z.ZodOptional<z.ZodString>;
1000
+ }, z.core.$strip>>;
1001
+ }, ((O["teams"] extends {
1002
+ enabled: true;
1003
+ } ? {
1004
+ id: string;
1005
+ organizationId: string;
1006
+ email: string;
1007
+ role: InferOrganizationRolesFromOption<O>;
1008
+ status: InvitationStatus;
1009
+ inviterId: string;
1010
+ expiresAt: Date;
1011
+ createdAt: Date;
1012
+ teamId?: string | undefined;
1013
+ } : {
1014
+ id: string;
1015
+ organizationId: string;
1016
+ email: string;
1017
+ role: InferOrganizationRolesFromOption<O>;
1018
+ status: InvitationStatus;
1019
+ inviterId: string;
1020
+ expiresAt: Date;
1021
+ createdAt: Date;
1022
+ }) & (O["schema"] extends {
1023
+ invitation?: {
1024
+ additionalFields: infer Field extends Record<string, import("@entro314labs/entro-auth-core/db").DBFieldAttribute>;
1025
+ } | undefined;
1026
+ } ? FieldAttributeToObject<Field> : {}) extends (infer T) ? { [K in keyof T]: T[K]; } : never)[]>;
1027
+ /**
1028
+ * List all invitations a user has received
1029
+ */
1030
+ export declare const listUserInvitations: <O extends OrganizationOptions>(options: O) => import("better-call").StrictEndpoint<"/organization/list-user-invitations", {
1031
+ method: "GET";
1032
+ use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
1033
+ orgOptions: OrganizationOptions;
1034
+ roles: typeof defaultRoles & {
1035
+ [key: string]: Role<{}>;
1036
+ };
1037
+ getSession: (context: import("@entro314labs/entro-auth-core").GenericEndpointContext) => Promise<{
1038
+ session: {
1039
+ id: string;
1040
+ createdAt: Date;
1041
+ updatedAt: Date;
1042
+ userId: string;
1043
+ expiresAt: Date;
1044
+ token: string;
1045
+ ipAddress?: string | null | undefined;
1046
+ userAgent?: string | null | undefined;
1047
+ } & {
1048
+ activeTeamId?: string | undefined;
1049
+ activeOrganizationId?: string | undefined;
1050
+ };
1051
+ user: {
1052
+ id: string;
1053
+ createdAt: Date;
1054
+ updatedAt: Date;
1055
+ email: string;
1056
+ emailVerified: boolean;
1057
+ name: string;
1058
+ image?: string | null | undefined;
1059
+ };
1060
+ }>;
1061
+ }>>[];
1062
+ query: z.ZodOptional<z.ZodObject<{
1063
+ email: z.ZodOptional<z.ZodString>;
1064
+ }, z.core.$strip>>;
1065
+ metadata: {
1066
+ openapi: {
1067
+ description: string;
1068
+ responses: {
1069
+ "200": {
1070
+ description: string;
1071
+ content: {
1072
+ "application/json": {
1073
+ schema: {
1074
+ type: "array";
1075
+ items: {
1076
+ type: string;
1077
+ properties: {
1078
+ id: {
1079
+ type: string;
1080
+ };
1081
+ email: {
1082
+ type: string;
1083
+ };
1084
+ role: {
1085
+ type: string;
1086
+ };
1087
+ organizationId: {
1088
+ type: string;
1089
+ };
1090
+ organizationName: {
1091
+ type: string;
1092
+ };
1093
+ inviterId: {
1094
+ type: string;
1095
+ description: string;
1096
+ };
1097
+ teamId: {
1098
+ type: string;
1099
+ description: string;
1100
+ nullable: boolean;
1101
+ };
1102
+ status: {
1103
+ type: string;
1104
+ };
1105
+ expiresAt: {
1106
+ type: string;
1107
+ };
1108
+ createdAt: {
1109
+ type: string;
1110
+ };
1111
+ };
1112
+ required: string[];
1113
+ };
1114
+ };
1115
+ };
1116
+ };
1117
+ };
1118
+ };
1119
+ };
1120
+ };
1121
+ }, (Omit<((O["teams"] extends {
1122
+ enabled: true;
1123
+ } ? {
1124
+ id: string;
1125
+ organizationId: string;
1126
+ email: string;
1127
+ role: InferOrganizationRolesFromOption<O>;
1128
+ status: InvitationStatus;
1129
+ inviterId: string;
1130
+ expiresAt: Date;
1131
+ createdAt: Date;
1132
+ teamId?: string | undefined;
1133
+ } : {
1134
+ id: string;
1135
+ organizationId: string;
1136
+ email: string;
1137
+ role: InferOrganizationRolesFromOption<O>;
1138
+ status: InvitationStatus;
1139
+ inviterId: string;
1140
+ expiresAt: Date;
1141
+ createdAt: Date;
1142
+ }) & (O["schema"] extends {
1143
+ invitation?: {
1144
+ additionalFields: infer Field extends Record<string, import("@entro314labs/entro-auth-core/db").DBFieldAttribute>;
1145
+ } | undefined;
1146
+ } ? FieldAttributeToObject<Field> : {}) extends (infer T) ? { [K in keyof T]: T[K]; } : never) & {
1147
+ organization: {
1148
+ id: string;
1149
+ name: string;
1150
+ slug: string;
1151
+ createdAt: Date;
1152
+ logo?: string | null | undefined;
1153
+ metadata?: any;
1154
+ } & (O["schema"] extends {
1155
+ organization?: {
1156
+ additionalFields: infer Field extends Record<string, import("@entro314labs/entro-auth-core/db").DBFieldAttribute>;
1157
+ } | undefined;
1158
+ } ? FieldAttributeToObject<Field> : {}) extends (infer T_1) ? { [K_1 in keyof T_1]: T_1[K_1]; } : never;
1159
+ }, "organization"> & {
1160
+ organizationName: ({
1161
+ id: string;
1162
+ name: string;
1163
+ slug: string;
1164
+ createdAt: Date;
1165
+ logo?: string | null | undefined;
1166
+ metadata?: any;
1167
+ } & (O["schema"] extends {
1168
+ organization?: {
1169
+ additionalFields: infer Field extends Record<string, import("@entro314labs/entro-auth-core/db").DBFieldAttribute>;
1170
+ } | undefined;
1171
+ } ? FieldAttributeToObject<Field> : {}))["name"];
1172
+ })[]>;
1173
+ export {};