faire-auth 1.0.4 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (228) hide show
  1. package/dist/{adapter-factory-lKIOf2OR.mjs → adapter-factory-qPVW8x9-.mjs} +34 -36
  2. package/dist/{adapter-factory-D1I7joki.cjs → adapter-factory-u8r3oTez.cjs} +66 -68
  3. package/dist/adapters/drizzle-adapter/index.cjs +34 -40
  4. package/dist/adapters/drizzle-adapter/index.d.cts +4 -9
  5. package/dist/adapters/drizzle-adapter/index.d.mts +4 -9
  6. package/dist/adapters/drizzle-adapter/index.mjs +20 -26
  7. package/dist/adapters/index.cjs +11 -16
  8. package/dist/adapters/index.d.cts +11 -37
  9. package/dist/adapters/index.d.mts +11 -37
  10. package/dist/adapters/index.mjs +4 -13
  11. package/dist/adapters/kysely-adapter/index.cjs +270 -11
  12. package/dist/adapters/kysely-adapter/index.d.cts +9 -19
  13. package/dist/adapters/kysely-adapter/index.d.mts +9 -19
  14. package/dist/adapters/kysely-adapter/index.mjs +267 -9
  15. package/dist/adapters/memory-adapter/index.cjs +146 -9
  16. package/dist/adapters/memory-adapter/index.d.cts +4 -10
  17. package/dist/adapters/memory-adapter/index.d.mts +4 -10
  18. package/dist/adapters/memory-adapter/index.mjs +145 -9
  19. package/dist/adapters/mongodb-adapter/index.cjs +13 -21
  20. package/dist/adapters/mongodb-adapter/index.d.cts +3 -8
  21. package/dist/adapters/mongodb-adapter/index.d.mts +4 -9
  22. package/dist/adapters/mongodb-adapter/index.mjs +12 -20
  23. package/dist/adapters/prisma-adapter/index.cjs +12 -20
  24. package/dist/adapters/prisma-adapter/index.d.cts +4 -8
  25. package/dist/adapters/prisma-adapter/index.d.mts +4 -8
  26. package/dist/adapters/prisma-adapter/index.mjs +5 -13
  27. package/dist/adapters/test.cjs +86 -69
  28. package/dist/adapters/test.d.cts +7 -11
  29. package/dist/adapters/test.d.mts +7 -11
  30. package/dist/adapters/test.mjs +83 -66
  31. package/dist/api/index.cjs +3 -20
  32. package/dist/api/index.d.cts +2 -3
  33. package/dist/api/index.d.mts +2 -3
  34. package/dist/api/index.mjs +1 -20
  35. package/dist/api/middleware/index.cjs +4 -11
  36. package/dist/api/middleware/index.d.cts +3 -9
  37. package/dist/api/middleware/index.d.mts +3 -9
  38. package/dist/api/middleware/index.mjs +3 -11
  39. package/dist/{api-B4RDwBty.mjs → api-0f-F-Fi2.mjs} +292 -189
  40. package/dist/{api-CaRC1Gio.cjs → api-LjfH6hQi.cjs} +557 -452
  41. package/dist/{test-utils/bun-sqlite-dialect-BZBvHchL.cjs → bun-sqlite-dialect-BHkarnxN.cjs} +5 -9
  42. package/dist/{test-utils/bun-sqlite-dialect-BSWhhKNs.mjs → bun-sqlite-dialect-BiZBuEF6.mjs} +6 -9
  43. package/dist/client/index.cjs +8 -15
  44. package/dist/client/index.d.cts +9 -14
  45. package/dist/client/index.d.mts +9 -14
  46. package/dist/client/index.mjs +7 -15
  47. package/dist/client/lynx/index.cjs +10 -18
  48. package/dist/client/lynx/index.d.cts +402 -71
  49. package/dist/client/lynx/index.d.mts +402 -71
  50. package/dist/client/lynx/index.mjs +5 -13
  51. package/dist/client/plugins/index.cjs +3 -5
  52. package/dist/client/plugins/index.d.cts +5 -10
  53. package/dist/client/plugins/index.d.mts +5 -10
  54. package/dist/client/plugins/index.mjs +2 -4
  55. package/dist/client/react/index.cjs +6 -14
  56. package/dist/client/react/index.d.cts +402 -71
  57. package/dist/client/react/index.d.mts +402 -71
  58. package/dist/client/react/index.mjs +5 -13
  59. package/dist/client/solid/index.cjs +6 -14
  60. package/dist/client/solid/index.d.cts +393 -57
  61. package/dist/client/solid/index.d.mts +393 -57
  62. package/dist/client/solid/index.mjs +5 -13
  63. package/dist/client/svelte/index.cjs +5 -10
  64. package/dist/client/svelte/index.d.cts +400 -67
  65. package/dist/client/svelte/index.d.mts +400 -67
  66. package/dist/client/svelte/index.mjs +4 -10
  67. package/dist/client/vue/index.cjs +6 -14
  68. package/dist/client/vue/index.d.cts +401 -68
  69. package/dist/client/vue/index.d.mts +401 -68
  70. package/dist/client/vue/index.mjs +5 -13
  71. package/dist/{cookies-BTs1o992.mjs → cookies-D9aY_gJh.mjs} +25 -21
  72. package/dist/{cookies-BTl72THv.cjs → cookies-DQ52rcOy.cjs} +119 -115
  73. package/dist/crypto/index.cjs +10 -8
  74. package/dist/crypto/index.d.cts +5 -13
  75. package/dist/crypto/index.d.mts +5 -13
  76. package/dist/crypto/index.mjs +2 -5
  77. package/dist/{crypto-DH2Aa7jN.mjs → crypto-BH-hD0lJ.mjs} +7 -10
  78. package/dist/{crypto-DpSCnrTp.cjs → crypto-BITfWVwD.cjs} +24 -27
  79. package/dist/db/index.cjs +1135 -29
  80. package/dist/db/index.d.cts +1 -2
  81. package/dist/db/index.d.mts +1 -2
  82. package/dist/db/index.mjs +1115 -16
  83. package/dist/defu-D2h4S3X-.mjs +87 -0
  84. package/dist/defu-DWS5RPWt.cjs +134 -0
  85. package/dist/{email-verification-DI_0H4JC.cjs → email-verification-DOPnSgbI.cjs} +65 -71
  86. package/dist/{email-verification-C_lBu_JY.mjs → email-verification-YSR5n5lb.mjs} +23 -29
  87. package/dist/{hono-CO-zsqI-.mjs → hono-BAV2wQkK.mjs} +16 -33
  88. package/dist/hono-SVQuc5Ru.mjs +4 -0
  89. package/dist/hono-pgK4H_U1.cjs +9 -0
  90. package/dist/{hono-DnW5crl1.cjs → hono-tyFFJFdS.cjs} +42 -60
  91. package/dist/index-B86Cy0dE.d.cts +2 -0
  92. package/dist/index-B86Cy0dE.d.mts +2 -0
  93. package/dist/index.cjs +115 -150
  94. package/dist/index.d.cts +4 -5
  95. package/dist/index.d.mts +4 -5
  96. package/dist/index.mjs +45 -80
  97. package/dist/integrations/next-js.cjs +5 -9
  98. package/dist/integrations/next-js.d.cts +6 -14
  99. package/dist/integrations/next-js.d.mts +6 -14
  100. package/dist/integrations/next-js.mjs +4 -9
  101. package/dist/integrations/node.cjs +16 -14
  102. package/dist/integrations/node.d.cts +6 -14
  103. package/dist/integrations/node.d.mts +6 -14
  104. package/dist/integrations/node.mjs +15 -13
  105. package/dist/integrations/react-start.cjs +7 -11
  106. package/dist/integrations/react-start.d.cts +5 -13
  107. package/dist/integrations/react-start.d.mts +5 -13
  108. package/dist/integrations/react-start.mjs +6 -11
  109. package/dist/integrations/solid-start.cjs +3 -5
  110. package/dist/integrations/solid-start.d.cts +2 -5
  111. package/dist/integrations/solid-start.d.mts +2 -5
  112. package/dist/integrations/solid-start.mjs +2 -4
  113. package/dist/integrations/svelte-kit.cjs +6 -10
  114. package/dist/integrations/svelte-kit.d.cts +11 -23
  115. package/dist/integrations/svelte-kit.d.mts +11 -23
  116. package/dist/integrations/svelte-kit.mjs +5 -10
  117. package/dist/{ip-BjNYspCH.mjs → ip-6Lv2o42m.mjs} +4 -9
  118. package/dist/{ip-C17Qdq-G.cjs → ip-DPydExzV.cjs} +21 -27
  119. package/dist/{json--tl7Grvs.cjs → json-D3aq-nH2.cjs} +9 -13
  120. package/dist/{json-B1v2qRTQ.mjs → json-DooGMtnJ.mjs} +2 -5
  121. package/dist/{logged-CyGfp8_H.mjs → logged-B83SzMnJ.mjs} +6 -10
  122. package/dist/{logged-Dv3st5qc.cjs → logged-BIpCpnVY.cjs} +13 -18
  123. package/dist/{middleware-CE6OhDkq.mjs → middleware-Cakg4e1D.mjs} +2 -4
  124. package/dist/{middleware-CWvRH4EW.cjs → middleware-Cd-VkNxB.cjs} +17 -20
  125. package/dist/{node-sqlite-dialect-w4DAg0PH.mjs → node-sqlite-dialect-BMVOjEMh.mjs} +6 -9
  126. package/dist/{test-utils/node-sqlite-dialect-BgJqjBOu.cjs → node-sqlite-dialect-D3QPFROH.cjs} +5 -9
  127. package/dist/oauth2/index.cjs +166 -22
  128. package/dist/oauth2/index.d.cts +5 -17
  129. package/dist/oauth2/index.d.mts +5 -17
  130. package/dist/oauth2/index.mjs +156 -16
  131. package/dist/{origin-check-DjLTuZQ8.cjs → origin-check-BflGhEEN.cjs} +34 -38
  132. package/dist/{origin-check-8Gajklvh.mjs → origin-check-CRgs1M7k.mjs} +13 -16
  133. package/dist/{parser-B25ylT5u.mjs → parser-CqwvpF6l.cjs} +12 -10
  134. package/dist/{parser-B_wxvaAr.cjs → parser-DcKDjjHO.mjs} +7 -22
  135. package/dist/plugins/access/index.cjs +38 -4
  136. package/dist/plugins/access/index.d.cts +36 -2
  137. package/dist/plugins/access/index.d.mts +36 -2
  138. package/dist/plugins/access/index.mjs +36 -3
  139. package/dist/plugins/bearer/index.cjs +52 -7
  140. package/dist/plugins/bearer/index.d.cts +27 -4
  141. package/dist/plugins/bearer/index.d.mts +27 -4
  142. package/dist/plugins/bearer/index.mjs +51 -7
  143. package/dist/plugins/index.cjs +1385 -842
  144. package/dist/plugins/index.d.cts +489 -7566
  145. package/dist/plugins/index.d.mts +489 -7566
  146. package/dist/plugins/index.mjs +1118 -576
  147. package/dist/plugins/passkey/index.cjs +551 -15
  148. package/dist/plugins/passkey/index.d.cts +123 -4
  149. package/dist/plugins/passkey/index.d.mts +123 -4
  150. package/dist/plugins/passkey/index.mjs +547 -15
  151. package/dist/{chunk-BFnQceUY.mjs → rolldown-runtime-BKpuH2hG.mjs} +6 -7
  152. package/dist/{chunk-fPmz2rbM.cjs → rolldown-runtime-C_Pgydhf.cjs} +22 -24
  153. package/dist/{schema-DTIwLLmf.mjs → schema-CFCpv0tK.mjs} +3 -6
  154. package/dist/{schema-CirKflVs.cjs → schema-b-lKhMkG.cjs} +51 -55
  155. package/dist/{session-CM3rmOYF.mjs → session-BGjJgihS.mjs} +51 -74
  156. package/dist/{session-Cwrj4GfV.cjs → session-CzZSMmQC.cjs} +197 -219
  157. package/dist/shared.d.cts +1581 -0
  158. package/dist/shared.d.mts +1581 -0
  159. package/dist/social-providers/index.cjs +9 -9
  160. package/dist/social-providers/index.d.cts +1 -1
  161. package/dist/social-providers/index.d.mts +1 -1
  162. package/dist/social-providers/index.mjs +3 -5
  163. package/dist/social-providers-CjPww-qf.mjs +6 -0
  164. package/dist/social-providers-D7w_7Ym8.cjs +10 -0
  165. package/dist/{state-CvSihlVT.cjs → state-2OrNjOO-.cjs} +24 -24
  166. package/dist/{state-CQghgH9I.mjs → state-Dooeisfq.mjs} +17 -17
  167. package/dist/{bun-sqlite-dialect-DPgTzc0w.cjs → test-utils/bun-sqlite-dialect-BHkarnxN.cjs} +5 -9
  168. package/dist/{bun-sqlite-dialect-6NqeV3px.mjs → test-utils/bun-sqlite-dialect-BiZBuEF6.mjs} +6 -9
  169. package/dist/test-utils/index.cjs +8831 -7941
  170. package/dist/test-utils/index.d.cts +310 -12440
  171. package/dist/test-utils/index.d.mts +313 -12440
  172. package/dist/test-utils/index.mjs +8591 -7701
  173. package/dist/test-utils/{node-sqlite-dialect-DAQXiobH.mjs → node-sqlite-dialect-BMVOjEMh.mjs} +6 -9
  174. package/dist/{node-sqlite-dialect-DP11CB0y.cjs → test-utils/node-sqlite-dialect-D3QPFROH.cjs} +5 -9
  175. package/dist/types/index.d.cts +2 -3
  176. package/dist/types/index.d.mts +2 -3
  177. package/dist/types/index.mjs +1 -1
  178. package/dist/{url-BoUuoIwZ.mjs → url-CJtdrrUu.mjs} +12 -13
  179. package/dist/{url-Ce7CVaQD.cjs → url-DjCmCUHS.cjs} +42 -44
  180. package/dist/utils/cookies.cjs +29 -30
  181. package/dist/utils/cookies.d.cts +21 -25
  182. package/dist/utils/cookies.d.mts +20 -24
  183. package/dist/utils/cookies.mjs +2 -7
  184. package/dist/utils-C7OHyfHa.mjs +4 -0
  185. package/dist/utils-iX0Vy_UL.cjs +3 -0
  186. package/package.json +40 -30
  187. package/dist/access-BZ7-AbTM.cjs +0 -51
  188. package/dist/access-D0DRqUKC.mjs +0 -39
  189. package/dist/bearer-DDzrp5M7.cjs +0 -60
  190. package/dist/bearer-WZcs7gxL.mjs +0 -54
  191. package/dist/db-4tUsQJXd.mjs +0 -1119
  192. package/dist/db-ChMbb_U-.cjs +0 -1180
  193. package/dist/defu-BmOYq4PU.cjs +0 -34
  194. package/dist/defu-D9ZTXqlo.mjs +0 -28
  195. package/dist/hono-C14rpOEa.cjs +0 -13
  196. package/dist/hono-CoKYWnXA.mjs +0 -7
  197. package/dist/hono-D0VqxVy1.d.mts +0 -18
  198. package/dist/hono-DOM31WQz.d.cts +0 -18
  199. package/dist/index--DLiUhEn.d.mts +0 -33
  200. package/dist/index-B4bqEDYG.d.mts +0 -992
  201. package/dist/index-BDhhaE6Y.d.cts +0 -3
  202. package/dist/index-Boa0SV4h.d.cts +0 -13350
  203. package/dist/index-Bykgiq3o.d.cts +0 -13350
  204. package/dist/index-CF9iq55a.d.mts +0 -3
  205. package/dist/index-CRt_fppq.d.mts +0 -41
  206. package/dist/index-CdLyn7qP.d.cts +0 -41
  207. package/dist/index-ClFGA8tb.d.mts +0 -33
  208. package/dist/index-ClOM0wFf.d.cts +0 -992
  209. package/dist/index-CsxNfGAV.d.mts +0 -13350
  210. package/dist/index-DKnO_Zfm.d.cts +0 -992
  211. package/dist/index-DRYO4mGd.d.cts +0 -33
  212. package/dist/index-Dsua4U8w.d.cts +0 -33
  213. package/dist/index-DxXFCG2_.d.mts +0 -13350
  214. package/dist/index-gtCVvDvC.d.mts +0 -992
  215. package/dist/kysely-adapter-CtIdoHa8.mjs +0 -270
  216. package/dist/kysely-adapter-QZTx077T.cjs +0 -288
  217. package/dist/memory-adapter-17RZd5df.cjs +0 -154
  218. package/dist/memory-adapter-Dp4XdCZK.mjs +0 -148
  219. package/dist/oauth2-5RL4cVNS.cjs +0 -177
  220. package/dist/oauth2-C56wz-n9.mjs +0 -159
  221. package/dist/passkey-BTT-v5c-.cjs +0 -512
  222. package/dist/passkey-CzY_W2us.mjs +0 -505
  223. package/dist/request-1NL_1lyJ.mjs +0 -58
  224. package/dist/request-CPNlp-DK.cjs +0 -100
  225. package/dist/social-providers-B8RK5yqI.mjs +0 -9
  226. package/dist/social-providers-BmFOIIPk.cjs +0 -13
  227. package/dist/utils-44aDDP8f.cjs +0 -2
  228. package/dist/utils-D4vZd1-9.mjs +0 -4
