faire-auth 1.0.3 → 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 +46 -81
  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-BCTFWP_o.d.mts +0 -992
  200. package/dist/index-BDhhaE6Y.d.cts +0 -3
  201. package/dist/index-BVRfQy6L.d.mts +0 -992
  202. package/dist/index-Baarsq5J.d.mts +0 -33
  203. package/dist/index-By364WbF.d.cts +0 -992
  204. package/dist/index-BzWwMgxr.d.cts +0 -992
  205. package/dist/index-CF9iq55a.d.mts +0 -3
  206. package/dist/index-CJD2yB-W.d.cts +0 -33
  207. package/dist/index-CRt_fppq.d.mts +0 -41
  208. package/dist/index-CdLyn7qP.d.cts +0 -41
  209. package/dist/index-CsWF3f7U.d.cts +0 -13350
  210. package/dist/index-CzidsAyA.d.mts +0 -13350
  211. package/dist/index-DvW-GCcI.d.cts +0 -33
  212. package/dist/index-f-5OJ9yV.d.cts +0 -13350
  213. package/dist/index-rFv8Hxld.d.mts +0 -13350
  214. package/dist/index-ztVZPQdV.d.mts +0 -33
  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,12 +1,10 @@
1
- import { t as getBaseURL } from "./url-BoUuoIwZ.mjs";
2
- import { a as removeIndexString, i as normaliseHeaders, n as mergeHeaders, o as replaceUrlParam, r as mergePath, s as replaceUrlProtocol, t as buildSearchParams } from "./request-1NL_1lyJ.mjs";
3
- import { t as defu } from "./defu-D9ZTXqlo.mjs";
4
- import { t as parseJSON } from "./parser-B25ylT5u.mjs";
1
+ import { t as getBaseURL } from "./url-CJtdrrUu.mjs";
2
+ import { a as normaliseHeaders, c as replaceUrlProtocol, i as mergePath, n as buildSearchParams, o as removeIndexString, r as mergeHeaders, s as replaceUrlParam, t as defu } from "./defu-D2h4S3X-.mjs";
3
+ import { t as parseJSON } from "./parser-DcKDjjHO.mjs";
5
4
  import { serialize } from "hono/utils/cookie";
6
5
  import { createFetch } from "@better-fetch/fetch";
7
6
  import { atom, onMount } from "nanostores";
8
-
9
- //#region src/client/fetch-plugins.ts
7
+ // src/client/fetch-plugins.ts
10
8
  const redirectPlugin = {
11
9
  id: "redirect",
12
10
  name: "Redirect",
@@ -20,9 +18,7 @@ const redirectPlugin = {
20
18
  }
21
19
  } }
22
20
  };
