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
@@ -0,0 +1,1581 @@
1
+ import { DBAdapter, DBAdapter as DBAdapter$1, DBAdapterInstance, DBAdapterInstance as DBAdapterInstance$1, DBAdapterSchemaCreation, DBAdapterSchemaCreation as DBAdapterSchemaCreation$1, DBTransactionAdapter, DBTransactionAdapter as DBTransactionAdapter$1, Where, Where as Where$1 } from "@faire-auth/core/db/adapter";
2
+ import { ENV, ENV as ENV$1, InternalLogger, LogHandlerParams, LogLevel, Logger, createLogger, logger } from "@faire-auth/core/env";
3
+ import { AnyHono, AuthContext as AuthContext$1, AuthRouteConfig, BasePath as BasePath$1, BuildSchema, ConvertPathType, CustomIO, DTOTransformer, DefaultHook, DocPathFromOptions, ExK, Exec, ExecOpts, Expand, FaireAuthOptions as FaireAuthOptions$1, FaireAuthPlugin as FaireAuthPlugin$1, FaireAuthRateLimitOptions as FaireAuthRateLimitOptions$1, FieldAttribute, Fn, FromFn, InferFieldsFromOptions as InferFieldsFromOptions$1, InferFieldsFromPlugins as InferFieldsFromPlugins$1, InferFieldsInputClient as InferFieldsInputClient$1, InferFieldsOutput as InferFieldsOutput$1, InferInput, InternalAdapter, JSONRenderRespond, LiteralString, LiteralStringUnion, MinRouteConfig, OmitId, Prettify, ProcessRouteConfig, RouteConfigToEnv, RouteConfigToMiddleware, RouteConfigToRequest, RouteHandler, RouteHook, StripEmptyObjects, UnionToIntersection, execHelper } from "@faire-auth/core/types";
4
+ import { Context, Env, ExecutionContext, Hono, HonoRequest, MiddlewareHandler, Schema, TypedResponse } from "hono";
5
+ import { APIError, BASE_ERROR_CODES, FaireAuthError, MissingDependencyError } from "@faire-auth/core/error";
6
+ import { OpenAPIHono, OpenAPIHono as OpenAPIHono$1 } from "@faire-auth/core/factory";
7
+ import { BetterFetch, BetterFetchError, BetterFetchOption, BetterFetchPlugin, CreateFetchOption, Methods, Schema as Schema$1, SchemaConfig, StandardSchemaV1 } from "@better-fetch/fetch";
8
+ import { ExtractSchema } from "hono/types";
9
+ import { Atom, WritableAtom } from "nanostores";
10
+ import { Account, AccountInput, DBFieldAttribute, DBFieldAttributeConfig, DBFieldType, FaireAuthDBSchema, FaireAuthPluginDBSchema as FaireAuthPluginDBSchema$1, Session as Session$1, SessionInput, StrictSession, StrictUser, User, UserInput, VerificationInput } from "@faire-auth/core/db";
11
+ import { ClientRequest, ClientResponse } from "hono/client";
12
+ import { ClientErrorStatusCode, ServerErrorStatusCode, SuccessStatusCode } from "hono/utils/http-status";
13
+ import { HasRequiredKeys } from "hono/utils/types";
14
+ import { Definitions, Routes, SCHEMAS } from "@faire-auth/core/static";
15
+ import * as z from "zod";
16
+ import { z as z$1 } from "zod";
17
+ import { HonoRequest as HonoRequest$1 } from "hono/request";
18
+ import { generateId, generateRandomString } from "@faire-auth/core/crypto";
19
+ declare const getCurrentAdapter: (adapter?: DBTransactionAdapter$1) => DBTransactionAdapter$1;
20
+ /**
21
+ * Adapter Interface
22
+ *
23
+ * @deprecated Use `DBAdapter` from `@faire-auth/core/db/adapter` instead.
24
+ */
25
+ type Adapter = DBAdapter$1;
26
+ /**
27
+ * @deprecated Use `DBTransactionAdapter` from `@faire-auth/core/db/adapter` instead.
28
+ */
29
+ type TransactionAdapter = DBTransactionAdapter$1;
30
+ /**
31
+ * @deprecated Use `DBAdapterSchemaCreation` from `@faire-auth/core/db/adapter` instead.
32
+ */
33
+ type AdapterSchemaCreation = DBAdapterSchemaCreation$1;
34
+ /**
35
+ * @deprecated Use `DBAdapterInstance` from `@faire-auth/core/db/adapter` instead.
36
+ */
37
+ type AdapterInstance = DBAdapterInstance$1;
38
+ type AuthContext<Options extends FaireAuthOptions = FaireAuthOptions> = AuthContext$1<ContextVars, Options>;
39
+ declare const init: <O extends FaireAuthOptions>(options: O) => readonly [AuthContext$1<ContextVars, Options>, FaireAuthOptions];
40
+ type AuthArgs<C extends MinRouteConfig> = [C, RouteHandler<C, Env extends RouteConfigToEnv<C> ? ContextVars : RouteConfigToEnv<C> & ContextVars>, FromFn<RouteHook<C>> | undefined];
41
+ /**
42
+ * Represents the properties of an auth endpoint.
43
+ * @template C - The route config type.
44
+ * @template O - The options type.
45
+ */
46
+ interface AuthProperties<C extends MinRouteConfig> extends ReturnType<typeof execHelper<C, ContextVars<any>>> {
47
+ toArgs: (builtSchemas: Record<Definitions, z$1.ZodType>, context: AuthContext, api: Record<string, (...args: any[]) => any>, hook?: FromFn<RouteHook<any>>) => AuthArgs<C>;
48
+ }
49
+ /**
50
+ * Represents an auth endpoint function.
51
+ * @template C - The route config type.
52
+ */
53
+ interface AuthEndpoint<C extends MinRouteConfig> {
54
+ <O extends FaireAuthOptions = {}>(options: O): AuthProperties<ProcessRouteConfig<C, O>>;
55
+ }
56
+ /**
57
+ * Factory function for creating auth endpoints.
58
+ *
59
+ * @todo Maybe some day the compiler will be strong enough we won't
60
+ * need this explicit type annotation
61
+ */
62
+ interface AuthFactory {
63
+ <C extends AuthRouteConfig, H extends (options: FaireAuthOptions) => RouteHandler<C, RouteConfigToEnv<C>, InferInput<C>, ConvertPathType<C["path"]>, true>>(config: C, handler: H, hook?: FromFn<RouteHook<C>>): AuthEndpoint<C>;
64
+ }
65
+ /**
66
+ * Creates an auth endpoint.
67
+ * @template C - The route config type.
68
+ * @param config - The route configuration.
69
+ * @param handler - The route handler function.
70
+ * @param hook - Optional route hook.
71
+ * @returns The auth endpoint function.
72
+ */
73
+ declare const createEndpoint: <C extends AuthRouteConfig>(config: C, handler: (options: FaireAuthOptions) => RouteHandler<C, Env extends RouteConfigToEnv<C> ? ContextVars : RouteConfigToEnv<C> & ContextVars, InferInput<C>, ConvertPathType<C["path"]>, true>, hook?: FromFn<RouteHook<C>>) => AuthEndpoint<C>;
74
+ declare const createFieldAttribute: <T extends DBFieldType, C extends DBFieldAttributeConfig>(type: T, config?: C) => DBFieldAttribute<T>;
75
+ type InferValueType<T extends DBFieldType> = T extends "string" ? string : T extends "number" ? number : T extends "boolean" ? boolean : T extends "date" ? Date : T extends `${infer T}[]` ? T extends "string" ? string[] : number[] : T extends Array<any> ? T[number] : never;
76
+ type InferFieldsOutput<Field> = Field extends Record<infer Key, DBFieldAttribute> ? { [key in Key as Field[key]["required"] extends false ? Field[key]["defaultValue"] extends boolean | string | number | Date ? key : never : key]: InferFieldOutput<Field[key]>; } & { [key in Key as Field[key]["returned"] extends false ? never : key]?: InferFieldOutput<Field[key]> | null; } : {};
77
+ type InferFieldsInput<Field> = Field extends Record<infer Key, DBFieldAttribute> ? { [key in Key as Field[key]["required"] extends false ? never : Field[key]["defaultValue"] extends string | number | boolean | Date ? never : Field[key]["input"] extends false ? never : key]: InferFieldInput<Field[key]>; } & { [key in Key as Field[key]["input"] extends false ? never : key]?: InferFieldInput<Field[key]> | undefined | null; } : {};
78
+ /**
79
+ * For client will add "?" on optional fields
80
+ */
81
+ type InferFieldsInputClient<Field> = Field extends Record<infer Key, DBFieldAttribute> ? { [key in Key as Field[key]["required"] extends false ? never : Field[key]["defaultValue"] extends string | number | boolean | Date ? never : Field[key]["input"] extends false ? never : key]: InferFieldInput<Field[key]>; } & { [key in Key as Field[key]["input"] extends false ? never : Field[key]["required"] extends false ? key : Field[key]["defaultValue"] extends string | number | boolean | Date ? key : never]?: InferFieldInput<Field[key]> | undefined | null; } : {};
82
+ type InferFieldOutput<T extends DBFieldAttribute> = T["returned"] extends false ? never : T["required"] extends false ? InferValueType<T["type"]> | undefined | null : InferValueType<T["type"]>;
83
+ /**
84
+ * Converts a Record<string, DBFieldAttribute> to an object type
85
+ * with keys and value types inferred from DBFieldAttribute["type"].
86
+ */
87
+ type FieldAttributeToObject<Fields extends Record<string, DBFieldAttribute>> = AddOptionalFields<{ [K in keyof Fields]: InferValueType<Fields[K]["type"]>; }, Fields>;
88
+ type AddOptionalFields<T extends Record<string, any>, Fields extends Record<keyof T, DBFieldAttribute>> = { [K in keyof T as Fields[K] extends {
89
+ required: true;
90
+ } ? K : never]: T[K]; } & { [K in keyof T as Fields[K] extends {
91
+ required: true;
92
+ } ? never : K]?: T[K]; };
93
+ /**
94
+ * Infer the additional fields from the plugin options.
95
+ * For example, you can infer the additional fields of the org plugin's organization schema like this:
96
+ * ```ts
97
+ * type AdditionalFields = InferAdditionalFieldsFromPluginOptions<"organization", OrganizationOptions>
98
+ * ```
99
+ */
100
+ type InferAdditionalFieldsFromPluginOptions<SchemaName extends string, Options extends {
101
+ schema?: { [key in SchemaName]?: {
102
+ additionalFields?: Record<string, DBFieldAttribute>;
103
+ }; };
104
+ }, isClientSide extends boolean = true> = Options["schema"] extends { [key in SchemaName]?: {
105
+ additionalFields: infer Field extends Record<string, DBFieldAttribute>;
106
+ }; } ? isClientSide extends true ? FieldAttributeToObject<RemoveFieldsWithInputFalse<Field>> : FieldAttributeToObject<Field> : {};
107
+ type RemoveFieldsWithInputFalse<T extends Record<string, DBFieldAttribute>> = { [K in keyof T as T[K]["input"] extends false ? never : K]: T[K]; };
108
+ type InferFieldInput<T extends DBFieldAttribute> = InferValueType<T["type"]>;
109
+ type PluginFieldAttribute = Omit<DBFieldAttribute, "transform" | "defaultValue" | "hashValue">;
110
+ type InferFieldsFromPlugins<Options extends FaireAuthOptions$1, Key extends string, Format extends "output" | "input" = "output"> = Options["plugins"] extends [] ? {} : Options["plugins"] extends Array<infer T> ? T extends {
111
+ schema: { [key in Key]: {
112
+ fields: infer Field;
113
+ }; };
114
+ } ? Format extends "output" ? InferFieldsOutput<Field> : InferFieldsInput<Field> : {} : {};
115
+ type InferFieldsFromOptions<Options extends FaireAuthOptions$1, Key extends "session" | "user", Format extends "output" | "input" = "output"> = Options[Key] extends {
116
+ additionalFields: infer Field;
117
+ } ? Format extends "output" ? InferFieldsOutput<Field> : InferFieldsInput<Field> : {};
118
+ type KyselyDatabaseType = "postgres" | "mysql" | "sqlite" | "mssql";
119
+ declare function matchType(columnDataType: string, fieldType: DBFieldType, dbType: KyselyDatabaseType): any;
120
+ declare function getMigrations(config: FaireAuthOptions): Promise<{
121
+ toBeCreated: {
122
+ table: string;
123
+ fields: Record<string, DBFieldAttribute>;
124
+ order: number;
125
+ }[];
126
+ toBeAdded: {
127
+ table: string;
128
+ fields: Record<string, DBFieldAttribute>;
129
+ order: number;
130
+ }[];
131
+ runMigrations: () => Promise<void>;
132
+ compileMigrations: () => Promise<string>;
133
+ }>;
134
+ declare function getSchema(config: FaireAuthOptions): Record<string, {
135
+ fields: Record<string, DBFieldAttribute>;
136
+ order: number;
137
+ }>;
138
+ declare const getAuthTables: (options: FaireAuthOptions) => FaireAuthDBSchema;
139
+ declare const createInternalAdapter: (adapter: DBAdapter$1<FaireAuthOptions>, options: Pick<FaireAuthOptions, "advanced" | "user" | "session" | "verification" | "plugins">, context: Pick<AuthContext, "logger" | "generateId" | "secondaryStorage" | "sessionConfig">, hooks?: Exclude<FaireAuthOptions["databaseHooks"], undefined>[]) => InternalAdapter;
140
+ declare function parseUserOutput(options: Pick<FaireAuthOptions, "user" | "plugins">, user: User): User;
141
+ declare function parseAccountOutput(options: Pick<FaireAuthOptions, "plugins">, account: Account): Account;
142
+ declare function parseSessionOutput(options: Pick<FaireAuthOptions, "session" | "plugins">, session: Session$1): Session$1;
143
+ declare function parseInputData<T extends Record<string, any>>(data: T, schema: {
144
+ fields: Record<string, DBFieldAttribute>;
145
+ action?: ("create" | "update") | undefined;
146
+ }): Partial<T> | Response;
147
+ declare function parseUserInput(options: Pick<FaireAuthOptions, "user" | "plugins">, user: Record<string, any> | undefined, action: "create" | "update"): Partial<Record<string, any>> | Response;
148
+ declare function parseAdditionalUserInput(options: Pick<FaireAuthOptions, "user" | "plugins">, user?: Record<string, any>): Partial<Record<string, any>> | Response;
149
+ declare function parseAccountInput(options: Pick<FaireAuthOptions, "plugins">, account: Partial<Account>): any;
150
+ declare function parseSessionInput(options: Pick<FaireAuthOptions, "session" | "plugins">, session: Partial<Session$1>): any;
151
+ declare function mergeSchema<S extends FaireAuthPluginDBSchema$1>(schema: S, newSchema?: { [K in keyof S]?: {
152
+ modelName?: string | undefined;
153
+ fields?: {
154
+ [P: string]: string;
155
+ } | undefined;
156
+ }; }): S;
157
+ declare function toZodSchema<Fields extends Record<string, DBFieldAttribute | never>, IsClientSide extends boolean>({ fields, isClientSide }: {
158
+ fields: Fields;
159
+ /**
160
+ * If true, then any fields that have `input: false` will be removed from the schema to prevent user input.
161
+ */
162
+ isClientSide: IsClientSide;
163
+ }): z.ZodObject<RemoveNeverProps<{ [key in keyof Fields]: FieldAttributeToSchema<Fields[key], IsClientSide>; }>, z.core.$strip>;
164
+ type FieldAttributeToSchema<Field extends DBFieldAttribute | Record<string, never>, isClientSide extends boolean = false> = Field extends {
165
+ type: any;
166
+ } ? GetInput<isClientSide, Field, GetRequired<Field, GetType<Field>>> : Record<string, never>;
167
+ type GetType<F extends DBFieldAttribute> = F extends {
168
+ type: "string";
169
+ } ? z.ZodString : F extends {
170
+ type: "number";
171
+ } ? z.ZodNumber : F extends {
172
+ type: "boolean";
173
+ } ? z.ZodBoolean : F extends {
174
+ type: "date";
175
+ } ? z.ZodDate : z.ZodAny;
176
+ type GetRequired<F extends DBFieldAttribute, Schema extends z.core.SomeType> = F extends {
177
+ required: true;
178
+ } ? Schema : z.ZodOptional<Schema>;
179
+ type GetInput<isClientSide extends boolean, Field extends DBFieldAttribute, Schema extends z.core.SomeType> = Field extends {
180
+ input: false;
181
+ } ? isClientSide extends true ? never : Schema : Schema;
182
+ type RemoveNeverProps<T> = { [K in keyof T as [T[K]] extends [never] ? never : K]: T[K]; };
183
+ declare function getAdapter(options: FaireAuthOptions): DBAdapter$1<FaireAuthOptions>;
184
+ declare function convertToDB<T extends Record<string, any>>(fields: Record<string, DBFieldAttribute>, values: T): T;
185
+ declare function convertFromDB<T extends Record<string, any>>(fields: Record<string, DBFieldAttribute>, values: T | null): T | null;
186
+ type BaseModels = keyof NonNullable<FaireAuthOptions["databaseHooks"]>;
187
+ type ModelShape = { [K in BaseModels]: K extends "user" ? UserInput : K extends "session" ? SessionInput : K extends "account" ? AccountInput : K extends "verification" ? VerificationInput : unknown; };
188
+ type ModelFn<M extends BaseModels, Op extends "create" | "update" | "delete"> = Exclude<Exclude<Exclude<Exclude<FaireAuthOptions["databaseHooks"], undefined>[M], undefined>[Op], undefined>["before"], undefined> extends ((...args: [infer Model extends Partial<ModelShape[M]>, ...any[]]) => Promise<infer Return>) ? {
189
+ arg: Model;
190
+ ret: Return extends any ? Return extends {
191
+ data: infer D;
192
+ } ? D : never : never;
193
+ } : never;
194
+ declare const getWithHooks: (adapter: DBAdapter$1<FaireAuthOptions>, hooks?: Exclude<FaireAuthOptions["databaseHooks"], undefined>[]) => {
195
+ createWithHooks<M extends BaseModels>(data: OmitId<ModelFn<M, "create">["arg"]>, model: M, customCreateFn?: {
196
+ fn: (data: OmitId<ModelFn<M, "create">["arg"]>) => Promise<ModelFn<M, "create">["ret"] | void>;
197
+ executeMainFn?: boolean;
198
+ } | undefined): Promise<ModelFn<M, "create">["ret"] | null>;
199
+ updateWithHooks<M extends BaseModels>(data: ModelFn<M, "update">["arg"], where: Where$1[], model: M, customUpdateFn?: {
200
+ fn: (data: ModelFn<M, "update">["arg"]) => Promise<ModelFn<M, "update">["ret"] | void>;
201
+ executeMainFn?: boolean;
202
+ } | undefined): Promise<ModelFn<M, "update">["ret"] | null>;
203
+ updateManyWithHooks<M extends BaseModels>(data: ModelFn<M, "update">["arg"], where: Where$1[], model: M, customUpdateFn?: {
204
+ fn: (data: ModelFn<M, "update">["arg"]) => Promise<ModelFn<M, "update">["ret"] | void>;
205
+ executeMainFn?: boolean;
206
+ } | undefined): Promise<number | ModelFn<M, "update">["ret"] | null>;
207
+ deleteWithHooks<M extends BaseModels>(where: Where$1[], model: M, customDeleteFn?: {
208
+ fn: (where: Where$1[]) => Promise<void>;
209
+ executeMainFn?: boolean;
210
+ } | undefined): Promise<void | null>;
211
+ deleteManyWithHooks<M extends BaseModels>(where: Where$1[], model: M, customDeleteFn?: {
212
+ fn: (where: Where$1[]) => Promise<void>;
213
+ executeMainFn?: boolean;
214
+ } | undefined): Promise<number | void | null>;
215
+ };
216
+ import * as import__faire_auth_core_db from "@faire-auth/core/db";
217
+ type AuthPluginSchema = { [table in string]: {
218
+ fields: { [field in string]: FieldAttribute; };
219
+ disableMigration?: boolean;
220
+ modelName?: string | undefined;
221
+ }; };
222
+ interface FaireAuthPlugin extends FaireAuthPlugin$1<ContextVars<any>> {
223
+ /**
224
+ * Custom routes provided by the plugin.
225
+ */
226
+ routes?: Record<string, AuthEndpoint<any>>;
227
+ /**
228
+ * Post-validation route hooks used in base or plugin routes.
229
+ */
230
+ routeHooks?: Prettify<Hooks>;
231
+ /**
232
+ * Plugin middleware used in base or plugin routes.
233
+ */
234
+ middleware?: Prettify<Middleware>;
235
+ }
236
+ type InferOptionSchema<S extends index_d_exports.FaireAuthPluginDBSchema> = S extends Record<string, {
237
+ fields: infer Fields;
238
+ }> ? { [K in keyof S]?: {
239
+ modelName?: string | undefined;
240
+ fields?: { [P in keyof Fields]?: string; } | undefined;
241
+ }; } : never;
242
+ type InferPluginErrorCodes<O extends FaireAuthOptions> = O["plugins"] extends (infer P)[] ? UnionToIntersection<P extends FaireAuthPlugin ? P["$ERROR_CODES"] extends Record<string, any> ? P["$ERROR_CODES"] : {} : {}> : {};
243
+ type InferPluginHooks<T extends readonly FaireAuthPlugin[]> = UnionToIntersection<T extends (infer P)[] ? P extends {
244
+ routes: infer R;
245
+ } ? { [K in keyof R]?: R[K] extends AuthEndpoint<infer C> ? RouteHook<C> : never; } : {} : {}>;
246
+ type InferPluginMiddleware<T extends readonly FaireAuthPlugin[]> = UnionToIntersection<T extends (infer P)[] ? P extends {
247
+ routes: infer R;
248
+ } ? { [K in keyof R]?: R[K] extends AuthEndpoint<infer C> ? never extends RouteConfigToMiddleware<C> ? MiddlewareHandler<ContextVars> : RouteConfigToMiddleware<C> : never; } : {} : {}>;
249
+ type InferPluginDTO<T extends readonly FaireAuthPlugin[]> = UnionToIntersection<T extends (infer P)[] ? P extends {
250
+ schemas: infer R;
251
+ } ? { [K in keyof R]?: DTOTransformer<z$1.output<R[K]>>; } : {} : {}>;
252
+ type InferPluginRateLimit<T extends readonly FaireAuthPlugin[]> = {
253
+ customRules?: UnionToIntersection<T extends (infer P)[] ? P extends {
254
+ routes: infer R;
255
+ } ? R extends Record<string, infer E> ? E extends AuthEndpoint<infer C> ? { [K in C as K["path"]]?: {
256
+ window: number;
257
+ max: number;
258
+ } | false | ((request: HonoRequest<K["path"], CustomIO<K, "out">>) => {
259
+ window: number;
260
+ max: number;
261
+ } | false | Promise<{
262
+ window: number;
263
+ max: number;
264
+ } | false>); } : {} : {} : {} : {}>;
265
+ };
266
+ type Hooks = { [K in LiteralStringUnion<Routes>]?: FromFn<K extends Routes ? RouteHook<Config<K>> : DefaultHook> extends ((...args: infer A) => infer R) ? (...args: A) => R | void : never; };
267
+ type DTO = { [K in LiteralStringUnion<Definitions>]?: K extends Definitions ? (typeof SCHEMAS)[K] extends {
268
+ default: infer D;
269
+ } ? DTOTransformer<z$1.output<D & z$1.ZodType>> extends ((...args: infer A) => infer R) ? (...args: A) => R : never : never : (schema: any) => any | Promise<any>; };
270
+ type Middleware = { [K in LiteralStringUnion<Routes>]?: K extends Routes ? RouteConfigToMiddleware<Config<K>> extends never ? MiddlewareHandler : RouteConfigToMiddleware<Config<K>> : MiddlewareHandler; };
271
+ type CustomRules = { [K in LiteralStringUnion<Config<Routes>> as K extends AuthRouteConfig ? K["path"] : string]?: {
272
+ /**
273
+ * The window to use for the custom rule.
274
+ */
275
+ window: number;
276
+ /**
277
+ * The maximum number of requests allowed within the window.
278
+ */
279
+ max: number;
280
+ } | false | ((request: K extends AuthRouteConfig ? RouteConfigToRequest<K> : HonoRequest) => {
281
+ window: number;
282
+ max: number;
283
+ } | false | Promise<{
284
+ window: number;
285
+ max: number;
286
+ } | false>); };
287
+ interface FaireAuthRateLimitOptions extends FaireAuthRateLimitOptions$1 {
288
+ /**
289
+ * Custom rate limit rules to apply to
290
+ * specific paths.
291
+ */
292
+ customRules?: CustomRules | undefined;
293
+ }
294
+ interface FaireAuthOptions extends FaireAuthOptions$1<ContextVars> {
295
+ /**
296
+ * Post-validation route hooks for base or plugin routes.
297
+ *
298
+ * Route hooks run after request validation but before the handler runs.
299
+ * They allow you to modify the request data, handle errors, or perform
300
+ * additional logic based on the validation result.
301
+ *
302
+ * @example
303
+ * ```ts
304
+ * routeHooks: {
305
+ * // Transform successful sign-up requests to add custom data
306
+ * signUpEmail: (result, ctx) => {
307
+ * if (result.success && result.target === 'json') {
308
+ * result.data.customField = 'custom value';
309
+ * }
310
+ * },
311
+ * // Handle validation errors with custom responses
312
+ * signInEmail: (result, ctx) => {
313
+ * if (!result.success) {
314
+ * return ctx.json({
315
+ * error: 'Custom error message',
316
+ * details: result.error.errors
317
+ * }, 400);
318
+ * }
319
+ * }
320
+ * }
321
+ * ```
322
+ *
323
+ * The hook receives:
324
+ * - `result`: Either `{ success: true, target: string, data: any }` for successful validation
325
+ * or `{ success: false, error: ZodError }` for validation failures
326
+ * - `ctx`: The request context with methods like `ctx.json()` to return responses
327
+ *
328
+ * Hooks can return a response or undefined to continue with the original.
329
+ */
330
+ routeHooks?: Hooks;
331
+ /**
332
+ * Custom middleware for base or plugin routes.
333
+ *
334
+ * Middleware functions run before route handlers and can perform
335
+ * authentication, authorization, request modification, or early response.
336
+ * They execute in the order they are defined and can pass control
337
+ * to the next middleware or route handler.
338
+ *
339
+ * @example
340
+ * ```ts
341
+ * middleware: {
342
+ * // Add custom authentication to specific routes
343
+ * signUpEmail: createMiddleware<{ isAdmin: boolean }>()(async (ctx, next) => {
344
+ * const user = ctx.get('user');
345
+ * if (!user?.isAdmin) {
346
+ * return ctx.json({ error: 'Admin access required' }, 403);
347
+ * }
348
+ * ctx.set("isAdmin", true)
349
+ * return await next();
350
+ * }),
351
+ *
352
+ * // Add request logging
353
+ * getSession: createMiddleware()(async (ctx, next) => {
354
+ * const logger = ctx.get("context").logger
355
+ * logger.info(`${ctx.req.method} ${ctx.req.path}`);
356
+ * const start = Date.now();
357
+ * await next();
358
+ * logger.info(`Response time: ${Date.now() - start}ms`);
359
+ * })
360
+ * }
361
+ * ```
362
+ *
363
+ * Common middleware patterns:
364
+ * - Authentication: Check user sessions, API keys, or tokens
365
+ * - Authorization: Verify user permissions or roles
366
+ * - Request processing: Parse, validate, or transform request data
367
+ * - Response modification: Add headers, CORS, or caching
368
+ * - Error handling: Catch and format errors consistently
369
+ *
370
+ * The middleware receives the request context and `next()` function.
371
+ * Call `await next()` to continue to the next middleware or route handler.
372
+ * Return a Response to stop processing and send an immediate response.
373
+ */
374
+ middleware?: Middleware;
375
+ /**
376
+ * Data Transfer Object (DTO) transformers that automatically transform
377
+ * response objects across all routes.
378
+ *
379
+ * DTO transformers can be synchronous or asynchronous and are perfect for:
380
+ * - Sanitizing data according to your operational security policy
381
+ * (removing passwords, internal IDs)
382
+ * - Adding computed properties or metadata
383
+ * - Formatting data for client consumption
384
+ * - Implementing data access patterns
385
+ *
386
+ * @example
387
+ * ```ts
388
+ * dto: {
389
+ * // Transform user objects to remove sensitive data
390
+ * user: (user) => ({
391
+ * ...user,
392
+ * id: undefined,
393
+ * email: user.email.toLowerCase(),
394
+ * displayName: user.name || 'Anonymous',
395
+ * isActive: true,
396
+ * memberSince: user.createdAt.toISOString().split('T')[0]
397
+ * }),
398
+ *
399
+ * // Add metadata to session responses
400
+ * session: (session) => ({
401
+ * ...session,
402
+ * expiresIn: Math.floor((session.expiresAt - Date.now()) / 1000),
403
+ * isFresh: session.createdAt > new Date(Date.now() - 60000)
404
+ * }),
405
+ *
406
+ * // Async transformation for complex operations
407
+ * account: async (account) => {
408
+ * const providerInfo = await getProviderDetails(account.providerId);
409
+ * return {
410
+ * ...account,
411
+ * providerName: providerInfo.name,
412
+ * providerIcon: providerInfo.icon,
413
+ * lastUsedFormatted: formatLastUsed(account.updatedAt)
414
+ * };
415
+ * }
416
+ * }
417
+ * ```
418
+ *
419
+ * Key features:
420
+ * - **Automatic nesting**: Works with nested response structures
421
+ * - **Type safety**: Preserves TypeScript types through transformations
422
+ * - **Performance**: Only transforms data that actually gets sent to clients
423
+ * and the API
424
+ * - **Consistency**: Ensures all responses follow the same data format
425
+ *
426
+ * Common use cases:
427
+ * - Remove internal properties (passwords, tokens, metadata)
428
+ * - Format dates, numbers, and other display values
429
+ * - Add computed properties or relationships
430
+ * - Implement field-level access control
431
+ * - Standardize API response formats
432
+ */
433
+ dto?: DTO;
434
+ /**
435
+ * List of Faire Auth plugins
436
+ */
437
+ plugins?: FaireAuthPlugin[] | undefined;
438
+ }
439
+ type ClientRequestOptions<T = unknown> = {
440
+ fetch?: typeof fetch | HonoRequest$1;
441
+ webSocket?: (...args: ConstructorParameters<typeof WebSocket>) => WebSocket;
442
+ /**
443
+ * Standard `RequestInit`, caution that this take highest priority
444
+ * and could be used to overwrite things that Hono sets for you, like `body | method | headers`.
445
+ *
446
+ * If you want to add some headers, use in `headers` instead of `init`
447
+ */
448
+ init?: RequestInit;
449
+ } & (keyof T extends never ? {
450
+ headers?: HeadersInit | (() => HeadersInit | Promise<HeadersInit>);
451
+ } : {
452
+ headers: T | (() => T | Promise<T>);
453
+ });
454
+ type FetchOptions<Head = unknown, Body = any, Query extends Record<string, any> = any, Params extends Record<string, any> | Array<string> | undefined = any, Res = any, ExtraOptions extends Record<string, any> = {}> = {
455
+ fetchOptions?: ExK<BetterFetchOption<Body, Query, Params, Res, ExtraOptions>, "throw">;
456
+ } & ClientRequestOptions<Head>;
457
+ type FetchEsque = (input: string | URL | globalThis.Request, init?: RequestInit) => Promise<Response> | Response;
458
+ interface AtomListener {
459
+ matcher: (path: string) => boolean;
460
+ signal: LiteralStringUnion<"$sessionSignal">;
461
+ }
462
+ interface Store {
463
+ notify: (signal: string) => void;
464
+ listen: (signal: string, listener: () => void) => void;
465
+ atoms: Record<string, WritableAtom<any>>;
466
+ }
467
+ interface FaireAuthClientPlugin {
468
+ id: LiteralString;
469
+ /**
470
+ * only used for type inference. don't pass the
471
+ * actual plugin
472
+ */
473
+ $InferServerPlugin?: FaireAuthPlugin;
474
+ /**
475
+ * Custom actions
476
+ */
477
+ getActions?: ($fetch: BetterFetch, $store: Store,
478
+ /**
479
+ * faire-auth client options
480
+ */
481
+ options: ClientOptions | undefined) => Record<string, any>;
482
+ /**
483
+ * State atoms that'll be resolved by each framework
484
+ * auth store.
485
+ */
486
+ getAtoms?: ($fetch: BetterFetch) => Record<string, Atom<any>>;
487
+ /**
488
+ * specify path methods for server plugin inferred
489
+ * endpoints to force a specific method.
490
+ */
491
+ pathMethods?: Record<string, "POST" | "GET">;
492
+ /**
493
+ * Better fetch plugins
494
+ */
495
+ fetchPlugins?: BetterFetchPlugin[];
496
+ /**
497
+ * a list of recaller based on a matcher function.
498
+ * The signal name needs to match a signal in this
499
+ * plugin or any plugin the user might have added.
500
+ */
501
+ atomListeners?: AtomListener[];
502
+ }
503
+ interface RevalidateOptions {
504
+ /**
505
+ * A time interval (in seconds) after which the session will be re-fetched.
506
+ * If set to `0` (default), the session is not polled.
507
+ *
508
+ * This helps prevent session expiry during idle periods by periodically
509
+ * refreshing the session.
510
+ *
511
+ * @default 0
512
+ */
513
+ refetchInterval?: number | undefined;
514
+ /**
515
+ * Automatically refetch the session when the user switches back to the window/tab.
516
+ * This option activates this behavior if set to `true` (default).
517
+ *
518
+ * Prevents expired sessions when users switch tabs and come back later.
519
+ *
520
+ * @default true
521
+ */
522
+ refetchOnWindowFocus?: boolean | undefined;
523
+ /**
524
+ * Set to `false` to stop polling when the device has no internet access
525
+ * (determined by `navigator.onLine`).
526
+ *
527
+ * @default false
528
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/NavigatorOnLine/onLine
529
+ */
530
+ refetchWhenOffline?: boolean | undefined;
531
+ }
532
+ interface ClientOptions<S extends Schema$1 = Schema$1> {
533
+ fetchOptions?: Omit<CreateFetchOption, "schema" | "customFetchImpl"> & {
534
+ schema?: S;
535
+ customFetchImpl?: FetchEsque;
536
+ };
537
+ plugins?: FaireAuthClientPlugin[];
538
+ baseURL?: string;
539
+ basePath?: string;
540
+ disableDefaultFetchPlugins?: boolean;
541
+ $InferAuth?: FaireAuthOptions;
542
+ sessionOptions?: RevalidateOptions | undefined;
543
+ }
544
+ type InferActions<O extends ClientOptions> = O["plugins"] extends Array<infer Plugin> ? UnionToIntersection<Plugin extends FaireAuthClientPlugin ? Plugin["getActions"] extends ((...args: any) => infer Actions) ? Actions : {} : {}> : {};
545
+ type InferErrorCodes<O extends ClientOptions> = O["plugins"] extends (infer Plugin)[] ? UnionToIntersection<Plugin extends FaireAuthClientPlugin ? Plugin["$InferServerPlugin"] extends FaireAuthPlugin ? Plugin["$InferServerPlugin"]["$ERROR_CODES"] : {} : {}> : {};
546
+ /**
547
+ * signals are just used to recall a computed value.
548
+ * as a convention they start with "$"
549
+ */
550
+ type IsSignal<T> = T extends `$${infer _}` ? true : false;
551
+ type InferPluginsFromClient<O extends ClientOptions> = O["plugins"] extends FaireAuthClientPlugin[] ? O["plugins"][number]["$InferServerPlugin"][] : undefined;
552
+ type InferSessionFromClient<O extends ClientOptions> = StripEmptyObjects<StrictSession & UnionToIntersection<InferAdditionalFromClient<O, "session">>>;
553
+ type InferUserFromClient<O extends ClientOptions> = StripEmptyObjects<StrictUser & UnionToIntersection<InferAdditionalFromClient<O, "user">>>;
554
+ type InferAdditionalFromClient<Options extends ClientOptions, Key extends string, Format extends "input" | "output" = "output"> = Options["plugins"] extends Array<infer T> ? T extends FaireAuthClientPlugin ? T["$InferServerPlugin"] extends {
555
+ schema: { [key in Key]: {
556
+ fields: infer Field;
557
+ }; };
558
+ } ? Format extends "input" ? InferFieldsInputClient$1<Field> : InferFieldsOutput$1<Field> : {} : {} : {};
559
+ type SessionQueryParams = {
560
+ disableCookieCache?: boolean;
561
+ disableRefresh?: boolean;
562
+ };
563
+ type InferAdditionalAsClient<Options extends FaireAuthOptions, Key extends string, Format extends "input" | "output" = "output"> = Options["plugins"] extends (infer T)[] ? T extends FaireAuthPlugin ? T extends {
564
+ schema: Record<Key, {
565
+ fields: infer Field;
566
+ }>;
567
+ } ? Format extends "input" ? InferFieldsInputClient$1<Field> : InferFieldsOutput$1<Field> : {} : {} : {};
568
+ type TransformToSchema<T> = { [K in keyof T]: T[K] extends Record<string, any> ? { [M in keyof T[K] as M extends `$${infer Method extends Methods}` ? `@${Method}/${K & string}` : never]: T[K][M] extends {
569
+ input: {
570
+ json?: infer Json;
571
+ cbor?: infer Cbor;
572
+ query?: infer Query;
573
+ param?: infer Param;
574
+ };
575
+ output: infer Output;
576
+ outputFormat?: string;
577
+ status?: number;
578
+ } ? Prettify<{
579
+ method?: M extends `$${infer Method extends Methods}` ? Method : never;
580
+ } & (Json extends Record<string, any> ? {
581
+ input: StandardSchemaV1<Json>;
582
+ } : {}) & (Cbor extends Record<string, any> ? {
583
+ input: StandardSchemaV1<Cbor>;
584
+ } : {}) & (Output extends Record<string, any> ? {
585
+ output: StandardSchemaV1<Output>;
586
+ } : {}) & (Query extends Record<string, any> ? {
587
+ query: StandardSchemaV1<Query>;
588
+ } : {}) & (Param extends Record<string, any> ? {
589
+ params: StandardSchemaV1<Param>;
590
+ } : {})> : never; } : never; }[keyof T] extends (infer U) ? U extends Record<string, any> ? U : never : never;
591
+ type FlattenRoutes<T> = T extends Record<string, any> ? (T extends any ? T : never) : never;
592
+ type CreateSchemaType<T> = {
593
+ schema: FlattenRoutes<TransformToSchema<T>>;
594
+ config: SchemaConfig;
595
+ };
596
+ type S$1<T> = {
597
+ data: T;
598
+ error: null;
599
+ };
600
+ type E<Err, Stat extends ClientErrorStatusCode | ServerErrorStatusCode> = {
601
+ data: null;
602
+ error: Prettify<(Err extends Record<string, any> ? Err : {
603
+ message?: string;
604
+ }) & {
605
+ status: Stat;
606
+ statusText: string;
607
+ }>;
608
+ };
609
+ type BuildTuple<N extends number, Acc extends unknown[] = []> = Acc["length"] extends N ? Acc : BuildTuple<N, [...Acc, unknown]>;
610
+ type Inc<A extends number> = [unknown, ...BuildTuple<A>]["length"] & number;
611
+ type CamelCase<S extends string> = S extends `${infer P1}-${infer P2}${infer P3}` ? `${Lowercase<P1>}${Uppercase<P2>}${CamelCase<P3>}` : Lowercase<S>;
612
+ type ExcludeServerPaths<T, P extends string> = T extends Record<string, infer EP> ? EP extends any ? EP extends {
613
+ SERVER_ONLY: true;
614
+ } ? never : EP extends {
615
+ isAction: false;
616
+ } ? never : P : never : never;
617
+ type Segments<P extends string, O extends string[] = [], Depth extends number = 0> = P extends "" ? O : Depth extends 3 ? O : P extends `${infer First}/${infer Second}` ? Segments<Second, [...O, First], Inc<Depth>> : [...O, P];
618
+ type BuildChain<Segs extends string[], BasePath extends string, Sch extends Schema, Original extends string, Throw extends boolean, Idx extends number = 0> = Idx extends Segs["length"] ? ClientRequest<string, Original, Sch[Original]> extends (infer I) ? { [K in keyof I]: I[K] extends ((...args: [infer In extends object, infer _Opt, ...infer Rest]) => Promise<infer Res>) ? <O extends FetchOptions<In extends {
619
+ header: infer H;
620
+ } ? H : unknown, In extends {
621
+ json: infer J;
622
+ } ? J : any, // | In["cbor"]
623
+ In extends {
624
+ query: infer Q;
625
+ } ? Q : any, In extends {
626
+ param: infer P;
627
+ } ? P : any, Res extends any ? Res extends ClientResponse<infer CRes, infer Stat, infer _F> ? Stat extends SuccessStatusCode ? CRes : never : never : never>>(...args: HasRequiredKeys<In> extends true ? [args: In, options?: O, ...Rest] : [options?: O, ...Rest]) => Promise<Res extends any ? Res extends ClientResponse<infer CRes, infer Stat, infer _F> ? Stat extends SuccessStatusCode ? Throw extends true ? CRes : S$1<CRes> : Stat extends ClientErrorStatusCode | ServerErrorStatusCode ? Throw extends true ? never : E<CRes, Stat> : never : Res : never> : I[K]; } : never : { [K in Segs[Idx] as ExcludeServerPaths<Sch[Original], CamelCase<K>>]: BuildChain<Segs, BasePath, Sch, Original, Throw, Inc<Idx>>; };
628
+ type Relative<Path extends string, BasePath extends string> = BasePath extends "" ? Path : Path extends `${BasePath}/${infer Rest}` ? Rest : Path extends BasePath ? "" : Path;
629
+ type PathToChain<Path extends string, BasePath extends string, E extends Schema, Original extends string = Path, Throw extends boolean = false> = BuildChain<Segments<Relative<Path, BasePath>>, BasePath, E, Original, Throw>;
630
+ type Client<S, BasePath extends string, COpts extends ClientOptions> = UnionToIntersection<S extends Record<infer K, any> ? K extends string ? PathToChain<K, BasePath, S, K, COpts["fetchOptions"] extends {
631
+ throw: true;
632
+ } ? true : false> : never : never>;
633
+ type InferResolvedHooks<O extends ClientOptions> = O["plugins"] extends (infer Plugin)[] ? Plugin extends FaireAuthClientPlugin ? Plugin["getAtoms"] extends ((fetch: any) => infer Atoms) ? Atoms extends Record<string, any> ? { [key in keyof Atoms as IsSignal<key> extends true ? never : key extends string ? `use${Capitalize<key>}` : never]: Atoms[key]; } : {} : {} : {} : {};
634
+ declare const createAuthClient: <App extends AnyHono = DefaultApp>() => <Option extends ClientOptions>(options: Option) => UnionToIntersection<InferResolvedHooks<Option>> & (App extends Hono<any, infer S extends import("hono").Schema, infer P extends string> ? UnionToIntersection<S_1 extends Record<infer K extends string | number | symbol, any> ? K extends string ? 0 extends (infer T) ? T extends 0 ? T extends ((BasePath extends "" ? K : K extends (infer T_1) ? T_1 extends K ? T_1 extends `${BasePath}/${infer Rest}` ? Rest : T_1 extends BasePath ? "" : T_1 : never : never) extends (infer T_2) ? T_2 extends (BasePath extends "" ? K : K extends (infer T_1) ? T_1 extends K ? T_1 extends `${BasePath}/${infer Rest}` ? Rest : T_1 extends BasePath ? "" : T_1 : never : never) ? T_2 extends "" ? [] : T_2 extends `${infer First}/${infer Second}` ? Second extends "" ? [First] : Second extends `${infer First}/${infer Second}` ? Second extends "" ? [First, First] : Second extends `${infer First}/${infer Second}` ? Second extends "" ? [First, First, First] : [First, First, First] : [First, First, Second] : [First, Second] : [T_2] : never : never)["length"] ? import("hono/client").ClientRequest<string, K, S_1[K]> extends (infer I) ? { [K_1 in keyof I]: I[K_1] extends ((args_0: infer In extends object, args_1: infer _Opt, ...args: infer Rest_1) => Promise<infer Res>) ? <O extends FetchOptions<In extends {
635
+ header: infer H;
636
+ } ? H : unknown, In extends {
637
+ json: infer J;
638
+ } ? J : any, In extends {
639
+ query: infer Q;
640
+ } ? Q : any, In extends {
641
+ param: infer P_1;
642
+ } ? P_1 : any, Res extends any ? Res extends import("hono/client").ClientResponse<infer CRes, infer Stat, infer _F> ? Stat extends import("hono/utils/http-status").SuccessStatusCode ? CRes : never : never : never>>(...args: import("hono/utils/types").HasRequiredKeys<In> extends true ? [args: In, options?: O, ...Rest_1] : [options?: O, ...Rest_1]) => Promise<Res extends any ? Res extends import("hono/client").ClientResponse<infer CRes, infer Stat extends number, infer _F extends string> ? Stat extends import("hono/utils/http-status").SuccessStatusCode ? (COpts["fetchOptions"] extends {
643
+ throw: true;
644
+ } ? true : false) extends (infer T_3) ? T_3 extends (COpts["fetchOptions"] extends {
645
+ throw: true;
646
+ } ? true : false) ? T_3 extends true ? CRes : {
647
+ data: CRes;
648
+ error: null;
649
+ } : never : never : Stat extends import("hono/utils/http-status").ClientErrorStatusCode | import("hono/utils/http-status").ServerErrorStatusCode ? (COpts["fetchOptions"] extends {
650
+ throw: true;
651
+ } ? true : false) extends (infer T_4) ? T_4 extends (COpts["fetchOptions"] extends {
652
+ throw: true;
653
+ } ? true : false) ? T_4 extends true ? never : {
654
+ data: null;
655
+ error: Prettify<(Err extends Record<string, any> ? Err : {
656
+ message?: string;
657
+ }) & {
658
+ status: Stat_1;
659
+ statusText: string;
660
+ }>;
661
+ } : never : never : never : Res : never> : I[K_1]; } : never : { [K_1 in ((BasePath extends "" ? K : K extends (infer T_1) ? T_1 extends K ? T_1 extends `${BasePath}/${infer Rest}` ? Rest : T_1 extends BasePath ? "" : T_1 : never : never) extends (infer T_2) ? T_2 extends (BasePath extends "" ? K : K extends (infer T_1) ? T_1 extends K ? T_1 extends `${BasePath}/${infer Rest}` ? Rest : T_1 extends BasePath ? "" : T_1 : never : never) ? T_2 extends "" ? [] : T_2 extends `${infer First}/${infer Second}` ? Second extends "" ? [First] : Second extends `${infer First}/${infer Second}` ? Second extends "" ? [First, First] : Second extends `${infer First}/${infer Second}` ? Second extends "" ? [First, First, First] : [First, First, First] : [First, First, Second] : [First, Second] : [T_2] : never : never)[T] as S_1[K] extends (infer T_3) ? T_3 extends S_1[K] ? T_3 extends Record<string, infer EP> ? EP extends any ? EP extends {
662
+ SERVER_ONLY: true;
663
+ } ? never : EP extends {
664
+ isAction: false;
665
+ } ? never : CamelCase<K_1> : never : never : never : never]: Inc<T> extends (infer T_4) ? T_4 extends Inc<T> ? T_4 extends ((BasePath extends "" ? K : K extends (infer T_1) ? T_1 extends K ? T_1 extends `${BasePath}/${infer Rest}` ? Rest : T_1 extends BasePath ? "" : T_1 : never : never) extends (infer T_2) ? T_2 extends (BasePath extends "" ? K : K extends (infer T_1) ? T_1 extends K ? T_1 extends `${BasePath}/${infer Rest}` ? Rest : T_1 extends BasePath ? "" : T_1 : never : never) ? T_2 extends "" ? [] : T_2 extends `${infer First}/${infer Second}` ? Second extends "" ? [First] : Second extends `${infer First}/${infer Second}` ? Second extends "" ? [First, First] : Second extends `${infer First}/${infer Second}` ? Second extends "" ? [First, First, First] : [First, First, First] : [First, First, Second] : [First, Second] : [T_2] : never : never)["length"] ? import("hono/client").ClientRequest<string, K, S_1[K]> extends (infer I) ? { [K_1 in keyof I]: I[K_1] extends ((args_0: infer In extends object, args_1: infer _Opt, ...args: infer Rest_1) => Promise<infer Res>) ? <O extends FetchOptions<In extends {
666
+ header: infer H;
667
+ } ? H : unknown, In extends {
668
+ json: infer J;
669
+ } ? J : any, In extends {
670
+ query: infer Q;
671
+ } ? Q : any, In extends {
672
+ param: infer P_1;
673
+ } ? P_1 : any, Res extends any ? Res extends import("hono/client").ClientResponse<infer CRes, infer Stat, infer _F> ? Stat extends import("hono/utils/http-status").SuccessStatusCode ? CRes : never : never : never>>(...args: import("hono/utils/types").HasRequiredKeys<In> extends true ? [args: In, options?: O, ...Rest_1] : [options?: O, ...Rest_1]) => Promise<Res extends any ? Res extends import("hono/client").ClientResponse<infer CRes, infer Stat extends number, infer _F extends string> ? Stat extends import("hono/utils/http-status").SuccessStatusCode ? (COpts["fetchOptions"] extends {
674
+ throw: true;
675
+ } ? true : false) extends (infer T_3) ? T_3 extends (COpts["fetchOptions"] extends {
676
+ throw: true;
677
+ } ? true : false) ? T_3 extends true ? CRes : {
678
+ data: CRes;
679
+ error: null;
680
+ } : never : never : Stat extends import("hono/utils/http-status").ClientErrorStatusCode | import("hono/utils/http-status").ServerErrorStatusCode ? (COpts["fetchOptions"] extends {
681
+ throw: true;
682
+ } ? true : false) extends (infer T_4) ? T_4 extends (COpts["fetchOptions"] extends {
683
+ throw: true;
684
+ } ? true : false) ? T_4 extends true ? never : {
685
+ data: null;
686
+ error: Prettify<(Err extends Record<string, any> ? Err : {
687
+ message?: string;
688
+ }) & {
689
+ status: Stat_1;
690
+ statusText: string;
691
+ }>;
692
+ } : never : never : never : Res : never> : I[K_1]; } : never : { [K_2 in ((BasePath extends "" ? K : K extends (infer T_1) ? T_1 extends K ? T_1 extends `${BasePath}/${infer Rest}` ? Rest : T_1 extends BasePath ? "" : T_1 : never : never) extends (infer T_2) ? T_2 extends (BasePath extends "" ? K : K extends (infer T_1) ? T_1 extends K ? T_1 extends `${BasePath}/${infer Rest}` ? Rest : T_1 extends BasePath ? "" : T_1 : never : never) ? T_2 extends "" ? [] : T_2 extends `${infer First}/${infer Second}` ? Second extends "" ? [First] : Second extends `${infer First}/${infer Second}` ? Second extends "" ? [First, First] : Second extends `${infer First}/${infer Second}` ? Second extends "" ? [First, First, First] : [First, First, First] : [First, First, Second] : [First, Second] : [T_2] : never : never)[T_4] as S_1[K] extends (infer T_5) ? T_5 extends S_1[K] ? T_5 extends Record<string, infer EP> ? EP extends any ? EP extends {
693
+ SERVER_ONLY: true;
694
+ } ? never : EP extends {
695
+ isAction: false;
696
+ } ? never : CamelCase<K_2> : never : never : never : never]: Inc<T_4> extends (infer T_6) ? T_6 extends Inc<T_4> ? T_6 extends ((BasePath extends "" ? K : K extends (infer T_1) ? T_1 extends K ? T_1 extends `${BasePath}/${infer Rest}` ? Rest : T_1 extends BasePath ? "" : T_1 : never : never) extends (infer T_2) ? T_2 extends (BasePath extends "" ? K : K extends (infer T_1) ? T_1 extends K ? T_1 extends `${BasePath}/${infer Rest}` ? Rest : T_1 extends BasePath ? "" : T_1 : never : never) ? T_2 extends "" ? [] : T_2 extends `${infer First}/${infer Second}` ? Second extends "" ? [First] : Second extends `${infer First}/${infer Second}` ? Second extends "" ? [First, First] : Second extends `${infer First}/${infer Second}` ? Second extends "" ? [First, First, First] : [First, First, First] : [First, First, Second] : [First, Second] : [T_2] : never : never)["length"] ? import("hono/client").ClientRequest<string, K, S_1[K]> extends (infer I) ? { [K_1 in keyof I]: I[K_1] extends ((args_0: infer In extends object, args_1: infer _Opt, ...args: infer Rest_1) => Promise<infer Res>) ? <O extends FetchOptions<In extends {
697
+ header: infer H;
698
+ } ? H : unknown, In extends {
699
+ json: infer J;
700
+ } ? J : any, In extends {
701
+ query: infer Q;
702
+ } ? Q : any, In extends {
703
+ param: infer P_1;
704
+ } ? P_1 : any, Res extends any ? Res extends import("hono/client").ClientResponse<infer CRes, infer Stat, infer _F> ? Stat extends import("hono/utils/http-status").SuccessStatusCode ? CRes : never : never : never>>(...args: import("hono/utils/types").HasRequiredKeys<In> extends true ? [args: In, options?: O, ...Rest_1] : [options?: O, ...Rest_1]) => Promise<Res extends any ? Res extends import("hono/client").ClientResponse<infer CRes, infer Stat extends number, infer _F extends string> ? Stat extends import("hono/utils/http-status").SuccessStatusCode ? (COpts["fetchOptions"] extends {
705
+ throw: true;
706
+ } ? true : false) extends (infer T_3) ? T_3 extends (COpts["fetchOptions"] extends {
707
+ throw: true;
708
+ } ? true : false) ? T_3 extends true ? CRes : {
709
+ data: CRes;
710
+ error: null;
711
+ } : never : never : Stat extends import("hono/utils/http-status").ClientErrorStatusCode | import("hono/utils/http-status").ServerErrorStatusCode ? (COpts["fetchOptions"] extends {
712
+ throw: true;
713
+ } ? true : false) extends (infer T_4) ? T_4 extends (COpts["fetchOptions"] extends {
714
+ throw: true;
715
+ } ? true : false) ? T_4 extends true ? never : {
716
+ data: null;
717
+ error: Prettify<(Err extends Record<string, any> ? Err : {
718
+ message?: string;
719
+ }) & {
720
+ status: Stat_1;
721
+ statusText: string;
722
+ }>;
723
+ } : never : never : never : Res : never> : I[K_1]; } : never : { [K_3 in ((BasePath extends "" ? K : K extends (infer T_1) ? T_1 extends K ? T_1 extends `${BasePath}/${infer Rest}` ? Rest : T_1 extends BasePath ? "" : T_1 : never : never) extends (infer T_2) ? T_2 extends (BasePath extends "" ? K : K extends (infer T_1) ? T_1 extends K ? T_1 extends `${BasePath}/${infer Rest}` ? Rest : T_1 extends BasePath ? "" : T_1 : never : never) ? T_2 extends "" ? [] : T_2 extends `${infer First}/${infer Second}` ? Second extends "" ? [First] : Second extends `${infer First}/${infer Second}` ? Second extends "" ? [First, First] : Second extends `${infer First}/${infer Second}` ? Second extends "" ? [First, First, First] : [First, First, First] : [First, First, Second] : [First, Second] : [T_2] : never : never)[T_6] as S_1[K] extends (infer T_7) ? T_7 extends S_1[K] ? T_7 extends Record<string, infer EP> ? EP extends any ? EP extends {
724
+ SERVER_ONLY: true;
725
+ } ? never : EP extends {
726
+ isAction: false;
727
+ } ? never : CamelCase<K_3> : never : never : never : never]: Inc<T_6> extends (infer T_8) ? T_8 extends Inc<T_6> ? T_8 extends ((BasePath extends "" ? K : K extends (infer T_1) ? T_1 extends K ? T_1 extends `${BasePath}/${infer Rest}` ? Rest : T_1 extends BasePath ? "" : T_1 : never : never) extends (infer T_2) ? T_2 extends (BasePath extends "" ? K : K extends (infer T_1) ? T_1 extends K ? T_1 extends `${BasePath}/${infer Rest}` ? Rest : T_1 extends BasePath ? "" : T_1 : never : never) ? T_2 extends "" ? [] : T_2 extends `${infer First}/${infer Second}` ? Second extends "" ? [First] : Second extends `${infer First}/${infer Second}` ? Second extends "" ? [First, First] : Second extends `${infer First}/${infer Second}` ? Second extends "" ? [First, First, First] : [First, First, First] : [First, First, Second] : [First, Second] : [T_2] : never : never)["length"] ? import("hono/client").ClientRequest<string, K, S_1[K]> extends (infer I) ? { [K_1 in keyof I]: I[K_1] extends ((args_0: infer In extends object, args_1: infer _Opt, ...args: infer Rest_1) => Promise<infer Res>) ? <O extends FetchOptions<In extends {
728
+ header: infer H;
729
+ } ? H : unknown, In extends {
730
+ json: infer J;
731
+ } ? J : any, In extends {
732
+ query: infer Q;
733
+ } ? Q : any, In extends {
734
+ param: infer P_1;
735
+ } ? P_1 : any, Res extends any ? Res extends import("hono/client").ClientResponse<infer CRes, infer Stat, infer _F> ? Stat extends import("hono/utils/http-status").SuccessStatusCode ? CRes : never : never : never>>(...args: import("hono/utils/types").HasRequiredKeys<In> extends true ? [args: In, options?: O, ...Rest_1] : [options?: O, ...Rest_1]) => Promise<Res extends any ? Res extends import("hono/client").ClientResponse<infer CRes, infer Stat extends number, infer _F extends string> ? Stat extends import("hono/utils/http-status").SuccessStatusCode ? (COpts["fetchOptions"] extends {
736
+ throw: true;
737
+ } ? true : false) extends (infer T_3) ? T_3 extends (COpts["fetchOptions"] extends {
738
+ throw: true;
739
+ } ? true : false) ? T_3 extends true ? CRes : {
740
+ data: CRes;
741
+ error: null;
742
+ } : never : never : Stat extends import("hono/utils/http-status").ClientErrorStatusCode | import("hono/utils/http-status").ServerErrorStatusCode ? (COpts["fetchOptions"] extends {
743
+ throw: true;
744
+ } ? true : false) extends (infer T_4) ? T_4 extends (COpts["fetchOptions"] extends {
745
+ throw: true;
746
+ } ? true : false) ? T_4 extends true ? never : {
747
+ data: null;
748
+ error: Prettify<(Err extends Record<string, any> ? Err : {
749
+ message?: string;
750
+ }) & {
751
+ status: Stat_1;
752
+ statusText: string;
753
+ }>;
754
+ } : never : never : never : Res : never> : I[K_1]; } : never : { [K_4 in ((BasePath extends "" ? K : K extends (infer T_1) ? T_1 extends K ? T_1 extends `${BasePath}/${infer Rest}` ? Rest : T_1 extends BasePath ? "" : T_1 : never : never) extends (infer T_2) ? T_2 extends (BasePath extends "" ? K : K extends (infer T_1) ? T_1 extends K ? T_1 extends `${BasePath}/${infer Rest}` ? Rest : T_1 extends BasePath ? "" : T_1 : never : never) ? T_2 extends "" ? [] : T_2 extends `${infer First}/${infer Second}` ? Second extends "" ? [First] : Second extends `${infer First}/${infer Second}` ? Second extends "" ? [First, First] : Second extends `${infer First}/${infer Second}` ? Second extends "" ? [First, First, First] : [First, First, First] : [First, First, Second] : [First, Second] : [T_2] : never : never)[T_8] as S_1[K] extends (infer T_9) ? T_9 extends S_1[K] ? T_9 extends Record<string, infer EP> ? EP extends any ? EP extends {
755
+ SERVER_ONLY: true;
756
+ } ? never : EP extends {
757
+ isAction: false;
758
+ } ? never : CamelCase<K_4> : never : never : never : never]: Inc<T_8> extends (infer T_10) ? T_10 extends Inc<T_8> ? T_10 extends ((BasePath extends "" ? K : K extends (infer T_1) ? T_1 extends K ? T_1 extends `${BasePath}/${infer Rest}` ? Rest : T_1 extends BasePath ? "" : T_1 : never : never) extends (infer T_2) ? T_2 extends (BasePath extends "" ? K : K extends (infer T_1) ? T_1 extends K ? T_1 extends `${BasePath}/${infer Rest}` ? Rest : T_1 extends BasePath ? "" : T_1 : never : never) ? T_2 extends "" ? [] : T_2 extends `${infer First}/${infer Second}` ? Second extends "" ? [First] : Second extends `${infer First}/${infer Second}` ? Second extends "" ? [First, First] : Second extends `${infer First}/${infer Second}` ? Second extends "" ? [First, First, First] : [First, First, First] : [First, First, Second] : [First, Second] : [T_2] : never : never)["length"] ? import("hono/client").ClientRequest<string, K, S_1[K]> extends (infer I) ? { [K_1 in keyof I]: I[K_1] extends ((args_0: infer In extends object, args_1: infer _Opt, ...args: infer Rest_1) => Promise<infer Res>) ? <O extends FetchOptions<In extends {
759
+ header: infer H;
760
+ } ? H : unknown, In extends {
761
+ json: infer J;
762
+ } ? J : any, In extends {
763
+ query: infer Q;
764
+ } ? Q : any, In extends {
765
+ param: infer P_1;
766
+ } ? P_1 : any, Res extends any ? Res extends import("hono/client").ClientResponse<infer CRes, infer Stat, infer _F> ? Stat extends import("hono/utils/http-status").SuccessStatusCode ? CRes : never : never : never>>(...args: import("hono/utils/types").HasRequiredKeys<In> extends true ? [args: In, options?: O, ...Rest_1] : [options?: O, ...Rest_1]) => Promise<Res extends any ? Res extends import("hono/client").ClientResponse<infer CRes, infer Stat extends number, infer _F extends string> ? Stat extends import("hono/utils/http-status").SuccessStatusCode ? (COpts["fetchOptions"] extends {
767
+ throw: true;
768
+ } ? true : false) extends (infer T_3) ? T_3 extends (COpts["fetchOptions"] extends {
769
+ throw: true;
770
+ } ? true : false) ? T_3 extends true ? CRes : {
771
+ data: CRes;
772
+ error: null;
773
+ } : never : never : Stat extends import("hono/utils/http-status").ClientErrorStatusCode | import("hono/utils/http-status").ServerErrorStatusCode ? (COpts["fetchOptions"] extends {
774
+ throw: true;
775
+ } ? true : false) extends (infer T_4) ? T_4 extends (COpts["fetchOptions"] extends {
776
+ throw: true;
777
+ } ? true : false) ? T_4 extends true ? never : {
778
+ data: null;
779
+ error: Prettify<(Err extends Record<string, any> ? Err : {
780
+ message?: string;
781
+ }) & {
782
+ status: Stat_1;
783
+ statusText: string;
784
+ }>;
785
+ } : never : never : never : Res : never> : I[K_1]; } : never : { [K_5 in ((BasePath extends "" ? K : K extends (infer T_1) ? T_1 extends K ? T_1 extends `${BasePath}/${infer Rest}` ? Rest : T_1 extends BasePath ? "" : T_1 : never : never) extends (infer T_2) ? T_2 extends (BasePath extends "" ? K : K extends (infer T_1) ? T_1 extends K ? T_1 extends `${BasePath}/${infer Rest}` ? Rest : T_1 extends BasePath ? "" : T_1 : never : never) ? T_2 extends "" ? [] : T_2 extends `${infer First}/${infer Second}` ? Second extends "" ? [First] : Second extends `${infer First}/${infer Second}` ? Second extends "" ? [First, First] : Second extends `${infer First}/${infer Second}` ? Second extends "" ? [First, First, First] : [First, First, First] : [First, First, Second] : [First, Second] : [T_2] : never : never)[T_10] as S_1[K] extends (infer T_11) ? T_11 extends S_1[K] ? T_11 extends Record<string, infer EP> ? EP extends any ? EP extends {
786
+ SERVER_ONLY: true;
787
+ } ? never : EP extends {
788
+ isAction: false;
789
+ } ? never : CamelCase<K_5> : never : never : never : never]: Inc<T_10> extends (infer T_12) ? T_12 extends Inc<T_10> ? T_12 extends ((BasePath extends "" ? K : K extends (infer T_1) ? T_1 extends K ? T_1 extends `${BasePath}/${infer Rest}` ? Rest : T_1 extends BasePath ? "" : T_1 : never : never) extends (infer T_2) ? T_2 extends (BasePath extends "" ? K : K extends (infer T_1) ? T_1 extends K ? T_1 extends `${BasePath}/${infer Rest}` ? Rest : T_1 extends BasePath ? "" : T_1 : never : never) ? T_2 extends "" ? [] : T_2 extends `${infer First}/${infer Second}` ? Second extends "" ? [First] : Second extends `${infer First}/${infer Second}` ? Second extends "" ? [First, First] : Second extends `${infer First}/${infer Second}` ? Second extends "" ? [First, First, First] : [First, First, First] : [First, First, Second] : [First, Second] : [T_2] : never : never)["length"] ? import("hono/client").ClientRequest<string, K, S_1[K]> extends (infer I) ? { [K_1 in keyof I]: I[K_1] extends ((args_0: infer In extends object, args_1: infer _Opt, ...args: infer Rest_1) => Promise<infer Res>) ? <O extends FetchOptions<In extends {
790
+ header: infer H;
791
+ } ? H : unknown, In extends {
792
+ json: infer J;
793
+ } ? J : any, In extends {
794
+ query: infer Q;
795
+ } ? Q : any, In extends {
796
+ param: infer P_1;
797
+ } ? P_1 : any, Res extends any ? Res extends import("hono/client").ClientResponse<infer CRes, infer Stat, infer _F> ? Stat extends import("hono/utils/http-status").SuccessStatusCode ? CRes : never : never : never>>(...args: import("hono/utils/types").HasRequiredKeys<In> extends true ? [args: In, options?: O, ...Rest_1] : [options?: O, ...Rest_1]) => Promise<Res extends any ? Res extends import("hono/client").ClientResponse<infer CRes, infer Stat extends number, infer _F extends string> ? Stat extends import("hono/utils/http-status").SuccessStatusCode ? (COpts["fetchOptions"] extends {
798
+ throw: true;
799
+ } ? true : false) extends (infer T_3) ? T_3 extends (COpts["fetchOptions"] extends {
800
+ throw: true;
801
+ } ? true : false) ? T_3 extends true ? CRes : {
802
+ data: CRes;
803
+ error: null;
804
+ } : never : never : Stat extends import("hono/utils/http-status").ClientErrorStatusCode | import("hono/utils/http-status").ServerErrorStatusCode ? (COpts["fetchOptions"] extends {
805
+ throw: true;
806
+ } ? true : false) extends (infer T_4) ? T_4 extends (COpts["fetchOptions"] extends {
807
+ throw: true;
808
+ } ? true : false) ? T_4 extends true ? never : {
809
+ data: null;
810
+ error: Prettify<(Err extends Record<string, any> ? Err : {
811
+ message?: string;
812
+ }) & {
813
+ status: Stat_1;
814
+ statusText: string;
815
+ }>;
816
+ } : never : never : never : Res : never> : I[K_1]; } : never : { [K_6 in ((BasePath extends "" ? K : K extends (infer T_1) ? T_1 extends K ? T_1 extends `${BasePath}/${infer Rest}` ? Rest : T_1 extends BasePath ? "" : T_1 : never : never) extends (infer T_2) ? T_2 extends (BasePath extends "" ? K : K extends (infer T_1) ? T_1 extends K ? T_1 extends `${BasePath}/${infer Rest}` ? Rest : T_1 extends BasePath ? "" : T_1 : never : never) ? T_2 extends "" ? [] : T_2 extends `${infer First}/${infer Second}` ? Second extends "" ? [First] : Second extends `${infer First}/${infer Second}` ? Second extends "" ? [First, First] : Second extends `${infer First}/${infer Second}` ? Second extends "" ? [First, First, First] : [First, First, First] : [First, First, Second] : [First, Second] : [T_2] : never : never)[T_12] as S_1[K] extends (infer T_13) ? T_13 extends S_1[K] ? T_13 extends Record<string, infer EP> ? EP extends any ? EP extends {
817
+ SERVER_ONLY: true;
818
+ } ? never : EP extends {
819
+ isAction: false;
820
+ } ? never : CamelCase<K_6> : never : never : never : never]: Inc<T_12> extends (infer T_14) ? T_14 extends Inc<T_12> ? T_14 extends ((BasePath extends "" ? K : K extends (infer T_1) ? T_1 extends K ? T_1 extends `${BasePath}/${infer Rest}` ? Rest : T_1 extends BasePath ? "" : T_1 : never : never) extends (infer T_2) ? T_2 extends (BasePath extends "" ? K : K extends (infer T_1) ? T_1 extends K ? T_1 extends `${BasePath}/${infer Rest}` ? Rest : T_1 extends BasePath ? "" : T_1 : never : never) ? T_2 extends "" ? [] : T_2 extends `${infer First}/${infer Second}` ? Second extends "" ? [First] : Second extends `${infer First}/${infer Second}` ? Second extends "" ? [First, First] : Second extends `${infer First}/${infer Second}` ? Second extends "" ? [First, First, First] : [First, First, First] : [First, First, Second] : [First, Second] : [T_2] : never : never)["length"] ? import("hono/client").ClientRequest<string, K, S_1[K]> extends (infer I) ? { [K_1 in keyof I]: I[K_1] extends ((args_0: infer In extends object, args_1: infer _Opt, ...args: infer Rest_1) => Promise<infer Res>) ? <O extends FetchOptions<In extends {
821
+ header: infer H;
822
+ } ? H : unknown, In extends {
823
+ json: infer J;
824
+ } ? J : any, In extends {
825
+ query: infer Q;
826
+ } ? Q : any, In extends {
827
+ param: infer P_1;
828
+ } ? P_1 : any, Res extends any ? Res extends import("hono/client").ClientResponse<infer CRes, infer Stat, infer _F> ? Stat extends import("hono/utils/http-status").SuccessStatusCode ? CRes : never : never : never>>(...args: import("hono/utils/types").HasRequiredKeys<In> extends true ? [args: In, options?: O, ...Rest_1] : [options?: O, ...Rest_1]) => Promise<Res extends any ? Res extends import("hono/client").ClientResponse<infer CRes, infer Stat extends number, infer _F extends string> ? Stat extends import("hono/utils/http-status").SuccessStatusCode ? (COpts["fetchOptions"] extends {
829
+ throw: true;
830
+ } ? true : false) extends (infer T_3) ? T_3 extends (COpts["fetchOptions"] extends {
831
+ throw: true;
832
+ } ? true : false) ? T_3 extends true ? CRes : {
833
+ data: CRes;
834
+ error: null;
835
+ } : never : never : Stat extends import("hono/utils/http-status").ClientErrorStatusCode | import("hono/utils/http-status").ServerErrorStatusCode ? (COpts["fetchOptions"] extends {
836
+ throw: true;
837
+ } ? true : false) extends (infer T_4) ? T_4 extends (COpts["fetchOptions"] extends {
838
+ throw: true;
839
+ } ? true : false) ? T_4 extends true ? never : {
840
+ data: null;
841
+ error: Prettify<(Err extends Record<string, any> ? Err : {
842
+ message?: string;
843
+ }) & {
844
+ status: Stat_1;
845
+ statusText: string;
846
+ }>;
847
+ } : never : never : never : Res : never> : I[K_1]; } : never : { [K_7 in ((BasePath extends "" ? K : K extends (infer T_1) ? T_1 extends K ? T_1 extends `${BasePath}/${infer Rest}` ? Rest : T_1 extends BasePath ? "" : T_1 : never : never) extends (infer T_2) ? T_2 extends (BasePath extends "" ? K : K extends (infer T_1) ? T_1 extends K ? T_1 extends `${BasePath}/${infer Rest}` ? Rest : T_1 extends BasePath ? "" : T_1 : never : never) ? T_2 extends "" ? [] : T_2 extends `${infer First}/${infer Second}` ? Second extends "" ? [First] : Second extends `${infer First}/${infer Second}` ? Second extends "" ? [First, First] : Second extends `${infer First}/${infer Second}` ? Second extends "" ? [First, First, First] : [First, First, First] : [First, First, Second] : [First, Second] : [T_2] : never : never)[T_14] as S_1[K] extends (infer T_15) ? T_15 extends S_1[K] ? T_15 extends Record<string, infer EP> ? EP extends any ? EP extends {
848
+ SERVER_ONLY: true;
849
+ } ? never : EP extends {
850
+ isAction: false;
851
+ } ? never : CamelCase<K_7> : never : never : never : never]: Inc<T_14> extends (infer T_16) ? T_16 extends Inc<T_14> ? T_16 extends ((BasePath extends "" ? K : K extends (infer T_1) ? T_1 extends K ? T_1 extends `${BasePath}/${infer Rest}` ? Rest : T_1 extends BasePath ? "" : T_1 : never : never) extends (infer T_2) ? T_2 extends (BasePath extends "" ? K : K extends (infer T_1) ? T_1 extends K ? T_1 extends `${BasePath}/${infer Rest}` ? Rest : T_1 extends BasePath ? "" : T_1 : never : never) ? T_2 extends "" ? [] : T_2 extends `${infer First}/${infer Second}` ? Second extends "" ? [First] : Second extends `${infer First}/${infer Second}` ? Second extends "" ? [First, First] : Second extends `${infer First}/${infer Second}` ? Second extends "" ? [First, First, First] : [First, First, First] : [First, First, Second] : [First, Second] : [T_2] : never : never)["length"] ? import("hono/client").ClientRequest<string, K, S_1[K]> extends (infer I) ? { [K_1 in keyof I]: I[K_1] extends ((args_0: infer In extends object, args_1: infer _Opt, ...args: infer Rest_1) => Promise<infer Res>) ? <O extends FetchOptions<In extends {
852
+ header: infer H;
853
+ } ? H : unknown, In extends {
854
+ json: infer J;
855
+ } ? J : any, In extends {
856
+ query: infer Q;
857
+ } ? Q : any, In extends {
858
+ param: infer P_1;
859
+ } ? P_1 : any, Res extends any ? Res extends import("hono/client").ClientResponse<infer CRes, infer Stat, infer _F> ? Stat extends import("hono/utils/http-status").SuccessStatusCode ? CRes : never : never : never>>(...args: import("hono/utils/types").HasRequiredKeys<In> extends true ? [args: In, options?: O, ...Rest_1] : [options?: O, ...Rest_1]) => Promise<Res extends any ? Res extends import("hono/client").ClientResponse<infer CRes, infer Stat extends number, infer _F extends string> ? Stat extends import("hono/utils/http-status").SuccessStatusCode ? (COpts["fetchOptions"] extends {
860
+ throw: true;
861
+ } ? true : false) extends (infer T_3) ? T_3 extends (COpts["fetchOptions"] extends {
862
+ throw: true;
863
+ } ? true : false) ? T_3 extends true ? CRes : {
864
+ data: CRes;
865
+ error: null;
866
+ } : never : never : Stat extends import("hono/utils/http-status").ClientErrorStatusCode | import("hono/utils/http-status").ServerErrorStatusCode ? (COpts["fetchOptions"] extends {
867
+ throw: true;
868
+ } ? true : false) extends (infer T_4) ? T_4 extends (COpts["fetchOptions"] extends {
869
+ throw: true;
870
+ } ? true : false) ? T_4 extends true ? never : {
871
+ data: null;
872
+ error: Prettify<(Err extends Record<string, any> ? Err : {
873
+ message?: string;
874
+ }) & {
875
+ status: Stat_1;
876
+ statusText: string;
877
+ }>;
878
+ } : never : never : never : Res : never> : I[K_1]; } : never : { [K_8 in ((BasePath extends "" ? K : K extends (infer T_1) ? T_1 extends K ? T_1 extends `${BasePath}/${infer Rest}` ? Rest : T_1 extends BasePath ? "" : T_1 : never : never) extends (infer T_2) ? T_2 extends (BasePath extends "" ? K : K extends (infer T_1) ? T_1 extends K ? T_1 extends `${BasePath}/${infer Rest}` ? Rest : T_1 extends BasePath ? "" : T_1 : never : never) ? T_2 extends "" ? [] : T_2 extends `${infer First}/${infer Second}` ? Second extends "" ? [First] : Second extends `${infer First}/${infer Second}` ? Second extends "" ? [First, First] : Second extends `${infer First}/${infer Second}` ? Second extends "" ? [First, First, First] : [First, First, First] : [First, First, Second] : [First, Second] : [T_2] : never : never)[T_16] as S_1[K] extends (infer T_17) ? T_17 extends S_1[K] ? T_17 extends Record<string, infer EP> ? EP extends any ? EP extends {
879
+ SERVER_ONLY: true;
880
+ } ? never : EP extends {
881
+ isAction: false;
882
+ } ? never : CamelCase<K_8> : never : never : never : never]: Inc<T_16> extends (infer T_18) ? T_18 extends Inc<T_16> ? T_18 extends ((BasePath extends "" ? K : K extends (infer T_1) ? T_1 extends K ? T_1 extends `${BasePath}/${infer Rest}` ? Rest : T_1 extends BasePath ? "" : T_1 : never : never) extends (infer T_2) ? T_2 extends (BasePath extends "" ? K : K extends (infer T_1) ? T_1 extends K ? T_1 extends `${BasePath}/${infer Rest}` ? Rest : T_1 extends BasePath ? "" : T_1 : never : never) ? T_2 extends "" ? [] : T_2 extends `${infer First}/${infer Second}` ? Second extends "" ? [First] : Second extends `${infer First}/${infer Second}` ? Second extends "" ? [First, First] : Second extends `${infer First}/${infer Second}` ? Second extends "" ? [First, First, First] : [First, First, First] : [First, First, Second] : [First, Second] : [T_2] : never : never)["length"] ? import("hono/client").ClientRequest<string, K, S_1[K]> extends (infer I) ? { [K_1 in keyof I]: I[K_1] extends ((args_0: infer In extends object, args_1: infer _Opt, ...args: infer Rest_1) => Promise<infer Res>) ? <O extends FetchOptions<In extends {
883
+ header: infer H;
884
+ } ? H : unknown, In extends {
885
+ json: infer J;
886
+ } ? J : any, In extends {
887
+ query: infer Q;
888
+ } ? Q : any, In extends {
889
+ param: infer P_1;
890
+ } ? P_1 : any, Res extends any ? Res extends import("hono/client").ClientResponse<infer CRes, infer Stat, infer _F> ? Stat extends import("hono/utils/http-status").SuccessStatusCode ? CRes : never : never : never>>(...args: import("hono/utils/types").HasRequiredKeys<In> extends true ? [args: In, options?: O, ...Rest_1] : [options?: O, ...Rest_1]) => Promise<Res extends any ? Res extends import("hono/client").ClientResponse<infer CRes, infer Stat extends number, infer _F extends string> ? Stat extends import("hono/utils/http-status").SuccessStatusCode ? (COpts["fetchOptions"] extends {
891
+ throw: true;
892
+ } ? true : false) extends (infer T_3) ? T_3 extends (COpts["fetchOptions"] extends {
893
+ throw: true;
894
+ } ? true : false) ? T_3 extends true ? CRes : {
895
+ data: CRes;
896
+ error: null;
897
+ } : never : never : Stat extends import("hono/utils/http-status").ClientErrorStatusCode | import("hono/utils/http-status").ServerErrorStatusCode ? (COpts["fetchOptions"] extends {
898
+ throw: true;
899
+ } ? true : false) extends (infer T_4) ? T_4 extends (COpts["fetchOptions"] extends {
900
+ throw: true;
901
+ } ? true : false) ? T_4 extends true ? never : {
902
+ data: null;
903
+ error: Prettify<(Err extends Record<string, any> ? Err : {
904
+ message?: string;
905
+ }) & {
906
+ status: Stat_1;
907
+ statusText: string;
908
+ }>;
909
+ } : never : never : never : Res : never> : I[K_1]; } : never : { [K_9 in ((BasePath extends "" ? K : K extends (infer T_1) ? T_1 extends K ? T_1 extends `${BasePath}/${infer Rest}` ? Rest : T_1 extends BasePath ? "" : T_1 : never : never) extends (infer T_2) ? T_2 extends (BasePath extends "" ? K : K extends (infer T_1) ? T_1 extends K ? T_1 extends `${BasePath}/${infer Rest}` ? Rest : T_1 extends BasePath ? "" : T_1 : never : never) ? T_2 extends "" ? [] : T_2 extends `${infer First}/${infer Second}` ? Second extends "" ? [First] : Second extends `${infer First}/${infer Second}` ? Second extends "" ? [First, First] : Second extends `${infer First}/${infer Second}` ? Second extends "" ? [First, First, First] : [First, First, First] : [First, First, Second] : [First, Second] : [T_2] : never : never)[T_18] as S_1[K] extends (infer T_19) ? T_19 extends S_1[K] ? T_19 extends Record<string, infer EP> ? EP extends any ? EP extends {
910
+ SERVER_ONLY: true;
911
+ } ? never : EP extends {
912
+ isAction: false;
913
+ } ? never : CamelCase<K_9> : never : never : never : never]: Inc<T_18> extends (infer T_20) ? T_20 extends Inc<T_18> ? T_20 extends ((BasePath extends "" ? K : K extends (infer T_1) ? T_1 extends K ? T_1 extends `${BasePath}/${infer Rest}` ? Rest : T_1 extends BasePath ? "" : T_1 : never : never) extends (infer T_2) ? T_2 extends (BasePath extends "" ? K : K extends (infer T_1) ? T_1 extends K ? T_1 extends `${BasePath}/${infer Rest}` ? Rest : T_1 extends BasePath ? "" : T_1 : never : never) ? T_2 extends "" ? [] : T_2 extends `${infer First}/${infer Second}` ? Second extends "" ? [First] : Second extends `${infer First}/${infer Second}` ? Second extends "" ? [First, First] : Second extends `${infer First}/${infer Second}` ? Second extends "" ? [First, First, First] : [First, First, First] : [First, First, Second] : [First, Second] : [T_2] : never : never)["length"] ? import("hono/client").ClientRequest<string, K, S_1[K]> extends (infer I) ? { [K_1 in keyof I]: I[K_1] extends ((args_0: infer In extends object, args_1: infer _Opt, ...args: infer Rest_1) => Promise<infer Res>) ? <O extends FetchOptions<In extends {
914
+ header: infer H;
915
+ } ? H : unknown, In extends {
916
+ json: infer J;
917
+ } ? J : any, In extends {
918
+ query: infer Q;
919
+ } ? Q : any, In extends {
920
+ param: infer P_1;
921
+ } ? P_1 : any, Res extends any ? Res extends import("hono/client").ClientResponse<infer CRes, infer Stat, infer _F> ? Stat extends import("hono/utils/http-status").SuccessStatusCode ? CRes : never : never : never>>(...args: import("hono/utils/types").HasRequiredKeys<In> extends true ? [args: In, options?: O, ...Rest_1] : [options?: O, ...Rest_1]) => Promise<Res extends any ? Res extends import("hono/client").ClientResponse<infer CRes, infer Stat extends number, infer _F extends string> ? Stat extends import("hono/utils/http-status").SuccessStatusCode ? (COpts["fetchOptions"] extends {
922
+ throw: true;
923
+ } ? true : false) extends (infer T_3) ? T_3 extends (COpts["fetchOptions"] extends {
924
+ throw: true;
925
+ } ? true : false) ? T_3 extends true ? CRes : {
926
+ data: CRes;
927
+ error: null;
928
+ } : never : never : Stat extends import("hono/utils/http-status").ClientErrorStatusCode | import("hono/utils/http-status").ServerErrorStatusCode ? (COpts["fetchOptions"] extends {
929
+ throw: true;
930
+ } ? true : false) extends (infer T_4) ? T_4 extends (COpts["fetchOptions"] extends {
931
+ throw: true;
932
+ } ? true : false) ? T_4 extends true ? never : {
933
+ data: null;
934
+ error: Prettify<(Err extends Record<string, any> ? Err : {
935
+ message?: string;
936
+ }) & {
937
+ status: Stat_1;
938
+ statusText: string;
939
+ }>;
940
+ } : never : never : never : Res : never> : I[K_1]; } : never : { [K_10 in ((BasePath extends "" ? K : K extends (infer T_1) ? T_1 extends K ? T_1 extends `${BasePath}/${infer Rest}` ? Rest : T_1 extends BasePath ? "" : T_1 : never : never) extends (infer T_2) ? T_2 extends (BasePath extends "" ? K : K extends (infer T_1) ? T_1 extends K ? T_1 extends `${BasePath}/${infer Rest}` ? Rest : T_1 extends BasePath ? "" : T_1 : never : never) ? T_2 extends "" ? [] : T_2 extends `${infer First}/${infer Second}` ? Second extends "" ? [First] : Second extends `${infer First}/${infer Second}` ? Second extends "" ? [First, First] : Second extends `${infer First}/${infer Second}` ? Second extends "" ? [First, First, First] : [First, First, First] : [First, First, Second] : [First, Second] : [T_2] : never : never)[T_20] as S_1[K] extends (infer T_21) ? T_21 extends S_1[K] ? T_21 extends Record<string, infer EP> ? EP extends any ? EP extends {
941
+ SERVER_ONLY: true;
942
+ } ? never : EP extends {
943
+ isAction: false;
944
+ } ? never : CamelCase<K_10> : never : never : never : never]: Inc<T_20> extends (infer T_22) ? T_22 extends Inc<T_20> ? T_22 extends ((BasePath extends "" ? K : K extends (infer T_1) ? T_1 extends K ? T_1 extends `${BasePath}/${infer Rest}` ? Rest : T_1 extends BasePath ? "" : T_1 : never : never) extends (infer T_2) ? T_2 extends (BasePath extends "" ? K : K extends (infer T_1) ? T_1 extends K ? T_1 extends `${BasePath}/${infer Rest}` ? Rest : T_1 extends BasePath ? "" : T_1 : never : never) ? T_2 extends "" ? [] : T_2 extends `${infer First}/${infer Second}` ? Second extends "" ? [First] : Second extends `${infer First}/${infer Second}` ? Second extends "" ? [First, First] : Second extends `${infer First}/${infer Second}` ? Second extends "" ? [First, First, First] : [First, First, First] : [First, First, Second] : [First, Second] : [T_2] : never : never)["length"] ? import("hono/client").ClientRequest<string, K, S_1[K]> extends (infer I) ? { [K_1 in keyof I]: I[K_1] extends ((args_0: infer In extends object, args_1: infer _Opt, ...args: infer Rest_1) => Promise<infer Res>) ? <O extends FetchOptions<In extends {
945
+ header: infer H;
946
+ } ? H : unknown, In extends {
947
+ json: infer J;
948
+ } ? J : any, In extends {
949
+ query: infer Q;
950
+ } ? Q : any, In extends {
951
+ param: infer P_1;
952
+ } ? P_1 : any, Res extends any ? Res extends import("hono/client").ClientResponse<infer CRes, infer Stat, infer _F> ? Stat extends import("hono/utils/http-status").SuccessStatusCode ? CRes : never : never : never>>(...args: import("hono/utils/types").HasRequiredKeys<In> extends true ? [args: In, options?: O, ...Rest_1] : [options?: O, ...Rest_1]) => Promise<Res extends any ? Res extends import("hono/client").ClientResponse<infer CRes, infer Stat extends number, infer _F extends string> ? Stat extends import("hono/utils/http-status").SuccessStatusCode ? (COpts["fetchOptions"] extends {
953
+ throw: true;
954
+ } ? true : false) extends (infer T_3) ? T_3 extends (COpts["fetchOptions"] extends {
955
+ throw: true;
956
+ } ? true : false) ? T_3 extends true ? CRes : {
957
+ data: CRes;
958
+ error: null;
959
+ } : never : never : Stat extends import("hono/utils/http-status").ClientErrorStatusCode | import("hono/utils/http-status").ServerErrorStatusCode ? (COpts["fetchOptions"] extends {
960
+ throw: true;
961
+ } ? true : false) extends (infer T_4) ? T_4 extends (COpts["fetchOptions"] extends {
962
+ throw: true;
963
+ } ? true : false) ? T_4 extends true ? never : {
964
+ data: null;
965
+ error: Prettify<(Err extends Record<string, any> ? Err : {
966
+ message?: string;
967
+ }) & {
968
+ status: Stat_1;
969
+ statusText: string;
970
+ }>;
971
+ } : never : never : never : Res : never> : I[K_1]; } : never : { [K_11 in ((BasePath extends "" ? K : K extends (infer T_1) ? T_1 extends K ? T_1 extends `${BasePath}/${infer Rest}` ? Rest : T_1 extends BasePath ? "" : T_1 : never : never) extends (infer T_2) ? T_2 extends (BasePath extends "" ? K : K extends (infer T_1) ? T_1 extends K ? T_1 extends `${BasePath}/${infer Rest}` ? Rest : T_1 extends BasePath ? "" : T_1 : never : never) ? T_2 extends "" ? [] : T_2 extends `${infer First}/${infer Second}` ? Second extends "" ? [First] : Second extends `${infer First}/${infer Second}` ? Second extends "" ? [First, First] : Second extends `${infer First}/${infer Second}` ? Second extends "" ? [First, First, First] : [First, First, First] : [First, First, Second] : [First, Second] : [T_2] : never : never)[T_22] as S_1[K] extends (infer T_23) ? T_23 extends S_1[K] ? T_23 extends Record<string, infer EP> ? EP extends any ? EP extends {
972
+ SERVER_ONLY: true;
973
+ } ? never : EP extends {
974
+ isAction: false;
975
+ } ? never : CamelCase<K_11> : never : never : never : never]: /*elided*/ any; } : never : never; } : never : never; } : never : never; } : never : never; } : never : never; } : never : never; } : never : never; } : never : never; } : never : never; } : never : never; } : never : never : never : never> : never) & InferActions<Option> & {
976
+ useSession: Atom<{
977
+ data: (App extends Hono<any, infer S_2 extends import("hono").Schema, infer P_1 extends string> ? (S_2[`${P_1}/get-session`]["$get"]["output"] & {
978
+ success: true;
979
+ })["data"] : never) | null;
980
+ error: BetterFetchError | null;
981
+ isPending: boolean;
982
+ }>;
983
+ $fetch: import("@better-fetch/fetch").BetterFetch<{
984
+ cache?: RequestCache;
985
+ integrity?: string;
986
+ keepalive?: boolean;
987
+ mode?: RequestMode;
988
+ priority?: RequestPriority;
989
+ redirect?: RequestRedirect;
990
+ referrer?: string;
991
+ referrerPolicy?: ReferrerPolicy;
992
+ signal?: AbortSignal | null;
993
+ window?: null;
994
+ catchAllError?: boolean;
995
+ defaultOutput?: import("@better-fetch/fetch").StandardSchemaV1;
996
+ defaultError?: import("@better-fetch/fetch").StandardSchemaV1;
997
+ onRetry?: (response: import("@better-fetch/fetch").ResponseContext) => Promise<void> | void;
998
+ hookOptions?: {
999
+ cloneResponse?: boolean;
1000
+ };
1001
+ timeout?: number;
1002
+ throw?: boolean;
1003
+ auth?: {
1004
+ type: "Basic";
1005
+ username: string | (() => string | undefined) | undefined;
1006
+ password: string | (() => string | undefined) | undefined;
1007
+ } | {
1008
+ type: "Bearer";
1009
+ token: string | Promise<string | undefined> | (() => string | Promise<string | undefined> | undefined) | undefined;
1010
+ } | {
1011
+ type: "Custom";
1012
+ prefix: string | (() => string | undefined) | undefined;
1013
+ value: string | (() => string | undefined) | undefined;
1014
+ };
1015
+ headers?: {
1016
+ [x: string]: string | undefined;
1017
+ accept?: "application/json" | "application/octet-stream" | "text/plain" | (string & {});
1018
+ "content-type"?: "application/json" | "application/octet-stream" | "application/x-www-form-urlencoded" | "multipart/form-data" | "text/plain" | (string & {});
1019
+ authorization?: `Basic ${string}` | `Bearer ${string}` | (string & {});
1020
+ } | {};
1021
+ body?: any;
1022
+ query?: any;
1023
+ params?: any;
1024
+ duplex?: "full" | "half";
1025
+ retry?: import("@better-fetch/fetch").RetryOptions;
1026
+ retryAttempt?: number;
1027
+ output?: import("@better-fetch/fetch").StandardSchemaV1 | typeof Blob | typeof File;
1028
+ errorSchema?: import("@better-fetch/fetch").StandardSchemaV1;
1029
+ disableValidation?: boolean;
1030
+ schema?: import("@better-fetch/fetch").Schema;
1031
+ baseURL: string;
1032
+ credentials?: RequestCredentials;
1033
+ method: string;
1034
+ jsonParser: (text: string) => Promise<any> | any;
1035
+ customFetchImpl: any;
1036
+ plugins: (import("@better-fetch/fetch").BetterFetchPlugin | {
1037
+ id: string;
1038
+ name: string;
1039
+ hooks: {};
1040
+ })[];
1041
+ }, unknown, unknown, import("@better-fetch/fetch").Schema>;
1042
+ $store: {
1043
+ notify: (signal?: BASE_ERROR_CODES<"$sessionSignal">) => void;
1044
+ listen: (signal: BASE_ERROR_CODES<"$sessionSignal">, listener: (value: boolean, oldValue?: boolean | undefined) => void) => void;
1045
+ atoms: {
1046
+ session: import("nanostores").PreinitializedWritableAtom<{
1047
+ data: {
1048
+ user: BASE_ERROR_CODES;
1049
+ session: BASE_ERROR_CODES;
1050
+ } | null;
1051
+ error: BetterFetchError | null;
1052
+ isPending: boolean;
1053
+ isRefetching: boolean;
1054
+ refetch: () => void;
1055
+ }> & object;
1056
+ $sessionSignal: import("nanostores").PreinitializedWritableAtom<boolean> & object;
1057
+ } & Record<string, import("nanostores").WritableAtom<any>>;
1058
+ };
1059
+ $Infer: {
1060
+ Session: NonNullable<App extends Hono<any, infer S_2 extends import("hono").Schema, infer P_1 extends string> ? (S_2[`${P_1}/get-session`]["$get"]["output"] & {
1061
+ success: true;
1062
+ })["data"] : never>;
1063
+ };
1064
+ $ERROR_CODES: Prettify<InferErrorCodes<Option> & typeof BASE_ERROR_CODES>;
1065
+ };
1066
+ declare const signInSocialRoute: any;
1067
+ declare const signInEmailRoute: any;
1068
+ declare const getOAuthCallbackRoute: any;
1069
+ declare const postOAuthCallbackRoute: any;
1070
+ declare const getSessionRoute: any;
1071
+ declare const getSessionFromCtx: <U extends User = StrictUser, S extends Session$1 = StrictSession, V extends object = object>(ctx: Context<ContextVars<V & {
1072
+ session?: {
1073
+ session: S;
1074
+ user: U;
1075
+ };
1076
+ }>>, config?: {
1077
+ disableCookieCache?: boolean;
1078
+ disableRefresh?: boolean;
1079
+ }) => Promise<{
1080
+ session: S;
1081
+ user: U;
1082
+ } | (Response & TypedResponse<{
1083
+ success: false;
1084
+ code?: string | undefined;
1085
+ message?: string | undefined;
1086
+ }, 401>)>;
1087
+ /**
1088
+ * The middleware forces the endpoint to require a valid session.
1089
+ */
1090
+ declare const sessionMiddleware: <V extends object>() => (ctx: Context<ContextVars<V & {
1091
+ session: {
1092
+ session: Session$1;
1093
+ user: User;
1094
+ };
1095
+ }>, string, {}>, next: import("hono").Next) => Promise<void | (Response & TypedResponse<{
1096
+ success: false;
1097
+ code?: string | undefined;
1098
+ message?: string | undefined;
1099
+ }, 401>)>;
1100
+ /**
1101
+ * This middleware forces the endpoint to require a valid session and ignores cookie cache.
1102
+ * This should be used for sensitive operations like password changes, account deletion, etc.
1103
+ * to ensure that revoked sessions cannot be used even if they're still cached in cookies.
1104
+ */
1105
+ declare const sensitiveSessionMiddleware: (ctx: Context<ContextVars<{
1106
+ session: {
1107
+ session: Session$1;
1108
+ user: User;
1109
+ };
1110
+ }>, string, {}>, next: import("hono").Next) => Promise<void | (Response & TypedResponse<{
1111
+ success: false;
1112
+ code?: string | undefined;
1113
+ message?: string | undefined;
1114
+ }, 401>)>;
1115
+ /**
1116
+ * This middleware allows you to call the endpoint on the client if session is valid.
1117
+ * However, if called on the server, no session is required.
1118
+ */
1119
+ declare const requestOnlySessionMiddleware: (ctx: Context<ContextVars<{
1120
+ session?: {
1121
+ session: Session$1;
1122
+ user: User;
1123
+ };
1124
+ }>, string, {}>, next: import("hono").Next) => Promise<void | (Response & TypedResponse<{
1125
+ success: false;
1126
+ code?: string | undefined;
1127
+ message?: string | undefined;
1128
+ }, 401>)>;
1129
+ /**
1130
+ * This middleware forces the endpoint to require a valid session,
1131
+ * as well as making sure the session is fresh before proceeding.
1132
+ *
1133
+ * Session freshness check will be skipped if the session config's freshAge
1134
+ * is set to 0
1135
+ */
1136
+ declare const freshSessionMiddleware: (ctx: Context<ContextVars<{
1137
+ session: {
1138
+ session: Session$1;
1139
+ user: User;
1140
+ };
1141
+ }>, string, {}>, next: import("hono").Next) => Promise<void | Response>;
1142
+ declare const listSessionsRoute: any;
1143
+ declare const revokeSessionRoute: any;
1144
+ declare const revokeSessionsRoute: any;
1145
+ declare const revokeOtherSessionsRoute: any;
1146
+ declare const signOutRoute: any;
1147
+ declare const requestPasswordResetRoute: any;
1148
+ declare const requestPasswordResetCallbackRoute: any;
1149
+ declare const resetPasswordRoute: any;
1150
+ declare const sendVerificationEmailRoute: any;
1151
+ declare const verifyEmailRoute: any;
1152
+ declare const updateUserRoute: any;
1153
+ declare const changePasswordRoute: any;
1154
+ declare const setPasswordRoute: any;
1155
+ declare const deleteUserRoute: any;
1156
+ declare const deleteUserCallbackRoute: any;
1157
+ declare const changeEmailRoute: any;
1158
+ declare const errorRoute: any;
1159
+ declare const okRoute: any;
1160
+ declare const signUpEmailRoute: any;
1161
+ declare const listAccountsRoute: any;
1162
+ declare const linkAccountRoute: any;
1163
+ declare const unlinkAccountRoute: any;
1164
+ declare const getAccessTokenRoute: any;
1165
+ declare const refreshAccessTokenRoute: any;
1166
+ declare const getAccountInfoRoute: any;
1167
+ type APIFromRoutes<C extends AuthRouteConfig> = { [K in C as K["operationId"]]: FromFn<Execute<K>> extends ((...args: infer A) => infer R) ? (...args: A) => R : never; };
1168
+ type AllPluginConfigs<O> = O extends {
1169
+ plugins: readonly (infer P)[];
1170
+ } ? P extends {
1171
+ routes: infer R;
1172
+ } ? R extends Record<string, infer T> ? T extends AuthEndpoint<infer C> ? C : never : never : never : never;
1173
+ type Configs = typeof changeEmailRoute | typeof changePasswordRoute | typeof deleteUserCallbackRoute | typeof deleteUserRoute | typeof errorRoute | typeof getAccessTokenRoute | typeof getAccountInfoRoute | typeof getOAuthCallbackRoute | typeof getSessionRoute | typeof linkAccountRoute | typeof listAccountsRoute | typeof listSessionsRoute | typeof okRoute | typeof postOAuthCallbackRoute | typeof refreshAccessTokenRoute | typeof requestPasswordResetCallbackRoute | typeof requestPasswordResetRoute | typeof resetPasswordRoute | typeof revokeOtherSessionsRoute | typeof revokeSessionRoute | typeof revokeSessionsRoute | typeof sendVerificationEmailRoute | typeof setPasswordRoute | typeof signInEmailRoute | typeof signInSocialRoute | typeof signOutRoute | typeof signUpEmailRoute | typeof unlinkAccountRoute | typeof updateUserRoute | typeof verifyEmailRoute;
1174
+ type Config<R extends string> = {
1175
+ operationId: R;
1176
+ } & Configs;
1177
+ type BuildConfigs<O extends FaireAuthOptions> = AllPluginConfigs<O> | Configs extends (infer X) ? ProcessRouteConfig<X, O> : never;
1178
+ type InferSchema<O extends FaireAuthOptions> = UnionToIntersection<BuildSchema<BuildConfigs<O>, BasePath$1<O>>> & DocPathFromOptions<O>;
1179
+ type InferApp<O extends FaireAuthOptions> = OpenAPIHono$1<ContextVars, InferSchema<O>, BasePath$1<O>>;
1180
+ type InferAPI<A extends AnyHono, HideCallbacks extends boolean = true> = ExtractSchema<A> extends Record<string, infer R> ? { [Method in keyof R as R[Method] extends {
1181
+ operationId: infer K;
1182
+ } ? K extends string ? true extends HideCallbacks ? R[Method] extends {
1183
+ isAction: false;
1184
+ } ? never : K : K : never : never]: R[Method] extends {
1185
+ _api: infer Api;
1186
+ } ? Api : never; } extends (infer S) ? UnionToIntersection<S> : never : never;
1187
+ type Session<C, Opts extends ClientOptions> = C extends {
1188
+ getSession: {
1189
+ $get: infer GetSession;
1190
+ };
1191
+ } ? GetSession extends ((...args: any) => any) ? Awaited<ReturnType<GetSession>> extends (infer R) ? Opts["fetchOptions"] extends {
1192
+ throw: true;
1193
+ } ? R : R extends {
1194
+ status: 200;
1195
+ json: infer Json;
1196
+ } ? Json extends ((...args: any) => any) ? Awaited<ReturnType<Json>> : never : never : never : never : never;
1197
+ /**
1198
+ * InferClient turns a Hono-based FaireAuth client into the exact shape
1199
+ * that the runtime client returns, including every route, action, hook
1200
+ * and the strongly-typed `useSession` atom.
1201
+ */
1202
+ type InferClient<A extends AnyHono, Opts extends ClientOptions> = A extends Hono<any, infer S, infer B> ? Client<S, B, Opts> extends (infer ClientAPI) ? UnionToIntersection<InferResolvedHooks<Opts>> & ClientAPI & InferActions<Opts> & {
1203
+ useSession: Atom<{
1204
+ data: Session<ClientAPI, Opts> | null;
1205
+ error: BetterFetchError | null;
1206
+ isPending: boolean;
1207
+ }>;
1208
+ $fetch: BetterFetch;
1209
+ $store: {
1210
+ notify: (signal?: LiteralStringUnion<"$sessionSignal"> | undefined) => void;
1211
+ listen: (signal: LiteralStringUnion<"$sessionSignal">, listener: (value: boolean, oldValue?: boolean | undefined) => void) => void;
1212
+ atoms: Record<string, WritableAtom<any>>;
1213
+ };
1214
+ $Infer: {
1215
+ Session: Session<ClientAPI, Opts>;
1216
+ };
1217
+ $ERROR_CODES: Prettify<InferErrorCodes<Opts> & typeof BASE_ERROR_CODES>;
1218
+ } : never : never;
1219
+ type DefaultAPI = APIFromRoutes<Configs>;
1220
+ type DefaultApp = OpenAPIHono$1<ContextVars, UnionToIntersection<BuildSchema<Configs, "/api/auth">>, "/api/auth">;
1221
+ declare module "hono" {
1222
+ interface ContextRenderer extends JSONRenderRespond {}
1223
+ interface ContextVariableMap {
1224
+ /** Gets set early before hitting route handler */
1225
+ path: LiteralStringUnion<Configs["path"]>;
1226
+ /** Gets set at route handler for intraroute consistency */
1227
+ config?: AuthRouteConfig;
1228
+ /** Gets set by initContext middleware */
1229
+ context: AuthContext;
1230
+ /** Gets set in endpoint Route Apps */
1231
+ isServer?: true;
1232
+ /** Gets set by initContext middleware */
1233
+ api: DefaultAPI;
1234
+ }
1235
+ }
1236
+ type ContextVars<E extends object = object> = {
1237
+ Bindings: typeof ENV$1;
1238
+ Variables: E;
1239
+ };
1240
+ type Execute<C extends MinRouteConfig> = Exec<C, ContextVars<any>>;
1241
+ type ToExecFull<T extends Execute<any>> = T extends Fn<infer Par extends any[], infer Ret> ? {
1242
+ <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(...args: Par extends [infer Input, infer Ctx] ? Ctx extends Context<any> ? [Input, (Ctx | ExecOpts<AsResponse, ReturnHeaders>)?] : Par : Par extends [infer Ctx] ? [(Ctx | ExecOpts<AsResponse, ReturnHeaders>)?] : Par): Ret extends Promise<infer R> ? Promise<AsResponse extends true ? Response : ReturnHeaders extends true ? {
1243
+ headers: Headers;
1244
+ response: R;
1245
+ } : R> : never;
1246
+ } : never;
1247
+ type Models = "user" | "account" | "session" | "verification" | "rate-limit" | "organization" | "member" | "invitation" | "jwks" | "passkey" | "two-factor";
1248
+ type AdditionalUserFieldsInput<Options extends FaireAuthOptions> = InferFieldsFromOptions$1<Options, "user", "input"> & InferFieldsFromPlugins$1<Options, "user", "input">;
1249
+ type AdditionalUserFieldsOutput<Options extends FaireAuthOptions> = InferFieldsFromOptions$1<Options, "user"> & InferFieldsFromPlugins$1<Options, "user">;
1250
+ type AdditionalSessionFieldsInput<Options extends FaireAuthOptions> = InferFieldsFromOptions$1<Options, "session", "input"> & InferFieldsFromPlugins$1<Options, "session", "input">;
1251
+ type AdditionalSessionFieldsOutput<Options extends FaireAuthOptions> = InferFieldsFromOptions$1<Options, "session"> & InferFieldsFromPlugins$1<Options, "session">;
1252
+ type InferUser<O extends Auth | FaireAuthOptions> = Record<never, never> & UnionToIntersection<StripEmptyObjects<(O extends FaireAuthOptions ? AdditionalUserFieldsOutput<O> : O extends Auth ? AdditionalUserFieldsOutput<O["options"]> : {}) & StrictUser>>;
1253
+ type InferSession<O extends Auth | FaireAuthOptions> = Record<never, never> & UnionToIntersection<StripEmptyObjects<(O extends FaireAuthOptions ? AdditionalSessionFieldsOutput<O> : O extends Auth ? AdditionalSessionFieldsOutput<O["options"]> : {}) & StrictSession>>;
1254
+ type InferPluginTypes<O extends FaireAuthOptions> = O["plugins"] extends (infer P)[] ? UnionToIntersection<P extends FaireAuthPlugin ? P["$Infer"] extends Record<string, any> ? P["$Infer"] : {} : {}> : {};
1255
+ interface RateLimit {
1256
+ /**
1257
+ * The key to use for rate limiting
1258
+ */
1259
+ key: string;
1260
+ /**
1261
+ * The number of requests made
1262
+ */
1263
+ count: number;
1264
+ /**
1265
+ * The last request time in milliseconds
1266
+ */
1267
+ lastRequest: number;
1268
+ }
1269
+ declare const router: <O extends FaireAuthOptions>(context: AuthContext, options: O) => {
1270
+ api: {
1271
+ [x: number]: any;
1272
+ };
1273
+ app: any;
1274
+ };
1275
+ type WithJsDoc<T, D> = Expand<D & T>;
1276
+ declare function defineOptions<const T extends FaireAuthPlugin[], U extends {
1277
+ routeHooks?: InferPluginHooks<T>;
1278
+ middleware?: InferPluginMiddleware<T>;
1279
+ dto?: InferPluginDTO<T>;
1280
+ rateLimit?: InferPluginRateLimit<T>;
1281
+ } & ExK<FaireAuthOptions, "plugins">>(config: {
1282
+ plugins: T;
1283
+ } & U): {
1284
+ plugins: T;
1285
+ } & U;
1286
+ declare function defineOptions<U extends ExK<FaireAuthOptions, "plugins">>(config: U): U;
1287
+ declare const faireAuth: <Options extends FaireAuthOptions>(options: Options & Record<never, never>) => {
1288
+ handler: (request: Request, Env?: any, executionCtx?: ExecutionContext) => any;
1289
+ app: any;
1290
+ api: {
1291
+ [x: number]: any;
1292
+ };
1293
+ options: {
1294
+ [x: string]: unknown;
1295
+ secret: string;
1296
+ baseURL: string;
1297
+ basePath: string;
1298
+ } & Options;
1299
+ $context: BaseAuthContext<ContextVars, Options_1>;
1300
+ $Infer: {
1301
+ Session: {
1302
+ session: Prettify<InferSession<Options>>;
1303
+ user: Prettify<InferUser<Options>>;
1304
+ };
1305
+ App: <O extends FaireAuthOptions>(_o: O) => InferApp<O>;
1306
+ Api: <A extends AnyHono>(_a: A) => InferAPI<A>;
1307
+ } & InferPluginTypes<Options>;
1308
+ $ERROR_CODES: InferPluginErrorCodes<Options> & typeof BASE_ERROR_CODES;
1309
+ };
1310
+ interface Auth<Options extends FaireAuthOptions = FaireAuthOptions> {
1311
+ handler: (request: Request, Env?: any, executionCtx?: ExecutionContext) => Promise<Response> | Response;
1312
+ app: ReturnType<typeof router>["app"];
1313
+ api: ReturnType<typeof router>["api"];
1314
+ options: {
1315
+ [x: string]: unknown;
1316
+ secret: string;
1317
+ baseURL: string;
1318
+ basePath: string;
1319
+ } & Options;
1320
+ $context: AuthContext<Options>;
1321
+ $Infer: {
1322
+ Session: unknown;
1323
+ App: unknown;
1324
+ Api: unknown;
1325
+ };
1326
+ $ERROR_CODES: typeof BASE_ERROR_CODES;
1327
+ }
1328
+ declare const generateState: <V extends object>(ctx: Context<ContextVars<V>, string, {
1329
+ out: {
1330
+ json: {
1331
+ callbackURL?: string | undefined;
1332
+ errorCallbackURL?: string | undefined;
1333
+ newUserCallbackURL?: string | undefined;
1334
+ requestSignUp?: boolean | undefined;
1335
+ };
1336
+ };
1337
+ }>, link?: {
1338
+ email: string;
1339
+ userId: string;
1340
+ }, options?: Pick<FaireAuthOptions, "baseURL">) => Promise<{
1341
+ state: any;
1342
+ codeVerifier: any;
1343
+ }>;
1344
+ declare const parsingSchema: z.ZodObject<{
1345
+ callbackURL: z.ZodString;
1346
+ codeVerifier: z.ZodString;
1347
+ errorURL: z.ZodOptional<z.ZodString>;
1348
+ newUserURL: z.ZodOptional<z.ZodString>;
1349
+ expiresAt: z.ZodNumber;
1350
+ link: z.ZodOptional<z.ZodObject<{
1351
+ email: any;
1352
+ userId: z.ZodCoercedString<unknown>;
1353
+ }, z.core.$strip>>;
1354
+ requestSignUp: z.ZodOptional<z.ZodBoolean>;
1355
+ }, z.core.$strip>;
1356
+ declare const parseState: <V extends object>(ctx: Context<ContextVars<V>, string, {
1357
+ out: {
1358
+ query: {
1359
+ state?: string | undefined;
1360
+ };
1361
+ json: {
1362
+ state?: string | undefined;
1363
+ };
1364
+ };
1365
+ }>, options: Pick<FaireAuthOptions, "onAPIError">) => Promise<{
1366
+ type: "success";
1367
+ data: z.output<typeof parsingSchema>;
1368
+ } | {
1369
+ type: "redirect";
1370
+ response: Response & TypedResponse<undefined, 302, "redirect">;
1371
+ }>;
1372
+ type HeaderSource = HeadersInit | Record<string, string | undefined>;
1373
+ declare const mergeHeaders: (...sources: (HeaderSource | (() => HeaderSource | Promise<HeaderSource>) | undefined)[]) => Headers | (() => Promise<Headers>);
1374
+ interface TelemetryEvent {
1375
+ type: string;
1376
+ anonymousId?: string | undefined;
1377
+ payload: Record<string, any>;
1378
+ }
1379
+ interface TelemetryContext {
1380
+ customTrack?: (event: TelemetryEvent) => Promise<void>;
1381
+ database?: string;
1382
+ adapter?: string;
1383
+ skipTestCheck?: boolean;
1384
+ }
1385
+ declare function createTelemetry(options: FaireAuthOptions, context?: TelemetryContext): {
1386
+ initPromise: Promise<void>;
1387
+ publish(event: TelemetryEvent): Promise<void>;
1388
+ };
1389
+ declare function getTelemetryAuthConfig(options: FaireAuthOptions, context?: TelemetryContext): {
1390
+ database: string | undefined;
1391
+ adapter: string | undefined;
1392
+ emailVerification: {
1393
+ sendVerificationEmail: boolean;
1394
+ sendOnSignUp: boolean;
1395
+ sendOnSignIn: boolean;
1396
+ autoSignInAfterVerification: boolean;
1397
+ expiresIn: any;
1398
+ onEmailVerification: boolean;
1399
+ afterEmailVerification: boolean;
1400
+ };
1401
+ emailAndPassword: {
1402
+ enabled: boolean;
1403
+ disableSignUp: boolean;
1404
+ requireEmailVerification: boolean;
1405
+ maxPasswordLength: any;
1406
+ minPasswordLength: any;
1407
+ sendResetPassword: boolean;
1408
+ resetPasswordTokenExpiresIn: any;
1409
+ onPasswordReset: boolean;
1410
+ password: {
1411
+ hash: boolean;
1412
+ verify: boolean;
1413
+ };
1414
+ autoSignIn: boolean;
1415
+ revokeSessionsOnPasswordReset: boolean;
1416
+ };
1417
+ socialProviders: ({
1418
+ id?: never;
1419
+ mapProfileToUser?: never;
1420
+ disableDefaultScope?: never;
1421
+ disableIdTokenSignIn?: never;
1422
+ disableImplicitSignUp?: never;
1423
+ disableSignUp?: never;
1424
+ getUserInfo?: never;
1425
+ overrideUserInfoOnSignIn?: never;
1426
+ prompt?: never;
1427
+ verifyIdToken?: never;
1428
+ scope?: never;
1429
+ refreshAccessToken?: never;
1430
+ } | {
1431
+ id: string;
1432
+ mapProfileToUser: boolean;
1433
+ disableDefaultScope: boolean;
1434
+ disableIdTokenSignIn: boolean;
1435
+ disableImplicitSignUp: any;
1436
+ disableSignUp: any;
1437
+ getUserInfo: boolean;
1438
+ overrideUserInfoOnSignIn: boolean;
1439
+ prompt: any;
1440
+ verifyIdToken: boolean;
1441
+ scope: any;
1442
+ refreshAccessToken: boolean;
1443
+ })[];
1444
+ plugins: any[] | undefined;
1445
+ user: {
1446
+ modelName: any;
1447
+ fields: any;
1448
+ additionalFields: any;
1449
+ changeEmail: {
1450
+ enabled: any;
1451
+ sendChangeEmailVerification: boolean;
1452
+ };
1453
+ };
1454
+ verification: {
1455
+ modelName: any;
1456
+ disableCleanup: any;
1457
+ fields: any;
1458
+ };
1459
+ session: {
1460
+ modelName: any;
1461
+ additionalFields: any;
1462
+ cookieCache: {
1463
+ enabled: any;
1464
+ maxAge: any;
1465
+ };
1466
+ disableSessionRefresh: any;
1467
+ expiresIn: any;
1468
+ fields: any;
1469
+ freshAge: any;
1470
+ preserveSessionInDatabase: any;
1471
+ storeSessionInDatabase: any;
1472
+ updateAge: any;
1473
+ };
1474
+ account: {
1475
+ modelName: any;
1476
+ fields: any;
1477
+ encryptOAuthTokens: any;
1478
+ updateAccountOnSignIn: any;
1479
+ accountLinking: {
1480
+ enabled: any;
1481
+ trustedProviders: any;
1482
+ updateUserInfoOnLink: any;
1483
+ allowUnlinkingAll: any;
1484
+ };
1485
+ };
1486
+ hooks: {
1487
+ after: boolean;
1488
+ before: boolean;
1489
+ };
1490
+ secondaryStorage: boolean;
1491
+ advanced: {
1492
+ cookiePrefix: boolean;
1493
+ cookies: boolean;
1494
+ crossSubDomainCookies: {
1495
+ domain: boolean;
1496
+ enabled: any;
1497
+ additionalCookies: any;
1498
+ };
1499
+ database: {
1500
+ useNumberId: boolean;
1501
+ generateId: any;
1502
+ defaultFindManyLimit: any;
1503
+ };
1504
+ useSecureCookies: any;
1505
+ ipAddress: {
1506
+ disableIpTracking: any;
1507
+ ipAddressHeaders: any;
1508
+ };
1509
+ disableCSRFCheck: any;
1510
+ cookieAttributes: {
1511
+ expires: any;
1512
+ secure: any;
1513
+ sameSite: any;
1514
+ domain: boolean;
1515
+ path: any;
1516
+ httpOnly: any;
1517
+ };
1518
+ };
1519
+ trustedOrigins: any;
1520
+ rateLimit: {
1521
+ storage: any;
1522
+ modelName: any;
1523
+ window: any;
1524
+ customStorage: boolean;
1525
+ enabled: any;
1526
+ max: any;
1527
+ };
1528
+ onAPIError: {
1529
+ errorURL: any;
1530
+ onError: boolean;
1531
+ throw: any;
1532
+ };
1533
+ logger: {
1534
+ disabled: any;
1535
+ level: any;
1536
+ log: boolean;
1537
+ };
1538
+ databaseHooks: {
1539
+ user: {
1540
+ create: {
1541
+ after: boolean;
1542
+ before: boolean;
1543
+ };
1544
+ update: {
1545
+ after: boolean;
1546
+ before: boolean;
1547
+ };
1548
+ };
1549
+ session: {
1550
+ create: {
1551
+ after: boolean;
1552
+ before: boolean;
1553
+ };
1554
+ update: {
1555
+ after: boolean;
1556
+ before: boolean;
1557
+ };
1558
+ };
1559
+ account: {
1560
+ create: {
1561
+ after: boolean;
1562
+ before: boolean;
1563
+ };
1564
+ update: {
1565
+ after: boolean;
1566
+ before: boolean;
1567
+ };
1568
+ };
1569
+ verification: {
1570
+ create: {
1571
+ after: boolean;
1572
+ before: boolean;
1573
+ };
1574
+ update: {
1575
+ after: boolean;
1576
+ before: boolean;
1577
+ };
1578
+ };
1579
+ };
1580
+ };
1581
+ export { FaireAuthClientPlugin as $, InferFieldsInputClient as $t, InferSession as A, getAdapter as At, InferClient as B, parseUserInput as Bt, faireAuth as C, InferPluginErrorCodes as Ct, AdditionalUserFieldsInput as D, getWithHooks as Dt, AdditionalSessionFieldsOutput as E, InferPluginRateLimit as Et, Execute as F, parseAccountOutput as Ft, sessionMiddleware as G, getMigrations as Gt, getSessionFromCtx as H, createInternalAdapter as Ht, ToExecFull as I, parseAdditionalUserInput as It, AtomListener as J, FieldAttributeToObject as Jt, InferResolvedHooks as K, matchType as Kt, DefaultApp as L, parseInputData as Lt, Models as M, toZodSchema as Mt, RateLimit as N, mergeSchema as Nt, AdditionalUserFieldsOutput as O, convertFromDB as Ot, ContextVars as P, parseAccountInput as Pt, CreateSchemaType as Q, InferFieldsInput as Qt, InferAPI as R, parseSessionInput as Rt, defineOptions as S, InferPluginDTO as St, AdditionalSessionFieldsInput as T, InferPluginMiddleware as Tt, requestOnlySessionMiddleware as U, getAuthTables as Ut, freshSessionMiddleware as V, parseUserOutput as Vt, sensitiveSessionMiddleware as W, getSchema as Wt, Client as X, InferFieldsFromOptions as Xt, CamelCase as Y, InferAdditionalFieldsFromPluginOptions as Yt, ClientOptions as Z, InferFieldsFromPlugins as Zt, mergeHeaders as _, TransactionAdapter as _n, Hooks as _t, getTelemetryAuthConfig as a, AuthFactory as an, InferPluginsFromClient as at, Auth as b, FaireAuthPlugin as bt, ENV as c, AuthContext as cn, IsSignal as ct, LogLevel as d, AdapterInstance as dn, Store as dt, InferFieldsOutput as en, Inc as et, Logger as f, AdapterSchemaCreation as fn, FetchOptions as ft, logger as g, DBTransactionAdapter as gn, FaireAuthRateLimitOptions as gt, generateRandomString as h, DBAdapterSchemaCreation as hn, FaireAuthOptions as ht, OpenAPIHono as i, AuthEndpoint as in, InferErrorCodes as it, InferUser as j, FieldAttributeToSchema as jt, InferPluginTypes as k, convertToDB as kt, InternalLogger as l, init as ln, RevalidateOptions as lt, generateId as m, DBAdapterInstance as mn, DTO as mt, FaireAuthError as n, PluginFieldAttribute as nn, InferAdditionalAsClient as nt, createTelemetry as o, AuthProperties as on, InferSessionFromClient as ot, createLogger as p, DBAdapter as pn, CustomRules as pt, createAuthClient as q, KyselyDatabaseType as qt, MissingDependencyError as r, createFieldAttribute as rn, InferAdditionalFromClient as rt, TelemetryEvent as s, createEndpoint as sn, InferUserFromClient as st, APIError as t, InferValueType as tn, InferActions as tt, LogHandlerParams as u, Adapter as un, SessionQueryParams as ut, generateState as v, Where as vn, Middleware as vt, router as w, InferPluginHooks as wt, WithJsDoc as x, InferOptionSchema as xt, parseState as y, getCurrentAdapter as yn, AuthPluginSchema as yt, InferApp as z, parseSessionOutput as zt };