@@ -1,22 +1,22 @@
1
- const require_chunk = require('./chunk-fPmz2rbM.cjs');
2
- const require_json = require('./json--tl7Grvs.cjs');
3
- const require_cookies = require('./cookies-BTl72THv.cjs');
4
- const require_logged = require('./logged-Dv3st5qc.cjs');
5
- const require_url = require('./url-Ce7CVaQD.cjs');
6
- const require_middleware = require('./middleware-CWvRH4EW.cjs');
7
- let __faire_auth_core_env = require("@faire-auth/core/env");
8
- let __faire_auth_core_error = require("@faire-auth/core/error");
9
- let __faire_auth_core_factory = require("@faire-auth/core/factory");
10
- let __faire_auth_core_static = require("@faire-auth/core/static");
11
- let __faire_auth_core_utils = require("@faire-auth/core/utils");
12
- let __faire_auth_core_datatypes = require("@faire-auth/core/datatypes");
1
+ const require_rolldown_runtime = require("./rolldown-runtime-C_Pgydhf.cjs");
2
+ const require_cookies = require("./cookies-DQ52rcOy.cjs");
3
+ const require_json = require("./json-D3aq-nH2.cjs");
4
+ require("./hono-pgK4H_U1.cjs");
5
+ const require_logged = require("./logged-BIpCpnVY.cjs");
6
+ const require_url = require("./url-DjCmCUHS.cjs");
7
+ const require_middleware = require("./middleware-Cd-VkNxB.cjs");
8
+ let _faire_auth_core_env = require("@faire-auth/core/env");
9
+ let _faire_auth_core_error = require("@faire-auth/core/error");
10
+ let _faire_auth_core_factory = require("@faire-auth/core/factory");
11
+ let _faire_auth_core_static = require("@faire-auth/core/static");
12
+ let _faire_auth_core_utils = require("@faire-auth/core/utils");
13
+ let _faire_auth_core_datatypes = require("@faire-auth/core/datatypes");
13
14
  let hono_http_exception = require("hono/http-exception");