23
-
24
- //#endregion
25
- //#region src/client/plugins/lifecycle.ts
21
+ // src/client/plugins/lifecycle.ts
26
22
  const lifecycle = (options) => ({
27
23
  id: "lifecycle-hooks",
28
24
  name: "lifecycle-hooks",
@@ -33,9 +29,7 @@ const lifecycle = (options) => ({
33
29
  ...options?.fetchOptions?.onResponse && { onResponse: options.fetchOptions.onResponse }
34
30
  }
35
31
  });
36
-
37
- //#endregion
38
- //#region src/client/query.ts
32
+ // src/client/query.ts
39
33
  const isServer = typeof window === "undefined";
40
34
  const useAuthQuery = (initializedAtom, path, $fetch, options) => {
41
35
  const value = atom({
@@ -108,9 +102,7 @@ const useAuthQuery = (initializedAtom, path, $fetch, options) => {
108
102
  });
109
103
  return value;
110
104
  };
111
-
112
- //#endregion
113
- //#region src/client/broadcast-channel.ts
105
+ // src/client/broadcast-channel.ts
114
106
  const now$1 = () => Math.floor(Date.now() / 1e3);
115
107
  function createBroadcastChannel(name = "faire-auth.message") {
116
108
  return {
@@ -135,9 +127,7 @@ function createBroadcastChannel(name = "faire-auth.message") {
135
127
  }
136
128
  };
137
129
  }
138
-
139
- //#endregion
140
- //#region src/client/session-refresh.ts
130
+ // src/client/session-refresh.ts
141
131
  const now = () => Math.floor(Date.now() / 1e3);
142
132
  function createSessionRefreshManager(opts) {
143
133
  const { sessionAtom, sessionSignal, options = {} } = opts;
@@ -245,9 +235,7 @@ function createSessionRefreshManager(opts) {
245
235
  broadcastSessionUpdate
246
236
  };
247
237
  }
248
-
249
- //#endregion
250
- //#region src/client/session-atom.ts
238
+ // src/client/session-atom.ts
251
239
  const getSessionAtom = ($fetch, options) => {
252
240
  const $signal = atom(false);
253
241
  const session = useAuthQuery($signal, "/get-session", $fetch, { method: "GET" });
@@ -268,15 +256,13 @@ const getSessionAtom = ($fetch, options) => {
268
256
  $sessionSignal: $signal
269
257
  };
270
258
  };
271
-
272
- //#endregion
273
- //#region src/client/config.ts
259
+ // src/client/config.ts
274
260
  const getClientConfig = (options) => {
275
261
  const baseURL = () => getBaseURL(options?.baseURL, options?.basePath) ?? "/api/auth";
276
262
  const plugins = options?.plugins ?? [];
277
263
  const pluginsFetchPlugins = plugins.flatMap((plugin) => plugin.fetchPlugins).filter((pl) => pl !== void 0);
278
- const { onSuccess: _, onError: __, onRequest: ___, onResponse: ____,...restOfFetchOptions } = options?.fetchOptions ?? {};
279
- const $fetch = createFetch({
264
+ const { onSuccess: _, onError: __, onRequest: ___, onResponse: ____, ...restOfFetchOptions } = options?.fetchOptions ?? {};
265
+ const fetchOptions = {
280
266
  get baseURL() {
281
267
  return baseURL();
282
268
  },
@@ -294,7 +280,8 @@ const getClientConfig = (options) => {
294
280
  ...options?.disableDefaultFetchPlugins ? [] : [redirectPlugin],
295
281
  ...pluginsFetchPlugins
296
282
  ]
297
- });
283
+ };
284
+ const $fetch = createFetch(fetchOptions);
298
285
  const sessionAtom = getSessionAtom($fetch);
299
286
  const pluginsActions = {};
300
287
  const pluginsAtoms = sessionAtom;
@@ -337,9 +324,7 @@ const getClientConfig = (options) => {
337
324
  $store
338
325
  };
339
326
  };
340
-
341
- //#endregion
342
- //#region src/client/hono.ts
327
+ // src/client/hono.ts
343
328
  const isPromise = (value) => value != null && typeof value.then === "function";
344
329
  const isHonoRequestLike = (value) => value != null && typeof value === "object" && "raw" in value && value.raw instanceof Request && "header" in value && typeof value.header === "function" && "query" in value && typeof value.query === "function" && "param" in value && typeof value.param === "function" && "json" in value && typeof value.json === "function" && "path" in value && typeof value.path === "string";
345
330
  const isInputOpts = (value) => value == null || typeof value === "object" && Object.keys(value).every((k) => k !== "fetchOptions" && k !== "fetch" && k !== "websocket" && k !== "init" && k !== "headers");
@@ -503,6 +488,4 @@ const createHonoClient = (options, routes, $fetch, atoms, atomListeners) => crea
503
488
  clientOpts.fetchOptions = defu(clientOpts.fetchOptions, options.createFetchOptions);
504
489
  return req.fetch(input, clientOpts);
505
490
  }, [], routes);
