better-auth 1.8.0-beta.2 → 1.8.0-beta.3
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 +5 -10
- package/dist/api/dispatch.d.mts +3 -5
- package/dist/api/dispatch.mjs +6 -4
- package/dist/api/index.d.mts +506 -508
- package/dist/api/index.mjs +35 -34
- package/dist/api/middlewares/authorization.d.mts +15 -12
- package/dist/api/middlewares/authorization.mjs +2 -1
- package/dist/api/middlewares/index.d.mts +2 -1
- package/dist/api/middlewares/origin-check.d.mts +4 -7
- package/dist/api/routes/account.d.mts +11 -15
- package/dist/api/routes/account.mjs +7 -4
- package/dist/api/routes/callback.d.mts +2 -5
- package/dist/api/routes/callback.mjs +4 -2
- package/dist/api/routes/email-verification.d.mts +7 -12
- package/dist/api/routes/error.d.mts +2 -5
- package/dist/api/routes/index.d.mts +2 -1
- package/dist/api/routes/ok.d.mts +2 -5
- package/dist/api/routes/password.d.mts +8 -11
- package/dist/api/routes/password.mjs +3 -2
- package/dist/api/routes/session.d.mts +26 -29
- package/dist/api/routes/sign-in.d.mts +4 -6
- package/dist/api/routes/sign-out.d.mts +2 -5
- package/dist/api/routes/sign-up.d.mts +4 -6
- package/dist/api/routes/update-session.d.mts +4 -6
- package/dist/api/routes/update-user.d.mts +14 -16
- package/dist/api/routes/update-user.mjs +1 -1
- package/dist/api/state/oauth.d.mts +0 -3
- package/dist/api/state/oauth.mjs +2 -1
- package/dist/auth/full.d.mts +3 -4
- package/dist/auth/minimal.d.mts +3 -3
- package/dist/client/broadcast-channel.d.mts +6 -7
- package/dist/client/config.d.mts +15 -19
- package/dist/client/config.mjs +2 -2
- package/dist/client/equality.d.mts +3 -5
- package/dist/client/focus-manager.d.mts +4 -5
- package/dist/client/index.d.mts +8 -7
- package/dist/client/lynx/index.d.mts +6 -7
- package/dist/client/lynx/index.mjs +3 -2
- package/dist/client/lynx/lynx-store.d.mts +3 -4
- package/dist/client/online-manager.d.mts +4 -5
- package/dist/client/parser.d.mts +9 -5
- package/dist/client/path-to-object.d.mts +13 -14
- package/dist/client/plugins/index.d.mts +1 -1
- package/dist/client/plugins/infer-plugin.d.mts +2 -4
- package/dist/client/query.d.mts +4 -6
- package/dist/client/react/index.d.mts +6 -7
- package/dist/client/react/index.mjs +3 -2
- package/dist/client/react/react-store.d.mts +3 -4
- package/dist/client/session-atom.d.mts +4 -4
- package/dist/client/session-refresh.d.mts +3 -5
- package/dist/client/solid/index.d.mts +6 -7
- package/dist/client/solid/index.mjs +3 -2
- package/dist/client/svelte/index.d.mts +6 -7
- package/dist/client/svelte/index.mjs +3 -2
- package/dist/client/types.d.mts +11 -11
- package/dist/client/vanilla.d.mts +4 -5
- package/dist/client/vanilla.mjs +3 -2
- package/dist/client/vue/index.d.mts +6 -7
- package/dist/client/vue/index.mjs +3 -2
- package/dist/context/create-context.mjs +7 -7
- package/dist/context/helpers.mjs +9 -7
- package/dist/cookies/cookie-utils.d.mts +13 -13
- package/dist/cookies/cookie-utils.mjs +1 -3
- package/dist/cookies/index.d.mts +17 -18
- package/dist/cookies/index.mjs +11 -7
- package/dist/cookies/jwt.mjs +2 -1
- package/dist/cookies/session-store.d.mts +6 -5
- package/dist/cookies/session-store.mjs +3 -2
- package/dist/crypto/buffer.d.mts +2 -3
- package/dist/crypto/index.d.mts +9 -16
- package/dist/crypto/index.mjs +2 -1
- package/dist/crypto/jwt.d.mts +5 -7
- package/dist/crypto/jwt.mjs +2 -1
- package/dist/crypto/password.d.mts +1 -5
- package/dist/crypto/random.d.mts +2 -3
- package/dist/db/adapter-base.d.mts +2 -4
- package/dist/db/adapter-kysely.d.mts +2 -4
- package/dist/db/field-converter.d.mts +3 -5
- package/dist/db/field.d.mts +11 -12
- package/dist/db/get-migration.d.mts +4 -8
- package/dist/db/get-migration.mjs +22 -22
- package/dist/db/get-schema.d.mts +2 -4
- package/dist/db/internal-adapter.d.mts +2 -4
- package/dist/db/internal-adapter.mjs +6 -4
- package/dist/db/revoke-unproven-account-access.d.mts +3 -4
- package/dist/db/schema.d.mts +15 -16
- package/dist/db/schema.mjs +6 -3
- package/dist/db/to-zod.d.mts +5 -9
- package/dist/db/with-hooks.d.mts +3 -5
- package/dist/index.d.mts +4 -3
- package/dist/integrations/next-js.d.mts +7 -11
- package/dist/integrations/node.d.mts +5 -7
- package/dist/integrations/node.mjs +4 -2
- package/dist/integrations/solid-start.d.mts +2 -3
- package/dist/integrations/svelte-kit.d.mts +6 -14
- package/dist/integrations/tanstack-start-solid.d.mts +4 -8
- package/dist/integrations/tanstack-start.d.mts +4 -8
- package/dist/oauth2/link-account.d.mts +5 -11
- package/dist/oauth2/link-account.mjs +12 -6
- package/dist/oauth2/state.d.mts +5 -7
- package/dist/oauth2/state.mjs +1 -1
- package/dist/oauth2/utils.d.mts +4 -6
- package/dist/package.mjs +1 -1
- package/dist/plugins/access/access.d.mts +4 -6
- package/dist/plugins/access/index.mjs +1 -2
- package/dist/plugins/access/types.d.mts +12 -14
- package/dist/plugins/additional-fields/client.d.mts +2 -4
- package/dist/plugins/admin/access/index.mjs +1 -2
- package/dist/plugins/admin/access/statement.d.mts +7 -7
- package/dist/plugins/admin/admin.d.mts +122 -128
- package/dist/plugins/admin/client.d.mts +32 -32
- package/dist/plugins/admin/client.mjs +1 -1
- package/dist/plugins/admin/error-codes.d.mts +25 -28
- package/dist/plugins/admin/index.d.mts +1 -1
- package/dist/plugins/admin/index.mjs +1 -2
- package/dist/plugins/admin/schema.d.mts +3 -4
- package/dist/plugins/admin/types.d.mts +8 -8
- package/dist/plugins/anonymous/client.d.mts +10 -12
- package/dist/plugins/anonymous/client.mjs +1 -1
- package/dist/plugins/anonymous/error-codes.d.mts +10 -13
- package/dist/plugins/anonymous/index.d.mts +17 -21
- package/dist/plugins/anonymous/schema.d.mts +2 -3
- package/dist/plugins/anonymous/types.d.mts +5 -6
- package/dist/plugins/bearer/index.d.mts +7 -11
- package/dist/plugins/captcha/constants.d.mts +2 -3
- package/dist/plugins/captcha/index.d.mts +6 -9
- package/dist/plugins/captcha/types.d.mts +11 -13
- package/dist/plugins/custom-session/client.d.mts +2 -4
- package/dist/plugins/custom-session/index.d.mts +10 -16
- package/dist/plugins/device-authorization/client.d.mts +2 -4
- package/dist/plugins/device-authorization/index.d.mts +39 -44
- package/dist/plugins/device-authorization/index.mjs +9 -8
- package/dist/plugins/device-authorization/routes.d.mts +11 -9
- package/dist/plugins/device-authorization/routes.mjs +6 -5
- package/dist/plugins/device-authorization/schema.d.mts +2 -3
- package/dist/plugins/email-otp/client.d.mts +5 -7
- package/dist/plugins/email-otp/client.mjs +1 -1
- package/dist/plugins/email-otp/error-codes.d.mts +5 -8
- package/dist/plugins/email-otp/index.d.mts +69 -76
- package/dist/plugins/email-otp/otp-token.mjs +19 -7
- package/dist/plugins/email-otp/types.d.mts +2 -4
- package/dist/plugins/generic-oauth/index.d.mts +9 -13
- package/dist/plugins/generic-oauth/index.mjs +6 -4
- package/dist/plugins/generic-oauth/providers/auth0.d.mts +3 -5
- package/dist/plugins/generic-oauth/providers/gumroad.d.mts +3 -5
- package/dist/plugins/generic-oauth/providers/gumroad.mjs +1 -1
- package/dist/plugins/generic-oauth/providers/hubspot.d.mts +3 -5
- package/dist/plugins/generic-oauth/providers/hubspot.mjs +2 -1
- package/dist/plugins/generic-oauth/providers/index.d.mts +2 -1
- package/dist/plugins/generic-oauth/providers/keycloak.d.mts +3 -5
- package/dist/plugins/generic-oauth/providers/line.d.mts +3 -5
- package/dist/plugins/generic-oauth/providers/microsoft-entra-id.d.mts +3 -5
- package/dist/plugins/generic-oauth/providers/okta.d.mts +3 -5
- package/dist/plugins/generic-oauth/providers/patreon.d.mts +3 -5
- package/dist/plugins/generic-oauth/providers/patreon.mjs +2 -2
- package/dist/plugins/generic-oauth/providers/slack.d.mts +3 -5
- package/dist/plugins/generic-oauth/providers/slack.mjs +5 -2
- package/dist/plugins/generic-oauth/providers/yandex.d.mts +3 -5
- package/dist/plugins/generic-oauth/types.d.mts +6 -7
- package/dist/plugins/haveibeenpwned/index.d.mts +7 -11
- package/dist/plugins/index.d.mts +4 -1
- package/dist/plugins/jwt/client.d.mts +2 -3
- package/dist/plugins/jwt/index.d.mts +11 -14
- package/dist/plugins/jwt/index.mjs +1 -1
- package/dist/plugins/jwt/schema.d.mts +2 -3
- package/dist/plugins/jwt/sign.d.mts +9 -8
- package/dist/plugins/jwt/types.d.mts +7 -8
- package/dist/plugins/jwt/utils.d.mts +6 -9
- package/dist/plugins/jwt/verify.d.mts +2 -4
- package/dist/plugins/last-login-method/client.d.mts +3 -4
- package/dist/plugins/last-login-method/index.d.mts +5 -9
- package/dist/plugins/last-login-method/index.mjs +1 -1
- package/dist/plugins/magic-link/client.d.mts +2 -4
- package/dist/plugins/magic-link/index.d.mts +7 -10
- package/dist/plugins/magic-link/index.mjs +20 -17
- package/dist/plugins/multi-session/client.d.mts +3 -5
- package/dist/plugins/multi-session/client.mjs +1 -1
- package/dist/plugins/multi-session/error-codes.d.mts +3 -6
- package/dist/plugins/multi-session/index.d.mts +10 -14
- package/dist/plugins/oauth-popup/client.d.mts +11 -17
- package/dist/plugins/oauth-popup/client.mjs +6 -4
- package/dist/plugins/oauth-popup/constants.d.mts +5 -6
- package/dist/plugins/oauth-popup/error-codes.d.mts +6 -9
- package/dist/plugins/oauth-popup/index.d.mts +11 -15
- package/dist/plugins/oauth-popup/index.mjs +8 -7
- package/dist/plugins/oauth-popup/types.d.mts +4 -6
- package/dist/plugins/oauth-proxy/index.d.mts +11 -15
- package/dist/plugins/oauth-proxy/index.mjs +10 -7
- package/dist/plugins/one-tap/client.d.mts +6 -9
- package/dist/plugins/one-tap/index.d.mts +4 -7
- package/dist/plugins/one-time-token/client.d.mts +2 -3
- package/dist/plugins/one-time-token/index.d.mts +8 -10
- package/dist/plugins/open-api/generator.d.mts +8 -8
- package/dist/plugins/open-api/generator.mjs +5 -5
- package/dist/plugins/open-api/index.d.mts +5 -7
- package/dist/plugins/organization/access/index.mjs +1 -2
- package/dist/plugins/organization/access/statement.d.mts +8 -8
- package/dist/plugins/organization/adapter.d.mts +60 -87
- package/dist/plugins/organization/adapter.mjs +14 -10
- package/dist/plugins/organization/client.d.mts +108 -107
- package/dist/plugins/organization/client.mjs +9 -5
- package/dist/plugins/organization/error-codes.d.mts +61 -64
- package/dist/plugins/organization/has-permission.d.mts +2 -4
- 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 +20 -20
- package/dist/plugins/organization/organization.mjs +13 -8
- package/dist/plugins/organization/permission.d.mts +4 -5
- package/dist/plugins/organization/routes/crud-access-control.d.mts +28 -28
- package/dist/plugins/organization/routes/crud-invites.d.mts +64 -65
- package/dist/plugins/organization/routes/crud-invites.mjs +21 -18
- package/dist/plugins/organization/routes/crud-members.d.mts +53 -56
- package/dist/plugins/organization/routes/crud-members.mjs +23 -21
- package/dist/plugins/organization/routes/crud-org.d.mts +63 -65
- package/dist/plugins/organization/routes/crud-org.mjs +4 -2
- package/dist/plugins/organization/routes/crud-team.d.mts +65 -66
- package/dist/plugins/organization/routes/crud-team.mjs +4 -2
- package/dist/plugins/organization/schema.d.mts +33 -33
- package/dist/plugins/organization/schema.mjs +1 -1
- package/dist/plugins/organization/types.d.mts +16 -17
- package/dist/plugins/phone-number/client.d.mts +14 -16
- package/dist/plugins/phone-number/client.mjs +1 -1
- package/dist/plugins/phone-number/error-codes.d.mts +14 -17
- package/dist/plugins/phone-number/index.d.mts +48 -54
- package/dist/plugins/phone-number/schema.d.mts +2 -3
- package/dist/plugins/phone-number/types.d.mts +4 -5
- package/dist/plugins/siwe/client.d.mts +2 -4
- package/dist/plugins/siwe/index.d.mts +7 -9
- package/dist/plugins/siwe/index.mjs +1 -1
- package/dist/plugins/siwe/parse-message.mjs +1 -3
- package/dist/plugins/siwe/schema.d.mts +3 -4
- package/dist/plugins/siwe/types.d.mts +4 -4
- package/dist/plugins/test-utils/auth-helpers.mjs +4 -2
- package/dist/plugins/test-utils/index.d.mts +3 -5
- package/dist/plugins/test-utils/types.d.mts +7 -7
- package/dist/plugins/two-factor/backup-codes/index.d.mts +11 -14
- package/dist/plugins/two-factor/backup-codes/index.mjs +12 -6
- package/dist/plugins/two-factor/client.d.mts +16 -19
- package/dist/plugins/two-factor/client.mjs +1 -1
- package/dist/plugins/two-factor/constant.mjs +1 -1
- package/dist/plugins/two-factor/error-code.d.mts +15 -18
- package/dist/plugins/two-factor/index.d.mts +31 -35
- package/dist/plugins/two-factor/index.mjs +6 -3
- package/dist/plugins/two-factor/otp/index.d.mts +5 -8
- package/dist/plugins/two-factor/otp/index.mjs +159 -154
- package/dist/plugins/two-factor/schema.d.mts +2 -3
- package/dist/plugins/two-factor/totp/index.d.mts +7 -10
- package/dist/plugins/two-factor/totp/index.mjs +164 -148
- package/dist/plugins/two-factor/types.d.mts +6 -7
- package/dist/plugins/username/client.d.mts +12 -14
- package/dist/plugins/username/client.mjs +1 -1
- package/dist/plugins/username/error-codes.d.mts +11 -14
- package/dist/plugins/username/index.d.mts +26 -31
- package/dist/plugins/username/schema.d.mts +7 -10
- package/dist/state.d.mts +4 -5
- package/dist/test-utils/headers.d.mts +2 -3
- package/dist/test-utils/http-test-instance.d.mts +26 -29
- package/dist/test-utils/test-instance.d.mts +7 -6
- package/dist/test-utils/test-instance.mjs +4 -2
- package/dist/types/adapter.d.mts +1 -1
- package/dist/types/api.d.mts +4 -6
- package/dist/types/auth.d.mts +2 -4
- package/dist/types/helper.d.mts +11 -12
- package/dist/types/index.d.mts +2 -2
- package/dist/types/models.d.mts +4 -5
- package/dist/types/plugins.d.mts +7 -8
- package/dist/utils/hide-metadata.d.mts +2 -3
- package/dist/utils/index.d.mts +2 -1
- package/dist/utils/is-api-error.mjs +1 -2
- package/dist/utils/time.d.mts +4 -4
- package/dist/utils/url.d.mts +13 -15
- package/dist/utils/wildcard.mjs +5 -3
- package/package.json +12 -12
package/dist/client/index.d.mts
CHANGED
|
@@ -11,25 +11,26 @@ import { SessionRefreshOptions, createSessionRefreshManager } from "./session-re
|
|
|
11
11
|
import { AuthClient, createAuthClient } from "./vanilla.mjs";
|
|
12
12
|
import { AccessControl, ArrayElement, ExactRoleStatements, Role, RoleAuthorizeRequest, RoleInput, RoleStatements, Statements, SubArray, Subset } from "../plugins/access/types.mjs";
|
|
13
13
|
import { AuthorizeResponse, createAccessControl, role } from "../plugins/access/access.mjs";
|
|
14
|
+
import "../plugins/access/index.mjs";
|
|
14
15
|
import { OrganizationOptions } from "../plugins/organization/types.mjs";
|
|
15
16
|
import { InferInvitation, InferMember, InferOrganization, InferOrganizationRolesFromOption, InferOrganizationZodRolesFromOption, InferTeam, Invitation, InvitationInput, InvitationStatus, Member, MemberInput, Organization, OrganizationInput, OrganizationRole, OrganizationSchema, Team, TeamInput, TeamMember, TeamMemberInput, defaultRolesSchema, invitationSchema, invitationStatus, memberSchema, organizationRoleSchema, organizationSchema, roleSchema, teamMemberSchema, teamSchema } from "../plugins/organization/schema.mjs";
|
|
16
17
|
import { getOrgAdapter } from "../plugins/organization/adapter.mjs";
|
|
17
18
|
import { hasPermission } from "../plugins/organization/has-permission.mjs";
|
|
18
19
|
import { DefaultOrganizationPlugin, DynamicAccessControlEndpoints, OrganizationCreator, OrganizationEndpoints, OrganizationPlugin, TeamEndpoints, organization, parseRoles } from "../plugins/organization/organization.mjs";
|
|
20
|
+
import "../plugins/organization/index.mjs";
|
|
19
21
|
import { BetterAuthOptions, BetterAuthPlugin } from "@better-auth/core";
|
|
20
22
|
import { DBPrimitive } from "@better-auth/core/db";
|
|
21
|
-
export * from "@better-auth/core/db";
|
|
22
|
-
export * from "nanostores";
|
|
23
|
-
export * from "@better-fetch/fetch";
|
|
24
|
-
|
|
23
|
+
export type * from "@better-auth/core/db";
|
|
24
|
+
export type * from "nanostores";
|
|
25
|
+
export type * from "@better-fetch/fetch";
|
|
25
26
|
//#region src/client/index.d.ts
|
|
26
|
-
declare const InferPlugin: <T extends BetterAuthPlugin>() => {
|
|
27
|
+
export declare const InferPlugin: <T extends BetterAuthPlugin>() => {
|
|
27
28
|
id: "infer-server-plugin";
|
|
28
29
|
version: string;
|
|
29
30
|
$InferServerPlugin: T;
|
|
30
31
|
};
|
|
31
|
-
declare function InferAuth<O extends {
|
|
32
|
+
export declare function InferAuth<O extends {
|
|
32
33
|
options: BetterAuthOptions;
|
|
33
34
|
}>(): O["options"];
|
|
34
35
|
//#endregion
|
|
35
|
-
export { AccessControl, ArrayElement, AuthClient, AuthQueryAtom, AuthQueryState, AuthorizeResponse, BetterAuthClientOptions, BetterAuthClientPlugin, BroadcastChannel, BroadcastListener, BroadcastMessage, CamelCase, ClientAtomListener, ClientStore, type DBPrimitive, DefaultOrganizationPlugin, DynamicAccessControlEndpoints, ExactRoleStatements, ExtractPluginField, type FocusListener, type FocusManager, HasRequiredKeys, InferActions, InferAdditionalFromClient,
|
|
36
|
+
export { type AccessControl, type ArrayElement, AuthClient, AuthQueryAtom, AuthQueryState, type AuthorizeResponse, type BetterAuthClientOptions, type BetterAuthClientPlugin, BroadcastChannel, BroadcastListener, BroadcastMessage, type CamelCase, type ClientAtomListener, type ClientStore, type DBPrimitive, type DefaultOrganizationPlugin, type DynamicAccessControlEndpoints, type ExactRoleStatements, type ExtractPluginField, type FocusListener, type FocusManager, type HasRequiredKeys, InferActions, InferAdditionalFromClient, InferClientAPI, type InferCtx, InferErrorCodes, type InferInvitation, type InferMember, type InferOrganization, type InferOrganizationRolesFromOption, type InferOrganizationZodRolesFromOption, type InferPluginFieldFromTuple, type InferRoute, type InferRoutes, InferSessionFromClient, type InferSessionUpdateCtx, type InferSignUpEmailCtx, type InferTeam, InferUserFromClient, type InferUserUpdateCtx, type Invitation, type InvitationInput, type InvitationStatus, type IsAny, IsSignal, type Member, type MemberInput, type MergeRoutes, type OnlineListener, type OnlineManager, type Organization, type OrganizationCreator, type OrganizationEndpoints, type OrganizationInput, type OrganizationOptions, type OrganizationPlugin, type OrganizationRole, type OrganizationSchema, type OverrideMerge, type PathToObject, type Prettify, type PrettifyDeep, type ProxyRequest, type RequiredKeysOf, type Role, type RoleAuthorizeRequest, type RoleInput, type RoleStatements, SessionQueryParams, SessionRefreshOptions, type Statements, type StripEmptyObjects, type SubArray, type Subset, type Team, type TeamEndpoints, type TeamInput, type TeamMember, type TeamMemberInput, type UnionToIntersection, type createAccessControl, createAuthClient, createSessionRefreshManager, type defaultRolesSchema, getGlobalBroadcastChannel, type getOrgAdapter, type hasPermission, type invitationSchema, type invitationStatus, isJsonEqual, kBroadcastChannel, kFocusManager, kOnlineManager, type memberSchema, type organization, type organizationRoleSchema, type organizationSchema, parseJSON, type parseRoles, type role, type roleSchema, type teamMemberSchema, type teamSchema, useAuthQuery, withEquality };
|
|
@@ -5,15 +5,14 @@ import { useStore } from "./lynx-store.mjs";
|
|
|
5
5
|
import { BetterAuthClientOptions } from "@better-auth/core";
|
|
6
6
|
import { BASE_ERROR_CODES } from "@better-auth/core/error";
|
|
7
7
|
import { BetterFetchError, BetterFetchResponse } from "@better-fetch/fetch";
|
|
8
|
-
export * from "nanostores";
|
|
9
|
-
export * from "@better-fetch/fetch";
|
|
10
|
-
|
|
8
|
+
export type * from "nanostores";
|
|
9
|
+
export type * from "@better-fetch/fetch";
|
|
11
10
|
//#region src/client/lynx/index.d.ts
|
|
12
11
|
type InferResolvedHooks<O extends BetterAuthClientOptions> = O extends {
|
|
13
12
|
plugins: Array<infer Plugin>;
|
|
14
13
|
} ? UnionToIntersection<Plugin extends {
|
|
15
14
|
getAtoms?: infer GetAtoms;
|
|
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]: () => ReturnType<Atoms[key]["get"]
|
|
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]: () => ReturnType<Atoms[key]["get"]>; } : {} : {} : {}> : {};
|
|
17
16
|
type ClientConfig = ReturnType<typeof getClientConfig>;
|
|
18
17
|
type ClientSession<Option extends BetterAuthClientOptions> = InferClientAPI<Option> extends {
|
|
19
18
|
getSession: () => Promise<infer Res>;
|
|
@@ -21,7 +20,7 @@ type ClientSession<Option extends BetterAuthClientOptions> = InferClientAPI<Opti
|
|
|
21
20
|
/**
|
|
22
21
|
* Lynx client returned by `createAuthClient`.
|
|
23
22
|
*/
|
|
24
|
-
type LynxAuthClient<Option extends BetterAuthClientOptions> = UnionToIntersection<InferResolvedHooks<Option>> & InferClientAPI<Option> & InferActions<Option> & {
|
|
23
|
+
export type LynxAuthClient<Option extends BetterAuthClientOptions> = UnionToIntersection<InferResolvedHooks<Option>> & InferClientAPI<Option> & InferActions<Option> & {
|
|
25
24
|
hydrateSession(session: NonNullable<ClientSession<Option>> | null): void;
|
|
26
25
|
useSession: () => {
|
|
27
26
|
data: ClientSession<Option>;
|
|
@@ -38,6 +37,6 @@ type LynxAuthClient<Option extends BetterAuthClientOptions> = UnionToIntersectio
|
|
|
38
37
|
$store: ClientConfig["$store"];
|
|
39
38
|
$ERROR_CODES: PrettifyDeep<InferErrorCodes<Option> & typeof BASE_ERROR_CODES>;
|
|
40
39
|
};
|
|
41
|
-
declare function createAuthClient<Option extends BetterAuthClientOptions>(options?: Option | undefined): LynxAuthClient<Option>;
|
|
40
|
+
export declare function createAuthClient<Option extends BetterAuthClientOptions>(options?: Option | undefined): LynxAuthClient<Option>;
|
|
42
41
|
//#endregion
|
|
43
|
-
export { ExtractPluginField, HasRequiredKeys, InferPluginFieldFromTuple, IsAny,
|
|
42
|
+
export { type ExtractPluginField, type HasRequiredKeys, type InferPluginFieldFromTuple, type IsAny, type OverrideMerge, type Prettify, type PrettifyDeep, type RequiredKeysOf, type StripEmptyObjects, type UnionToIntersection, useStore };
|
|
@@ -10,13 +10,14 @@ function createAuthClient(options) {
|
|
|
10
10
|
const { pluginPathMethods, pluginsActions, pluginsAtoms, hydrateSession, $fetch, $store, atomListeners } = getClientConfig(options);
|
|
11
11
|
const resolvedHooks = {};
|
|
12
12
|
for (const [key, value] of Object.entries(pluginsAtoms)) resolvedHooks[getAtomKey(key)] = () => useStore(value);
|
|
13
|
-
|
|
13
|
+
const routes = {
|
|
14
14
|
...pluginsActions,
|
|
15
15
|
...resolvedHooks,
|
|
16
16
|
hydrateSession,
|
|
17
17
|
$fetch,
|
|
18
18
|
$store
|
|
19
|
-
}
|
|
19
|
+
};
|
|
20
|
+
return createDynamicPathProxy(routes, $fetch, pluginPathMethods, pluginsAtoms, atomListeners);
|
|
20
21
|
}
|
|
21
22
|
//#endregion
|
|
22
23
|
export { createAuthClient, useStore };
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { Store, StoreValue } from "nanostores";
|
|
2
2
|
import { DependencyList } from "@lynx-js/react";
|
|
3
|
-
|
|
4
3
|
//#region src/client/lynx/lynx-store.d.ts
|
|
5
4
|
type StoreKeys<T> = T extends {
|
|
6
5
|
setKey: (k: infer K, v: any) => unknown;
|
|
7
6
|
} ? K : never;
|
|
8
|
-
interface UseStoreOptions<SomeStore> {
|
|
7
|
+
export interface UseStoreOptions<SomeStore> {
|
|
9
8
|
/**
|
|
10
9
|
* @default
|
|
11
10
|
* ```ts
|
|
@@ -41,6 +40,6 @@ interface UseStoreOptions<SomeStore> {
|
|
|
41
40
|
* @param store Store instance.
|
|
42
41
|
* @returns Store value.
|
|
43
42
|
*/
|
|
44
|
-
declare function useStore<SomeStore extends Store>(store: SomeStore, options?: UseStoreOptions<SomeStore>): StoreValue<SomeStore>;
|
|
43
|
+
export declare function useStore<SomeStore extends Store>(store: SomeStore, options?: UseStoreOptions<SomeStore>): StoreValue<SomeStore>;
|
|
45
44
|
//#endregion
|
|
46
|
-
export {
|
|
45
|
+
export {};
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
//#region src/client/online-manager.d.ts
|
|
2
|
-
type OnlineListener = (online: boolean) => void;
|
|
3
|
-
declare const kOnlineManager: unique symbol;
|
|
4
|
-
interface OnlineManager {
|
|
2
|
+
export type OnlineListener = (online: boolean) => void;
|
|
3
|
+
export declare const kOnlineManager: unique symbol;
|
|
4
|
+
export interface OnlineManager {
|
|
5
5
|
setOnline(online: boolean): void;
|
|
6
6
|
isOnline: boolean;
|
|
7
7
|
subscribe(listener: OnlineListener): () => void;
|
|
8
8
|
setup(): () => void;
|
|
9
9
|
}
|
|
10
|
-
//#endregion
|
|
11
|
-
export { OnlineListener, OnlineManager, kOnlineManager };
|
|
10
|
+
//#endregion
|
package/dist/client/parser.d.mts
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
//#region src/client/parser.d.ts
|
|
2
2
|
type ParseOptions = {
|
|
3
|
-
/** Throw errors instead of returning the original value */
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
/** Throw errors instead of returning the original value */
|
|
4
|
+
strict?: boolean | undefined;
|
|
5
|
+
/** Log warnings when suspicious patterns are detected */
|
|
6
|
+
warnings?: boolean | undefined;
|
|
7
|
+
/** Custom reviver function */
|
|
8
|
+
reviver?: ((key: string, value: any) => any) | undefined;
|
|
9
|
+
/** Automatically convert ISO date strings to Date objects */
|
|
6
10
|
parseDates?: boolean | undefined;
|
|
7
11
|
};
|
|
8
|
-
declare function parseJSON<T = unknown>(value: unknown, options?: ParseOptions): T;
|
|
12
|
+
export declare function parseJSON<T = unknown>(value: unknown, options?: ParseOptions): T;
|
|
9
13
|
//#endregion
|
|
10
|
-
export {
|
|
14
|
+
export {};
|
|
@@ -4,7 +4,6 @@ import { BetterAuthClientOptions, ClientFetchOption } from "@better-auth/core";
|
|
|
4
4
|
import { SocialProviderList } from "@better-auth/core/social-providers";
|
|
5
5
|
import { Endpoint, InputContext, StandardSchemaV1 as StandardSchemaV1$1 } from "better-call";
|
|
6
6
|
import { BetterFetchResponse } from "@better-fetch/fetch";
|
|
7
|
-
|
|
8
7
|
//#region src/client/path-to-object.d.ts
|
|
9
8
|
/**
|
|
10
9
|
* Extract generic OAuth provider IDs from the client options.
|
|
@@ -37,18 +36,18 @@ type InferGenericOAuthProviderIds<O extends BetterAuthClientOptions> = (O extend
|
|
|
37
36
|
};
|
|
38
37
|
} ? ID & string : never : never);
|
|
39
38
|
type KeepNullishFromOriginal<Original, Replaced> = Replaced | (undefined extends Original ? undefined : never) | (null extends Original ? null : never);
|
|
40
|
-
type ReplaceTopLevelField<Data, Field extends "user" | "session", Replaced> = Data extends object ? Field extends keyof Data ? Omit<Data, Field> & { [K in Field]: KeepNullishFromOriginal<Data[K], Replaced
|
|
39
|
+
type ReplaceTopLevelField<Data, Field extends "user" | "session", Replaced> = Data extends object ? Field extends keyof Data ? Omit<Data, Field> & { [K in Field]: KeepNullishFromOriginal<Data[K], Replaced>; } : Data : Data;
|
|
41
40
|
type ReplaceAuthUserAndSession<Data, ClientOpts extends BetterAuthClientOptions> = ReplaceTopLevelField<ReplaceTopLevelField<Data, "user", InferUserFromClient<ClientOpts>>, "session", InferSessionFromClient<ClientOpts>>;
|
|
42
|
-
type MergeCustomSessionField<R extends object, Field extends "user" | "session", InferType> = Field extends keyof R ? { [K in Field]: KeepNullishFromOriginal<R[K], NonNullable<R[K]> & InferType
|
|
41
|
+
type MergeCustomSessionField<R extends object, Field extends "user" | "session", InferType> = Field extends keyof R ? { [K in Field]: KeepNullishFromOriginal<R[K], NonNullable<R[K]> & InferType>; } : {};
|
|
43
42
|
type MergeCustomSessionWithInferred<R, ClientOpts extends BetterAuthClientOptions> = R extends object ? Omit<R, "user" | "session"> & MergeCustomSessionField<R, "user", InferUserFromClient<ClientOpts>> & MergeCustomSessionField<R, "session", InferSessionFromClient<ClientOpts>> : never;
|
|
44
43
|
type RefineAuthResponse<Data, ClientOpts extends BetterAuthClientOptions> = Data extends {
|
|
45
44
|
token: unknown;
|
|
46
45
|
} | {
|
|
47
46
|
redirect: unknown;
|
|
48
47
|
} ? ReplaceAuthUserAndSession<Data, ClientOpts> : Data;
|
|
49
|
-
type CamelCase<S extends string> = S extends `${infer P1}-${infer P2}${infer P3}` ? `${Lowercase<P1>}${Uppercase<P2>}${CamelCase<P3>}` : Lowercase<S>;
|
|
50
|
-
type PathToObject<T extends string, Fn extends (...args: any[]) => any> = T extends `/${infer Segment}/${infer Rest}` ? { [K in CamelCase<Segment>]: PathToObject<`/${Rest}`, Fn
|
|
51
|
-
type InferSignUpEmailCtx<ClientOpts extends BetterAuthClientOptions, FetchOptions extends ClientFetchOption> = {
|
|
48
|
+
export type CamelCase<S extends string> = S extends `${infer P1}-${infer P2}${infer P3}` ? `${Lowercase<P1>}${Uppercase<P2>}${CamelCase<P3>}` : Lowercase<S>;
|
|
49
|
+
export type PathToObject<T extends string, Fn extends (...args: any[]) => any> = T extends `/${infer Segment}/${infer Rest}` ? { [K in CamelCase<Segment>]: PathToObject<`/${Rest}`, Fn>; } : T extends `/${infer Segment}` ? { [K in CamelCase<Segment>]: Fn; } : never;
|
|
50
|
+
export type InferSignUpEmailCtx<ClientOpts extends BetterAuthClientOptions, FetchOptions extends ClientFetchOption> = {
|
|
52
51
|
email: string;
|
|
53
52
|
name: string;
|
|
54
53
|
password: string;
|
|
@@ -56,12 +55,12 @@ type InferSignUpEmailCtx<ClientOpts extends BetterAuthClientOptions, FetchOption
|
|
|
56
55
|
callbackURL?: string | undefined;
|
|
57
56
|
fetchOptions?: FetchOptions | undefined;
|
|
58
57
|
} & UnionToIntersection<InferAdditionalFromClient<ClientOpts, "user", "input">>;
|
|
59
|
-
type InferUserUpdateCtx<ClientOpts extends BetterAuthClientOptions, FetchOptions extends ClientFetchOption> = {
|
|
58
|
+
export type InferUserUpdateCtx<ClientOpts extends BetterAuthClientOptions, FetchOptions extends ClientFetchOption> = {
|
|
60
59
|
image?: (string | null) | undefined;
|
|
61
60
|
name?: string | undefined;
|
|
62
61
|
fetchOptions?: FetchOptions | undefined;
|
|
63
62
|
} & Partial<UnionToIntersection<InferAdditionalFromClient<ClientOpts, "user", "input">>>;
|
|
64
|
-
type InferSessionUpdateCtx<ClientOpts extends BetterAuthClientOptions, FetchOptions extends ClientFetchOption> = {
|
|
63
|
+
export type InferSessionUpdateCtx<ClientOpts extends BetterAuthClientOptions, FetchOptions extends ClientFetchOption> = {
|
|
65
64
|
fetchOptions?: FetchOptions | undefined;
|
|
66
65
|
} & Partial<UnionToIntersection<InferAdditionalFromClient<ClientOpts, "session", "input">>>;
|
|
67
66
|
type InferCtxQuery<C extends InputContext<any, any>, FetchOptions extends ClientFetchOption> = C["query"] extends Record<string, any> ? {
|
|
@@ -79,9 +78,9 @@ type InferBodyCtx<Body, FetchOptions extends ClientFetchOption> = Body extends R
|
|
|
79
78
|
type PrettifyUnion<T> = T extends unknown ? Prettify$1<T> : never;
|
|
80
79
|
type HasRequiredKeysInUnion<T> = true extends (T extends unknown ? HasRequiredKeys<T> : never) ? true : false;
|
|
81
80
|
type HasRequiredCtx<C extends InputContext<any, any>, FetchOptions extends ClientFetchOption> = IsAny<C["body"]> extends true ? HasRequiredKeysInUnion<InferCtx<C, FetchOptions>> : undefined extends C["body"] ? HasRequiredKeysInUnion<InferCtxQuery<C, FetchOptions>> : HasRequiredKeysInUnion<InferCtx<C, FetchOptions>>;
|
|
82
|
-
type InferCtx<C extends InputContext<any, any>, FetchOptions extends ClientFetchOption> = IsAny<C["body"]> extends true ? InferCtxQuery<C, FetchOptions> : [NonNullable<C["body"]>] extends [never] ? InferCtxQuery<C, FetchOptions> : NonNullable<C["body"]> extends Record<string, any> ? InferBodyCtx<NonNullable<C["body"]>, FetchOptions> : InferCtxQuery<C, FetchOptions>;
|
|
83
|
-
type MergeRoutes<T> = UnionToIntersection<T>;
|
|
84
|
-
type InferRoute<API, COpts extends BetterAuthClientOptions> = API extends Record<string, infer T> ? T extends Endpoint ? T["options"]["metadata"] extends {
|
|
81
|
+
export type InferCtx<C extends InputContext<any, any>, FetchOptions extends ClientFetchOption> = IsAny<C["body"]> extends true ? InferCtxQuery<C, FetchOptions> : [NonNullable<C["body"]>] extends [never] ? InferCtxQuery<C, FetchOptions> : NonNullable<C["body"]> extends Record<string, any> ? InferBodyCtx<NonNullable<C["body"]>, FetchOptions> : InferCtxQuery<C, FetchOptions>;
|
|
82
|
+
export type MergeRoutes<T> = UnionToIntersection<T>;
|
|
83
|
+
export type InferRoute<API, COpts extends BetterAuthClientOptions> = API extends Record<string, infer T> ? T extends Endpoint ? T["options"]["metadata"] extends {
|
|
85
84
|
isAction: false;
|
|
86
85
|
} | {
|
|
87
86
|
SERVER_ONLY: true;
|
|
@@ -103,11 +102,11 @@ type InferRoute<API, COpts extends BetterAuthClientOptions> = API extends Record
|
|
|
103
102
|
}, FetchOptions["throw"] extends true ? true : COpts["fetchOptions"] extends {
|
|
104
103
|
throw: true;
|
|
105
104
|
} ? true : false>> : never : never> : {} : never;
|
|
106
|
-
type InferRoutes<API extends Record<string, unknown>, ClientOpts extends BetterAuthClientOptions> = MergeRoutes<InferRoute<API, ClientOpts>>;
|
|
107
|
-
type ProxyRequest = {
|
|
105
|
+
export type InferRoutes<API extends Record<string, unknown>, ClientOpts extends BetterAuthClientOptions> = MergeRoutes<InferRoute<API, ClientOpts>>;
|
|
106
|
+
export type ProxyRequest = {
|
|
108
107
|
options?: ClientFetchOption<any, any> | undefined;
|
|
109
108
|
query?: any | undefined;
|
|
110
109
|
[key: string]: any;
|
|
111
110
|
};
|
|
112
111
|
//#endregion
|
|
113
|
-
export {
|
|
112
|
+
export {};
|
|
@@ -41,4 +41,4 @@ import { phoneNumberClient } from "../../plugins/phone-number/client.mjs";
|
|
|
41
41
|
import { siweClient } from "../../plugins/siwe/client.mjs";
|
|
42
42
|
import { UsernameClientOptions, usernameClient } from "../../plugins/username/client.mjs";
|
|
43
43
|
import { InferServerPlugin } from "./infer-plugin.mjs";
|
|
44
|
-
export { ADMIN_ERROR_CODES, ANONYMOUS_ERROR_CODES, AdminClientOptions, AdminOptions, AnonymousOptions, AnonymousSession, BackupCodeOptions, EMAIL_OTP_ERROR_CODES, ExtractPluginField, type FieldAttributeToObject, GoogleOneTapActionOptions, GoogleOneTapOptions, GsiButtonConfiguration, HasRequiredKeys, InferAdminRolesFromOption, InferInvitation, InferMember, InferOrganization, InferOrganizationRolesFromOption, InferOrganizationZodRolesFromOption, InferPluginFieldFromTuple, InferServerPlugin, InferTeam, Invitation, InvitationInput, InvitationStatus, IsAny, JWKOptions, JWSAlgorithms, Jwk, JwtOptions, LastLoginMethodClientConfig, MULTI_SESSION_ERROR_CODES, Member, MemberInput, MultiSessionConfig, OAUTH_POPUP_ERROR_CODES, ORGANIZATION_ERROR_CODES, OTPOptions, OneTimeTokenOptions, Organization, OrganizationClientOptions, OrganizationInput, OrganizationRole, OrganizationSchema, OverrideMerge, PHONE_NUMBER_ERROR_CODES, POPUP_TOKEN_STORAGE_KEY, PhoneNumberOptions, Prettify, PrettifyDeep, type RemoveFieldsWithReturnedFalse, RequiredKeysOf, ResolvedSigningKey, SessionWithImpersonatedBy, SignInPopupOptions, SignInPopupResult, StripEmptyObjects, TOTPOptions, TWO_FACTOR_ERROR_CODES, Team, TeamInput, TeamMember, TeamMemberInput, TwoFactorOptions, TwoFactorProvider, TwoFactorTable, USERNAME_ERROR_CODES, UnionToIntersection, UserWithAnonymous, UserWithPhoneNumber, UserWithRole, UserWithTwoFactor, UsernameClientOptions, adminClient, anonymousClient, backupCode2fa, clientSideHasPermission, createSignInPopup, customSessionClient, defaultRolesSchema, deviceAuthorizationClient, emailOTPClient, encodeBackupCodes, generateBackupCodes, getBackupCodes, getStoredPopupToken, inferAdditionalFields, inferOrgAdditionalFields, invitationSchema, invitationStatus, jwtClient, lastLoginMethodClient, magicLinkClient, memberSchema, multiSessionClient, oauthPopupClient, oneTapClient, oneTimeTokenClient, organizationClient, organizationRoleSchema, organizationSchema, otp2fa, phoneNumberClient, popupBearerFetchPlugin, roleSchema, schema, siweClient, teamMemberSchema, teamSchema, totp2fa, twoFactorClient, usernameClient, verifyBackupCode };
|
|
44
|
+
export { ADMIN_ERROR_CODES, ANONYMOUS_ERROR_CODES, AdminClientOptions, type AdminOptions, type AnonymousOptions, type AnonymousSession, type BackupCodeOptions, EMAIL_OTP_ERROR_CODES, type ExtractPluginField, type FieldAttributeToObject, GoogleOneTapActionOptions, GoogleOneTapOptions, GsiButtonConfiguration, type HasRequiredKeys, type InferAdminRolesFromOption, type InferInvitation, type InferMember, type InferOrganization, type InferOrganizationRolesFromOption, type InferOrganizationZodRolesFromOption, type InferPluginFieldFromTuple, InferServerPlugin, type InferTeam, type Invitation, type InvitationInput, type InvitationStatus, type IsAny, type JWKOptions, type JWSAlgorithms, type Jwk, type JwtOptions, LastLoginMethodClientConfig, MULTI_SESSION_ERROR_CODES, type Member, type MemberInput, type MultiSessionConfig, OAUTH_POPUP_ERROR_CODES, ORGANIZATION_ERROR_CODES, type OTPOptions, type OneTimeTokenOptions, type Organization, OrganizationClientOptions, type OrganizationInput, type OrganizationRole, type OrganizationSchema, type OverrideMerge, PHONE_NUMBER_ERROR_CODES, POPUP_TOKEN_STORAGE_KEY, type PhoneNumberOptions, type Prettify, type PrettifyDeep, type RemoveFieldsWithReturnedFalse, type RequiredKeysOf, type ResolvedSigningKey, type SessionWithImpersonatedBy, SignInPopupOptions, SignInPopupResult, type StripEmptyObjects, type TOTPOptions, TWO_FACTOR_ERROR_CODES, type Team, type TeamInput, type TeamMember, type TeamMemberInput, type TwoFactorOptions, type TwoFactorProvider, type TwoFactorTable, USERNAME_ERROR_CODES, type UnionToIntersection, type UserWithAnonymous, type UserWithPhoneNumber, type UserWithRole, type UserWithTwoFactor, UsernameClientOptions, adminClient, anonymousClient, type backupCode2fa, clientSideHasPermission, createSignInPopup, customSessionClient, type defaultRolesSchema, deviceAuthorizationClient, emailOTPClient, type encodeBackupCodes, type generateBackupCodes, type getBackupCodes, getStoredPopupToken, inferAdditionalFields, inferOrgAdditionalFields, type invitationSchema, type invitationStatus, jwtClient, lastLoginMethodClient, magicLinkClient, type memberSchema, multiSessionClient, oauthPopupClient, oneTapClient, oneTimeTokenClient, organizationClient, type organizationRoleSchema, type organizationSchema, type otp2fa, phoneNumberClient, popupBearerFetchPlugin, type roleSchema, type schema, siweClient, type teamMemberSchema, type teamSchema, type totp2fa, twoFactorClient, usernameClient, type verifyBackupCode };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { BetterAuthOptions } from "@better-auth/core";
|
|
2
|
-
|
|
3
2
|
//#region src/client/plugins/infer-plugin.d.ts
|
|
4
|
-
declare const InferServerPlugin: <AuthOrOption extends BetterAuthOptions | {
|
|
3
|
+
export declare const InferServerPlugin: <AuthOrOption extends BetterAuthOptions | {
|
|
5
4
|
options: BetterAuthOptions;
|
|
6
5
|
}, ID extends string>() => {
|
|
7
6
|
id: "infer-server-plugin";
|
|
@@ -12,5 +11,4 @@ declare const InferServerPlugin: <AuthOrOption extends BetterAuthOptions | {
|
|
|
12
11
|
id: ID;
|
|
13
12
|
} ? P : never : never;
|
|
14
13
|
};
|
|
15
|
-
//#endregion
|
|
16
|
-
export { InferServerPlugin };
|
|
14
|
+
//#endregion
|
package/dist/client/query.d.mts
CHANGED
|
@@ -2,9 +2,8 @@ import { SessionQueryParams } from "./types.mjs";
|
|
|
2
2
|
import { ClientFetchOption } from "@better-auth/core";
|
|
3
3
|
import { PreinitializedWritableAtom } from "nanostores";
|
|
4
4
|
import { BetterFetch, BetterFetchError } from "@better-fetch/fetch";
|
|
5
|
-
|
|
6
5
|
//#region src/client/query.d.ts
|
|
7
|
-
type AuthQueryState<T> = {
|
|
6
|
+
export type AuthQueryState<T> = {
|
|
8
7
|
data: null | T;
|
|
9
8
|
error: null | BetterFetchError;
|
|
10
9
|
isPending: boolean;
|
|
@@ -13,11 +12,10 @@ type AuthQueryState<T> = {
|
|
|
13
12
|
query?: SessionQueryParams;
|
|
14
13
|
} | undefined) => Promise<void>;
|
|
15
14
|
};
|
|
16
|
-
type AuthQueryAtom<T> = PreinitializedWritableAtom<AuthQueryState<T>>;
|
|
17
|
-
declare const useAuthQuery: <T>(initializedAtom: PreinitializedWritableAtom<any> | PreinitializedWritableAtom<any>[], path: string, $fetch: BetterFetch, options?: (((value: {
|
|
15
|
+
export type AuthQueryAtom<T> = PreinitializedWritableAtom<AuthQueryState<T>>;
|
|
16
|
+
export declare const useAuthQuery: <T>(initializedAtom: PreinitializedWritableAtom<any> | PreinitializedWritableAtom<any>[], path: string, $fetch: BetterFetch, options?: (((value: {
|
|
18
17
|
data: null | T;
|
|
19
18
|
error: null | BetterFetchError;
|
|
20
19
|
isPending: boolean;
|
|
21
20
|
}) => ClientFetchOption) | ClientFetchOption) | undefined) => AuthQueryAtom<T>;
|
|
22
|
-
//#endregion
|
|
23
|
-
export { AuthQueryAtom, AuthQueryState, useAuthQuery };
|
|
21
|
+
//#endregion
|
|
@@ -5,15 +5,14 @@ import { useStore } from "./react-store.mjs";
|
|
|
5
5
|
import { BetterAuthClientOptions } from "@better-auth/core";
|
|
6
6
|
import { BASE_ERROR_CODES } from "@better-auth/core/error";
|
|
7
7
|
import { BetterFetchError, BetterFetchResponse } from "@better-fetch/fetch";
|
|
8
|
-
export * from "nanostores";
|
|
9
|
-
export * from "@better-fetch/fetch";
|
|
10
|
-
|
|
8
|
+
export type * from "nanostores";
|
|
9
|
+
export type * from "@better-fetch/fetch";
|
|
11
10
|
//#region src/client/react/index.d.ts
|
|
12
11
|
type InferResolvedHooks<O extends BetterAuthClientOptions> = O extends {
|
|
13
12
|
plugins: Array<infer Plugin>;
|
|
14
13
|
} ? UnionToIntersection<Plugin extends {
|
|
15
14
|
getAtoms?: infer GetAtoms;
|
|
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]: () => ReturnType<Atoms[key]["get"]
|
|
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]: () => ReturnType<Atoms[key]["get"]>; } : {} : {} : {}> : {};
|
|
17
16
|
type ClientConfig = ReturnType<typeof getClientConfig>;
|
|
18
17
|
type ClientSession<Option extends BetterAuthClientOptions> = InferClientAPI<Option> extends {
|
|
19
18
|
getSession: () => Promise<infer Res>;
|
|
@@ -21,7 +20,7 @@ type ClientSession<Option extends BetterAuthClientOptions> = InferClientAPI<Opti
|
|
|
21
20
|
/**
|
|
22
21
|
* React client returned by `createAuthClient`.
|
|
23
22
|
*/
|
|
24
|
-
type ReactAuthClient<Option extends BetterAuthClientOptions> = UnionToIntersection<InferResolvedHooks<Option>> & InferClientAPI<Option> & InferActions<Option> & {
|
|
23
|
+
export type ReactAuthClient<Option extends BetterAuthClientOptions> = UnionToIntersection<InferResolvedHooks<Option>> & InferClientAPI<Option> & InferActions<Option> & {
|
|
25
24
|
hydrateSession(session: NonNullable<ClientSession<Option>> | null): void;
|
|
26
25
|
useSession: () => {
|
|
27
26
|
data: ClientSession<Option>;
|
|
@@ -39,6 +38,6 @@ type ReactAuthClient<Option extends BetterAuthClientOptions> = UnionToIntersecti
|
|
|
39
38
|
$store: ClientConfig["$store"];
|
|
40
39
|
$ERROR_CODES: InferErrorCodes<Option> & typeof BASE_ERROR_CODES;
|
|
41
40
|
};
|
|
42
|
-
declare function createAuthClient<Option extends BetterAuthClientOptions>(options?: Option | undefined): ReactAuthClient<Option>;
|
|
41
|
+
export declare function createAuthClient<Option extends BetterAuthClientOptions>(options?: Option | undefined): ReactAuthClient<Option>;
|
|
43
42
|
//#endregion
|
|
44
|
-
export { ExtractPluginField, HasRequiredKeys, InferPluginFieldFromTuple, IsAny, OverrideMerge, Prettify, PrettifyDeep,
|
|
43
|
+
export { type ExtractPluginField, type HasRequiredKeys, type InferPluginFieldFromTuple, type IsAny, type OverrideMerge, type Prettify, type PrettifyDeep, type RequiredKeysOf, type StripEmptyObjects, type UnionToIntersection, useStore };
|
|
@@ -10,13 +10,14 @@ function createAuthClient(options) {
|
|
|
10
10
|
const { pluginPathMethods, pluginsActions, pluginsAtoms, hydrateSession, $fetch, $store, atomListeners } = getClientConfig(options);
|
|
11
11
|
const resolvedHooks = {};
|
|
12
12
|
for (const [key, value] of Object.entries(pluginsAtoms)) resolvedHooks[getAtomKey(key)] = () => useStore(value);
|
|
13
|
-
|
|
13
|
+
const routes = {
|
|
14
14
|
...pluginsActions,
|
|
15
15
|
...resolvedHooks,
|
|
16
16
|
hydrateSession,
|
|
17
17
|
$fetch,
|
|
18
18
|
$store
|
|
19
|
-
}
|
|
19
|
+
};
|
|
20
|
+
return createDynamicPathProxy(routes, $fetch, pluginPathMethods, pluginsAtoms, atomListeners);
|
|
20
21
|
}
|
|
21
22
|
//#endregion
|
|
22
23
|
export { createAuthClient, useStore };
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { Store, StoreValue } from "nanostores";
|
|
2
2
|
import { DependencyList } from "react";
|
|
3
|
-
|
|
4
3
|
//#region src/client/react/react-store.d.ts
|
|
5
4
|
type StoreKeys<T> = T extends {
|
|
6
5
|
setKey: (k: infer K, v: any) => unknown;
|
|
7
6
|
} ? K : never;
|
|
8
|
-
interface UseStoreOptions<SomeStore> {
|
|
7
|
+
export interface UseStoreOptions<SomeStore> {
|
|
9
8
|
/**
|
|
10
9
|
* @default
|
|
11
10
|
* ```ts
|
|
@@ -41,6 +40,6 @@ interface UseStoreOptions<SomeStore> {
|
|
|
41
40
|
* @param store Store instance.
|
|
42
41
|
* @returns Store value.
|
|
43
42
|
*/
|
|
44
|
-
declare function useStore<SomeStore extends Store>(store: SomeStore, options?: UseStoreOptions<SomeStore>): StoreValue<SomeStore>;
|
|
43
|
+
export declare function useStore<SomeStore extends Store>(store: SomeStore, options?: UseStoreOptions<SomeStore>): StoreValue<SomeStore>;
|
|
45
44
|
//#endregion
|
|
46
|
-
export {
|
|
45
|
+
export {};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Session, User } from "../types/models.mjs";
|
|
2
|
+
import "../types/index.mjs";
|
|
3
|
+
import "./query.mjs";
|
|
2
4
|
import { BetterAuthClientOptions } from "@better-auth/core";
|
|
3
5
|
import { BetterFetch } from "@better-fetch/fetch";
|
|
4
|
-
|
|
5
6
|
//#region src/client/session-atom.d.ts
|
|
6
|
-
type SessionData = {
|
|
7
|
+
export type SessionData = {
|
|
7
8
|
user: User;
|
|
8
9
|
session: Session;
|
|
9
10
|
} & Record<string, any>;
|
|
10
|
-
//#endregion
|
|
11
|
-
export { SessionData };
|
|
11
|
+
//#endregion
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { BetterAuthClientOptions } from "@better-auth/core";
|
|
2
2
|
import { WritableAtom } from "nanostores";
|
|
3
|
-
|
|
4
3
|
//#region src/client/session-refresh.d.ts
|
|
5
|
-
interface SessionRefreshOptions {
|
|
4
|
+
export interface SessionRefreshOptions {
|
|
6
5
|
fetchSession: () => Promise<void>;
|
|
7
6
|
shouldPollSession?: () => boolean;
|
|
8
7
|
sessionSignal: WritableAtom<boolean>;
|
|
9
8
|
options?: BetterAuthClientOptions | undefined;
|
|
10
9
|
}
|
|
11
|
-
declare function createSessionRefreshManager(opts: SessionRefreshOptions): {
|
|
10
|
+
export declare function createSessionRefreshManager(opts: SessionRefreshOptions): {
|
|
12
11
|
init: () => void;
|
|
13
12
|
cleanup: () => void;
|
|
14
13
|
triggerRefetch: (event?: {
|
|
@@ -16,5 +15,4 @@ declare function createSessionRefreshManager(opts: SessionRefreshOptions): {
|
|
|
16
15
|
} | undefined) => void;
|
|
17
16
|
broadcastSessionUpdate: (trigger: "signout" | "getSession" | "updateUser") => void;
|
|
18
17
|
};
|
|
19
|
-
//#endregion
|
|
20
|
-
export { SessionRefreshOptions, createSessionRefreshManager };
|
|
18
|
+
//#endregion
|
|
@@ -5,15 +5,14 @@ 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 { Accessor } from "solid-js";
|
|
8
|
-
export * from "nanostores";
|
|
9
|
-
export * from "@better-fetch/fetch";
|
|
10
|
-
|
|
8
|
+
export type * from "nanostores";
|
|
9
|
+
export type * from "@better-fetch/fetch";
|
|
11
10
|
//#region src/client/solid/index.d.ts
|
|
12
11
|
type InferResolvedHooks<O extends BetterAuthClientOptions> = O extends {
|
|
13
12
|
plugins: Array<infer Plugin>;
|
|
14
13
|
} ? UnionToIntersection<Plugin extends {
|
|
15
14
|
getAtoms?: infer GetAtoms;
|
|
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]: () => Accessor<ReturnType<Atoms[key]["get"]
|
|
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]: () => Accessor<ReturnType<Atoms[key]["get"]>>; } : {} : {} : {}> : {};
|
|
17
16
|
type ClientConfig = ReturnType<typeof getClientConfig>;
|
|
18
17
|
type ClientSession<Option extends BetterAuthClientOptions> = InferClientAPI<Option> extends {
|
|
19
18
|
getSession: () => Promise<infer Res>;
|
|
@@ -21,7 +20,7 @@ type ClientSession<Option extends BetterAuthClientOptions> = InferClientAPI<Opti
|
|
|
21
20
|
/**
|
|
22
21
|
* Solid client returned by `createAuthClient`.
|
|
23
22
|
*/
|
|
24
|
-
type SolidAuthClient<Option extends BetterAuthClientOptions> = UnionToIntersection<InferResolvedHooks<Option>> & InferClientAPI<Option> & InferActions<Option> & {
|
|
23
|
+
export type SolidAuthClient<Option extends BetterAuthClientOptions> = UnionToIntersection<InferResolvedHooks<Option>> & InferClientAPI<Option> & InferActions<Option> & {
|
|
25
24
|
hydrateSession(session: NonNullable<ClientSession<Option>> | null): void;
|
|
26
25
|
useSession: () => Accessor<{
|
|
27
26
|
data: ClientSession<Option>;
|
|
@@ -39,6 +38,6 @@ type SolidAuthClient<Option extends BetterAuthClientOptions> = UnionToIntersecti
|
|
|
39
38
|
$store: ClientConfig["$store"];
|
|
40
39
|
$ERROR_CODES: PrettifyDeep<InferErrorCodes<Option> & typeof BASE_ERROR_CODES>;
|
|
41
40
|
};
|
|
42
|
-
declare function createAuthClient<Option extends BetterAuthClientOptions>(options?: Option | undefined): SolidAuthClient<Option>;
|
|
41
|
+
export declare function createAuthClient<Option extends BetterAuthClientOptions>(options?: Option | undefined): SolidAuthClient<Option>;
|
|
43
42
|
//#endregion
|
|
44
|
-
export { ExtractPluginField, HasRequiredKeys, InferPluginFieldFromTuple, IsAny, OverrideMerge, Prettify, PrettifyDeep, RequiredKeysOf,
|
|
43
|
+
export type { ExtractPluginField, HasRequiredKeys, InferPluginFieldFromTuple, IsAny, OverrideMerge, Prettify, PrettifyDeep, RequiredKeysOf, StripEmptyObjects, UnionToIntersection };
|
|
@@ -10,13 +10,14 @@ function createAuthClient(options) {
|
|
|
10
10
|
const { pluginPathMethods, pluginsActions, pluginsAtoms, hydrateSession, $fetch, $store, atomListeners } = getClientConfig(options);
|
|
11
11
|
const resolvedHooks = {};
|
|
12
12
|
for (const [key, value] of Object.entries(pluginsAtoms)) resolvedHooks[getAtomKey(key)] = () => useStore(value);
|
|
13
|
-
|
|
13
|
+
const routes = {
|
|
14
14
|
...pluginsActions,
|
|
15
15
|
...resolvedHooks,
|
|
16
16
|
hydrateSession,
|
|
17
17
|
$fetch,
|
|
18
18
|
$store
|
|
19
|
-
}
|
|
19
|
+
};
|
|
20
|
+
return createDynamicPathProxy(routes, $fetch, pluginPathMethods, pluginsAtoms, atomListeners);
|
|
20
21
|
}
|
|
21
22
|
//#endregion
|
|
22
23
|
export { createAuthClient };
|
|
@@ -5,15 +5,14 @@ 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
|
-
export * from "nanostores";
|
|
9
|
-
export * from "@better-fetch/fetch";
|
|
10
|
-
|
|
8
|
+
export type * from "nanostores";
|
|
9
|
+
export type * from "@better-fetch/fetch";
|
|
11
10
|
//#region src/client/svelte/index.d.ts
|
|
12
11
|
type InferResolvedHooks<O extends BetterAuthClientOptions> = O extends {
|
|
13
12
|
plugins: Array<infer Plugin>;
|
|
14
13
|
} ? UnionToIntersection<Plugin extends {
|
|
15
14
|
getAtoms?: infer GetAtoms;
|
|
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]: () => Atoms[key] } : {} : {} : {}> : {};
|
|
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]: () => Atoms[key]; } : {} : {} : {}> : {};
|
|
17
16
|
type ClientConfig = ReturnType<typeof getClientConfig>;
|
|
18
17
|
type ClientSession<Option extends BetterAuthClientOptions> = InferClientAPI<Option> extends {
|
|
19
18
|
getSession: () => Promise<infer Res>;
|
|
@@ -21,7 +20,7 @@ type ClientSession<Option extends BetterAuthClientOptions> = InferClientAPI<Opti
|
|
|
21
20
|
/**
|
|
22
21
|
* Svelte client returned by `createAuthClient`.
|
|
23
22
|
*/
|
|
24
|
-
type SvelteAuthClient<Option extends BetterAuthClientOptions> = UnionToIntersection<InferResolvedHooks<Option>> & InferClientAPI<Option> & InferActions<Option> & {
|
|
23
|
+
export type SvelteAuthClient<Option extends BetterAuthClientOptions> = UnionToIntersection<InferResolvedHooks<Option>> & InferClientAPI<Option> & InferActions<Option> & {
|
|
25
24
|
hydrateSession(session: NonNullable<ClientSession<Option>> | null): void;
|
|
26
25
|
useSession: () => Atom<{
|
|
27
26
|
data: ClientSession<Option>;
|
|
@@ -39,6 +38,6 @@ type SvelteAuthClient<Option extends BetterAuthClientOptions> = UnionToIntersect
|
|
|
39
38
|
};
|
|
40
39
|
$ERROR_CODES: PrettifyDeep<InferErrorCodes<Option> & typeof BASE_ERROR_CODES>;
|
|
41
40
|
};
|
|
42
|
-
declare function createAuthClient<Option extends BetterAuthClientOptions>(options?: Option | undefined): SvelteAuthClient<Option>;
|
|
41
|
+
export declare function createAuthClient<Option extends BetterAuthClientOptions>(options?: Option | undefined): SvelteAuthClient<Option>;
|
|
43
42
|
//#endregion
|
|
44
|
-
export { ExtractPluginField, HasRequiredKeys, InferPluginFieldFromTuple, IsAny, OverrideMerge, Prettify, PrettifyDeep, RequiredKeysOf, StripEmptyObjects,
|
|
43
|
+
export type { ExtractPluginField, HasRequiredKeys, InferPluginFieldFromTuple, IsAny, OverrideMerge, Prettify, PrettifyDeep, RequiredKeysOf, StripEmptyObjects, UnionToIntersection };
|
|
@@ -6,13 +6,14 @@ function createAuthClient(options) {
|
|
|
6
6
|
const { pluginPathMethods, pluginsActions, pluginsAtoms, hydrateSession, $fetch, atomListeners, $store } = getClientConfig(options);
|
|
7
7
|
const resolvedHooks = {};
|
|
8
8
|
for (const [key, value] of Object.entries(pluginsAtoms)) resolvedHooks[`use${capitalizeFirstLetter(key)}`] = () => value;
|
|
9
|
-
|
|
9
|
+
const routes = {
|
|
10
10
|
...pluginsActions,
|
|
11
11
|
...resolvedHooks,
|
|
12
12
|
hydrateSession,
|
|
13
13
|
$fetch,
|
|
14
14
|
$store
|
|
15
|
-
}
|
|
15
|
+
};
|
|
16
|
+
return createDynamicPathProxy(routes, $fetch, pluginPathMethods, pluginsAtoms, atomListeners);
|
|
16
17
|
}
|
|
17
18
|
//#endregion
|
|
18
19
|
export { createAuthClient };
|
package/dist/client/types.d.mts
CHANGED
|
@@ -3,9 +3,9 @@ import { StripEmptyObjects, UnionToIntersection } from "../types/helper.mjs";
|
|
|
3
3
|
import { InferRoutes } from "./path-to-object.mjs";
|
|
4
4
|
import { Session as Session$1, User as User$1 } from "../types/models.mjs";
|
|
5
5
|
import { Auth } from "../types/auth.mjs";
|
|
6
|
+
import "../types/index.mjs";
|
|
6
7
|
import { BetterAuthClientOptions as BetterAuthClientOptions$1, BetterAuthClientPlugin, ClientAtomListener as ClientAtomListener$1, ClientStore as ClientStore$1 } from "@better-auth/core";
|
|
7
8
|
import { DBFieldAttribute, InferDBFieldsOutput } from "@better-auth/core/db";
|
|
8
|
-
|
|
9
9
|
//#region src/client/types.d.ts
|
|
10
10
|
type ClientPluginError<K extends string = string> = {
|
|
11
11
|
readonly code: K;
|
|
@@ -16,36 +16,36 @@ type InferPluginEndpoints<Plugins> = Plugins extends Array<infer Pl> ? UnionToIn
|
|
|
16
16
|
} ? Plug extends {
|
|
17
17
|
endpoints?: infer Endpoints;
|
|
18
18
|
} ? Endpoints extends Record<string, unknown> ? Endpoints : {} : {} : {}> : {};
|
|
19
|
-
type InferClientAPI<O extends BetterAuthClientOptions$1> = InferRoutes<O["plugins"] extends Array<any> ? Omit<Auth["api"], keyof InferPluginEndpoints<O["plugins"]>> & InferPluginEndpoints<O["plugins"]> : Auth["api"], O>;
|
|
20
|
-
type InferActions<O extends BetterAuthClientOptions$1> = (O["plugins"] extends Array<infer Plugin> ? UnionToIntersection<Plugin extends {
|
|
19
|
+
export type InferClientAPI<O extends BetterAuthClientOptions$1> = InferRoutes<O["plugins"] extends Array<any> ? Omit<Auth["api"], keyof InferPluginEndpoints<O["plugins"]>> & InferPluginEndpoints<O["plugins"]> : Auth["api"], O>;
|
|
20
|
+
export type InferActions<O extends BetterAuthClientOptions$1> = (O["plugins"] extends Array<infer Plugin> ? UnionToIntersection<Plugin extends {
|
|
21
21
|
getActions?: infer GetActions;
|
|
22
22
|
} ? GetActions extends ((...args: any) => infer Actions) ? Actions : {} : {}> : {}) & InferRoutes<O["$InferAuth"] extends {
|
|
23
23
|
plugins: infer Plugins;
|
|
24
24
|
} ? Plugins extends Array<infer Plugin> ? Plugin extends {
|
|
25
25
|
endpoints?: infer Endpoints;
|
|
26
26
|
} ? Endpoints extends Record<string, unknown> ? Endpoints : {} : {} : {} : {}, O>;
|
|
27
|
-
type InferErrorCodes<O extends BetterAuthClientOptions$1> = O["plugins"] extends Array<infer Plugin> ? UnionToIntersection<Plugin extends {
|
|
27
|
+
export type InferErrorCodes<O extends BetterAuthClientOptions$1> = O["plugins"] extends Array<infer Plugin> ? UnionToIntersection<Plugin extends {
|
|
28
28
|
$InferServerPlugin?: infer ServerPlugin;
|
|
29
29
|
} ? ServerPlugin extends {
|
|
30
30
|
$ERROR_CODES?: infer E;
|
|
31
|
-
} ? { [K in keyof E & string]: E[K] extends ClientPluginError ? ClientPluginError<K> : never } : {} : {}> : {};
|
|
31
|
+
} ? { [K in keyof E & string]: E[K] extends ClientPluginError ? ClientPluginError<K> : never; } : {} : {}> : {};
|
|
32
32
|
/**
|
|
33
33
|
* signals are just used to recall a computed value.
|
|
34
34
|
* as a convention they start with "$"
|
|
35
35
|
*/
|
|
36
|
-
type IsSignal<T> = T extends `$${infer _}` ? true : false;
|
|
37
|
-
type InferSessionFromClient<O extends BetterAuthClientOptions$1> = StripEmptyObjects<Session$1 & UnionToIntersection<InferAdditionalFromClient<O, "session", "output">>>;
|
|
38
|
-
type InferUserFromClient<O extends BetterAuthClientOptions$1> = StripEmptyObjects<User$1 & UnionToIntersection<InferAdditionalFromClient<O, "user", "output">>>;
|
|
39
|
-
type InferAdditionalFromClient<Options extends BetterAuthClientOptions$1, Key extends string, Format extends "input" | "output" = "output"> = Options["plugins"] extends Array<infer Plugin> ? Plugin extends {
|
|
36
|
+
export type IsSignal<T> = T extends `$${infer _}` ? true : false;
|
|
37
|
+
export type InferSessionFromClient<O extends BetterAuthClientOptions$1> = StripEmptyObjects<Session$1 & UnionToIntersection<InferAdditionalFromClient<O, "session", "output">>>;
|
|
38
|
+
export type InferUserFromClient<O extends BetterAuthClientOptions$1> = StripEmptyObjects<User$1 & UnionToIntersection<InferAdditionalFromClient<O, "user", "output">>>;
|
|
39
|
+
export type InferAdditionalFromClient<Options extends BetterAuthClientOptions$1, Key extends string, Format extends "input" | "output" = "output"> = Options["plugins"] extends Array<infer Plugin> ? Plugin extends {
|
|
40
40
|
$InferServerPlugin?: infer ServerPlugin;
|
|
41
41
|
} ? ServerPlugin extends {
|
|
42
42
|
schema?: infer Schema;
|
|
43
43
|
} ? Schema extends Record<Key, {
|
|
44
44
|
fields: infer Fields;
|
|
45
45
|
}> ? Fields extends Record<string, DBFieldAttribute> ? Format extends "input" ? InferFieldsInputClient<Fields> : InferDBFieldsOutput<Fields> : {} : {} : {} : {} : {};
|
|
46
|
-
type SessionQueryParams = {
|
|
46
|
+
export type SessionQueryParams = {
|
|
47
47
|
disableCookieCache?: boolean | undefined;
|
|
48
48
|
disableRefresh?: boolean | undefined;
|
|
49
49
|
};
|
|
50
50
|
//#endregion
|
|
51
|
-
export {
|
|
51
|
+
export type { BetterAuthClientOptions$1 as BetterAuthClientOptions, BetterAuthClientPlugin, ClientAtomListener$1 as ClientAtomListener, ClientStore$1 as ClientStore };
|