14
15
  let zod = require("zod");
15
- zod = require_chunk.__toESM(zod);
16
- let __faire_auth_core_db = require("@faire-auth/core/db");
16
+ zod = require_rolldown_runtime.__toESM(zod, 1);
17
+ let _faire_auth_core_db = require("@faire-auth/core/db");
17
18
  let hono_context_storage = require("hono/context-storage");
18
-
19
- //#region src/api/middleware/context.ts
19
+ // src/api/middleware/context.ts
20
20
  /**
21
21
  * Initializes the context middleware.
22
22
  * @template O - The options type.
@@ -30,14 +30,12 @@ const initContextMiddleware = (options, context, api) => require_middleware.crea
30
30
  ctx.set("path", ctx.req.path.slice((options.basePath ?? "/api/auth").length));
31
31
  return await next();
32
32
  });
33
-
34
- //#endregion
35
- //#region src/api/middleware/hooks.ts
33
+ // src/api/middleware/hooks.ts
36
34
  const runHooks = async (ctx, hooks) => {
37
35
  let response = void 0;
38
36
  for (const hook of hooks) if (hook.matcher(ctx)) try {
39
37
  const maybePromise = hook.handler(ctx);
40
- const result = (0, __faire_auth_core_static.isPromise)(maybePromise) ? await maybePromise : maybePromise;
38
+ const result = (0, _faire_auth_core_static.isPromise)(maybePromise) ? await maybePromise : maybePromise;
41
39
  if (result instanceof Response) response = result;
42
40
  } catch (error) {
43
41
  ctx.error = error;
@@ -86,9 +84,7 @@ const initHooksMiddleware = (options) => {
86
84
  if (after instanceof Response) ctx.res = after;
87
85
  });
88
86
  };
89
-
90
- //#endregion
91
- //#region src/api/middleware/on-error.ts
87
+ // src/api/middleware/on-error.ts
92
88
  /**
93
89
  * Initializes the error handler.
94
90
  * @param options - The FaireAuth options.
@@ -96,19 +92,19 @@ const initHooksMiddleware = (options) => {
96
92
  */