506
-
507
- //#endregion
508
- export { getClientConfig as n, useAuthQuery as r, createHonoClient as t };
491
+ export { getClientConfig as n, useAuthQuery as r, createHonoClient as t };
@@ -0,0 +1,4 @@
1
+ import { contextStorage, getContext as getContext$1 } from "hono/context-storage";
2
+ // src/context/hono.ts
3
+ const getContext = () => getContext$1();
4
+ export { getContext as n, contextStorage as t };
@@ -0,0 +1,9 @@
1
+ let hono_context_storage = require("hono/context-storage");
2
+ // src/context/hono.ts
3
+ const getContext = () => (0, hono_context_storage.getContext)();
4
+ Object.defineProperty(exports, "getContext", {
5
+ enumerable: true,
6
+ get: function() {
7
+ return getContext;
8
+ }
9
+ });
@@ -1,13 +1,10 @@
1
- const require_chunk = require('./chunk-fPmz2rbM.cjs');
2
- const require_url = require('./url-Ce7CVaQD.cjs');
3
- const require_request = require('./request-CPNlp-DK.cjs');
4
- const require_defu = require('./defu-BmOYq4PU.cjs');
5
- const require_parser = require('./parser-B_wxvaAr.cjs');
1
+ const require_url = require("./url-DjCmCUHS.cjs");
2
+ const require_defu = require("./defu-DWS5RPWt.cjs");
3
+ const require_parser = require("./parser-CqwvpF6l.cjs");
6
4
  let hono_utils_cookie = require("hono/utils/cookie");
7
- let __better_fetch_fetch = require("@better-fetch/fetch");
5
+ let _better_fetch_fetch = require("@better-fetch/fetch");
8
6
  let nanostores = require("nanostores");
9
-
10
- //#region src/client/fetch-plugins.ts
7
+ // src/client/fetch-plugins.ts
11
8
  const redirectPlugin = {
12
9
  id: "redirect",
13
10
  name: "Redirect",
@@ -21,9 +18,7 @@ const redirectPlugin = {
21
18
  }
22
19
  } }
23
20
  };
