better-auth 1.6.27 → 1.6.28
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/dist/adapters/index.d.mts +6 -1
- package/dist/api/dispatch.d.mts +1 -0
- package/dist/api/index.d.mts +474 -472
- package/dist/api/middlewares/authorization.d.mts +8 -12
- package/dist/api/middlewares/authorization.mjs +1 -2
- package/dist/api/middlewares/index.d.mts +1 -2
- package/dist/api/middlewares/origin-check.d.mts +5 -3
- package/dist/api/routes/account.d.mts +13 -10
- package/dist/api/routes/callback.d.mts +3 -1
- package/dist/api/routes/email-verification.d.mts +8 -4
- package/dist/api/routes/error.d.mts +3 -1
- package/dist/api/routes/index.d.mts +1 -2
- package/dist/api/routes/ok.d.mts +3 -1
- package/dist/api/routes/password.d.mts +9 -7
- package/dist/api/routes/session.d.mts +24 -22
- package/dist/api/routes/sign-in.d.mts +5 -3
- package/dist/api/routes/sign-out.d.mts +3 -1
- package/dist/api/routes/sign-up.d.mts +4 -3
- package/dist/api/routes/update-session.d.mts +4 -3
- package/dist/api/routes/update-user.d.mts +14 -13
- package/dist/auth/full.d.mts +1 -1
- package/dist/auth/minimal.d.mts +1 -1
- package/dist/client/config.d.mts +14 -12
- package/dist/client/config.mjs +2 -2
- package/dist/client/equality.d.mts +1 -0
- package/dist/client/index.d.mts +5 -6
- package/dist/client/lynx/index.d.mts +5 -4
- package/dist/client/lynx/lynx-store.d.mts +2 -1
- package/dist/client/parser.d.mts +3 -7
- package/dist/client/path-to-object.d.mts +4 -3
- package/dist/client/plugins/index.d.mts +1 -1
- package/dist/client/plugins/infer-plugin.d.mts +1 -0
- package/dist/client/query.d.mts +1 -0
- package/dist/client/react/index.d.mts +5 -4
- package/dist/client/react/react-store.d.mts +2 -1
- package/dist/client/session-atom.mjs +41 -17
- package/dist/client/session-refresh.d.mts +1 -0
- package/dist/client/solid/index.d.mts +5 -4
- package/dist/client/svelte/index.d.mts +5 -4
- package/dist/client/types.d.mts +2 -2
- package/dist/client/vanilla.d.mts +2 -1
- package/dist/client/vue/index.d.mts +5 -4
- package/dist/context/create-context.mjs +3 -3
- package/dist/context/helpers.mjs +2 -2
- package/dist/cookies/index.d.mts +7 -6
- package/dist/cookies/session-store.d.mts +0 -1
- package/dist/cookies/session-store.mjs +1 -2
- package/dist/crypto/index.d.mts +9 -2
- package/dist/crypto/jwt.d.mts +1 -0
- package/dist/crypto/password.d.mts +5 -1
- package/dist/db/adapter-base.d.mts +1 -0
- package/dist/db/adapter-kysely.d.mts +1 -0
- package/dist/db/field-converter.d.mts +1 -0
- package/dist/db/field.d.mts +10 -9
- package/dist/db/get-migration.d.mts +1 -0
- package/dist/db/get-schema.d.mts +1 -0
- package/dist/db/internal-adapter.d.mts +1 -0
- package/dist/db/internal-adapter.mjs +1 -2
- package/dist/db/revoke-unproven-account-access.d.mts +1 -0
- package/dist/db/schema.d.mts +2 -2
- package/dist/db/to-zod.d.mts +7 -3
- package/dist/db/with-hooks.d.mts +1 -0
- package/dist/index.d.mts +3 -4
- package/dist/integrations/next-js.d.mts +7 -4
- package/dist/integrations/node.d.mts +3 -2
- package/dist/integrations/svelte-kit.d.mts +9 -2
- package/dist/integrations/tanstack-start-solid.d.mts +5 -2
- package/dist/integrations/tanstack-start.d.mts +5 -2
- package/dist/oauth2/link-account.d.mts +1 -1
- package/dist/oauth2/state.d.mts +1 -0
- package/dist/oauth2/utils.d.mts +1 -0
- package/dist/package.mjs +1 -1
- package/dist/plugins/access/access.d.mts +1 -0
- package/dist/plugins/access/types.d.mts +5 -4
- package/dist/plugins/additional-fields/client.d.mts +1 -0
- package/dist/plugins/admin/access/statement.d.mts +0 -1
- package/dist/plugins/admin/admin.d.mts +125 -120
- package/dist/plugins/admin/client.d.mts +30 -30
- package/dist/plugins/admin/client.mjs +1 -1
- package/dist/plugins/admin/error-codes.d.mts +25 -23
- package/dist/plugins/admin/index.d.mts +1 -1
- package/dist/plugins/admin/schema.d.mts +1 -1
- package/dist/plugins/admin/types.d.mts +2 -3
- package/dist/plugins/anonymous/client.d.mts +11 -9
- package/dist/plugins/anonymous/client.mjs +1 -1
- package/dist/plugins/anonymous/error-codes.d.mts +10 -8
- package/dist/plugins/anonymous/index.d.mts +18 -14
- package/dist/plugins/anonymous/types.d.mts +1 -1
- package/dist/plugins/bearer/index.d.mts +7 -4
- package/dist/plugins/captcha/index.d.mts +8 -5
- package/dist/plugins/captcha/types.d.mts +1 -0
- package/dist/plugins/custom-session/client.d.mts +1 -0
- package/dist/plugins/custom-session/index.d.mts +12 -7
- package/dist/plugins/device-authorization/client.d.mts +1 -0
- package/dist/plugins/device-authorization/index.d.mts +22 -19
- package/dist/plugins/email-otp/client.d.mts +6 -4
- package/dist/plugins/email-otp/client.mjs +1 -1
- package/dist/plugins/email-otp/error-codes.d.mts +5 -3
- package/dist/plugins/email-otp/index.d.mts +74 -67
- package/dist/plugins/email-otp/types.d.mts +1 -0
- package/dist/plugins/generic-oauth/client.d.mts +11 -10
- package/dist/plugins/generic-oauth/client.mjs +1 -1
- package/dist/plugins/generic-oauth/error-codes.d.mts +10 -8
- package/dist/plugins/generic-oauth/index.d.mts +44 -40
- package/dist/plugins/generic-oauth/providers/auth0.d.mts +1 -0
- package/dist/plugins/generic-oauth/providers/gumroad.d.mts +1 -0
- package/dist/plugins/generic-oauth/providers/hubspot.d.mts +1 -0
- package/dist/plugins/generic-oauth/providers/index.d.mts +1 -2
- package/dist/plugins/generic-oauth/providers/keycloak.d.mts +1 -0
- package/dist/plugins/generic-oauth/providers/line.d.mts +1 -0
- package/dist/plugins/generic-oauth/providers/microsoft-entra-id.d.mts +1 -0
- package/dist/plugins/generic-oauth/providers/okta.d.mts +1 -0
- package/dist/plugins/generic-oauth/providers/patreon.d.mts +1 -0
- package/dist/plugins/generic-oauth/providers/slack.d.mts +1 -0
- package/dist/plugins/generic-oauth/providers/yandex.d.mts +1 -0
- package/dist/plugins/generic-oauth/types.d.mts +2 -1
- package/dist/plugins/haveibeenpwned/index.d.mts +6 -3
- package/dist/plugins/index.d.mts +1 -4
- package/dist/plugins/jwt/client.d.mts +2 -1
- package/dist/plugins/jwt/index.d.mts +11 -8
- package/dist/plugins/jwt/sign.d.mts +2 -2
- package/dist/plugins/jwt/types.d.mts +1 -1
- package/dist/plugins/jwt/utils.d.mts +4 -2
- package/dist/plugins/jwt/verify.d.mts +1 -0
- package/dist/plugins/last-login-method/index.d.mts +5 -2
- package/dist/plugins/magic-link/client.d.mts +1 -0
- package/dist/plugins/magic-link/index.d.mts +6 -4
- package/dist/plugins/mcp/client/adapters.d.mts +1 -0
- package/dist/plugins/mcp/client/index.mjs +2 -4
- package/dist/plugins/mcp/index.d.mts +11 -10
- package/dist/plugins/multi-session/client.d.mts +4 -2
- package/dist/plugins/multi-session/client.mjs +1 -1
- package/dist/plugins/multi-session/error-codes.d.mts +3 -1
- package/dist/plugins/multi-session/index.d.mts +11 -7
- package/dist/plugins/oauth-popup/client.d.mts +12 -6
- package/dist/plugins/oauth-popup/client.mjs +3 -5
- package/dist/plugins/oauth-popup/error-codes.d.mts +6 -4
- package/dist/plugins/oauth-popup/index.d.mts +12 -8
- package/dist/plugins/oauth-popup/index.mjs +1 -1
- package/dist/plugins/oauth-popup/types.d.mts +2 -1
- package/dist/plugins/oauth-proxy/index.d.mts +9 -6
- package/dist/plugins/oauth-proxy/index.mjs +2 -2
- package/dist/plugins/oidc-provider/client.d.mts +2 -1
- package/dist/plugins/oidc-provider/index.d.mts +17 -15
- package/dist/plugins/oidc-provider/schema.d.mts +1 -0
- package/dist/plugins/oidc-provider/types.d.mts +1 -1
- package/dist/plugins/one-tap/client.d.mts +3 -1
- package/dist/plugins/one-tap/index.d.mts +3 -1
- package/dist/plugins/one-time-token/client.d.mts +2 -1
- package/dist/plugins/one-time-token/index.d.mts +6 -5
- package/dist/plugins/open-api/generator.d.mts +1 -0
- package/dist/plugins/open-api/generator.mjs +5 -5
- package/dist/plugins/open-api/index.d.mts +5 -3
- package/dist/plugins/organization/access/statement.d.mts +0 -1
- package/dist/plugins/organization/adapter.d.mts +82 -56
- package/dist/plugins/organization/client.d.mts +103 -104
- package/dist/plugins/organization/client.mjs +4 -7
- package/dist/plugins/organization/error-codes.d.mts +61 -59
- package/dist/plugins/organization/has-permission.d.mts +1 -0
- package/dist/plugins/organization/has-permission.mjs +1 -1
- package/dist/plugins/organization/index.d.mts +1 -1
- package/dist/plugins/organization/organization.d.mts +9 -9
- package/dist/plugins/organization/organization.mjs +1 -1
- package/dist/plugins/organization/permission.d.mts +2 -2
- package/dist/plugins/organization/routes/crud-access-control.d.mts +27 -27
- package/dist/plugins/organization/routes/crud-invites.d.mts +64 -63
- package/dist/plugins/organization/routes/crud-invites.mjs +1 -1
- package/dist/plugins/organization/routes/crud-members.d.mts +56 -54
- package/dist/plugins/organization/routes/crud-members.mjs +1 -1
- package/dist/plugins/organization/routes/crud-org.d.mts +54 -53
- package/dist/plugins/organization/routes/crud-team.d.mts +65 -64
- package/dist/plugins/organization/schema.d.mts +4 -4
- package/dist/plugins/organization/schema.mjs +1 -1
- package/dist/plugins/organization/types.d.mts +14 -14
- package/dist/plugins/phone-number/client.d.mts +15 -13
- package/dist/plugins/phone-number/client.mjs +1 -1
- package/dist/plugins/phone-number/error-codes.d.mts +14 -12
- package/dist/plugins/phone-number/index.d.mts +47 -41
- package/dist/plugins/phone-number/types.d.mts +1 -1
- package/dist/plugins/siwe/client.d.mts +1 -0
- package/dist/plugins/siwe/index.d.mts +5 -4
- package/dist/plugins/test-utils/index.d.mts +4 -2
- package/dist/plugins/test-utils/types.d.mts +0 -1
- package/dist/plugins/two-factor/backup-codes/index.d.mts +6 -4
- package/dist/plugins/two-factor/backup-codes/index.mjs +1 -1
- package/dist/plugins/two-factor/client.d.mts +15 -12
- package/dist/plugins/two-factor/client.mjs +1 -1
- package/dist/plugins/two-factor/error-code.d.mts +12 -10
- package/dist/plugins/two-factor/index.d.mts +31 -27
- package/dist/plugins/two-factor/otp/index.d.mts +4 -2
- package/dist/plugins/two-factor/totp/index.d.mts +6 -4
- package/dist/plugins/two-factor/types.d.mts +1 -1
- package/dist/plugins/username/client.d.mts +11 -9
- package/dist/plugins/username/client.mjs +1 -1
- package/dist/plugins/username/error-codes.d.mts +10 -8
- package/dist/plugins/username/index.d.mts +22 -17
- package/dist/plugins/username/schema.d.mts +5 -3
- package/dist/state.d.mts +1 -0
- package/dist/test-utils/test-instance.d.mts +3 -5
- package/dist/types/adapter.d.mts +1 -1
- package/dist/types/api.d.mts +2 -1
- package/dist/types/auth.d.mts +1 -0
- package/dist/types/helper.d.mts +5 -5
- package/dist/types/index.d.mts +2 -2
- package/dist/types/models.d.mts +1 -0
- package/dist/types/plugins.d.mts +3 -2
- package/dist/utils/index.d.mts +1 -2
- package/dist/utils/url.d.mts +1 -0
- package/package.json +10 -10
|
@@ -5,12 +5,13 @@ import { BetterAuthClientOptions } from "@better-auth/core";
|
|
|
5
5
|
import { BASE_ERROR_CODES } from "@better-auth/core/error";
|
|
6
6
|
import { Atom } from "nanostores";
|
|
7
7
|
import { BetterFetchError, BetterFetchResponse } from "@better-fetch/fetch";
|
|
8
|
+
|
|
8
9
|
//#region src/client/vanilla.d.ts
|
|
9
10
|
type InferResolvedHooks<O extends BetterAuthClientOptions> = O extends {
|
|
10
11
|
plugins: Array<infer Plugin>;
|
|
11
12
|
} ? UnionToIntersection<Plugin extends {
|
|
12
13
|
getAtoms?: infer GetAtoms;
|
|
13
|
-
} ? 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]
|
|
14
|
+
} ? 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] } : {} : {} : {}> : {};
|
|
14
15
|
type ClientConfig = ReturnType<typeof getClientConfig>;
|
|
15
16
|
type ClientSession<Option extends BetterAuthClientOptions> = InferClientAPI<Option> extends {
|
|
16
17
|
getSession: () => Promise<infer Res>;
|
|
@@ -5,14 +5,15 @@ import { BetterAuthClientOptions } from "@better-auth/core";
|
|
|
5
5
|
import { BASE_ERROR_CODES } from "@better-auth/core/error";
|
|
6
6
|
import { BetterFetchError, BetterFetchResponse } from "@better-fetch/fetch";
|
|
7
7
|
import { DeepReadonly, Ref } from "vue";
|
|
8
|
-
export
|
|
9
|
-
export
|
|
8
|
+
export * from "nanostores";
|
|
9
|
+
export * from "@better-fetch/fetch";
|
|
10
|
+
|
|
10
11
|
//#region src/client/vue/index.d.ts
|
|
11
12
|
type InferResolvedHooks<O extends BetterAuthClientOptions> = O extends {
|
|
12
13
|
plugins: Array<infer Plugin>;
|
|
13
14
|
} ? UnionToIntersection<Plugin extends {
|
|
14
15
|
getAtoms?: infer GetAtoms;
|
|
15
|
-
} ? 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]: () => DeepReadonly<Ref<ReturnType<Atoms[key]["get"]
|
|
16
|
+
} ? 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]: () => DeepReadonly<Ref<ReturnType<Atoms[key]["get"]>>> } : {} : {} : {}> : {};
|
|
16
17
|
type ClientConfig = ReturnType<typeof getClientConfig>;
|
|
17
18
|
type ClientSession<Option extends BetterAuthClientOptions> = InferClientAPI<Option> extends {
|
|
18
19
|
getSession: () => Promise<infer Res>;
|
|
@@ -51,4 +52,4 @@ type VueAuthClient<Option extends BetterAuthClientOptions> = UnionToIntersection
|
|
|
51
52
|
};
|
|
52
53
|
declare function createAuthClient<Option extends BetterAuthClientOptions>(options?: Option | undefined): VueAuthClient<Option>;
|
|
53
54
|
//#endregion
|
|
54
|
-
export {
|
|
55
|
+
export { ExtractPluginField, HasRequiredKeys, InferPluginFieldFromTuple, IsAny, OverrideMerge, Prettify, PrettifyDeep, RequiredKeysOf, StripEmptyObjects, type UnionToIntersection, VueAuthClient, createAuthClient };
|
|
@@ -18,7 +18,7 @@ import { generateId } from "@better-auth/core/utils/id";
|
|
|
18
18
|
import { socialProviders } from "@better-auth/core/social-providers";
|
|
19
19
|
import { findInvalidTrustedProxies } from "@better-auth/core/utils/ip";
|
|
20
20
|
import { createTelemetry } from "@better-auth/telemetry";
|
|
21
|
-
import defu from "defu";
|
|
21
|
+
import defu$1 from "defu";
|
|
22
22
|
//#region src/context/create-context.ts
|
|
23
23
|
/**
|
|
24
24
|
* Estimates the entropy of a string in bits.
|
|
@@ -45,13 +45,13 @@ function validateSecret(secret, logger) {
|
|
|
45
45
|
}
|
|
46
46
|
async function createAuthContext(adapter, options, getDatabaseType) {
|
|
47
47
|
const isStateful = hasServerSessionStore(options);
|
|
48
|
-
if (!isStateful) options = defu(options, { session: { cookieCache: {
|
|
48
|
+
if (!isStateful) options = defu$1(options, { session: { cookieCache: {
|
|
49
49
|
enabled: true,
|
|
50
50
|
strategy: "jwe",
|
|
51
51
|
refreshCache: true,
|
|
52
52
|
maxAge: options.session?.expiresIn || 3600 * 24 * 7
|
|
53
53
|
} } });
|
|
54
|
-
if (!options.database) options = defu(options, { account: { storeAccountCookie: true } });
|
|
54
|
+
if (!options.database) options = defu$1(options, { account: { storeAccountCookie: true } });
|
|
55
55
|
const plugins = options.plugins || [];
|
|
56
56
|
const internalPlugins = getInternalPlugins(options);
|
|
57
57
|
const logger = createLogger(options.logger);
|
package/dist/context/helpers.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import { createCookieGetter, getCookies } from "../cookies/index.mjs";
|
|
|
4
4
|
import { createInternalAdapter } from "../db/internal-adapter.mjs";
|
|
5
5
|
import { env } from "@better-auth/core/env";
|
|
6
6
|
import { BetterAuthError } from "@better-auth/core/error";
|
|
7
|
-
import { defu
|
|
7
|
+
import { defu } from "defu";
|
|
8
8
|
import { isLoopbackHost } from "@better-auth/core/utils/host";
|
|
9
9
|
//#region src/context/helpers.ts
|
|
10
10
|
async function runPluginInit(context) {
|
|
@@ -25,7 +25,7 @@ async function runPluginInit(context) {
|
|
|
25
25
|
hooks: databaseHooks
|
|
26
26
|
});
|
|
27
27
|
if (trustedOrigins) pluginTrustedOrigins.push(trustedOrigins);
|
|
28
|
-
options = defu
|
|
28
|
+
options = defu(options, restOpts);
|
|
29
29
|
}
|
|
30
30
|
if (result.context) Object.assign(context, result.context);
|
|
31
31
|
}
|
package/dist/cookies/index.d.mts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { Session, User } from "../types/models.mjs";
|
|
2
|
-
import "../types/index.mjs";
|
|
3
2
|
import { CookieAttributes, HOST_COOKIE_PREFIX, SECURE_COOKIE_PREFIX, applySetCookies, cookieNameRegex, parseCookies, parseSetCookieHeader, setCookieToHeader, setRequestCookie, splitSetCookieHeader, stripSecureCookiePrefix, toCookieOptions } from "./cookie-utils.mjs";
|
|
4
3
|
import { createSessionStore, getAccountCookie, getChunkedCookie } from "./session-store.mjs";
|
|
5
4
|
import { BetterAuthCookie, BetterAuthCookies, BetterAuthOptions, GenericEndpointContext } from "@better-auth/core";
|
|
5
|
+
import * as _$better_call0 from "better-call";
|
|
6
6
|
import { CookieOptions } from "better-call";
|
|
7
|
+
|
|
7
8
|
//#region src/cookies/index.d.ts
|
|
8
9
|
declare function createCookieGetter(options: BetterAuthOptions): (cookieName: string, overrideAttributes?: Partial<CookieOptions>) => {
|
|
9
10
|
name: string;
|
|
@@ -16,7 +17,7 @@ declare function createCookieGetter(options: BetterAuthOptions): (cookieName: st
|
|
|
16
17
|
secure: boolean;
|
|
17
18
|
sameSite: "Strict" | "Lax" | "None" | "strict" | "lax" | "none";
|
|
18
19
|
partitioned?: boolean;
|
|
19
|
-
prefix?:
|
|
20
|
+
prefix?: _$better_call0.CookiePrefixOptions;
|
|
20
21
|
};
|
|
21
22
|
};
|
|
22
23
|
declare function getCookies(options: BetterAuthOptions): {
|
|
@@ -31,7 +32,7 @@ declare function getCookies(options: BetterAuthOptions): {
|
|
|
31
32
|
secure: boolean;
|
|
32
33
|
sameSite: "Strict" | "Lax" | "None" | "strict" | "lax" | "none";
|
|
33
34
|
partitioned?: boolean;
|
|
34
|
-
prefix?:
|
|
35
|
+
prefix?: _$better_call0.CookiePrefixOptions;
|
|
35
36
|
};
|
|
36
37
|
};
|
|
37
38
|
/**
|
|
@@ -49,7 +50,7 @@ declare function getCookies(options: BetterAuthOptions): {
|
|
|
49
50
|
secure: boolean;
|
|
50
51
|
sameSite: "Strict" | "Lax" | "None" | "strict" | "lax" | "none";
|
|
51
52
|
partitioned?: boolean;
|
|
52
|
-
prefix?:
|
|
53
|
+
prefix?: _$better_call0.CookiePrefixOptions;
|
|
53
54
|
};
|
|
54
55
|
};
|
|
55
56
|
dontRememberToken: {
|
|
@@ -63,7 +64,7 @@ declare function getCookies(options: BetterAuthOptions): {
|
|
|
63
64
|
secure: boolean;
|
|
64
65
|
sameSite: "Strict" | "Lax" | "None" | "strict" | "lax" | "none";
|
|
65
66
|
partitioned?: boolean;
|
|
66
|
-
prefix?:
|
|
67
|
+
prefix?: _$better_call0.CookiePrefixOptions;
|
|
67
68
|
};
|
|
68
69
|
};
|
|
69
70
|
accountData: {
|
|
@@ -77,7 +78,7 @@ declare function getCookies(options: BetterAuthOptions): {
|
|
|
77
78
|
secure: boolean;
|
|
78
79
|
sameSite: "Strict" | "Lax" | "None" | "strict" | "lax" | "none";
|
|
79
80
|
partitioned?: boolean;
|
|
80
|
-
prefix?:
|
|
81
|
+
prefix?: _$better_call0.CookiePrefixOptions;
|
|
81
82
|
};
|
|
82
83
|
};
|
|
83
84
|
};
|
|
@@ -24,8 +24,7 @@ const MAX_COOKIE_CHUNKS = 100;
|
|
|
24
24
|
* wire. Non-positive when the name and attributes alone overflow.
|
|
25
25
|
*/
|
|
26
26
|
function getMaxCookieValueSize(name, options) {
|
|
27
|
-
|
|
28
|
-
return MAX_COOKIE_SIZE - overhead;
|
|
27
|
+
return MAX_COOKIE_SIZE - serializeCookie(name, "", { ...options }).length;
|
|
29
28
|
}
|
|
30
29
|
/**
|
|
31
30
|
* Read all existing chunks from cookies
|
package/dist/crypto/index.d.mts
CHANGED
|
@@ -3,6 +3,7 @@ import { signJWT, symmetricDecodeJWT, symmetricEncodeJWT, verifyJWT } from "./jw
|
|
|
3
3
|
import { hashPassword, verifyPassword } from "./password.mjs";
|
|
4
4
|
import { generateRandomString } from "./random.mjs";
|
|
5
5
|
import { SecretConfig } from "@better-auth/core";
|
|
6
|
+
|
|
6
7
|
//#region src/crypto/index.d.ts
|
|
7
8
|
declare function parseEnvelope(data: string): {
|
|
8
9
|
version: number;
|
|
@@ -13,12 +14,18 @@ type SymmetricEncryptOptions = {
|
|
|
13
14
|
key: string | SecretConfig;
|
|
14
15
|
data: string;
|
|
15
16
|
};
|
|
16
|
-
declare const symmetricEncrypt: ({
|
|
17
|
+
declare const symmetricEncrypt: ({
|
|
18
|
+
key,
|
|
19
|
+
data
|
|
20
|
+
}: SymmetricEncryptOptions) => Promise<string>;
|
|
17
21
|
type SymmetricDecryptOptions = {
|
|
18
22
|
key: string | SecretConfig;
|
|
19
23
|
data: string;
|
|
20
24
|
};
|
|
21
|
-
declare const symmetricDecrypt: ({
|
|
25
|
+
declare const symmetricDecrypt: ({
|
|
26
|
+
key,
|
|
27
|
+
data
|
|
28
|
+
}: SymmetricDecryptOptions) => Promise<string>;
|
|
22
29
|
declare const getCryptoKey: (secret: string | BufferSource) => Promise<CryptoKey>;
|
|
23
30
|
declare const makeSignature: (value: string, secret: string | BufferSource) => Promise<string>;
|
|
24
31
|
//#endregion
|
package/dist/crypto/jwt.d.mts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { hashPassword } from "@better-auth/utils/password";
|
|
2
|
+
|
|
2
3
|
//#region src/crypto/password.d.ts
|
|
3
4
|
declare const hashPassword$1: typeof hashPassword;
|
|
4
|
-
declare const verifyPassword$1: ({
|
|
5
|
+
declare const verifyPassword$1: ({
|
|
6
|
+
hash,
|
|
7
|
+
password
|
|
8
|
+
}: {
|
|
5
9
|
hash: string;
|
|
6
10
|
password: string;
|
|
7
11
|
}) => Promise<boolean>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { BetterAuthOptions } from "@better-auth/core";
|
|
2
2
|
import { DBAdapter } from "@better-auth/core/db/adapter";
|
|
3
|
+
|
|
3
4
|
//#region src/db/adapter-base.d.ts
|
|
4
5
|
declare function getBaseAdapter(options: BetterAuthOptions, handleDirectDatabase: (options: BetterAuthOptions) => Promise<DBAdapter<BetterAuthOptions>>): Promise<DBAdapter<BetterAuthOptions>>;
|
|
5
6
|
//#endregion
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { DBFieldAttribute } from "@better-auth/core/db";
|
|
2
|
+
|
|
2
3
|
//#region src/db/field-converter.d.ts
|
|
3
4
|
declare function convertToDB<T extends Record<string, any>>(fields: Record<string, DBFieldAttribute>, values: T): T;
|
|
4
5
|
declare function convertFromDB<T extends Record<string, any>>(fields: Record<string, DBFieldAttribute>, values: T | null): T | null;
|
package/dist/db/field.d.mts
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
import { DBFieldAttribute, InferDBValueType } from "@better-auth/core/db";
|
|
2
|
+
|
|
2
3
|
//#region src/db/field.d.ts
|
|
3
|
-
type InferFieldsOutput<Fields extends Record<string, DBFieldAttribute>> = Fields extends Record<infer Key, DBFieldAttribute> ? { [key in Key as Fields[key]["returned"] extends false ? never : Fields[key]["required"] extends false ? Fields[key]["defaultValue"] extends boolean | string | number | Date ? key : never : key]: InferFieldOutput<Fields[key]
|
|
4
|
+
type InferFieldsOutput<Fields extends Record<string, DBFieldAttribute>> = Fields extends Record<infer Key, DBFieldAttribute> ? { [key in Key as Fields[key]["returned"] extends false ? never : Fields[key]["required"] extends false ? Fields[key]["defaultValue"] extends boolean | string | number | Date ? key : never : key]: InferFieldOutput<Fields[key]> } & { [key in Key as Fields[key]["returned"] extends false ? never : Fields[key]["required"] extends false ? Fields[key]["defaultValue"] extends boolean | string | number | Date ? never : key : never]?: InferFieldOutput<Fields[key]> | null } : never;
|
|
4
5
|
/**
|
|
5
6
|
* For client will add "?" on optional fields
|
|
6
7
|
*/
|
|
7
|
-
type InferFieldsInputClient<Fields extends Record<string, DBFieldAttribute>> = Fields extends Record<infer Key, DBFieldAttribute> ? { [key in Key as Fields[key]["required"] extends false ? never : Fields[key]["defaultValue"] extends string | number | boolean | Date ? never : Fields[key]["input"] extends false ? never : key]: InferFieldInput<Fields[key]
|
|
8
|
+
type InferFieldsInputClient<Fields extends Record<string, DBFieldAttribute>> = Fields extends Record<infer Key, DBFieldAttribute> ? { [key in Key as Fields[key]["required"] extends false ? never : Fields[key]["defaultValue"] extends string | number | boolean | Date ? never : Fields[key]["input"] extends false ? never : key]: InferFieldInput<Fields[key]> } & { [key in Key as Fields[key]["input"] extends false ? never : Fields[key]["required"] extends false ? key : Fields[key]["defaultValue"] extends string | number | boolean | Date ? key : never]?: InferFieldInput<Fields[key]> | undefined | null } : never;
|
|
8
9
|
type InferFieldOutput<T extends DBFieldAttribute> = T["returned"] extends false ? never : T["required"] extends false ? InferDBValueType<T["type"]> | undefined | null : InferDBValueType<T["type"]>;
|
|
9
10
|
/**
|
|
10
11
|
* Converts a Record<string, DBFieldAttribute> to an object type
|
|
11
12
|
* with keys and value types inferred from DBFieldAttribute["type"].
|
|
12
13
|
*/
|
|
13
|
-
type FieldAttributeToObject<Fields extends Record<string, DBFieldAttribute>> = AddOptionalFields<{ [K in keyof Fields]: InferDBValueType<Fields[K]["type"]
|
|
14
|
+
type FieldAttributeToObject<Fields extends Record<string, DBFieldAttribute>> = AddOptionalFields<{ [K in keyof Fields]: InferDBValueType<Fields[K]["type"]> }, Fields>;
|
|
14
15
|
type AddOptionalFields<T extends Record<string, any>, Fields extends Record<keyof T, DBFieldAttribute>> = { [K in keyof T as Fields[K] extends {
|
|
15
16
|
required: false;
|
|
16
|
-
} ? never : K]: T[K]
|
|
17
|
+
} ? never : K]: T[K] } & { [K in keyof T as Fields[K] extends {
|
|
17
18
|
required: false;
|
|
18
|
-
} ? K : never]?: T[K]
|
|
19
|
+
} ? K : never]?: T[K] };
|
|
19
20
|
/**
|
|
20
21
|
* Infer the additional fields from the plugin options.
|
|
21
22
|
* For example, you can infer the additional fields of the org plugin's organization schema like this:
|
|
@@ -29,12 +30,12 @@ type AddOptionalFields<T extends Record<string, any>, Fields extends Record<keyo
|
|
|
29
30
|
type InferAdditionalFieldsFromPluginOptions<SchemaName extends string, Options extends {
|
|
30
31
|
schema?: { [key in SchemaName]?: {
|
|
31
32
|
additionalFields?: Record<string, DBFieldAttribute>;
|
|
32
|
-
}
|
|
33
|
+
} } | undefined;
|
|
33
34
|
}, isClientSide extends boolean = true> = Options["schema"] extends { [key in SchemaName]?: {
|
|
34
35
|
additionalFields: infer Field extends Record<string, DBFieldAttribute>;
|
|
35
|
-
}
|
|
36
|
-
type RemoveFieldsWithInputFalse<T extends Record<string, DBFieldAttribute>> = { [K in keyof T as T[K]["input"] extends false ? never : K]: T[K]
|
|
37
|
-
type RemoveFieldsWithReturnedFalse<T extends Record<string, DBFieldAttribute>> = { [K in keyof T as T[K]["returned"] extends false ? never : K]: T[K]
|
|
36
|
+
} } ? isClientSide extends true ? FieldAttributeToObject<RemoveFieldsWithInputFalse<Field>> : FieldAttributeToObject<Field> : {};
|
|
37
|
+
type RemoveFieldsWithInputFalse<T extends Record<string, DBFieldAttribute>> = { [K in keyof T as T[K]["input"] extends false ? never : K]: T[K] };
|
|
38
|
+
type RemoveFieldsWithReturnedFalse<T extends Record<string, DBFieldAttribute>> = { [K in keyof T as T[K]["returned"] extends false ? never : K]: T[K] };
|
|
38
39
|
type InferFieldInput<T extends DBFieldAttribute> = InferDBValueType<T["type"]>;
|
|
39
40
|
//#endregion
|
|
40
41
|
export { FieldAttributeToObject, InferAdditionalFieldsFromPluginOptions, InferFieldsInputClient, InferFieldsOutput, RemoveFieldsWithReturnedFalse };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { BetterAuthOptions } from "@better-auth/core";
|
|
2
2
|
import { DBFieldAttribute, DBFieldType } from "@better-auth/core/db";
|
|
3
3
|
import { KyselyDatabaseType } from "@better-auth/kysely-adapter";
|
|
4
|
+
|
|
4
5
|
//#region src/db/get-migration.d.ts
|
|
5
6
|
declare function matchType(columnDataType: string, fieldType: DBFieldType, dbType: KyselyDatabaseType): boolean;
|
|
6
7
|
declare function getMigrations(config: BetterAuthOptions): Promise<{
|
package/dist/db/get-schema.d.mts
CHANGED
|
@@ -2,6 +2,7 @@ import { DatabaseHooksEntry } from "./with-hooks.mjs";
|
|
|
2
2
|
import { AuthContext, BetterAuthOptions, InternalAdapter } from "@better-auth/core";
|
|
3
3
|
import { InternalLogger } from "@better-auth/core/env";
|
|
4
4
|
import { DBAdapter } from "@better-auth/core/db/adapter";
|
|
5
|
+
|
|
5
6
|
//#region src/db/internal-adapter.d.ts
|
|
6
7
|
declare const createInternalAdapter: (adapter: DBAdapter<BetterAuthOptions>, ctx: {
|
|
7
8
|
options: Omit<BetterAuthOptions, "logger">;
|
|
@@ -698,8 +698,7 @@ const createInternalAdapter = (adapter, ctx) => {
|
|
|
698
698
|
logger.warn("Secondary storage does not implement `getAndDelete`, so single-use verification values cannot be consumed atomically across processes. Implement `getAndDelete` or use database-backed verification storage to guarantee single use.");
|
|
699
699
|
}
|
|
700
700
|
return withVerificationConsumeLock(key, async () => {
|
|
701
|
-
const
|
|
702
|
-
const parsed = hydrateCachedVerification(raw);
|
|
701
|
+
const parsed = hydrateCachedVerification(await secondaryStorage.get(key));
|
|
703
702
|
if (!parsed) return null;
|
|
704
703
|
await secondaryStorage.delete(key);
|
|
705
704
|
return parsed;
|
package/dist/db/schema.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Account, Session as Session$1, User as User$1 } from "../types/models.mjs";
|
|
2
|
-
import "../types/index.mjs";
|
|
3
2
|
import { BetterAuthOptions } from "@better-auth/core";
|
|
4
3
|
import { BetterAuthPluginDBSchema, DBFieldAttribute } from "@better-auth/core/db";
|
|
4
|
+
|
|
5
5
|
//#region src/db/schema.d.ts
|
|
6
6
|
declare function parseUserOutput<T extends User$1>(options: BetterAuthOptions, user: T): T;
|
|
7
7
|
/**
|
|
@@ -57,6 +57,6 @@ declare function mergeSchema<S extends BetterAuthPluginDBSchema>(schema: S, newS
|
|
|
57
57
|
fields?: {
|
|
58
58
|
[P: string]: string;
|
|
59
59
|
} | undefined;
|
|
60
|
-
} | undefined
|
|
60
|
+
} | undefined } | undefined): S;
|
|
61
61
|
//#endregion
|
|
62
62
|
export { buildSyntheticUserOutput, getSessionDefaultFields, mergeSchema, parseAccountInput, parseAccountOutput, parseAdditionalUserInput, parseAdditionalUserInputFromProviderProfile, parseInputData, parseSessionInput, parseSessionOutput, parseUserInput, parseUserOutput };
|
package/dist/db/to-zod.d.mts
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import { DBFieldAttribute } from "@better-auth/core/db";
|
|
2
2
|
import * as z from "zod";
|
|
3
|
+
|
|
3
4
|
//#region src/db/to-zod.d.ts
|
|
4
|
-
declare function toZodSchema<Fields extends Record<string, DBFieldAttribute | never>, IsClientSide extends boolean>({
|
|
5
|
+
declare function toZodSchema<Fields extends Record<string, DBFieldAttribute | never>, IsClientSide extends boolean>({
|
|
6
|
+
fields,
|
|
7
|
+
isClientSide
|
|
8
|
+
}: {
|
|
5
9
|
fields: Fields;
|
|
6
10
|
/**
|
|
7
11
|
* If true, then any fields that have `input: false` will be removed from the schema to prevent user input.
|
|
8
12
|
*/
|
|
9
13
|
isClientSide: IsClientSide;
|
|
10
|
-
}): z.ZodObject<RemoveNeverProps<{ [key in keyof Fields]: FieldAttributeToSchema<Fields[key], IsClientSide
|
|
14
|
+
}): z.ZodObject<RemoveNeverProps<{ [key in keyof Fields]: FieldAttributeToSchema<Fields[key], IsClientSide> }>, z.core.$strip>;
|
|
11
15
|
type FieldAttributeToSchema<Field extends DBFieldAttribute | Record<string, never>, isClientSide extends boolean = false> = Field extends {
|
|
12
16
|
type: any;
|
|
13
17
|
} ? GetInput<isClientSide, Field, GetRequired<Field, GetType<Field>>> : Record<string, never>;
|
|
@@ -26,6 +30,6 @@ type GetRequired<F extends DBFieldAttribute, Schema extends z.core.SomeType> = F
|
|
|
26
30
|
type GetInput<isClientSide extends boolean, Field extends DBFieldAttribute, Schema extends z.core.SomeType> = Field extends {
|
|
27
31
|
input: false;
|
|
28
32
|
} ? isClientSide extends true ? never : Schema : Schema;
|
|
29
|
-
type RemoveNeverProps<T> = { [K in keyof T as [T[K]] extends [never] ? never : K]: T[K]
|
|
33
|
+
type RemoveNeverProps<T> = { [K in keyof T as [T[K]] extends [never] ? never : K]: T[K] };
|
|
30
34
|
//#endregion
|
|
31
35
|
export { FieldAttributeToSchema, toZodSchema };
|
package/dist/db/with-hooks.d.mts
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -11,7 +11,6 @@ import { generateState, parseState } from "./oauth2/state.mjs";
|
|
|
11
11
|
import { StateData, generateGenericState, parseGenericState } from "./state.mjs";
|
|
12
12
|
import { HIDE_METADATA } from "./utils/hide-metadata.mjs";
|
|
13
13
|
import { getBaseURL, getHost, getHostFromSource, getOrigin, getProtocol, getProtocolFromSource, isDynamicBaseURLConfig, isRequestLike, matchesHostPattern, resolveBaseURL, resolveDynamicBaseURL, trimTrailingSlashes } from "./utils/url.mjs";
|
|
14
|
-
import "./utils/index.mjs";
|
|
15
14
|
import { APIError } from "./api/index.mjs";
|
|
16
15
|
import { StandardSchemaV1 } from "@better-auth/core";
|
|
17
16
|
import { getCurrentAdapter } from "@better-auth/core/context";
|
|
@@ -26,6 +25,6 @@ export * from "@better-auth/core/utils/error-codes";
|
|
|
26
25
|
export * from "@better-auth/core/utils/id";
|
|
27
26
|
export * from "@better-auth/core/utils/json";
|
|
28
27
|
export * from "@better-auth/core/social-providers";
|
|
29
|
-
export
|
|
30
|
-
export
|
|
31
|
-
export { APIError,
|
|
28
|
+
export * from "better-call";
|
|
29
|
+
export * from "zod";
|
|
30
|
+
export { APIError, Account, AdditionalSessionFieldsInput, AdditionalUserFieldsInput, Auth, BetterAuthAdvancedOptions, BetterAuthClientOptions, BetterAuthClientPlugin, BetterAuthCookies, BetterAuthOptions, BetterAuthPlugin, BetterAuthRateLimitOptions, ClientAtomListener, ClientStore, DBAdapter, DBAdapterInstance, DBAdapterSchemaCreation, DBTransactionAdapter, ExtractPluginField, FilteredAPI, HIDE_METADATA, HasRequiredKeys, InferAPI, InferActions, InferAdditionalFromClient, InferClientAPI, InferErrorCodes, InferOptionSchema, InferPluginContext, InferPluginErrorCodes, InferPluginFieldFromTuple, InferPluginIDs, InferPluginTypes, InferSessionAPI, InferSessionFromClient, InferUserFromClient, IsAny, IsSignal, type JSONWebKeySet, type JWTPayload, JoinConfig, JoinOption, OverrideMerge, Prettify, PrettifyDeep, RateLimit, RequiredKeysOf, Session, SessionQueryParams, type StandardSchemaV1, StateData, StoreIdentifierOption, StripEmptyObjects, type TelemetryEvent, UnionToIntersection, User, Verification, Where, betterAuth, createTelemetry, generateGenericState, generateState, getBaseURL, getCurrentAdapter, getHost, getHostFromSource, getOrigin, getProtocol, getProtocolFromSource, getTelemetryAuthConfig, isDynamicBaseURLConfig, isRequestLike, matchesHostPattern, parseGenericState, parseState, resolveBaseURL, resolveDynamicBaseURL, trimTrailingSlashes };
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import * as _$_better_auth_core0 from "@better-auth/core";
|
|
2
|
+
import * as _$better_call0 from "better-call";
|
|
3
|
+
|
|
1
4
|
//#region src/integrations/next-js.d.ts
|
|
2
5
|
declare function toNextJsHandler(auth: {
|
|
3
6
|
handler: (request: Request) => Promise<Response>;
|
|
@@ -13,12 +16,12 @@ declare const nextCookies: () => {
|
|
|
13
16
|
version: string;
|
|
14
17
|
hooks: {
|
|
15
18
|
before: {
|
|
16
|
-
matcher(ctx:
|
|
17
|
-
handler:
|
|
19
|
+
matcher(ctx: _$_better_auth_core0.HookEndpointContext): boolean;
|
|
20
|
+
handler: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<void>>;
|
|
18
21
|
}[];
|
|
19
22
|
after: {
|
|
20
|
-
matcher(ctx:
|
|
21
|
-
handler:
|
|
23
|
+
matcher(ctx: _$_better_auth_core0.HookEndpointContext): true;
|
|
24
|
+
handler: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<void>>;
|
|
22
25
|
}[];
|
|
23
26
|
};
|
|
24
27
|
};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { Auth } from "../types/auth.mjs";
|
|
2
|
-
import "
|
|
2
|
+
import * as _$node_http0 from "node:http";
|
|
3
3
|
import { IncomingHttpHeaders } from "node:http";
|
|
4
|
+
|
|
4
5
|
//#region src/integrations/node.d.ts
|
|
5
6
|
declare const toNodeHandler: (auth: {
|
|
6
7
|
handler: Auth["handler"];
|
|
7
|
-
} | Auth["handler"]) => (req:
|
|
8
|
+
} | Auth["handler"]) => (req: _$node_http0.IncomingMessage, res: _$node_http0.ServerResponse) => Promise<void>;
|
|
8
9
|
declare function fromNodeHeaders(nodeHeaders: IncomingHttpHeaders): Headers;
|
|
9
10
|
//#endregion
|
|
10
11
|
export { fromNodeHeaders, toNodeHandler };
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { BetterAuthOptions } from "../types/index.mjs";
|
|
2
|
+
import * as _$better_call0 from "better-call";
|
|
2
3
|
import { RequestEvent } from "@sveltejs/kit";
|
|
4
|
+
|
|
3
5
|
//#region src/integrations/svelte-kit.d.ts
|
|
4
6
|
declare const toSvelteKitHandler: (auth: {
|
|
5
7
|
handler: (request: Request) => Response | Promise<Response>;
|
|
@@ -7,7 +9,12 @@ declare const toSvelteKitHandler: (auth: {
|
|
|
7
9
|
}) => (event: {
|
|
8
10
|
request: Request;
|
|
9
11
|
}) => Response | Promise<Response>;
|
|
10
|
-
declare const svelteKitHandler: ({
|
|
12
|
+
declare const svelteKitHandler: ({
|
|
13
|
+
auth,
|
|
14
|
+
event,
|
|
15
|
+
resolve,
|
|
16
|
+
building
|
|
17
|
+
}: {
|
|
11
18
|
auth: {
|
|
12
19
|
handler: (request: Request) => Response | Promise<Response>;
|
|
13
20
|
options: BetterAuthOptions;
|
|
@@ -23,7 +30,7 @@ declare const sveltekitCookies: (getRequestEvent: () => RequestEvent<any, any>)
|
|
|
23
30
|
hooks: {
|
|
24
31
|
after: {
|
|
25
32
|
matcher(): true;
|
|
26
|
-
handler:
|
|
33
|
+
handler: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<void>>;
|
|
27
34
|
}[];
|
|
28
35
|
};
|
|
29
36
|
};
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import * as _$_better_auth_core0 from "@better-auth/core";
|
|
2
|
+
import * as _$better_call0 from "better-call";
|
|
3
|
+
|
|
1
4
|
//#region src/integrations/tanstack-start-solid.d.ts
|
|
2
5
|
/**
|
|
3
6
|
* TanStack Start cookie plugin for Solid.js.
|
|
@@ -21,8 +24,8 @@ declare const tanstackStartCookies: () => {
|
|
|
21
24
|
version: string;
|
|
22
25
|
hooks: {
|
|
23
26
|
after: {
|
|
24
|
-
matcher(ctx:
|
|
25
|
-
handler:
|
|
27
|
+
matcher(ctx: _$_better_auth_core0.HookEndpointContext): true;
|
|
28
|
+
handler: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<void>>;
|
|
26
29
|
}[];
|
|
27
30
|
};
|
|
28
31
|
};
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import * as _$_better_auth_core0 from "@better-auth/core";
|
|
2
|
+
import * as _$better_call0 from "better-call";
|
|
3
|
+
|
|
1
4
|
//#region src/integrations/tanstack-start.d.ts
|
|
2
5
|
/**
|
|
3
6
|
* TanStack Start cookie plugin for React.
|
|
@@ -21,8 +24,8 @@ declare const tanstackStartCookies: () => {
|
|
|
21
24
|
version: string;
|
|
22
25
|
hooks: {
|
|
23
26
|
after: {
|
|
24
|
-
matcher(ctx:
|
|
25
|
-
handler:
|
|
27
|
+
matcher(ctx: _$_better_auth_core0.HookEndpointContext): true;
|
|
28
|
+
handler: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<void>>;
|
|
26
29
|
}[];
|
|
27
30
|
};
|
|
28
31
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Account, User } from "../types/models.mjs";
|
|
2
|
-
import "../types/index.mjs";
|
|
3
2
|
import { GenericEndpointContext } from "@better-auth/core";
|
|
3
|
+
|
|
4
4
|
//#region src/oauth2/link-account.d.ts
|
|
5
5
|
declare function handleOAuthUserInfo(c: GenericEndpointContext, opts: {
|
|
6
6
|
userInfo: Omit<User, "createdAt" | "updatedAt">;
|
package/dist/oauth2/state.d.mts
CHANGED
package/dist/oauth2/utils.d.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AuthContext } from "@better-auth/core";
|
|
2
|
+
|
|
2
3
|
//#region src/oauth2/utils.d.ts
|
|
3
4
|
declare function decryptOAuthToken(token: string, ctx: AuthContext): string | Promise<string>;
|
|
4
5
|
declare function setTokenUtil(token: string | null | undefined, ctx: AuthContext): string | Promise<string> | null | undefined;
|
package/dist/package.mjs
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
import { AuthorizeResponse, createAccessControl } from "./access.mjs";
|
|
2
2
|
import { LiteralString } from "@better-auth/core";
|
|
3
|
+
|
|
3
4
|
//#region src/plugins/access/types.d.ts
|
|
4
5
|
type ArrayElement<T> = T extends readonly (infer E)[] ? E : never;
|
|
5
6
|
type SubArray<T extends unknown[] | readonly unknown[] | any[]> = T[number][] | ReadonlyArray<T[number]>;
|
|
6
|
-
type Subset<K extends keyof R, R extends Record<string | LiteralString, readonly string[] | readonly LiteralString[]>> = { [P in K]: SubArray<R[P]
|
|
7
|
+
type Subset<K extends keyof R, R extends Record<string | LiteralString, readonly string[] | readonly LiteralString[]>> = { [P in K]: SubArray<R[P]> };
|
|
7
8
|
type Statements = {
|
|
8
9
|
readonly [resource: string]: readonly LiteralString[];
|
|
9
10
|
};
|
|
10
|
-
type RoleStatements<TStatements extends Statements> = { readonly [P in keyof TStatements]?: SubArray<TStatements[P]
|
|
11
|
+
type RoleStatements<TStatements extends Statements> = { readonly [P in keyof TStatements]?: SubArray<TStatements[P]> };
|
|
11
12
|
type RoleInput<TStatements extends Statements, TRoleStatements extends Statements> = TRoleStatements & (string extends keyof TRoleStatements ? {} : RoleStatements<TStatements> & Record<Exclude<keyof TRoleStatements, keyof TStatements>, never>);
|
|
12
|
-
type ExactRoleStatements<TStatements extends Statements> = { readonly [P in keyof TStatements]: readonly [...TStatements[P]]
|
|
13
|
+
type ExactRoleStatements<TStatements extends Statements> = { readonly [P in keyof TStatements]: readonly [...TStatements[P]] };
|
|
13
14
|
type AccessControl<TStatements extends Statements = Statements> = ReturnType<typeof createAccessControl<TStatements>>;
|
|
14
15
|
type RoleAuthorizeRequest<TStatements extends Statements> = { [P in keyof TStatements]?: SubArray<TStatements[P]> | {
|
|
15
16
|
actions: SubArray<TStatements[P]>;
|
|
16
17
|
connector: "OR" | "AND";
|
|
17
|
-
}
|
|
18
|
+
} };
|
|
18
19
|
type Role<TRoleStatements extends Statements = Record<string, any>, TAuthorizeStatements extends Statements = TRoleStatements> = {
|
|
19
20
|
authorize: (request: RoleAuthorizeRequest<TAuthorizeStatements>, connector?: ("OR" | "AND") | undefined) => AuthorizeResponse;
|
|
20
21
|
statements: TRoleStatements;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ExactRoleStatements, Role, RoleInput, Statements } from "../../access/types.mjs";
|
|
2
|
-
import "../../index.mjs";
|
|
3
2
|
//#region src/plugins/admin/access/statement.d.ts
|
|
4
3
|
declare const defaultStatements: {
|
|
5
4
|
readonly user: readonly ["create", "list", "set-role", "ban", "impersonate", "impersonate-admins", "delete", "set-password", "set-email", "get", "update"];
|