97
93
  const initErrorHandler = (options) => require_middleware.createErrorHandler()(async (e, ctx) => {
98
94
  const ret = ctx.finalized === true ? ctx.res : e instanceof Response ? e : e instanceof hono_http_exception.HTTPException ? e.getResponse() : ctx.json({
99
- success: __faire_auth_core_static.False,
95
+ success: _faire_auth_core_static.False,
100
96
  ...options.onAPIError?.exposeMessage === true && { message: e.message }
101
97
  }, 500);
102
- if (e instanceof __faire_auth_core_error.APIError && e.statusText === "FOUND") return ret;
98
+ if (e instanceof _faire_auth_core_error.APIError && e.statusText === "FOUND") return ret;
103
99
  if (options.onAPIError?.throw === true) throw e;
104
100
  if (options.onAPIError?.onError) {
105
- const res$1 = options.onAPIError.onError(e, ctx);
106
- if ((0, __faire_auth_core_static.isPromise)(res$1)) await res$1;
101
+ const res = options.onAPIError.onError(e, ctx);
102
+ if ((0, _faire_auth_core_static.isPromise)(res)) await res;
107
103
  return ret;
108
104
  }
109
105
  const optLogLevel = options.logger?.level;
110
106
  const critLog = ctx.get("context")?.logger ?? console;
111
- const log = optLogLevel === "error" || optLogLevel === "warn" || optLogLevel === "debug" ? __faire_auth_core_env.logger : void 0;
107
+ const log = optLogLevel === "error" || optLogLevel === "warn" || optLogLevel === "debug" ? _faire_auth_core_env.logger : void 0;
112
108
  if (options.logger?.disabled !== true) {
113
109
  if (e != null && typeof e === "object" && "message" in e && typeof e.message === "string") {
114
110
  if (e.message.includes("no column") || e.message.includes("column") || e.message.includes("relation") || e.message.includes("table") || e.message.includes("does not exist")) {
@@ -116,16 +112,14 @@ const initErrorHandler = (options) => require_middleware.createErrorHandler()(as
116
112
  return ret;
117
113
  }
118
114
  }
119
- if (e instanceof __faire_auth_core_error.APIError) {
115
+ if (e instanceof _faire_auth_core_error.APIError) {
120
116
  if (e.statusText === "INTERNAL_SERVER_ERROR") critLog.error(e.statusText, e);
121
117
  log?.error(e.message);
122
118
  } else critLog.error(e != null && typeof e === "object" && "name" in e ? e.name : "", e);
123
119
  }
124
120
  return ret;
125
121
  });
126
-
127
- //#endregion
128
- //#region src/api/middleware/server-api.ts
122
+ // src/api/middleware/server-api.ts
129
123
  /**
130
124
  * Middleware that sets a flag indicating the route was called from the server-side API.
131
125
  * This should only be used with localApp in createEndpoint to provide permissions depth.
@@ -134,9 +128,7 @@ const serverApiMiddleware = require_middleware.createMiddleware()(async (ctx, ne
134
128
  ctx.set("isServer", true);
135
129
  return await next();
136
130
  });
137
-
138
- //#endregion
139
- //#region src/utils/hono.ts
131
+ // src/utils/hono.ts
140
132
  const createDefaultExecutionCtx = (ctx) => {
141
133
  Object.defineProperty(ctx, "executionCtx", {
142
134
  get: () => ({
@@ -148,9 +140,7 @@ const createDefaultExecutionCtx = (ctx) => {
148
140
  enumerable: true
149
141
  });
150
142
  };
151
-
152
- //#endregion
153
- //#region src/api/middleware/set-execution-ctx.ts
143
+ // src/api/middleware/set-execution-ctx.ts
154
144
  /**
155
145
  * Sets the default execution context if not already present.
156
146
  * Manages promises to await after the middleware chain.
@@ -167,21 +157,17 @@ const setDefaultExecutionCtx = require_middleware.createMiddleware()(async (ctx,
167
157
  await next();
168
158
  if (hasDefaultExecutionCtx === true) await Promise.allSettled(ctx.get("toAwait"));
169
159
  });
170
-
171
- //#endregion
172
- //#region src/api/middleware/set-renderer.ts
160
+ // src/api/middleware/set-renderer.ts
173
161
  /**
174
162
  * Sets the renderer for the context.
175
163
  *
176
164
  * @todo `options.hono?.advanced?.cbor === true ? cborRespond : ctx.json`
177
165
  */
178
166
  const setRenderer = require_middleware.createMiddleware()(async (ctx, next) => {
179
- ctx.setRenderer((0, __faire_auth_core_factory.initRenderer)(ctx));
167
+ ctx.setRenderer((0, _faire_auth_core_factory.initRenderer)(ctx));
180
168
  return await next();
181
169
  });
182
-
183
- //#endregion
184
- //#region src/api/factory/endpoint.ts
170
+ // src/api/factory/endpoint.ts
185
171
  /**
186
172
  * Creates an auth endpoint.
187
173
  * @template C - The route config type.
@@ -195,48 +181,48 @@ const createEndpoint = (config, handler, hook) => {
195
181
  return ((options) => {
196
182
  const resolvedHandler = handler(options);
197
183
  let localApp = null;
198
- const execute = require_logged.logged_default.wrap(async (...args) => {
184
+ const execute = require_logged.LoggerAPI.wrap(async (...args) => {
199
185
  if (!bundle) throw new Error(`${config.operationId} config() must be called before using execute()!`);
200
186
  const [inputOrCtx, maybeCtx] = args;
201
- const { input, ctx, opts } = (0, __faire_auth_core_utils.isContextLike)(inputOrCtx) ? {
187
+ const { input, ctx, opts } = (0, _faire_auth_core_utils.isContextLike)(inputOrCtx) ? {
202
188
  input: void 0,
203
189
  ctx: inputOrCtx,
204
190
  opts: void 0
205
- } : (0, __faire_auth_core_utils.isContextLike)(maybeCtx) ? {
191
+ } : (0, _faire_auth_core_utils.isContextLike)(maybeCtx) ? {
206
192
  input: inputOrCtx,
207
193
  ctx: maybeCtx,
208
194
  opts: void 0
209
- } : (0, __faire_auth_core_utils.isExecOpts)(inputOrCtx) ? {
195
+ } : (0, _faire_auth_core_utils.isExecOpts)(inputOrCtx) ? {
210
196
  input: void 0,
211
197
  ctx: void 0,
212
198
  opts: inputOrCtx
213
199
  } : {
214
200
  input: inputOrCtx,
215
201
  ctx: void 0,
216
- opts: (0, __faire_auth_core_utils.isExecOpts)(maybeCtx) ? maybeCtx : void 0
202
+ opts: (0, _faire_auth_core_utils.isExecOpts)(maybeCtx) ? maybeCtx : void 0
217
203
  };
218
204
  if (ctx == null) {
219
205
  if (localApp == null) throw new Error(`${config.operationId} handler() must be called before using server-side execute()!`);
220
- const res$1 = localApp.fetch(new Request(...bundle.builder(input, opts?.headers)));
221
- if (opts?.returnHeaders === true) return res$1 instanceof Response ? bundle.parser(res$1).then((r) => ({
222
- headers: res$1.headers,
206
+ const res = localApp.fetch(new Request(...bundle.builder(input, opts?.headers)));
207
+ if (opts?.returnHeaders === true) return res instanceof Response ? bundle.parser(res).then((r) => ({
208
+ headers: res.headers,
223
209
  response: r
224
- })) : res$1.then((re) => bundle.parser(re).then((r) => ({
210
+ })) : res.then((re) => bundle.parser(re).then((r) => ({
225
211
  headers: re.headers,
226
212
  response: r
227
213
  })));
228
- if (opts?.asResponse === true) return res$1;
229
- return Promise.resolve(res$1).then((r) => bundle.parser(r));
214
+ if (opts?.asResponse === true) return res;
215
+ return Promise.resolve(res).then((r) => bundle.parser(r));
230
216
  }
231
- const out = await resolvedHandler((0, __faire_auth_core_utils.withOverlays)(ctx, input, config), async () => {
217
+ const out = await resolvedHandler((0, _faire_auth_core_utils.withOverlays)(ctx, input, config), async () => {
232
218
  throw new Error("next() called in manual execution when response was expected");
233
219
  });
234
220
  return bundle.parser(out);
235
221
  }, config.operationId, "immediate");
236
222
  execute.toArgs = (builtSchemas, context, api, routeHook = hook) => {
237
- if (!bundle) bundle = (0, __faire_auth_core_factory.buildRouteBundle)(config, resolvedHandler, require_url.getBaseURL(options.baseURL, options.basePath), options, builtSchemas, routeHook, context.logger);
238
- else if (!(0, __faire_auth_core_env.isTest)()) context.logger.warn(`${bundle.resolvedConfig.operationId} config() already initialized`);
239
- if (!localApp) localApp = (0, __faire_auth_core_factory.createRouteAppWrapper)(bundle.routeApp, [
223
+ if (!bundle) bundle = (0, _faire_auth_core_factory.buildRouteBundle)(config, resolvedHandler, require_url.getBaseURL(options.baseURL, options.basePath), options, builtSchemas, routeHook, context.logger);
224
+ else if (!(0, _faire_auth_core_env.isTest)()) context.logger.warn(`${bundle.resolvedConfig.operationId} config() already initialized`);
225
+ if (!localApp) localApp = (0, _faire_auth_core_factory.createRouteAppWrapper)(bundle.routeApp, [
240
226
  serverApiMiddleware,
241
227
  setDefaultExecutionCtx,
242
228
  setRenderer,
@@ -244,7 +230,7 @@ const createEndpoint = (config, handler, hook) => {
244
230
  (0, hono_context_storage.contextStorage)(),
245
231
  initHooksMiddleware(options)
246
232
  ], initErrorHandler(options), options.basePath);
247
- else if (!(0, __faire_auth_core_env.isTest)()) context.logger.warn(`${config.operationId} handler() was called when already initialized`);
233
+ else if (!(0, _faire_auth_core_env.isTest)()) context.logger.warn(`${config.operationId} handler() was called when already initialized`);
248
234
  return [
249
235
  bundle.resolvedConfig,
250
236
  resolvedHandler,
@@ -255,10 +241,12 @@ const createEndpoint = (config, handler, hook) => {
255
241
  });
256
242
  };
257
243
  const createAPI = (endpoints) => endpoints;
258
-
259
- //#endregion
260
- //#region src/api/schema/session.ts
244
+ // src/api/schema/session.ts
261
245
  const getSessionQuerySchema = zod.object({
246
+ /**
247
+ * If cookie cache is enabled, it will disable the cache
248
+ * and fetch the session from the database
249
+ */
262
250
  disableCookieCache: zod.boolean().or(zod.string().transform((v) => v === "true")).openapi({
263
251
  param: {
264
252
  in: "query",
@@ -275,41 +263,37 @@ const getSessionQuerySchema = zod.object({
275
263
  })
276
264
  }).partial();
277
265
  const revokeSessionSchema = zod.object({ token: zod.string().openapi({ description: "The token to revoke" }) });
278
-
279
- //#endregion
280
- //#region src/api/routes/session.ts
281
- const getSessionRoute = (0, __faire_auth_core_factory.createRoute)({
282
- operationId: __faire_auth_core_static.Routes.GET_SESSION,
266
+ const getSession = createEndpoint((0, _faire_auth_core_factory.createRoute)({
267
+ operationId: _faire_auth_core_static.Routes.GET_SESSION,
283
268
  method: "get",
284
269
  path: "/get-session",
285
270
  description: "Get the current session",
286
- request: (0, __faire_auth_core_factory.req)().qry(getSessionQuerySchema).bld(),
287
- responses: (0, __faire_auth_core_factory.res)(__faire_auth_core_static.SCHEMAS[__faire_auth_core_static.Definitions.SESSION_USER].default).err(401, "Failed to get session or expired").zod().err(500, "Unexpected Error").bld()
288
- });
289
- const getSession = createEndpoint(getSessionRoute, (options) => async (ctx) => {
271
+ request: (0, _faire_auth_core_factory.req)().qry(getSessionQuerySchema).bld(),
272
+ responses: (0, _faire_auth_core_factory.res)(_faire_auth_core_static.SCHEMAS[_faire_auth_core_static.Definitions.SESSION_USER].default).err(401, "Failed to get session or expired").zod().err(500, "Unexpected Error").bld()
273
+ }), (options) => async (ctx) => {
290
274
  const { disableCookieCache, disableRefresh } = ctx.req.valid("query");
291
275
  const context = ctx.get("context");
292
276
  try {
293
277
  const sessionCookieToken = await (0, require_cookies.cookies_exports.getSignedCookie)(ctx, context.secret, context.authCookies.sessionToken.name);
294
278
  if (sessionCookieToken == null) return ctx.render({
295
- success: __faire_auth_core_static.False,
296
- message: __faire_auth_core_error.BASE_ERROR_CODES.FAILED_TO_GET_SESSION
279
+ success: _faire_auth_core_static.False,
280
+ message: _faire_auth_core_error.BASE_ERROR_CODES.FAILED_TO_GET_SESSION
297
281
  }, 401);
298
282
  if (sessionCookieToken === false) return ctx.render({
299
- success: __faire_auth_core_static.False,
300
- message: __faire_auth_core_error.BASE_ERROR_CODES.SESSION_EXPIRED
283
+ success: _faire_auth_core_static.False,
284
+ message: _faire_auth_core_error.BASE_ERROR_CODES.SESSION_EXPIRED
301
285
  }, 401);
302
286
  const sessionDataCookie = (0, require_cookies.cookies_exports.getCookie)(ctx, context.authCookies.sessionData.name);
303
- const sessionDataPayload = sessionDataCookie != null ? require_json.safeJSONParse(__faire_auth_core_datatypes.binary.decode(__faire_auth_core_datatypes.base64Url.decode(sessionDataCookie))) : null;
287
+ const sessionDataPayload = sessionDataCookie != null ? require_json.safeJSONParse(_faire_auth_core_datatypes.binary.decode(_faire_auth_core_datatypes.base64Url.decode(sessionDataCookie))) : null;
304
288
  if (sessionDataPayload) {
305
- if (!await (0, __faire_auth_core_datatypes.createHMAC)("SHA-256", "base64urlnopad").verify(context.secret, JSON.stringify({
289
+ if (!await (0, _faire_auth_core_datatypes.createHMAC)("SHA-256", "base64urlnopad").verify(context.secret, JSON.stringify({
306
290
  ...sessionDataPayload.session,
307
291
  expiresAt: sessionDataPayload.expiresAt
308
292
  }), sessionDataPayload.signature)) {
309
293
  (0, require_cookies.cookies_exports.deleteCookie)(ctx, context.authCookies.sessionData.name, context.authCookies.sessionData.options);
310
294
  return ctx.render({
311
- success: __faire_auth_core_static.False,
312
- message: __faire_auth_core_error.BASE_ERROR_CODES.FAILED_TO_GET_SESSION
295
+ success: _faire_auth_core_static.False,
296
+ message: _faire_auth_core_error.BASE_ERROR_CODES.FAILED_TO_GET_SESSION
313
297
  }, 401);
314
298
  }
315
299
  }
@@ -318,11 +302,11 @@ const getSession = createEndpoint(getSessionRoute, (options) => async (ctx) => {
318
302
  * If session data is present in the cookie, return it
319
303
  */
320
304
  if (sessionDataPayload?.session && options.session?.cookieCache?.enabled === true && disableCookieCache !== true) {
321
- const { session: session$1 } = sessionDataPayload;
322
- if (!(session$1.session.createdAt instanceof Date) || !(session$1.session.updatedAt instanceof Date) || !(session$1.session.expiresAt instanceof Date) || !(session$1.user.createdAt instanceof Date) || !(session$1.user.updatedAt instanceof Date)) console.warn("not date ln 122");
323
- if (!(sessionDataPayload.expiresAt < Date.now() || session$1.session.expiresAt < /* @__PURE__ */ new Date())) {
324
- ctx.set("session", session$1);
325
- return ctx.render(session$1, 200);
305
+ const { session } = sessionDataPayload;
306
+ if (!(session.session.createdAt instanceof Date) || !(session.session.updatedAt instanceof Date) || !(session.session.expiresAt instanceof Date) || !(session.user.createdAt instanceof Date) || !(session.user.updatedAt instanceof Date)) console.warn("not date ln 122");
307
+ if (!(sessionDataPayload.expiresAt < Date.now() || session.session.expiresAt < /* @__PURE__ */ new Date())) {
308
+ ctx.set("session", session);
309
+ return ctx.render(session, 200);
326
310
  }
327
311
  (0, require_cookies.cookies_exports.deleteCookie)(ctx, context.authCookies.sessionData.name, context.authCookies.sessionData.options);
328
312
  }
@@ -333,13 +317,13 @@ const getSession = createEndpoint(getSessionRoute, (options) => async (ctx) => {
333
317
  if (session) {
334
318
  await context.internalAdapter.deleteSession(session.session.token);
335
319
  return ctx.render({
336
- success: __faire_auth_core_static.False,
337
- message: __faire_auth_core_error.BASE_ERROR_CODES.SESSION_EXPIRED
320
+ success: _faire_auth_core_static.False,
321
+ message: _faire_auth_core_error.BASE_ERROR_CODES.SESSION_EXPIRED
338
322
  }, 401);
339
323
  }
340
324
  return ctx.render({
341
- success: __faire_auth_core_static.False,
342
- message: __faire_auth_core_error.BASE_ERROR_CODES.FAILED_TO_GET_SESSION
325
+ success: _faire_auth_core_static.False,
326
+ message: _faire_auth_core_error.BASE_ERROR_CODES.FAILED_TO_GET_SESSION
343
327
  }, 401);
344
328
  }
345
329
  /**
@@ -350,7 +334,7 @@ const getSession = createEndpoint(getSessionRoute, (options) => async (ctx) => {
350
334
  const { expiresIn, updateAge } = context.sessionConfig;
351
335
  if (session.session.expiresAt.valueOf() - expiresIn * 1e3 + updateAge * 1e3 <= Date.now() && !options.session?.disableSessionRefresh) {
352
336
  const updatedSession = await context.internalAdapter.updateSession(session.session.token, {
353
- expiresAt: (0, __faire_auth_core_utils.getDate)(context.sessionConfig.expiresIn, "sec"),
337
+ expiresAt: (0, _faire_auth_core_utils.getDate)(context.sessionConfig.expiresIn, "sec"),
354
338
  updatedAt: /* @__PURE__ */ new Date()
355
339
  });
356
340
  if (updatedSession == null) {
@@ -359,8 +343,8 @@ const getSession = createEndpoint(getSessionRoute, (options) => async (ctx) => {
359
343
  */
360
344
  require_cookies.deleteSessionCookie(ctx);
361
345
  return ctx.render({
362
- success: __faire_auth_core_static.False,
363
- message: __faire_auth_core_error.BASE_ERROR_CODES.FAILED_TO_CREATE_SESSION
346
+ success: _faire_auth_core_static.False,
347
+ message: _faire_auth_core_error.BASE_ERROR_CODES.FAILED_TO_CREATE_SESSION
364
348
  }, 401);
365
349
  }
366
350
  const maxAge = (updatedSession.expiresAt.valueOf() - Date.now()) / 1e3;
@@ -380,8 +364,8 @@ const getSession = createEndpoint(getSessionRoute, (options) => async (ctx) => {
380
364
  } catch (error) {
381
365
  context.logger.error("INTERNAL_SERVER_ERROR", error);
382
366
  return ctx.render({
383
- success: __faire_auth_core_static.False,
384
- message: __faire_auth_core_error.BASE_ERROR_CODES.FAILED_TO_GET_SESSION
367
+ success: _faire_auth_core_static.False,
368
+ message: _faire_auth_core_error.BASE_ERROR_CODES.FAILED_TO_GET_SESSION
385
369
  }, 500);
386
370
  }
387
371
  });
@@ -391,13 +375,13 @@ const getSessionFromCtx = async (ctx, config) => {
391
375
  const newSession = await ctx.get("api").getSession({ query: { ...config && config } }, ctx).then(async (s) => s.success === true ? {
392
376
  success: true,
393
377
  data: {
394
- session: __faire_auth_core_db.looseSessionSchema.parse(s.data.session),
395
- user: __faire_auth_core_db.looseUserSchema.parse(s.data.user)
378
+ session: _faire_auth_core_db.looseSessionSchema.parse(s.data.session),
379
+ user: _faire_auth_core_db.looseUserSchema.parse(s.data.user)
396
380
  }
397
381
  } : s);
398
382
  if (newSession.success === false) return ctx.render(session ?? {
399
- success: __faire_auth_core_static.False,
400
- message: __faire_auth_core_error.BASE_ERROR_CODES.FAILED_TO_GET_SESSION
383
+ success: _faire_auth_core_static.False,
384
+ message: _faire_auth_core_error.BASE_ERROR_CODES.FAILED_TO_GET_SESSION
401
385
  }, 401);
402
386
  ctx.set("session", newSession.data);
403
387
  return newSession.data;
@@ -443,70 +427,67 @@ const freshSessionMiddleware = require_middleware.createMiddleware()(async (ctx,
443
427
  if (context.sessionConfig.freshAge === 0) return await next();
444
428
  const lastUpdated = (session.session.updatedAt ?? session.session.createdAt).valueOf();
445
429
  if (!(Date.now() - lastUpdated < context.sessionConfig.freshAge * 1e3)) return ctx.render({
446
- success: __faire_auth_core_static.False,
430
+ success: _faire_auth_core_static.False,
447
431
  message: "Session is not fresh"
448
432
  }, 403);
449
433
  return await next();
450
434
  });
451
- const listSessionsRoute = (0, __faire_auth_core_factory.createRoute)({
452
- operationId: __faire_auth_core_static.Routes.LIST_SESSIONS,
435
+ const listSessions = createEndpoint((0, _faire_auth_core_factory.createRoute)({
436
+ operationId: _faire_auth_core_static.Routes.LIST_SESSIONS,
453
437
  method: "get",
454
438
  path: "/list-sessions",
455
439
  description: "List all active sessions for the user",
456
440
  middleware: [sessionMiddleware()],
457
- responses: (0, __faire_auth_core_factory.res)(__faire_auth_core_static.SCHEMAS[__faire_auth_core_static.Definitions.SESSIONS_LIST].default).err(500).bld()
458
- });
459
- const listSessions = createEndpoint(listSessionsRoute, (_options) => async (ctx) => {
441
+ responses: (0, _faire_auth_core_factory.res)(_faire_auth_core_static.SCHEMAS[_faire_auth_core_static.Definitions.SESSIONS_LIST].default).err(500).bld()
442
+ }), (_options) => async (ctx) => {
460
443
  try {
461
444
  const activeSessions = (await ctx.get("context").internalAdapter.listSessions(ctx.get("session").user.id)).filter((s) => s.expiresAt > /* @__PURE__ */ new Date());
462
445
  return ctx.render(activeSessions, 200);
463
446
  } catch (e) {
464
447
  ctx.get("context").logger.error(e instanceof Error ? e.message : String(e), e);
465
448
  return ctx.render({
466
- success: __faire_auth_core_static.False,
449
+ success: _faire_auth_core_static.False,
467
450
  message: "Internal server error"
468
451
  }, 500);
469
452
  }
470
453
  });
471
- const revokeSessionRoute = (0, __faire_auth_core_factory.createRoute)({
472
- operationId: __faire_auth_core_static.Routes.REVOKE_SESSION,
454
+ const revokeSession = createEndpoint((0, _faire_auth_core_factory.createRoute)({
455
+ operationId: _faire_auth_core_static.Routes.REVOKE_SESSION,
473
456
  method: "post",
474
457
  path: "/revoke-session",
475
458
  description: "Revoke a single session",
476
459
  middleware: [sensitiveSessionMiddleware],
477
- request: (0, __faire_auth_core_factory.req)().bdy(revokeSessionSchema).bld(),
478
- responses: (0, __faire_auth_core_factory.res)(__faire_auth_core_static.SCHEMAS[__faire_auth_core_static.Definitions.SUCCESS].default).zod().err(400).err(401).err(500).bld()
479
- });
480
- const revokeSession = createEndpoint(revokeSessionRoute, (_options) => async (ctx) => {
460
+ request: (0, _faire_auth_core_factory.req)().bdy(revokeSessionSchema).bld(),
461
+ responses: (0, _faire_auth_core_factory.res)(_faire_auth_core_static.SCHEMAS[_faire_auth_core_static.Definitions.SUCCESS].default).zod().err(400).err(401).err(500).bld()
462
+ }), (_options) => async (ctx) => {
481
463
  const context = ctx.get("context");
482
464
  const session = ctx.get("session");
483
465
  const { token } = ctx.req.valid("json");
484
466
  const foundSession = await context.internalAdapter.findSession(token);
485
467
  if (!foundSession) return ctx.render({
486
- success: __faire_auth_core_static.False,
468
+ success: _faire_auth_core_static.False,
487
469
  message: "Session not found"
488
470
  }, 400);
489
- if (foundSession.session.userId !== session.user.id) return ctx.render({ success: __faire_auth_core_static.False }, 401);
471
+ if (foundSession.session.userId !== session.user.id) return ctx.render({ success: _faire_auth_core_static.False }, 401);
490
472
  try {
491
473
  await context.internalAdapter.deleteSession(token);
492
474
  } catch (error) {
493
475
  context.logger.error(error != null && typeof error === "object" && "name" in error ? String(error.name) : "Unknown Error", error);
494
476
  return ctx.render({
495
- success: __faire_auth_core_static.False,
477
+ success: _faire_auth_core_static.False,
496
478
  message: "Internal server error"
497
479
  }, 500);
498
480
  }
499
- return ctx.render({ success: __faire_auth_core_static.True }, 200);
481
+ return ctx.render({ success: _faire_auth_core_static.True }, 200);
500
482
  });
501
- const revokeSessionsRoute = (0, __faire_auth_core_factory.createRoute)({
502
- operationId: __faire_auth_core_static.Routes.REVOKE_SESSIONS,
483
+ const revokeSessions = createEndpoint((0, _faire_auth_core_factory.createRoute)({
484
+ operationId: _faire_auth_core_static.Routes.REVOKE_SESSIONS,
503
485
  method: "post",
504
486
  path: "/revoke-sessions",
505
487
  description: "Revoke all sessions for the user",
506
488
  middleware: [sensitiveSessionMiddleware],
507
- responses: (0, __faire_auth_core_factory.res)(__faire_auth_core_static.SCHEMAS[__faire_auth_core_static.Definitions.SUCCESS].default).err(500).bld()
508
- });
509
- const revokeSessions = createEndpoint(revokeSessionsRoute, (_options) => async (ctx) => {
489
+ responses: (0, _faire_auth_core_factory.res)(_faire_auth_core_static.SCHEMAS[_faire_auth_core_static.Definitions.SUCCESS].default).err(500).bld()
490
+ }), (_options) => async (ctx) => {
510
491
  const context = ctx.get("context");
511
492
  const session = ctx.get("session");
512
493
  try {
@@ -514,128 +495,125 @@ const revokeSessions = createEndpoint(revokeSessionsRoute, (_options) => async (
514
495
  } catch (error) {
515
496
  context.logger.error(error != null && typeof error === "object" && "name" in error ? String(error.name) : "Unknown Error", error);
516
497
  return ctx.render({
517
- success: __faire_auth_core_static.False,
498
+ success: _faire_auth_core_static.False,
518
499
  message: "Internal server error"
519
500
  }, 500);
520
501
  }
521
- return ctx.render({ success: __faire_auth_core_static.True }, 200);
502
+ return ctx.render({ success: _faire_auth_core_static.True }, 200);
522
503
  });
523
- const revokeOtherSessionsRoute = (0, __faire_auth_core_factory.createRoute)({
524
- operationId: __faire_auth_core_static.Routes.REVOKE_OTHER_SESSIONS,
504
+ const revokeOtherSessions = createEndpoint((0, _faire_auth_core_factory.createRoute)({
505
+ operationId: _faire_auth_core_static.Routes.REVOKE_OTHER_SESSIONS,
525
506
  method: "post",
526
507
  path: "/revoke-other-sessions",
527
508
  description: "Revoke all other sessions for the user except the current one",
528
509
  middleware: [sensitiveSessionMiddleware],
529
- responses: (0, __faire_auth_core_factory.res)(__faire_auth_core_static.SCHEMAS[__faire_auth_core_static.Definitions.SUCCESS].default).bld()
530
- });
531
- const revokeOtherSessions = createEndpoint(revokeOtherSessionsRoute, (_options) => async (ctx) => {
510
+ responses: (0, _faire_auth_core_factory.res)(_faire_auth_core_static.SCHEMAS[_faire_auth_core_static.Definitions.SUCCESS].default).bld()
511
+ }), (_options) => async (ctx) => {
532
512
  const context = ctx.get("context");
533
513
  const session = ctx.get("session");
534
- const otherSessions = (await context.internalAdapter.listSessions(session.user.id)).filter((session$1) => session$1.expiresAt > /* @__PURE__ */ new Date()).filter((sess) => sess.token !== session.session.token);
535
- await Promise.all(otherSessions.map(async (session$1) => context.internalAdapter.deleteSession(session$1.token)));
536
- return ctx.render({ success: __faire_auth_core_static.True }, 200);
514
+ const otherSessions = (await context.internalAdapter.listSessions(session.user.id)).filter((session) => session.expiresAt > /* @__PURE__ */ new Date()).filter((sess) => sess.token !== session.session.token);
515
+ await Promise.all(otherSessions.map(async (session) => context.internalAdapter.deleteSession(session.token)));
516
+ return ctx.render({ success: _faire_auth_core_static.True }, 200);
517
+ });
518
+ Object.defineProperty(exports, "createAPI", {
519
+ enumerable: true,
520
+ get: function() {
521
+ return createAPI;
522
+ }
537
523
  });
538
-
539
- //#endregion
540
- Object.defineProperty(exports, 'createAPI', {
541
- enumerable: true,
542
- get: function () {
543
- return createAPI;
544
- }
524
+ Object.defineProperty(exports, "createEndpoint", {
525
+ enumerable: true,
526
+ get: function() {
527
+ return createEndpoint;
528
+ }
545
529
  });
546
- Object.defineProperty(exports, 'createEndpoint', {
547
- enumerable: true,
548
- get: function () {
549
- return createEndpoint;
550
- }
530
+ Object.defineProperty(exports, "freshSessionMiddleware", {
531
+ enumerable: true,
532
+ get: function() {
533
+ return freshSessionMiddleware;
534
+ }
551
535
  });
552
- Object.defineProperty(exports, 'freshSessionMiddleware', {
553
- enumerable: true,
554
- get: function () {
555
- return freshSessionMiddleware;
556
- }
536
+ Object.defineProperty(exports, "getSession", {
537
+ enumerable: true,
538
+ get: function() {
539
+ return getSession;
540
+ }
557
541
  });
558
- Object.defineProperty(exports, 'getSession', {
559
- enumerable: true,
560
- get: function () {
561
- return getSession;
562
- }
542
+ Object.defineProperty(exports, "getSessionFromCtx", {
543
+ enumerable: true,
544
+ get: function() {
545
+ return getSessionFromCtx;
546
+ }
563
547
  });
564
- Object.defineProperty(exports, 'getSessionFromCtx', {
565
- enumerable: true,
566
- get: function () {
567
- return getSessionFromCtx;
568
- }
548
+ Object.defineProperty(exports, "initContextMiddleware", {
549
+ enumerable: true,
550
+ get: function() {
551
+ return initContextMiddleware;
552
+ }
569
553
  });
570
- Object.defineProperty(exports, 'initContextMiddleware', {
571
- enumerable: true,
572
- get: function () {
573
- return initContextMiddleware;
574
- }
554
+ Object.defineProperty(exports, "initErrorHandler", {
555
+ enumerable: true,
556
+ get: function() {
557
+ return initErrorHandler;
558
+ }
575
559
  });
576
- Object.defineProperty(exports, 'initErrorHandler', {
577
- enumerable: true,
578
- get: function () {
579
- return initErrorHandler;
580
- }
560
+ Object.defineProperty(exports, "initHooksMiddleware", {
561
+ enumerable: true,
562
+ get: function() {
563
+ return initHooksMiddleware;
564
+ }
581
565
  });
582
- Object.defineProperty(exports, 'initHooksMiddleware', {
583
- enumerable: true,
584
- get: function () {
585
- return initHooksMiddleware;
586
- }
566
+ Object.defineProperty(exports, "listSessions", {
567
+ enumerable: true,
568
+ get: function() {
569
+ return listSessions;
570
+ }
587
571
  });
588
- Object.defineProperty(exports, 'listSessions', {
589
- enumerable: true,
590
- get: function () {
591
- return listSessions;
592
- }
572
+ Object.defineProperty(exports, "requestOnlySessionMiddleware", {
573
+ enumerable: true,
574
+ get: function() {
575
+ return requestOnlySessionMiddleware;
576
+ }
593
577
  });
594
- Object.defineProperty(exports, 'requestOnlySessionMiddleware', {
595
- enumerable: true,
596
- get: function () {
597
- return requestOnlySessionMiddleware;
598
- }
578
+ Object.defineProperty(exports, "revokeOtherSessions", {
579
+ enumerable: true,
580
+ get: function() {
581
+ return revokeOtherSessions;
582
+ }
599
583
  });
600
- Object.defineProperty(exports, 'revokeOtherSessions', {
601
- enumerable: true,
602
- get: function () {
603
- return revokeOtherSessions;
604
- }
584
+ Object.defineProperty(exports, "revokeSession", {
585
+ enumerable: true,
586
+ get: function() {
587
+ return revokeSession;
588
+ }
605
589
  });
606
- Object.defineProperty(exports, 'revokeSession', {
607
- enumerable: true,
608
- get: function () {
609
- return revokeSession;
610
- }
590
+ Object.defineProperty(exports, "revokeSessions", {
591
+ enumerable: true,
592
+ get: function() {
593
+ return revokeSessions;
594
+ }
611
595
  });
612
- Object.defineProperty(exports, 'revokeSessions', {
613
- enumerable: true,
614
- get: function () {
615
- return revokeSessions;
616
- }
596
+ Object.defineProperty(exports, "sensitiveSessionMiddleware", {
597
+ enumerable: true,
598
+ get: function() {
599
+ return sensitiveSessionMiddleware;
600
+ }
617
601
  });
618
- Object.defineProperty(exports, 'sensitiveSessionMiddleware', {
619
- enumerable: true,
620
- get: function () {
621
- return sensitiveSessionMiddleware;
622
- }
602
+ Object.defineProperty(exports, "sessionMiddleware", {
603
+ enumerable: true,
604
+ get: function() {
605
+ return sessionMiddleware;
606
+ }
623
607
  });
624
- Object.defineProperty(exports, 'sessionMiddleware', {
625
- enumerable: true,
626
- get: function () {
627
- return sessionMiddleware;
628
- }
608
+ Object.defineProperty(exports, "setDefaultExecutionCtx", {
609
+ enumerable: true,
610
+ get: function() {
611
+ return setDefaultExecutionCtx;
612
+ }
629
613
  });
630
- Object.defineProperty(exports, 'setDefaultExecutionCtx', {
631
- enumerable: true,
632
- get: function () {
633
- return setDefaultExecutionCtx;
634
- }
614
+ Object.defineProperty(exports, "setRenderer", {
615
+ enumerable: true,
616
+ get: function() {
617
+ return setRenderer;
618
+ }
635
619
  });
636
- Object.defineProperty(exports, 'setRenderer', {
637
- enumerable: true,
638
- get: function () {
639
- return setRenderer;
640
- }
641
- });