@lunora/auth 1.0.0-alpha.11 → 1.0.0-alpha.111
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.
- package/LICENSE.md +38 -0
- package/README.md +56 -1
- package/dist/adapter.d.mts +4 -43
- package/dist/adapter.d.ts +4 -43
- package/dist/adapter.mjs +1 -47
- package/dist/audit.d.mts +131 -0
- package/dist/audit.d.ts +131 -0
- package/dist/audit.mjs +12 -0
- package/dist/email-guard.d.mts +127 -0
- package/dist/email-guard.d.ts +127 -0
- package/dist/email-guard.mjs +1 -0
- package/dist/index.d.mts +723 -147
- package/dist/index.d.ts +723 -147
- package/dist/index.mjs +1 -12
- package/dist/middleware.d.mts +167 -156
- package/dist/middleware.d.ts +167 -156
- package/dist/middleware.mjs +1 -53
- package/dist/packem_shared/AUTH_DO_AUDIT_PATH-0cTkMU8R.mjs +1 -0
- package/dist/packem_shared/DEFAULT_AUTH_BASE_PATH-DneiLGpv.mjs +1 -0
- package/dist/packem_shared/LunoraAuthAdminError-DtAKa22S.mjs +1 -0
- package/dist/packem_shared/adapter-DA8DdALX.mjs +1 -0
- package/dist/packem_shared/adapter.d-2a61HAY2.d.ts +76 -0
- package/dist/packem_shared/adapter.d-DrD3bb1u.d.mts +76 -0
- package/dist/packem_shared/authAuditHook-tG8gdR77.mjs +1 -0
- package/dist/packem_shared/authDoColumnAdditions-BCSs7qaN.mjs +1 -0
- package/dist/packem_shared/compileMigrationsSql-DYuP6UpZ.mjs +1 -0
- package/dist/packem_shared/create-auth.d-hkN1GE5-.d.mts +138 -0
- package/dist/packem_shared/create-auth.d-hkN1GE5-.d.ts +138 -0
- package/dist/packem_shared/createAuth-Ctz4BQoB.mjs +1 -0
- package/dist/packem_shared/createDoAuthWiring-DgLG8hNY.mjs +1 -0
- package/dist/packem_shared/createLunoraAuthClient-DhjhCwmM.mjs +1 -0
- package/dist/packem_shared/emailGateDatabaseHooks-CAygR3iq.mjs +1 -0
- package/dist/packem_shared/sessionPresets-C867Mlo4.mjs +1 -0
- package/dist/packem_shared/uiConfig-B8pN6pks.mjs +1 -0
- package/dist/plugins-client.d.mts +165 -1
- package/dist/plugins-client.d.ts +165 -1
- package/dist/plugins-client.mjs +1 -2
- package/dist/plugins-enterprise-client.d.mts +15 -0
- package/dist/plugins-enterprise-client.d.ts +15 -0
- package/dist/plugins-enterprise-client.mjs +1 -0
- package/dist/plugins-enterprise.d.mts +1670 -0
- package/dist/plugins-enterprise.d.ts +1670 -0
- package/dist/plugins-enterprise.mjs +1 -0
- package/dist/plugins.d.mts +102 -2
- package/dist/plugins.d.ts +102 -2
- package/dist/plugins.mjs +1 -22
- package/dist/schema.d.mts +39 -39
- package/dist/schema.d.ts +39 -39
- package/dist/schema.mjs +1 -62
- package/dist/sql-store.d.mts +28 -28
- package/dist/sql-store.d.ts +28 -28
- package/dist/sql-store.mjs +1 -162
- package/dist/store.d.mts +49 -31
- package/dist/store.d.ts +49 -31
- package/dist/store.mjs +1 -170
- package/dist/turnstile-middleware.d.mts +66 -55
- package/dist/turnstile-middleware.d.ts +66 -55
- package/dist/turnstile-middleware.mjs +1 -45
- package/dist/turnstile.d.mts +42 -59
- package/dist/turnstile.d.ts +42 -59
- package/dist/turnstile.mjs +1 -61
- package/package.json +39 -5
- package/dist/packem_shared/DEFAULT_AUTH_BASE_PATH-DjcUWEQl.mjs +0 -11
- package/dist/packem_shared/LunoraAuthAdminError-BxrfEeA_.mjs +0 -249
- package/dist/packem_shared/compileMigrationsSql-wZH3oXDu.mjs +0 -28
- package/dist/packem_shared/create-auth.d-M36jwG_Y.d.mts +0 -58
- package/dist/packem_shared/create-auth.d-M36jwG_Y.d.ts +0 -58
- package/dist/packem_shared/createAuth-B-tvsvQU.mjs +0 -56
- package/dist/packem_shared/sessionPresets-B95rXrd8.mjs +0 -35
package/dist/plugins-client.d.ts
CHANGED
|
@@ -1,2 +1,166 @@
|
|
|
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
|
-
|
|
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
|
+
deviceAuthorization?: boolean;
|
|
21
|
+
emailOtp?: boolean;
|
|
22
|
+
lastLoginMethod?: boolean;
|
|
23
|
+
magicLink?: boolean;
|
|
24
|
+
multiSession?: boolean;
|
|
25
|
+
oauthProvider?: boolean;
|
|
26
|
+
organization?: boolean;
|
|
27
|
+
passkey?: boolean;
|
|
28
|
+
phoneNumber?: boolean;
|
|
29
|
+
twoFactor?: boolean;
|
|
30
|
+
username?: boolean;
|
|
31
|
+
}
|
|
32
|
+
type LunoraAuthClientPlugin = ReturnType<typeof organizationClient>;
|
|
33
|
+
declare const lunoraAuthPlugins: (toggles?: LunoraAuthPluginToggles) => LunoraAuthClientPlugin[];
|
|
34
|
+
/** Options for {@link createLunoraAuthClient}; anything else is forwarded to `createAuthClient`. */
|
|
35
|
+
interface CreateLunoraAuthClientOptions {
|
|
36
|
+
[option: string]: unknown;
|
|
37
|
+
/** Defaults to the current origin, which is right for a same-origin app. */
|
|
38
|
+
baseURL?: string;
|
|
39
|
+
/** Your own client plugins, appended after the standard set. */
|
|
40
|
+
extraPlugins?: LunoraAuthClientPlugin[];
|
|
41
|
+
/**
|
|
42
|
+
* Google OAuth client id. Setting it installs the One Tap client plugin —
|
|
43
|
+
* a boolean toggle can't, because the prompt is Google's and needs the id.
|
|
44
|
+
*/
|
|
45
|
+
oneTapClientId?: string;
|
|
46
|
+
/** Which standard client plugins to include. */
|
|
47
|
+
plugins?: LunoraAuthPluginToggles;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Build a better-auth client with Lunora's standard plugin set from toggles.
|
|
51
|
+
*
|
|
52
|
+
* You pass your framework's `createAuthClient` in — `better-auth/react`,
|
|
53
|
+
* `/vue`, `/svelte`, or `/solid` — because the variant has to match the UI
|
|
54
|
+
* framework, and a helper that picked for you would either guess wrong or drag
|
|
55
|
+
* every variant into your bundle.
|
|
56
|
+
*
|
|
57
|
+
* ```ts
|
|
58
|
+
* import { createAuthClient } from "better-auth/react";
|
|
59
|
+
* import { createLunoraAuthClient } from "@lunora/auth/plugins/client";
|
|
60
|
+
*
|
|
61
|
+
* export const authClient = createLunoraAuthClient(createAuthClient, {
|
|
62
|
+
* plugins: { organization: true, passkey: true, twoFactor: true },
|
|
63
|
+
* });
|
|
64
|
+
* ```
|
|
65
|
+
*
|
|
66
|
+
* Reach for {@link lunoraAuthPlugins} instead when you want to own the
|
|
67
|
+
* `createAuthClient` call and only borrow the plugin array.
|
|
68
|
+
*/
|
|
69
|
+
declare const createLunoraAuthClient: <TClient>(createAuthClient: (options: Record<string, unknown>) => TClient, options?: CreateLunoraAuthClientOptions) => TClient;
|
|
70
|
+
export {
|
|
71
|
+
/**
|
|
72
|
+
* Client-side counterparts to the server plugins re-exported from
|
|
73
|
+
* `@lunora/auth/plugins`, surfaced under `@lunora/auth/plugins/client`.
|
|
74
|
+
*
|
|
75
|
+
* better-auth plugins come in two halves: a **server** plugin you pass to
|
|
76
|
+
* `betterAuth()` (re-exported from `@lunora/auth/plugins`) and a **client**
|
|
77
|
+
* plugin you pass to `createAuthClient()`. Both halves must be registered for a
|
|
78
|
+
* plugin's endpoints, inferred types, and client actions (e.g.
|
|
79
|
+
* `authClient.twoFactor.*`, `authClient.organization.*`, the `twoFactorRedirect`
|
|
80
|
+
* sign-in flow) to exist. This module is the client half so consumers don't have
|
|
81
|
+
* to reach into better-auth's `better-auth/client/plugins` subpath directly.
|
|
82
|
+
*
|
|
83
|
+
* # Wiring
|
|
84
|
+
*
|
|
85
|
+
* ```ts
|
|
86
|
+
* import { createAuthClient } from "better-auth/client"; // or a framework adapter
|
|
87
|
+
* import { organizationClient, twoFactorClient } from "@lunora/auth/plugins/client";
|
|
88
|
+
*
|
|
89
|
+
* export const authClient = createAuthClient({
|
|
90
|
+
* baseURL: import.meta.env.VITE_AUTH_URL,
|
|
91
|
+
* plugins: [
|
|
92
|
+
* organizationClient(),
|
|
93
|
+
* twoFactorClient({ onTwoFactorRedirect: () => location.assign("/2fa") }),
|
|
94
|
+
* ],
|
|
95
|
+
* });
|
|
96
|
+
* ```
|
|
97
|
+
*
|
|
98
|
+
* Keep the client plugin list in parity with the server `plugins` array passed
|
|
99
|
+
* to `createAuth`: a server plugin without its client counterpart leaves
|
|
100
|
+
* those actions untyped/unavailable, and vice-versa.
|
|
101
|
+
*/
|
|
102
|
+
type CreateLunoraAuthClientOptions,
|
|
103
|
+
/**
|
|
104
|
+
* Client-side counterparts to the server plugins re-exported from
|
|
105
|
+
* `@lunora/auth/plugins`, surfaced under `@lunora/auth/plugins/client`.
|
|
106
|
+
*
|
|
107
|
+
* better-auth plugins come in two halves: a **server** plugin you pass to
|
|
108
|
+
* `betterAuth()` (re-exported from `@lunora/auth/plugins`) and a **client**
|
|
109
|
+
* plugin you pass to `createAuthClient()`. Both halves must be registered for a
|
|
110
|
+
* plugin's endpoints, inferred types, and client actions (e.g.
|
|
111
|
+
* `authClient.twoFactor.*`, `authClient.organization.*`, the `twoFactorRedirect`
|
|
112
|
+
* sign-in flow) to exist. This module is the client half so consumers don't have
|
|
113
|
+
* to reach into better-auth's `better-auth/client/plugins` subpath directly.
|
|
114
|
+
*
|
|
115
|
+
* # Wiring
|
|
116
|
+
*
|
|
117
|
+
* ```ts
|
|
118
|
+
* import { createAuthClient } from "better-auth/client"; // or a framework adapter
|
|
119
|
+
* import { organizationClient, twoFactorClient } from "@lunora/auth/plugins/client";
|
|
120
|
+
*
|
|
121
|
+
* export const authClient = createAuthClient({
|
|
122
|
+
* baseURL: import.meta.env.VITE_AUTH_URL,
|
|
123
|
+
* plugins: [
|
|
124
|
+
* organizationClient(),
|
|
125
|
+
* twoFactorClient({ onTwoFactorRedirect: () => location.assign("/2fa") }),
|
|
126
|
+
* ],
|
|
127
|
+
* });
|
|
128
|
+
* ```
|
|
129
|
+
*
|
|
130
|
+
* Keep the client plugin list in parity with the server `plugins` array passed
|
|
131
|
+
* to `createAuth`: a server plugin without its client counterpart leaves
|
|
132
|
+
* those actions untyped/unavailable, and vice-versa.
|
|
133
|
+
*/
|
|
134
|
+
type LunoraAuthClientPlugin,
|
|
135
|
+
/**
|
|
136
|
+
* Client-side counterparts to the server plugins re-exported from
|
|
137
|
+
* `@lunora/auth/plugins`, surfaced under `@lunora/auth/plugins/client`.
|
|
138
|
+
*
|
|
139
|
+
* better-auth plugins come in two halves: a **server** plugin you pass to
|
|
140
|
+
* `betterAuth()` (re-exported from `@lunora/auth/plugins`) and a **client**
|
|
141
|
+
* plugin you pass to `createAuthClient()`. Both halves must be registered for a
|
|
142
|
+
* plugin's endpoints, inferred types, and client actions (e.g.
|
|
143
|
+
* `authClient.twoFactor.*`, `authClient.organization.*`, the `twoFactorRedirect`
|
|
144
|
+
* sign-in flow) to exist. This module is the client half so consumers don't have
|
|
145
|
+
* to reach into better-auth's `better-auth/client/plugins` subpath directly.
|
|
146
|
+
*
|
|
147
|
+
* # Wiring
|
|
148
|
+
*
|
|
149
|
+
* ```ts
|
|
150
|
+
* import { createAuthClient } from "better-auth/client"; // or a framework adapter
|
|
151
|
+
* import { organizationClient, twoFactorClient } from "@lunora/auth/plugins/client";
|
|
152
|
+
*
|
|
153
|
+
* export const authClient = createAuthClient({
|
|
154
|
+
* baseURL: import.meta.env.VITE_AUTH_URL,
|
|
155
|
+
* plugins: [
|
|
156
|
+
* organizationClient(),
|
|
157
|
+
* twoFactorClient({ onTwoFactorRedirect: () => location.assign("/2fa") }),
|
|
158
|
+
* ],
|
|
159
|
+
* });
|
|
160
|
+
* ```
|
|
161
|
+
*
|
|
162
|
+
* Keep the client plugin list in parity with the server `plugins` array passed
|
|
163
|
+
* to `createAuth`: a server plugin without its client counterpart leaves
|
|
164
|
+
* those actions untyped/unavailable, and vice-versa.
|
|
165
|
+
*/
|
|
166
|
+
type LunoraAuthPluginToggles, createLunoraAuthClient, lunoraAuthPlugins };
|
package/dist/plugins-client.mjs
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
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 t,lunoraAuthPlugins as n}from"./packem_shared/createLunoraAuthClient-DhjhCwmM.mjs";import{apiKeyClient as l}from"@better-auth/api-key/client";import{oauthDeviceAuthorizationClient as a,oauthProviderClient as C}from"@better-auth/oauth-provider/client";import{passkeyClient as s}from"@better-auth/passkey/client";import{adminClient as d,anonymousClient as p,customSessionClient as h,deviceAuthorizationClient as f,emailOTPClient as c,inferAdditionalFields as A,inferOrgAdditionalFields as g,jwtClient as x,lastLoginMethodClient as T,magicLinkClient as k,multiSessionClient as v,oneTapClient as w,oneTimeTokenClient as y,organizationClient as z,phoneNumberClient as F,siweClient as L,twoFactorClient as P,usernameClient as O}from"better-auth/client/plugins";export{d as adminClient,p as anonymousClient,l as apiKeyClient,t as createLunoraAuthClient,h as customSessionClient,f as deviceAuthorizationClient,c as emailOTPClient,A as inferAdditionalFields,g as inferOrgAdditionalFields,x as jwtClient,T as lastLoginMethodClient,n as lunoraAuthPlugins,k as magicLinkClient,v as multiSessionClient,a as oauthDeviceAuthorizationClient,C as oauthProviderClient,w as oneTapClient,y as oneTimeTokenClient,z as organizationClient,s as passkeyClient,F as phoneNumberClient,L as siweClient,P as twoFactorClient,O as usernameClient};
|
|
@@ -0,0 +1,15 @@
|
|
|
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
|
+
* @experimental
|
|
7
|
+
*/
|
|
8
|
+
ssoClient } from '@better-auth/sso/client';
|
|
9
|
+
/**
|
|
10
|
+
* The plugin instance `ssoClient()` returns. Exported so an app can type the array it
|
|
11
|
+
* passes to `createAuthClient` when it assembles plugins conditionally.
|
|
12
|
+
* @experimental
|
|
13
|
+
*/
|
|
14
|
+
type SSOClientPlugin = ReturnType<typeof ssoClient>;
|
|
15
|
+
export { SSOClientPlugin };
|
|
@@ -0,0 +1,15 @@
|
|
|
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
|
+
* @experimental
|
|
7
|
+
*/
|
|
8
|
+
ssoClient } from '@better-auth/sso/client';
|
|
9
|
+
/**
|
|
10
|
+
* The plugin instance `ssoClient()` returns. Exported so an app can type the array it
|
|
11
|
+
* passes to `createAuthClient` when it assembles plugins conditionally.
|
|
12
|
+
* @experimental
|
|
13
|
+
*/
|
|
14
|
+
type SSOClientPlugin = ReturnType<typeof ssoClient>;
|
|
15
|
+
export { SSOClientPlugin };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ssoClient as r}from"@better-auth/sso/client";export{r as ssoClient};
|