@lunora/auth 1.0.0-alpha.28 → 1.0.0-alpha.281

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 (107) hide show
  1. package/LICENSE.md +233 -104
  2. package/README.md +109 -15
  3. package/dist/adapter.d.mts +4 -43
  4. package/dist/adapter.d.ts +4 -43
  5. package/dist/adapter.mjs +1 -48
  6. package/dist/audit.d.mts +177 -0
  7. package/dist/audit.d.ts +177 -0
  8. package/dist/audit.mjs +1 -0
  9. package/dist/cimd-node.d.mts +1 -0
  10. package/dist/cimd-node.d.ts +1 -0
  11. package/dist/cimd-node.mjs +1 -0
  12. package/dist/cimd-workers.d.mts +64 -0
  13. package/dist/cimd-workers.d.ts +64 -0
  14. package/dist/cimd-workers.mjs +1 -0
  15. package/dist/email-guard.d.mts +143 -0
  16. package/dist/email-guard.d.ts +143 -0
  17. package/dist/email-guard.mjs +1 -0
  18. package/dist/index.d.mts +620 -541
  19. package/dist/index.d.ts +620 -541
  20. package/dist/index.mjs +1 -12
  21. package/dist/middleware.d.mts +165 -155
  22. package/dist/middleware.d.ts +165 -155
  23. package/dist/middleware.mjs +1 -56
  24. package/dist/migrate.d.mts +62 -0
  25. package/dist/migrate.d.ts +62 -0
  26. package/dist/migrate.mjs +1 -0
  27. package/dist/packem_shared/AUTH_DO_AUDIT_PATH-CrHU1RMO.mjs +1 -0
  28. package/dist/packem_shared/DEFAULT_AUTH_BASE_PATH-C3SqYG3N.mjs +1 -0
  29. package/dist/packem_shared/LunoraAuthAdminError-Cg94b5lr.mjs +1 -0
  30. package/dist/packem_shared/adapter-L3XvHnkW.mjs +2 -0
  31. package/dist/packem_shared/adapter.d-BEvPbvSs.d.ts +110 -0
  32. package/dist/packem_shared/adapter.d-RQVSeO5T.d.mts +110 -0
  33. package/dist/packem_shared/api-key-storage-D15k9_CF.mjs +1 -0
  34. package/dist/packem_shared/apiKey-B9uGt5Nc.mjs +1 -0
  35. package/dist/packem_shared/audit-4B6wftJ8.mjs +12 -0
  36. package/dist/packem_shared/auth-do-uwp9VIYJ.mjs +1 -0
  37. package/dist/packem_shared/authAuditBeforeHook-DHiP1Yjf.mjs +1 -0
  38. package/dist/packem_shared/authBackfillStatus-ZDUCk4U6.mjs +1 -0
  39. package/dist/packem_shared/authCanonicalEmailColumn-CfhnJ1Wp.mjs +1 -0
  40. package/dist/packem_shared/authCredentialColumns-EKQdB258.mjs +1 -0
  41. package/dist/packem_shared/authDiscoveryPaths-BtKCs_3V.mjs +1 -0
  42. package/dist/packem_shared/authDoColumnAdditions-UwF3Rl41.mjs +1 -0
  43. package/dist/packem_shared/convertAuthDatesOnce-DE_O-bpx.mjs +1 -0
  44. package/dist/packem_shared/create-auth.d-B8S7aw9O.d.mts +153 -0
  45. package/dist/packem_shared/create-auth.d-B8S7aw9O.d.ts +153 -0
  46. package/dist/packem_shared/createAuth-DFkaeVge.mjs +1 -0
  47. package/dist/packem_shared/createDoAuthWiring-C_ZTB1au.mjs +1 -0
  48. package/dist/packem_shared/createLunoraAuthClient-wzZk9E0m.mjs +1 -0
  49. package/dist/packem_shared/createSignUpInvitation-miwkunlA.mjs +1 -0
  50. package/dist/packem_shared/effectiveCookieCache-JvL6i6YO.mjs +1 -0
  51. package/dist/packem_shared/emailGateDatabaseHooks-Dvyliwxx.mjs +1 -0
  52. package/dist/packem_shared/handleAuthRequest-Id9Vv_Tk.mjs +1 -0
  53. package/dist/packem_shared/identity-claims-hAvIl2wm.mjs +1 -0
  54. package/dist/packem_shared/invitation-email-backfill-DUwurNbV.mjs +1 -0
  55. package/dist/packem_shared/invite-only.d-CsBPLsY1.d.mts +126 -0
  56. package/dist/packem_shared/invite-only.d-JdPDmy_a.d.ts +126 -0
  57. package/dist/packem_shared/isDevEnvironment-yLbPngwn.mjs +1 -0
  58. package/dist/packem_shared/legacyIssuerCleanupStatements-DCL5uV55.mjs +1 -0
  59. package/dist/packem_shared/mcp-CK5XkDFp.mjs +1 -0
  60. package/dist/packem_shared/on-cloudflare-edge-Dx6gFjBO.mjs +1 -0
  61. package/dist/packem_shared/prepareAuthData-CP4M7zk1.mjs +1 -0
  62. package/dist/packem_shared/provision-DWGVCbQD.mjs +1 -0
  63. package/dist/packem_shared/quote-identifier-CGiYFBvY.mjs +1 -0
  64. package/dist/packem_shared/resolveSessionIdentity-EBhckRBW.mjs +1 -0
  65. package/dist/packem_shared/sessionPresets-DQQYAOER.mjs +1 -0
  66. package/dist/packem_shared/sql-store-CFeVqF0V.mjs +1 -0
  67. package/dist/packem_shared/uiConfig-B8pN6pks.mjs +1 -0
  68. package/dist/packem_shared/worker.d-CDnMrB5s.d.mts +912 -0
  69. package/dist/packem_shared/worker.d-CVuhZPM3.d.ts +912 -0
  70. package/dist/plugins-client.d.mts +251 -1
  71. package/dist/plugins-client.d.ts +251 -1
  72. package/dist/plugins-client.mjs +1 -2
  73. package/dist/plugins-enterprise-client.d.mts +13 -0
  74. package/dist/plugins-enterprise-client.d.ts +13 -0
  75. package/dist/plugins-enterprise-client.mjs +1 -0
  76. package/dist/plugins-enterprise.d.mts +1659 -0
  77. package/dist/plugins-enterprise.d.ts +1659 -0
  78. package/dist/plugins-enterprise.mjs +1 -0
  79. package/dist/plugins.d.mts +180 -2
  80. package/dist/plugins.d.ts +180 -2
  81. package/dist/plugins.mjs +1 -22
  82. package/dist/schema.d.mts +47 -39
  83. package/dist/schema.d.ts +47 -39
  84. package/dist/schema.mjs +1 -62
  85. package/dist/sql-store.d.mts +48 -29
  86. package/dist/sql-store.d.ts +48 -29
  87. package/dist/sql-store.mjs +1 -184
  88. package/dist/store.d.mts +65 -47
  89. package/dist/store.d.ts +65 -47
  90. package/dist/store.mjs +1 -183
  91. package/dist/turnstile-middleware.d.mts +73 -55
  92. package/dist/turnstile-middleware.d.ts +73 -55
  93. package/dist/turnstile-middleware.mjs +1 -34
  94. package/dist/turnstile.d.mts +42 -49
  95. package/dist/turnstile.d.ts +42 -49
  96. package/dist/turnstile.mjs +1 -54
  97. package/dist/worker.d.mts +9 -0
  98. package/dist/worker.d.ts +9 -0
  99. package/dist/worker.mjs +1 -0
  100. package/package.json +58 -7
  101. package/dist/packem_shared/DEFAULT_AUTH_BASE_PATH-DjcUWEQl.mjs +0 -11
  102. package/dist/packem_shared/LunoraAuthAdminError-D4L7n6gN.mjs +0 -510
  103. package/dist/packem_shared/compileMigrationsSql-B9bj-mJv.mjs +0 -29
  104. package/dist/packem_shared/create-auth.d-Mwhb4gSc.d.mts +0 -128
  105. package/dist/packem_shared/create-auth.d-Mwhb4gSc.d.ts +0 -128
  106. package/dist/packem_shared/createAuth-BVMMllTm.mjs +0 -87
  107. package/dist/packem_shared/sessionPresets-Dwwd74_J.mjs +0 -38