24
-
25
- //#endregion
26
- //#region src/client/plugins/lifecycle.ts
21
+ // src/client/plugins/lifecycle.ts
27
22
  const lifecycle = (options) => ({
28
23
  id: "lifecycle-hooks",
29
24
  name: "lifecycle-hooks",
@@ -34,9 +29,7 @@ const lifecycle = (options) => ({
34
29
  ...options?.fetchOptions?.onResponse && { onResponse: options.fetchOptions.onResponse }
35
30
  }
36
31
  });
37
-
38
- //#endregion
39
- //#region src/client/query.ts
32
+ // src/client/query.ts
40
33
  const isServer = typeof window === "undefined";
41
34
  const useAuthQuery = (initializedAtom, path, $fetch, options) => {
42
35
  const value = (0, nanostores.atom)({
@@ -109,9 +102,7 @@ const useAuthQuery = (initializedAtom, path, $fetch, options) => {
109
102
  });
110
103
  return value;
111
104
  };
112
-
113
- //#endregion
114
- //#region src/client/broadcast-channel.ts
105
+ // src/client/broadcast-channel.ts
115
106
  const now$1 = () => Math.floor(Date.now() / 1e3);
116
107
  function createBroadcastChannel(name = "faire-auth.message") {
117
108
  return {
@@ -136,9 +127,7 @@ function createBroadcastChannel(name = "faire-auth.message") {
136
127
  }
137
128
  };
138
129
  }
139
-
140
- //#endregion
141
- //#region src/client/session-refresh.ts
130
+ // src/client/session-refresh.ts
142
131
  const now = () => Math.floor(Date.now() / 1e3);
143
132
  function createSessionRefreshManager(opts) {
144
133
  const { sessionAtom, sessionSignal, options = {} } = opts;
@@ -246,9 +235,7 @@ function createSessionRefreshManager(opts) {
246
235
  broadcastSessionUpdate
247
236
  };
248
237
  }
249
-
250
- //#endregion
251
- //#region src/client/session-atom.ts
238
+ // src/client/session-atom.ts
252
239
  const getSessionAtom = ($fetch, options) => {
253
240
  const $signal = (0, nanostores.atom)(false);
254
241
  const session = useAuthQuery($signal, "/get-session", $fetch, { method: "GET" });
@@ -269,15 +256,13 @@ const getSessionAtom = ($fetch, options) => {
269
256
  $sessionSignal: $signal
270
257
  };
271
258
  };
272
-
273
- //#endregion
274
- //#region src/client/config.ts
259
+ // src/client/config.ts
275
260
  const getClientConfig = (options) => {
276
261
  const baseURL = () => require_url.getBaseURL(options?.baseURL, options?.basePath) ?? "/api/auth";
277
262
  const plugins = options?.plugins ?? [];
278
263
  const pluginsFetchPlugins = plugins.flatMap((plugin) => plugin.fetchPlugins).filter((pl) => pl !== void 0);
279
- const { onSuccess: _, onError: __, onRequest: ___, onResponse: ____,...restOfFetchOptions } = options?.fetchOptions ?? {};
280
- const $fetch = (0, __better_fetch_fetch.createFetch)({
264
+ const { onSuccess: _, onError: __, onRequest: ___, onResponse: ____, ...restOfFetchOptions } = options?.fetchOptions ?? {};
265
+ const fetchOptions = {
281
266
  get baseURL() {
282
267
  return baseURL();
283
268
  },
@@ -295,7 +280,8 @@ const getClientConfig = (options) => {
295
280
  ...options?.disableDefaultFetchPlugins ? [] : [redirectPlugin],
296
281
  ...pluginsFetchPlugins
297
282
  ]
298
- });
283
+ };
284
+ const $fetch = (0, _better_fetch_fetch.createFetch)(fetchOptions);
299
285
  const sessionAtom = getSessionAtom($fetch);
300
286
  const pluginsActions = {};
301
287
  const pluginsAtoms = sessionAtom;
@@ -338,9 +324,7 @@ const getClientConfig = (options) => {
338
324
  $store
339
325
  };
340
326
  };
341
-
342
- //#endregion
343
- //#region src/client/hono.ts
327
+ // src/client/hono.ts
344
328
  const isPromise = (value) => value != null && typeof value.then === "function";
345
329
  const isHonoRequestLike = (value) => value != null && typeof value === "object" && "raw" in value && value.raw instanceof Request && "header" in value && typeof value.header === "function" && "query" in value && typeof value.query === "function" && "param" in value && typeof value.param === "function" && "json" in value && typeof value.json === "function" && "path" in value && typeof value.path === "string";
346
330
  const isInputOpts = (value) => value == null || typeof value === "object" && Object.keys(value).every((k) => k !== "fetchOptions" && k !== "fetch" && k !== "websocket" && k !== "init" && k !== "headers");
@@ -392,7 +376,7 @@ var ClientRequestImpl = class {
392
376
  fetch = async (args, opt) => {
393
377
  if (isHonoRequestLike(opt.fetch)) return this.$fetch(opt.fetch.url, opt.fetch.raw);
394
378
  if (args) {
395
- if (args.query) this.queryParams = require_request.buildSearchParams(args.query);
379
+ if (args.query) this.queryParams = require_defu.buildSearchParams(args.query);
396
380
  if (args.form) {
397
381
  const form = new FormData();
398
382
  for (const [k, v] of Object.entries(args.form)) if (Array.isArray(v)) for (const v2 of v) form.append(k, v2);
@@ -406,7 +390,7 @@ var ClientRequestImpl = class {
406
390
  if (args.param) this.pathParams = args.param;
407
391
  }
408
392
  let methodUpperCase = this.method.toUpperCase();
409
- let headers = require_request.normaliseHeaders(opt.headers);
393
+ let headers = require_defu.normaliseHeaders(opt.headers);
410
394
  if (isPromise(headers)) headers = await headers;
411
395
  if (args?.header) Object.entries(args.header).forEach(([k, v]) => headers.set(k, v));
412
396
  if (args?.cookie) {
@@ -416,8 +400,8 @@ var ClientRequestImpl = class {
416
400
  }
417
401
  if (this.cType) headers.set("Content-Type", this.cType);
418
402
  let url = this.url;
419
- url = require_request.removeIndexString(url);
420
- url = require_request.replaceUrlParam(url, this.pathParams);
403
+ url = require_defu.removeIndexString(url);
404
+ url = require_defu.replaceUrlParam(url, this.pathParams);
421
405
  if (this.queryParams && this.queryParams.size > 0) url = url + "?" + this.queryParams.toString();
422
406
  methodUpperCase = this.method.toUpperCase();
423
407
  const setBody = !(methodUpperCase === "GET" || methodUpperCase === "HEAD");
@@ -472,22 +456,22 @@ const createHonoClient = (options, routes, $fetch, atoms, atomListeners) => crea
472
456
  clientOpts: opts.args[0] ?? {}
473
457
  };
474
458
  const path = `/${parts.join("/")}`;
475
- const url = require_request.mergePath(options.baseURL, path);
476
- clientOpts.headers = require_request.mergeHeaders(options?.createFetchOptions?.headers, clientOpts.fetchOptions?.headers, clientOpts.headers);
459
+ const url = require_defu.mergePath(options.baseURL, path);
460
+ clientOpts.headers = require_defu.mergeHeaders(options?.createFetchOptions?.headers, clientOpts.fetchOptions?.headers, clientOpts.headers);
477
461
  if (method === "url" || method === "path") {
478
462
  let result = url;
479
- if (input.param) result = require_request.replaceUrlParam(url, input.param);
463
+ if (input.param) result = require_defu.replaceUrlParam(url, input.param);
480
464
  if (input.query) {
481
- const sp = require_request.buildSearchParams(input.query);
465
+ const sp = require_defu.buildSearchParams(input.query);
482
466
  if (sp.size > 0) result += "?" + sp.toString();
483
467
  }
484
- result = require_request.removeIndexString(result);
468
+ result = require_defu.removeIndexString(result);
485
469
  if (method === "url") return new URL(result);
486
470
  const base = (options.baseURL ?? "").replace(/\/+$/, "");
487
471
  return result.slice(base.length).replace(/^\/?/, "/");
488
472
  }
489
473
  if (method === "ws") {
490
- const webSocketUrl = require_request.replaceUrlProtocol(input.param ? require_request.replaceUrlParam(url, input.param) : url, "ws");
474
+ const webSocketUrl = require_defu.replaceUrlProtocol(input.param ? require_defu.replaceUrlParam(url, input.param) : url, "ws");
491
475
  const targetUrl = new URL(webSocketUrl);
492
476
  const queryParams = input.query;
493
477
  if (queryParams) Object.entries(queryParams).forEach(([key, value]) => {
@@ -504,23 +488,21 @@ const createHonoClient = (options, routes, $fetch, atoms, atomListeners) => crea
504
488
  clientOpts.fetchOptions = require_defu.defu(clientOpts.fetchOptions, options.createFetchOptions);
505
489
  return req.fetch(input, clientOpts);
506
490
  }, [], routes);
507
-
508
- //#endregion
509
- Object.defineProperty(exports, 'createHonoClient', {
510
- enumerable: true,
511
- get: function () {
512
- return createHonoClient;
513
- }
491
+ Object.defineProperty(exports, "createHonoClient", {
492
+ enumerable: true,
493
+ get: function() {
494
+ return createHonoClient;
495
+ }
514
496
  });
515
- Object.defineProperty(exports, 'getClientConfig', {
516
- enumerable: true,
517
- get: function () {
518
- return getClientConfig;
519
- }
497
+ Object.defineProperty(exports, "getClientConfig", {
498
+ enumerable: true,
499
+ get: function() {
500
+ return getClientConfig;
501
+ }
502
+ });
503
+ Object.defineProperty(exports, "useAuthQuery", {
504
+ enumerable: true,
505
+ get: function() {
506
+ return useAuthQuery;
507
+ }
520
508
  });
521
- Object.defineProperty(exports, 'useAuthQuery', {
522
- enumerable: true,
523
- get: function () {
524
- return useAuthQuery;
525
- }
526
- });
@@ -0,0 +1,2 @@
1
+ import * as import__faire_auth_core_social_providers from "@faire-auth/core/social-providers";
2
+ export { import__faire_auth_core_social_providers as t };
@@ -0,0 +1,2 @@
1
+ import * as import__faire_auth_core_social_providers from "@faire-auth/core/social-providers";
2
+ export { import__faire_auth_core_social_providers as t };