@@ -1,2 +1,252 @@
1
+ import { organizationClient } from 'better-auth/client/plugins';
2
+ export { adminClient, anonymousClient, customSessionClient, deviceAuthorizationClient, emailOTPClient, inferAdditionalFields, inferOrgAdditionalFields, jwtClient, lastLoginMethodClient, magicLinkClient, multiSessionClient, oneTapClient, oneTimeTokenClient, organizationClient, phoneNumberClient, siweClient, twoFactorClient, usernameClient } from 'better-auth/client/plugins';
3
+ export { apiKeyClient } from '@better-auth/api-key/client';
4
+ export { oauthDeviceAuthorizationClient, oauthProviderClient } from '@better-auth/oauth-provider/client';
1
5
  export { passkeyClient } from '@better-auth/passkey/client';
2
- export { adminClient, anonymousClient, customSessionClient, deviceAuthorizationClient, emailOTPClient, genericOAuthClient, inferAdditionalFields, inferOrgAdditionalFields, jwtClient, lastLoginMethodClient, magicLinkClient, multiSessionClient, oidcClient, oneTimeTokenClient, organizationClient, phoneNumberClient, siweClient, twoFactorClient, usernameClient } from 'better-auth/client/plugins';
6
+ /**
7
+ * Which client plugins to include. Each defaults to `false`.
8
+ *
9
+ * These are the same names `@lunora/auth-ui` gates its cards on, so one object
10
+ * can drive both `createLunoraAuthClient` and `registerAuthClientPlugins` — a
11
+ * flow the UI can show but this cannot install would be a card that renders and
12
+ * then fails at call time.
13
+ *
14
+ * `oneTap` is absent on purpose: Google One Tap needs a client id, not a
15
+ * boolean, so it comes in through {@link CreateLunoraAuthClientOptions.oneTapClientId}.
16
+ */
17
+ interface LunoraAuthPluginToggles {
18
+ admin?: boolean;
19
+ anonymous?: boolean;
20
+ apiKey?: boolean;
21
+ deviceAuthorization?: boolean;
22
+ emailOtp?: boolean;
23
+ lastLoginMethod?: boolean;
24
+ magicLink?: boolean;
25
+ multiSession?: boolean;
26
+ oauthProvider?: boolean;
27
+ organization?: boolean;
28
+ passkey?: boolean;
29
+ phoneNumber?: boolean;
30
+ twoFactor?: boolean;
31
+ username?: boolean;
32
+ }
33
+ type LunoraAuthClientPlugin = ReturnType<typeof organizationClient>;
34
+ declare const lunoraAuthPlugins: (toggles?: LunoraAuthPluginToggles) => LunoraAuthClientPlugin[];
35
+ /** Options for {@link createLunoraAuthClient}; anything else is forwarded to `createAuthClient`. */
36
+ interface CreateLunoraAuthClientOptions {
37
+ [option: string]: unknown;
38
+ /** Defaults to the current origin, which is right for a same-origin app. */
39
+ baseURL?: string;
40
+ /** Your own client plugins, appended after the standard set. */
41
+ extraPlugins?: LunoraAuthClientPlugin[];
42
+ /**
43
+ * Google OAuth client id. Setting it installs the One Tap client plugin —
44
+ * a boolean toggle can't, because the prompt is Google's and needs the id.
45
+ */
46
+ oneTapClientId?: string;
47
+ /** Which standard client plugins to include. */
48
+ plugins?: LunoraAuthPluginToggles;
49
+ }
50
+ /**
51
+ * What {@link lunoraSessionSync} returns: a better-auth client plugin, typed
52
+ * narrowly rather than as `BetterAuthClientPlugin` — widening a plugin to that
53
+ * type collapses better-auth's session inference on the client it joins.
54
+ */
55
+ interface LunoraSessionSyncPlugin {
56
+ fetchPlugins: {
57
+ hooks: {
58
+ onSuccess: (context: {
59
+ request: {
60
+ method?: string;
61
+ };
62
+ }) => void;
63
+ };
64
+ id: string;
65
+ name: string;
66
+ }[];
67
+ id: "lunora-session-sync";
68
+ }
69
+ /**
70
+ * Tell every `LunoraClient` in the page, and in the browser's other tabs on the
71
+ * same origin, that the auth session may have changed, so each asks
72
+ * `/get-session` who is signed in now. A tab on another origin that shares the
73
+ * cookie is not reached: it switches on its next socket reconnect, and the
74
+ * worker's replay check keeps its writes safe meanwhile.
75
+ *
76
+ * Needed for a **cookie** session: a sign-in or sign-out sets or clears an
77
+ * `HttpOnly` cookie in a request the Lunora client never sees, and nothing it
78
+ * can observe changes. Until it re-resolves, its live queries keep showing the
79
+ * previous user's rows over a socket still authenticated as them.
80
+ * {@link lunoraSessionSync} (installed by {@link createLunoraAuthClient}) and
81
+ * `@lunora/auth-ui` call it for you; call it yourself after a session change
82
+ * made any other way.
83
+ *
84
+ * Resolves once every client in this tab has re-resolved (or failed to), so
85
+ * code that reads `client.currentIdentity()` next can `await` it; the other
86
+ * tabs re-resolve on their own. Never rejects.
87
+ */
88
+ declare const notifyLunoraSessionChange: () => Promise<void>;
89
+ /**
90
+ * A better-auth client plugin that, after every successful auth request that
91
+ * can change the session (anything but a `GET` — sign-in, sign-up, sign-out,
92
+ * 2FA, account switch, session revocation), calls
93
+ * {@link notifyLunoraSessionChange}.
94
+ *
95
+ * {@link createLunoraAuthClient} always installs it. Add it yourself when you
96
+ * call `createAuthClient` directly:
97
+ *
98
+ * ```ts
99
+ * export const authClient = createAuthClient({ plugins: [lunoraSessionSync()] });
100
+ * ```
101
+ */
102
+ declare const lunoraSessionSync: () => LunoraSessionSyncPlugin;
103
+ /**
104
+ * Build a better-auth client with Lunora's standard plugin set from toggles.
105
+ *
106
+ * You pass your framework's `createAuthClient` in — `better-auth/react`,
107
+ * `/vue`, `/svelte`, or `/solid` — because the variant has to match the UI
108
+ * framework, and a helper that picked for you would either guess wrong or drag
109
+ * every variant into your bundle.
110
+ *
111
+ * ```ts
112
+ * import { createAuthClient } from "better-auth/react";
113
+ * import { createLunoraAuthClient } from "@lunora/auth/plugins/client";
114
+ *
115
+ * export const authClient = createLunoraAuthClient(createAuthClient, {
116
+ * plugins: { organization: true, passkey: true, twoFactor: true },
117
+ * });
118
+ * ```
119
+ *
120
+ * Reach for {@link lunoraAuthPlugins} instead when you want to own the
121
+ * `createAuthClient` call and only borrow the plugin array.
122
+ */
123
+ declare const createLunoraAuthClient: <TClient>(createAuthClient: (options: Record<string, unknown>) => TClient, options?: CreateLunoraAuthClientOptions) => TClient;
124
+ export {
125
+ /**
126
+ * Client-side counterparts to the server plugins re-exported from
127
+ * `@lunora/auth/plugins`, surfaced under `@lunora/auth/plugins/client`.
128
+ *
129
+ * better-auth plugins come in two halves: a **server** plugin you pass to
130
+ * `betterAuth()` (re-exported from `@lunora/auth/plugins`) and a **client**
131
+ * plugin you pass to `createAuthClient()`. Both halves must be registered for a
132
+ * plugin's endpoints, inferred types, and client actions (e.g.
133
+ * `authClient.twoFactor.*`, `authClient.organization.*`, the `twoFactorRedirect`
134
+ * sign-in flow) to exist. This module is the client half so consumers don't have
135
+ * to reach into better-auth's `better-auth/client/plugins` subpath directly.
136
+ *
137
+ * # Wiring
138
+ *
139
+ * ```ts
140
+ * import { createAuthClient } from "better-auth/client"; // or a framework adapter
141
+ * import { organizationClient, twoFactorClient } from "@lunora/auth/plugins/client";
142
+ *
143
+ * export const authClient = createAuthClient({
144
+ * baseURL: import.meta.env.VITE_AUTH_URL,
145
+ * plugins: [
146
+ * organizationClient(),
147
+ * twoFactorClient({ onTwoFactorRedirect: () => location.assign("/2fa") }),
148
+ * ],
149
+ * });
150
+ * ```
151
+ *
152
+ * Keep the client plugin list in parity with the server `plugins` array passed
153
+ * to `createAuth`: a server plugin without its client counterpart leaves
154
+ * those actions untyped/unavailable, and vice-versa.
155
+ */
156
+ type CreateLunoraAuthClientOptions,
157
+ /**
158
+ * Client-side counterparts to the server plugins re-exported from
159
+ * `@lunora/auth/plugins`, surfaced under `@lunora/auth/plugins/client`.
160
+ *
161
+ * better-auth plugins come in two halves: a **server** plugin you pass to
162
+ * `betterAuth()` (re-exported from `@lunora/auth/plugins`) and a **client**
163
+ * plugin you pass to `createAuthClient()`. Both halves must be registered for a
164
+ * plugin's endpoints, inferred types, and client actions (e.g.
165
+ * `authClient.twoFactor.*`, `authClient.organization.*`, the `twoFactorRedirect`
166
+ * sign-in flow) to exist. This module is the client half so consumers don't have
167
+ * to reach into better-auth's `better-auth/client/plugins` subpath directly.
168
+ *
169
+ * # Wiring
170
+ *
171
+ * ```ts
172
+ * import { createAuthClient } from "better-auth/client"; // or a framework adapter
173
+ * import { organizationClient, twoFactorClient } from "@lunora/auth/plugins/client";
174
+ *
175
+ * export const authClient = createAuthClient({
176
+ * baseURL: import.meta.env.VITE_AUTH_URL,
177
+ * plugins: [
178
+ * organizationClient(),
179
+ * twoFactorClient({ onTwoFactorRedirect: () => location.assign("/2fa") }),
180
+ * ],
181
+ * });
182
+ * ```
183
+ *
184
+ * Keep the client plugin list in parity with the server `plugins` array passed
185
+ * to `createAuth`: a server plugin without its client counterpart leaves
186
+ * those actions untyped/unavailable, and vice-versa.
187
+ */
188
+ type LunoraAuthClientPlugin,
189
+ /**
190
+ * Client-side counterparts to the server plugins re-exported from
191
+ * `@lunora/auth/plugins`, surfaced under `@lunora/auth/plugins/client`.
192
+ *
193
+ * better-auth plugins come in two halves: a **server** plugin you pass to
194
+ * `betterAuth()` (re-exported from `@lunora/auth/plugins`) and a **client**
195
+ * plugin you pass to `createAuthClient()`. Both halves must be registered for a
196
+ * plugin's endpoints, inferred types, and client actions (e.g.
197
+ * `authClient.twoFactor.*`, `authClient.organization.*`, the `twoFactorRedirect`
198
+ * sign-in flow) to exist. This module is the client half so consumers don't have
199
+ * to reach into better-auth's `better-auth/client/plugins` subpath directly.
200
+ *
201
+ * # Wiring
202
+ *
203
+ * ```ts
204
+ * import { createAuthClient } from "better-auth/client"; // or a framework adapter
205
+ * import { organizationClient, twoFactorClient } from "@lunora/auth/plugins/client";
206
+ *
207
+ * export const authClient = createAuthClient({
208
+ * baseURL: import.meta.env.VITE_AUTH_URL,
209
+ * plugins: [
210
+ * organizationClient(),
211
+ * twoFactorClient({ onTwoFactorRedirect: () => location.assign("/2fa") }),
212
+ * ],
213
+ * });
214
+ * ```
215
+ *
216
+ * Keep the client plugin list in parity with the server `plugins` array passed
217
+ * to `createAuth`: a server plugin without its client counterpart leaves
218
+ * those actions untyped/unavailable, and vice-versa.
219
+ */
220
+ type LunoraAuthPluginToggles,
221
+ /**
222
+ * Client-side counterparts to the server plugins re-exported from
223
+ * `@lunora/auth/plugins`, surfaced under `@lunora/auth/plugins/client`.
224
+ *
225
+ * better-auth plugins come in two halves: a **server** plugin you pass to
226
+ * `betterAuth()` (re-exported from `@lunora/auth/plugins`) and a **client**
227
+ * plugin you pass to `createAuthClient()`. Both halves must be registered for a
228
+ * plugin's endpoints, inferred types, and client actions (e.g.
229
+ * `authClient.twoFactor.*`, `authClient.organization.*`, the `twoFactorRedirect`
230
+ * sign-in flow) to exist. This module is the client half so consumers don't have
231
+ * to reach into better-auth's `better-auth/client/plugins` subpath directly.
232
+ *
233
+ * # Wiring
234
+ *
235
+ * ```ts
236
+ * import { createAuthClient } from "better-auth/client"; // or a framework adapter
237
+ * import { organizationClient, twoFactorClient } from "@lunora/auth/plugins/client";
238
+ *
239
+ * export const authClient = createAuthClient({
240
+ * baseURL: import.meta.env.VITE_AUTH_URL,
241
+ * plugins: [
242
+ * organizationClient(),
243
+ * twoFactorClient({ onTwoFactorRedirect: () => location.assign("/2fa") }),
244
+ * ],
245
+ * });
246
+ * ```
247
+ *
248
+ * Keep the client plugin list in parity with the server `plugins` array passed
249
+ * to `createAuth`: a server plugin without its client counterpart leaves
250
+ * those actions untyped/unavailable, and vice-versa.
251
+ */
252
+ type LunoraSessionSyncPlugin, createLunoraAuthClient, lunoraAuthPlugins, lunoraSessionSync, notifyLunoraSessionChange };
@@ -1,2 +1,252 @@
1
+ import { organizationClient } from 'better-auth/client/plugins';
2
+ export { adminClient, anonymousClient, customSessionClient, deviceAuthorizationClient, emailOTPClient, inferAdditionalFields, inferOrgAdditionalFields, jwtClient, lastLoginMethodClient, magicLinkClient, multiSessionClient, oneTapClient, oneTimeTokenClient, organizationClient, phoneNumberClient, siweClient, twoFactorClient, usernameClient } from 'better-auth/client/plugins';
3
+ export { apiKeyClient } from '@better-auth/api-key/client';
4
+ export { oauthDeviceAuthorizationClient, oauthProviderClient } from '@better-auth/oauth-provider/client';
1
5
  export { passkeyClient } from '@better-auth/passkey/client';
2
- export { adminClient, anonymousClient, customSessionClient, deviceAuthorizationClient, emailOTPClient, genericOAuthClient, inferAdditionalFields, inferOrgAdditionalFields, jwtClient, lastLoginMethodClient, magicLinkClient, multiSessionClient, oidcClient, oneTimeTokenClient, organizationClient, phoneNumberClient, siweClient, twoFactorClient, usernameClient } from 'better-auth/client/plugins';
6
+ /**
7
+ * Which client plugins to include. Each defaults to `false`.
8
+ *
9
+ * These are the same names `@lunora/auth-ui` gates its cards on, so one object
10
+ * can drive both `createLunoraAuthClient` and `registerAuthClientPlugins` — a
11
+ * flow the UI can show but this cannot install would be a card that renders and
12
+ * then fails at call time.
13
+ *
14
+ * `oneTap` is absent on purpose: Google One Tap needs a client id, not a
15
+ * boolean, so it comes in through {@link CreateLunoraAuthClientOptions.oneTapClientId}.
16
+ */
17
+ interface LunoraAuthPluginToggles {
18
+ admin?: boolean;
19
+ anonymous?: boolean;
20
+ apiKey?: boolean;
21
+ deviceAuthorization?: boolean;
22
+ emailOtp?: boolean;
23
+ lastLoginMethod?: boolean;
24
+ magicLink?: boolean;
25
+ multiSession?: boolean;
26
+ oauthProvider?: boolean;
27
+ organization?: boolean;
28
+ passkey?: boolean;
29
+ phoneNumber?: boolean;
30
+ twoFactor?: boolean;
31
+ username?: boolean;
32
+ }
33
+ type LunoraAuthClientPlugin = ReturnType<typeof organizationClient>;
34
+ declare const lunoraAuthPlugins: (toggles?: LunoraAuthPluginToggles) => LunoraAuthClientPlugin[];
35
+ /** Options for {@link createLunoraAuthClient}; anything else is forwarded to `createAuthClient`. */
36
+ interface CreateLunoraAuthClientOptions {
37
+ [option: string]: unknown;
38
+ /** Defaults to the current origin, which is right for a same-origin app. */
39
+ baseURL?: string;
40
+ /** Your own client plugins, appended after the standard set. */
41
+ extraPlugins?: LunoraAuthClientPlugin[];
42
+ /**
43
+ * Google OAuth client id. Setting it installs the One Tap client plugin —
44
+ * a boolean toggle can't, because the prompt is Google's and needs the id.
45
+ */
46
+ oneTapClientId?: string;
47
+ /** Which standard client plugins to include. */
48
+ plugins?: LunoraAuthPluginToggles;
49
+ }
50
+ /**
51
+ * What {@link lunoraSessionSync} returns: a better-auth client plugin, typed
52
+ * narrowly rather than as `BetterAuthClientPlugin` — widening a plugin to that
53
+ * type collapses better-auth's session inference on the client it joins.
54
+ */
55
+ interface LunoraSessionSyncPlugin {
56
+ fetchPlugins: {
57
+ hooks: {
58
+ onSuccess: (context: {
59
+ request: {
60
+ method?: string;
61
+ };
62
+ }) => void;
63
+ };
64
+ id: string;
65
+ name: string;
66
+ }[];
67
+ id: "lunora-session-sync";
68
+ }
69
+ /**
70
+ * Tell every `LunoraClient` in the page, and in the browser's other tabs on the
71
+ * same origin, that the auth session may have changed, so each asks
72
+ * `/get-session` who is signed in now. A tab on another origin that shares the
73
+ * cookie is not reached: it switches on its next socket reconnect, and the
74
+ * worker's replay check keeps its writes safe meanwhile.
75
+ *
76
+ * Needed for a **cookie** session: a sign-in or sign-out sets or clears an
77
+ * `HttpOnly` cookie in a request the Lunora client never sees, and nothing it
78
+ * can observe changes. Until it re-resolves, its live queries keep showing the
79
+ * previous user's rows over a socket still authenticated as them.
80
+ * {@link lunoraSessionSync} (installed by {@link createLunoraAuthClient}) and
81
+ * `@lunora/auth-ui` call it for you; call it yourself after a session change
82
+ * made any other way.
83
+ *
84
+ * Resolves once every client in this tab has re-resolved (or failed to), so
85
+ * code that reads `client.currentIdentity()` next can `await` it; the other
86
+ * tabs re-resolve on their own. Never rejects.
87
+ */
88
+ declare const notifyLunoraSessionChange: () => Promise<void>;
89
+ /**
90
+ * A better-auth client plugin that, after every successful auth request that
91
+ * can change the session (anything but a `GET` — sign-in, sign-up, sign-out,
92
+ * 2FA, account switch, session revocation), calls
93
+ * {@link notifyLunoraSessionChange}.
94
+ *
95
+ * {@link createLunoraAuthClient} always installs it. Add it yourself when you
96
+ * call `createAuthClient` directly:
97
+ *
98
+ * ```ts
99
+ * export const authClient = createAuthClient({ plugins: [lunoraSessionSync()] });
100
+ * ```
101
+ */
102
+ declare const lunoraSessionSync: () => LunoraSessionSyncPlugin;
103
+ /**
104
+ * Build a better-auth client with Lunora's standard plugin set from toggles.
105
+ *
106
+ * You pass your framework's `createAuthClient` in — `better-auth/react`,
107
+ * `/vue`, `/svelte`, or `/solid` — because the variant has to match the UI
108
+ * framework, and a helper that picked for you would either guess wrong or drag
109
+ * every variant into your bundle.
110
+ *
111
+ * ```ts
112
+ * import { createAuthClient } from "better-auth/react";
113
+ * import { createLunoraAuthClient } from "@lunora/auth/plugins/client";
114
+ *
115
+ * export const authClient = createLunoraAuthClient(createAuthClient, {
116
+ * plugins: { organization: true, passkey: true, twoFactor: true },
117
+ * });
118
+ * ```
119
+ *
120
+ * Reach for {@link lunoraAuthPlugins} instead when you want to own the
121
+ * `createAuthClient` call and only borrow the plugin array.
122
+ */
123
+ declare const createLunoraAuthClient: <TClient>(createAuthClient: (options: Record<string, unknown>) => TClient, options?: CreateLunoraAuthClientOptions) => TClient;
124
+ export {
125
+ /**
126
+ * Client-side counterparts to the server plugins re-exported from
127
+ * `@lunora/auth/plugins`, surfaced under `@lunora/auth/plugins/client`.
128
+ *
129
+ * better-auth plugins come in two halves: a **server** plugin you pass to
130
+ * `betterAuth()` (re-exported from `@lunora/auth/plugins`) and a **client**
131
+ * plugin you pass to `createAuthClient()`. Both halves must be registered for a
132
+ * plugin's endpoints, inferred types, and client actions (e.g.
133
+ * `authClient.twoFactor.*`, `authClient.organization.*`, the `twoFactorRedirect`
134
+ * sign-in flow) to exist. This module is the client half so consumers don't have
135
+ * to reach into better-auth's `better-auth/client/plugins` subpath directly.
136
+ *
137
+ * # Wiring
138
+ *
139
+ * ```ts
140
+ * import { createAuthClient } from "better-auth/client"; // or a framework adapter
141
+ * import { organizationClient, twoFactorClient } from "@lunora/auth/plugins/client";
142
+ *
143
+ * export const authClient = createAuthClient({
144
+ * baseURL: import.meta.env.VITE_AUTH_URL,
145
+ * plugins: [
146
+ * organizationClient(),
147
+ * twoFactorClient({ onTwoFactorRedirect: () => location.assign("/2fa") }),
148
+ * ],
149
+ * });
150
+ * ```
151
+ *
152
+ * Keep the client plugin list in parity with the server `plugins` array passed
153
+ * to `createAuth`: a server plugin without its client counterpart leaves
154
+ * those actions untyped/unavailable, and vice-versa.
155
+ */
156
+ type CreateLunoraAuthClientOptions,
157
+ /**
158
+ * Client-side counterparts to the server plugins re-exported from
159
+ * `@lunora/auth/plugins`, surfaced under `@lunora/auth/plugins/client`.
160
+ *
161
+ * better-auth plugins come in two halves: a **server** plugin you pass to
162
+ * `betterAuth()` (re-exported from `@lunora/auth/plugins`) and a **client**
163
+ * plugin you pass to `createAuthClient()`. Both halves must be registered for a
164
+ * plugin's endpoints, inferred types, and client actions (e.g.
165
+ * `authClient.twoFactor.*`, `authClient.organization.*`, the `twoFactorRedirect`
166
+ * sign-in flow) to exist. This module is the client half so consumers don't have
167
+ * to reach into better-auth's `better-auth/client/plugins` subpath directly.
168
+ *
169
+ * # Wiring
170
+ *
171
+ * ```ts
172
+ * import { createAuthClient } from "better-auth/client"; // or a framework adapter
173
+ * import { organizationClient, twoFactorClient } from "@lunora/auth/plugins/client";
174
+ *
175
+ * export const authClient = createAuthClient({
176
+ * baseURL: import.meta.env.VITE_AUTH_URL,
177
+ * plugins: [
178
+ * organizationClient(),
179
+ * twoFactorClient({ onTwoFactorRedirect: () => location.assign("/2fa") }),
180
+ * ],
181
+ * });
182
+ * ```
183
+ *
184
+ * Keep the client plugin list in parity with the server `plugins` array passed
185
+ * to `createAuth`: a server plugin without its client counterpart leaves
186
+ * those actions untyped/unavailable, and vice-versa.
187
+ */
188
+ type LunoraAuthClientPlugin,
189
+ /**
190
+ * Client-side counterparts to the server plugins re-exported from
191
+ * `@lunora/auth/plugins`, surfaced under `@lunora/auth/plugins/client`.
192
+ *
193
+ * better-auth plugins come in two halves: a **server** plugin you pass to
194
+ * `betterAuth()` (re-exported from `@lunora/auth/plugins`) and a **client**
195
+ * plugin you pass to `createAuthClient()`. Both halves must be registered for a
196
+ * plugin's endpoints, inferred types, and client actions (e.g.
197
+ * `authClient.twoFactor.*`, `authClient.organization.*`, the `twoFactorRedirect`
198
+ * sign-in flow) to exist. This module is the client half so consumers don't have
199
+ * to reach into better-auth's `better-auth/client/plugins` subpath directly.
200
+ *
201
+ * # Wiring
202
+ *
203
+ * ```ts
204
+ * import { createAuthClient } from "better-auth/client"; // or a framework adapter
205
+ * import { organizationClient, twoFactorClient } from "@lunora/auth/plugins/client";
206
+ *
207
+ * export const authClient = createAuthClient({
208
+ * baseURL: import.meta.env.VITE_AUTH_URL,
209
+ * plugins: [
210
+ * organizationClient(),
211
+ * twoFactorClient({ onTwoFactorRedirect: () => location.assign("/2fa") }),
212
+ * ],
213
+ * });
214
+ * ```
215
+ *
216
+ * Keep the client plugin list in parity with the server `plugins` array passed
217
+ * to `createAuth`: a server plugin without its client counterpart leaves
218
+ * those actions untyped/unavailable, and vice-versa.
219
+ */
220
+ type LunoraAuthPluginToggles,
221
+ /**
222
+ * Client-side counterparts to the server plugins re-exported from
223
+ * `@lunora/auth/plugins`, surfaced under `@lunora/auth/plugins/client`.
224
+ *
225
+ * better-auth plugins come in two halves: a **server** plugin you pass to
226
+ * `betterAuth()` (re-exported from `@lunora/auth/plugins`) and a **client**
227
+ * plugin you pass to `createAuthClient()`. Both halves must be registered for a
228
+ * plugin's endpoints, inferred types, and client actions (e.g.
229
+ * `authClient.twoFactor.*`, `authClient.organization.*`, the `twoFactorRedirect`
230
+ * sign-in flow) to exist. This module is the client half so consumers don't have
231
+ * to reach into better-auth's `better-auth/client/plugins` subpath directly.
232
+ *
233
+ * # Wiring
234
+ *
235
+ * ```ts
236
+ * import { createAuthClient } from "better-auth/client"; // or a framework adapter
237
+ * import { organizationClient, twoFactorClient } from "@lunora/auth/plugins/client";
238
+ *
239
+ * export const authClient = createAuthClient({
240
+ * baseURL: import.meta.env.VITE_AUTH_URL,
241
+ * plugins: [
242
+ * organizationClient(),
243
+ * twoFactorClient({ onTwoFactorRedirect: () => location.assign("/2fa") }),
244
+ * ],
245
+ * });
246
+ * ```
247
+ *
248
+ * Keep the client plugin list in parity with the server `plugins` array passed
249
+ * to `createAuth`: a server plugin without its client counterpart leaves
250
+ * those actions untyped/unavailable, and vice-versa.
251
+ */
252
+ type LunoraSessionSyncPlugin, createLunoraAuthClient, lunoraAuthPlugins, lunoraSessionSync, notifyLunoraSessionChange };
@@ -1,2 +1 @@
1
- export { passkeyClient } from '@better-auth/passkey/client';
2
- export { adminClient, anonymousClient, customSessionClient, deviceAuthorizationClient, emailOTPClient, genericOAuthClient, inferAdditionalFields, inferOrgAdditionalFields, jwtClient, lastLoginMethodClient, magicLinkClient, multiSessionClient, oidcClient, oneTimeTokenClient, organizationClient, phoneNumberClient, siweClient, twoFactorClient, usernameClient } from 'better-auth/client/plugins';
1
+ import{createLunoraAuthClient as n,lunoraAuthPlugins as t,lunoraSessionSync as o,notifyLunoraSessionChange as l}from"./packem_shared/createLunoraAuthClient-wzZk9E0m.mjs";import{apiKeyClient as a}from"@better-auth/api-key/client";import{oauthDeviceAuthorizationClient as s,oauthProviderClient as u}from"@better-auth/oauth-provider/client";import{passkeyClient as d}from"@better-auth/passkey/client";import{adminClient as p,anonymousClient as f,customSessionClient as c,deviceAuthorizationClient as g,emailOTPClient as A,inferAdditionalFields as x,inferOrgAdditionalFields as y,jwtClient as S,lastLoginMethodClient as L,magicLinkClient as T,multiSessionClient as k,oneTapClient as v,oneTimeTokenClient as w,organizationClient as z,phoneNumberClient as F,siweClient as P,twoFactorClient as O,usernameClient as b}from"better-auth/client/plugins";export{p as adminClient,f as anonymousClient,a as apiKeyClient,n as createLunoraAuthClient,c as customSessionClient,g as deviceAuthorizationClient,A as emailOTPClient,x as inferAdditionalFields,y as inferOrgAdditionalFields,S as jwtClient,L as lastLoginMethodClient,t as lunoraAuthPlugins,o as lunoraSessionSync,T as magicLinkClient,k as multiSessionClient,l as notifyLunoraSessionChange,s as oauthDeviceAuthorizationClient,u as oauthProviderClient,v as oneTapClient,w as oneTimeTokenClient,z as organizationClient,d as passkeyClient,F as phoneNumberClient,P as siweClient,O as twoFactorClient,b as usernameClient};
@@ -0,0 +1,13 @@
1
+ import { ssoClient } from '@better-auth/sso/client';
2
+ export type {
3
+ /**
4
+ * Adds `authClient.signIn.sso({ email | domain | providerId })`. Registering the
5
+ * server `sso` plugin without this leaves those actions unavailable and untyped.
6
+ */
7
+ ssoClient } from '@better-auth/sso/client';
8
+ /**
9
+ * The plugin instance `ssoClient()` returns. Exported so an app can type the array it
10
+ * passes to `createAuthClient` when it assembles plugins conditionally.
11
+ */
12
+ type SSOClientPlugin = ReturnType<typeof ssoClient>;
13
+ export { SSOClientPlugin };
@@ -0,0 +1,13 @@
1
+ import { ssoClient } from '@better-auth/sso/client';
2
+ export type {
3
+ /**
4
+ * Adds `authClient.signIn.sso({ email | domain | providerId })`. Registering the
5
+ * server `sso` plugin without this leaves those actions unavailable and untyped.
6
+ */
7
+ ssoClient } from '@better-auth/sso/client';
8
+ /**
9
+ * The plugin instance `ssoClient()` returns. Exported so an app can type the array it
10
+ * passes to `createAuthClient` when it assembles plugins conditionally.
11
+ */
12
+ type SSOClientPlugin = ReturnType<typeof ssoClient>;
13
+ export { SSOClientPlugin };
@@ -0,0 +1 @@
1
+ import{ssoClient as r}from"@better-auth/sso/client";export{r as ssoClient};