better-auth 1.7.12 → 1.7.14
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 +10 -9
- package/dist/plugins/device-authorization/routes.d.mts +7 -5
- 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/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/slack.d.mts +3 -5
- 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
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { Session, User } from "../../types/models.mjs";
|
|
2
|
+
import "../../types/index.mjs";
|
|
2
3
|
import { GenericEndpointContext } from "@better-auth/core";
|
|
3
|
-
import * as _$better_call0 from "better-call";
|
|
4
4
|
import * as z from "zod";
|
|
5
|
-
|
|
6
5
|
//#region src/plugins/one-time-token/index.d.ts
|
|
7
6
|
declare module "@better-auth/core" {
|
|
8
7
|
interface BetterAuthPluginRegistry<AuthOptions, Options> {
|
|
@@ -11,7 +10,7 @@ declare module "@better-auth/core" {
|
|
|
11
10
|
};
|
|
12
11
|
}
|
|
13
12
|
}
|
|
14
|
-
interface OneTimeTokenOptions {
|
|
13
|
+
export interface OneTimeTokenOptions {
|
|
15
14
|
/**
|
|
16
15
|
* Expires in minutes
|
|
17
16
|
*
|
|
@@ -48,7 +47,7 @@ interface OneTimeTokenOptions {
|
|
|
48
47
|
*/
|
|
49
48
|
setOttHeaderOnNewSession?: boolean;
|
|
50
49
|
}
|
|
51
|
-
declare const oneTimeToken: (options?: OneTimeTokenOptions | undefined) => {
|
|
50
|
+
export declare const oneTimeToken: (options?: OneTimeTokenOptions | undefined) => {
|
|
52
51
|
id: "one-time-token";
|
|
53
52
|
version: string;
|
|
54
53
|
endpoints: {
|
|
@@ -67,9 +66,9 @@ declare const oneTimeToken: (options?: OneTimeTokenOptions | undefined) => {
|
|
|
67
66
|
*
|
|
68
67
|
* @see [Read our docs to learn more.](https://better-auth.com/docs/plugins/one-time-token#api-method-one-time-token-generate)
|
|
69
68
|
*/
|
|
70
|
-
generateOneTimeToken:
|
|
69
|
+
generateOneTimeToken: import("better-call").StrictEndpoint<"/one-time-token/generate", {
|
|
71
70
|
method: "GET";
|
|
72
|
-
use:
|
|
71
|
+
use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
73
72
|
session: {
|
|
74
73
|
session: Record<string, any> & {
|
|
75
74
|
id: string;
|
|
@@ -110,7 +109,7 @@ declare const oneTimeToken: (options?: OneTimeTokenOptions | undefined) => {
|
|
|
110
109
|
*
|
|
111
110
|
* @see [Read our docs to learn more.](https://better-auth.com/docs/plugins/one-time-token#api-method-one-time-token-verify)
|
|
112
111
|
*/
|
|
113
|
-
verifyOneTimeToken:
|
|
112
|
+
verifyOneTimeToken: import("better-call").StrictEndpoint<"/one-time-token/verify", {
|
|
114
113
|
method: "POST";
|
|
115
114
|
body: z.ZodObject<{
|
|
116
115
|
token: z.ZodString;
|
|
@@ -123,10 +122,9 @@ declare const oneTimeToken: (options?: OneTimeTokenOptions | undefined) => {
|
|
|
123
122
|
hooks: {
|
|
124
123
|
after: {
|
|
125
124
|
matcher: () => true;
|
|
126
|
-
handler:
|
|
125
|
+
handler: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<void>>;
|
|
127
126
|
}[];
|
|
128
127
|
};
|
|
129
128
|
options: OneTimeTokenOptions | undefined;
|
|
130
129
|
};
|
|
131
|
-
//#endregion
|
|
132
|
-
export { OneTimeTokenOptions, oneTimeToken };
|
|
130
|
+
//#endregion
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { AuthContext, BetterAuthOptions } from "@better-auth/core";
|
|
2
2
|
import { DBFieldAttributeConfig, DBFieldType } from "@better-auth/core/db";
|
|
3
3
|
import { OpenAPIParameter, OpenAPISchemaType } from "better-call";
|
|
4
|
-
|
|
5
4
|
//#region src/plugins/open-api/generator.d.ts
|
|
6
|
-
interface Path {
|
|
5
|
+
export interface Path {
|
|
7
6
|
get?: OpenAPIOperation | undefined;
|
|
8
7
|
post?: OpenAPIOperation | undefined;
|
|
9
8
|
put?: OpenAPIOperation | undefined;
|
|
@@ -11,7 +10,7 @@ interface Path {
|
|
|
11
10
|
delete?: OpenAPIOperation | undefined;
|
|
12
11
|
}
|
|
13
12
|
type OpenAPISchemaPrimitiveType = OpenAPISchemaType | "null";
|
|
14
|
-
type OpenAPISchema = {
|
|
13
|
+
export type OpenAPISchema = {
|
|
15
14
|
type?: OpenAPISchemaPrimitiveType | OpenAPISchemaPrimitiveType[];
|
|
16
15
|
properties?: Record<string, OpenAPISchema>;
|
|
17
16
|
required?: string[];
|
|
@@ -70,8 +69,9 @@ type OpenAPIOperation = {
|
|
|
70
69
|
requestBody?: OpenAPIRequestBody;
|
|
71
70
|
responses?: Record<string, OpenAPIResponse>;
|
|
72
71
|
};
|
|
73
|
-
type FieldSchema = {
|
|
74
|
-
type: DBFieldType | "array";
|
|
72
|
+
export type FieldSchema = {
|
|
73
|
+
type: DBFieldType | "array";
|
|
74
|
+
/** Element schema for `type: "array"` (JSON Schema / OpenAPI array shape). */
|
|
75
75
|
items?: {
|
|
76
76
|
type: string;
|
|
77
77
|
};
|
|
@@ -79,12 +79,12 @@ type FieldSchema = {
|
|
|
79
79
|
readOnly?: boolean | undefined;
|
|
80
80
|
format?: string;
|
|
81
81
|
};
|
|
82
|
-
type OpenAPIModelSchema = {
|
|
82
|
+
export type OpenAPIModelSchema = {
|
|
83
83
|
type: "object";
|
|
84
84
|
properties: Record<string, FieldSchema>;
|
|
85
85
|
required?: string[] | undefined;
|
|
86
86
|
};
|
|
87
|
-
declare function generator(ctx: AuthContext, options: BetterAuthOptions): Promise<{
|
|
87
|
+
export declare function generator(ctx: AuthContext, options: BetterAuthOptions): Promise<{
|
|
88
88
|
openapi: string;
|
|
89
89
|
info: {
|
|
90
90
|
title: string;
|
|
@@ -123,4 +123,4 @@ declare function generator(ctx: AuthContext, options: BetterAuthOptions): Promis
|
|
|
123
123
|
paths: Record<string, Path>;
|
|
124
124
|
}>;
|
|
125
125
|
//#endregion
|
|
126
|
-
export {
|
|
126
|
+
export { OpenAPIParameter$1 as OpenAPIParameter };
|
|
@@ -2,7 +2,7 @@ import { db_exports } from "../../db/index.mjs";
|
|
|
2
2
|
import { getEndpoints } from "../../api/index.mjs";
|
|
3
3
|
import * as z from "zod";
|
|
4
4
|
//#region src/plugins/open-api/generator.ts
|
|
5
|
-
const OPEN_API_SCHEMA_TYPES = new Set([
|
|
5
|
+
const OPEN_API_SCHEMA_TYPES = /* @__PURE__ */ new Set([
|
|
6
6
|
"string",
|
|
7
7
|
"number",
|
|
8
8
|
"boolean",
|
|
@@ -51,7 +51,7 @@ function withDescription(schema, zodType) {
|
|
|
51
51
|
function addNullType(schema) {
|
|
52
52
|
if (schema.type) {
|
|
53
53
|
const type = Array.isArray(schema.type) ? schema.type : [schema.type];
|
|
54
|
-
const nullableType = Array.from(new Set([...type, "null"]));
|
|
54
|
+
const nullableType = Array.from(/* @__PURE__ */ new Set([...type, "null"]));
|
|
55
55
|
return {
|
|
56
56
|
...schema,
|
|
57
57
|
type: nullableType
|
|
@@ -152,7 +152,7 @@ function mergeObjectSchemas(left, right, description) {
|
|
|
152
152
|
if (properties[key] !== void 0 && !areSchemasEqual(properties[key], value)) return;
|
|
153
153
|
properties[key] = value;
|
|
154
154
|
}
|
|
155
|
-
const required = Array.from(new Set([...left.required || [], ...right.required || []]));
|
|
155
|
+
const required = Array.from(/* @__PURE__ */ new Set([...left.required || [], ...right.required || []]));
|
|
156
156
|
const leftAdditionalProperties = left.additionalProperties;
|
|
157
157
|
const rightAdditionalProperties = right.additionalProperties;
|
|
158
158
|
if (!areSchemaMembersCompatible(leftAdditionalProperties, rightAdditionalProperties)) return;
|
|
@@ -184,7 +184,7 @@ function getRequestBody(options) {
|
|
|
184
184
|
* Paths that accept `user.additionalFields` and plugin user schema fields via
|
|
185
185
|
* `parseUserInput`. Their static OpenAPI request bodies need those fields merged in.
|
|
186
186
|
*/
|
|
187
|
-
const USER_INPUT_BODY_PATHS = new Set(["/sign-up/email", "/update-user"]);
|
|
187
|
+
const USER_INPUT_BODY_PATHS = /* @__PURE__ */ new Set(["/sign-up/email", "/update-user"]);
|
|
188
188
|
function dbFieldToRequestBodyProperty(field) {
|
|
189
189
|
if (field.type === "date") return {
|
|
190
190
|
type: "string",
|
|
@@ -414,7 +414,7 @@ async function generator(ctx, options) {
|
|
|
414
414
|
const components = { schemas: { ...Object.entries(tables).reduce((acc, [key, value]) => {
|
|
415
415
|
const modelName = key.charAt(0).toUpperCase() + key.slice(1);
|
|
416
416
|
const fields = value.fields;
|
|
417
|
-
const required = new Set(["id"]);
|
|
417
|
+
const required = /* @__PURE__ */ new Set(["id"]);
|
|
418
418
|
const properties = { id: {
|
|
419
419
|
type: "string",
|
|
420
420
|
readOnly: true
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { FieldSchema, OpenAPIModelSchema, OpenAPIParameter, OpenAPISchema, Path, generator } from "./generator.mjs";
|
|
2
2
|
import { LiteralString } from "@better-auth/core";
|
|
3
|
-
import * as _$better_call0 from "better-call";
|
|
4
|
-
|
|
5
3
|
//#region src/plugins/open-api/index.d.ts
|
|
6
4
|
declare module "@better-auth/core" {
|
|
7
5
|
interface BetterAuthPluginRegistry<AuthOptions, Options> {
|
|
@@ -11,7 +9,7 @@ declare module "@better-auth/core" {
|
|
|
11
9
|
}
|
|
12
10
|
}
|
|
13
11
|
type ScalarTheme = "alternate" | "default" | "moon" | "purple" | "solarized" | "bluePlanet" | "saturn" | "kepler" | "mars" | "deepSpace" | "laserwave" | "none";
|
|
14
|
-
interface OpenAPIOptions {
|
|
12
|
+
export interface OpenAPIOptions {
|
|
15
13
|
/**
|
|
16
14
|
* The path to the OpenAPI reference page
|
|
17
15
|
*
|
|
@@ -40,11 +38,11 @@ interface OpenAPIOptions {
|
|
|
40
38
|
*/
|
|
41
39
|
nonce?: string | undefined;
|
|
42
40
|
}
|
|
43
|
-
declare const openAPI: <O extends OpenAPIOptions>(options?: O | undefined) => {
|
|
41
|
+
export declare const openAPI: <O extends OpenAPIOptions>(options?: O | undefined) => {
|
|
44
42
|
id: "open-api";
|
|
45
43
|
version: string;
|
|
46
44
|
endpoints: {
|
|
47
|
-
generateOpenAPISchema:
|
|
45
|
+
generateOpenAPISchema: import("better-call").StrictEndpoint<"/open-api/generate-schema", {
|
|
48
46
|
method: "GET";
|
|
49
47
|
}, {
|
|
50
48
|
openapi: string;
|
|
@@ -84,7 +82,7 @@ declare const openAPI: <O extends OpenAPIOptions>(options?: O | undefined) => {
|
|
|
84
82
|
}[];
|
|
85
83
|
paths: Record<string, Path>;
|
|
86
84
|
}>;
|
|
87
|
-
openAPIReference:
|
|
85
|
+
openAPIReference: import("better-call").StrictEndpoint<LiteralString | "/reference", {
|
|
88
86
|
method: "GET";
|
|
89
87
|
metadata: {
|
|
90
88
|
readonly scope: "server";
|
|
@@ -94,4 +92,4 @@ declare const openAPI: <O extends OpenAPIOptions>(options?: O | undefined) => {
|
|
|
94
92
|
options: NoInfer<O>;
|
|
95
93
|
};
|
|
96
94
|
//#endregion
|
|
97
|
-
export {
|
|
95
|
+
export type { FieldSchema, OpenAPIModelSchema, OpenAPIParameter, OpenAPISchema, Path, generator };
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { adminAc, defaultAc, defaultRoles, defaultStatements, memberAc, ownerAc };
|
|
1
|
+
export { adminAc, defaultAc, defaultRoles, defaultStatements, memberAc, ownerAc } from "./statement.mjs";
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { ExactRoleStatements, Role, RoleInput, Statements } from "../../access/types.mjs";
|
|
2
|
+
import "../../index.mjs";
|
|
2
3
|
//#region src/plugins/organization/access/statement.d.ts
|
|
3
|
-
declare const defaultStatements: {
|
|
4
|
+
export declare const defaultStatements: {
|
|
4
5
|
readonly organization: readonly ["update", "delete"];
|
|
5
6
|
readonly member: readonly ["create", "update", "delete"];
|
|
6
7
|
readonly invitation: readonly ["create", "cancel"];
|
|
7
8
|
readonly team: readonly ["create", "update", "delete"];
|
|
8
9
|
readonly ac: readonly ["create", "read", "update", "delete"];
|
|
9
10
|
};
|
|
10
|
-
declare const defaultAc: {
|
|
11
|
+
export declare const defaultAc: {
|
|
11
12
|
newRole<const TRoleStatements extends Statements>(statements: RoleInput<{
|
|
12
13
|
readonly organization: readonly ["update", "delete"];
|
|
13
14
|
readonly member: readonly ["create", "update", "delete"];
|
|
@@ -29,7 +30,7 @@ declare const defaultAc: {
|
|
|
29
30
|
readonly ac: readonly ["create", "read", "update", "delete"];
|
|
30
31
|
};
|
|
31
32
|
};
|
|
32
|
-
declare const adminAc: Role<ExactRoleStatements<{
|
|
33
|
+
export declare const adminAc: Role<ExactRoleStatements<{
|
|
33
34
|
readonly organization: ["update"];
|
|
34
35
|
readonly invitation: ["create", "cancel"];
|
|
35
36
|
readonly member: ["create", "update", "delete"];
|
|
@@ -42,7 +43,7 @@ declare const adminAc: Role<ExactRoleStatements<{
|
|
|
42
43
|
readonly team: readonly ["create", "update", "delete"];
|
|
43
44
|
readonly ac: readonly ["create", "read", "update", "delete"];
|
|
44
45
|
}>;
|
|
45
|
-
declare const ownerAc: Role<ExactRoleStatements<{
|
|
46
|
+
export declare const ownerAc: Role<ExactRoleStatements<{
|
|
46
47
|
readonly organization: ["update", "delete"];
|
|
47
48
|
readonly member: ["create", "update", "delete"];
|
|
48
49
|
readonly invitation: ["create", "cancel"];
|
|
@@ -55,7 +56,7 @@ declare const ownerAc: Role<ExactRoleStatements<{
|
|
|
55
56
|
readonly team: readonly ["create", "update", "delete"];
|
|
56
57
|
readonly ac: readonly ["create", "read", "update", "delete"];
|
|
57
58
|
}>;
|
|
58
|
-
declare const memberAc: Role<ExactRoleStatements<{
|
|
59
|
+
export declare const memberAc: Role<ExactRoleStatements<{
|
|
59
60
|
readonly organization: [];
|
|
60
61
|
readonly member: [];
|
|
61
62
|
readonly invitation: [];
|
|
@@ -68,7 +69,7 @@ declare const memberAc: Role<ExactRoleStatements<{
|
|
|
68
69
|
readonly team: readonly ["create", "update", "delete"];
|
|
69
70
|
readonly ac: readonly ["create", "read", "update", "delete"];
|
|
70
71
|
}>;
|
|
71
|
-
declare const defaultRoles: {
|
|
72
|
+
export declare const defaultRoles: {
|
|
72
73
|
admin: Role<ExactRoleStatements<{
|
|
73
74
|
readonly organization: ["update"];
|
|
74
75
|
readonly invitation: ["create", "cancel"];
|
|
@@ -109,5 +110,4 @@ declare const defaultRoles: {
|
|
|
109
110
|
readonly ac: readonly ["create", "read", "update", "delete"];
|
|
110
111
|
}>;
|
|
111
112
|
};
|
|
112
|
-
//#endregion
|
|
113
|
-
export { adminAc, defaultAc, defaultRoles, defaultStatements, memberAc, ownerAc };
|
|
113
|
+
//#endregion
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { FieldAttributeToObject, InferAdditionalFieldsFromPluginOptions, RemoveFieldsWithReturnedFalse } from "../../db/field.mjs";
|
|
2
|
-
import { User
|
|
2
|
+
import { User } from "../../types/models.mjs";
|
|
3
|
+
import "../../types/index.mjs";
|
|
4
|
+
import "../../db/index.mjs";
|
|
3
5
|
import { OrganizationOptions } from "./types.mjs";
|
|
4
6
|
import { InferInvitation, InferMember, InferOrganization, InferOrganizationRolesFromOption, InferTeam, InvitationStatus, MemberInput, OrganizationInput, TeamInput, TeamMember } from "./schema.mjs";
|
|
5
7
|
import { AuthContext, GenericEndpointContext } from "@better-auth/core";
|
|
6
|
-
import * as _$_better_auth_core_db0 from "@better-auth/core/db";
|
|
7
8
|
import { WhereOperator } from "@better-auth/core/db/adapter";
|
|
8
|
-
|
|
9
9
|
//#region src/plugins/organization/adapter.d.ts
|
|
10
|
-
declare const getOrgAdapter: <O extends OrganizationOptions>(context: AuthContext, options?: O | undefined) => {
|
|
10
|
+
export declare const getOrgAdapter: <O extends OrganizationOptions>(context: AuthContext, options?: O | undefined) => {
|
|
11
11
|
findOrganizationBySlug: (slug: string) => Promise<InferOrganization<O> | null>;
|
|
12
12
|
createOrganization: (data: {
|
|
13
13
|
organization: OrganizationInput & Record<string, any>;
|
|
@@ -44,9 +44,9 @@ declare const getOrgAdapter: <O extends OrganizationOptions>(context: AuthContex
|
|
|
44
44
|
};
|
|
45
45
|
}) & (O["schema"] extends {
|
|
46
46
|
member?: {
|
|
47
|
-
additionalFields: infer Field extends Record<string,
|
|
47
|
+
additionalFields: infer Field extends Record<string, import("@better-auth/core/db").DBFieldAttribute>;
|
|
48
48
|
} | undefined;
|
|
49
|
-
} ? FieldAttributeToObject<Field> : {}) extends infer T ? { [K in keyof T]: T[K] } : never) & {
|
|
49
|
+
} ? FieldAttributeToObject<Field> : {}) extends (infer T) ? { [K in keyof T]: T[K]; } : never) & {
|
|
50
50
|
user: {
|
|
51
51
|
id: string;
|
|
52
52
|
name: string;
|
|
@@ -95,9 +95,9 @@ declare const getOrgAdapter: <O extends OrganizationOptions>(context: AuthContex
|
|
|
95
95
|
};
|
|
96
96
|
}) & (O["schema"] extends {
|
|
97
97
|
member?: {
|
|
98
|
-
additionalFields: infer Field extends Record<string,
|
|
98
|
+
additionalFields: infer Field extends Record<string, import("@better-auth/core/db").DBFieldAttribute>;
|
|
99
99
|
} | undefined;
|
|
100
|
-
} ? FieldAttributeToObject<Field> : {}) extends infer T ? { [K in keyof T]: T[K] } : never) & {
|
|
100
|
+
} ? FieldAttributeToObject<Field> : {}) extends (infer T) ? { [K in keyof T]: T[K]; } : never) & {
|
|
101
101
|
user: {
|
|
102
102
|
id: string;
|
|
103
103
|
name: string;
|
|
@@ -139,10 +139,10 @@ declare const getOrgAdapter: <O extends OrganizationOptions>(context: AuthContex
|
|
|
139
139
|
};
|
|
140
140
|
}) & (O["schema"] extends {
|
|
141
141
|
member?: {
|
|
142
|
-
additionalFields: infer Field extends Record<string,
|
|
142
|
+
additionalFields: infer Field extends Record<string, import("@better-auth/core/db").DBFieldAttribute>;
|
|
143
143
|
} | undefined;
|
|
144
|
-
} ? FieldAttributeToObject<Field> : {}) extends infer T ? { [K in keyof T]: T[K] } : never) & {
|
|
145
|
-
user: User
|
|
144
|
+
} ? FieldAttributeToObject<Field> : {}) extends (infer T) ? { [K in keyof T]: T[K]; } : never) & {
|
|
145
|
+
user: User;
|
|
146
146
|
}, "user"> & {
|
|
147
147
|
user: {
|
|
148
148
|
id: string;
|
|
@@ -180,9 +180,9 @@ declare const getOrgAdapter: <O extends OrganizationOptions>(context: AuthContex
|
|
|
180
180
|
};
|
|
181
181
|
}) & (O["schema"] extends {
|
|
182
182
|
member?: {
|
|
183
|
-
additionalFields: infer Field extends Record<string,
|
|
183
|
+
additionalFields: infer Field extends Record<string, import("@better-auth/core/db").DBFieldAttribute>;
|
|
184
184
|
} | undefined;
|
|
185
|
-
} ? FieldAttributeToObject<Field> : {}) extends infer T ? { [K in keyof T]: T[K] } : never) & {
|
|
185
|
+
} ? FieldAttributeToObject<Field> : {}) extends (infer T) ? { [K in keyof T]: T[K]; } : never) & {
|
|
186
186
|
user: {
|
|
187
187
|
id: string;
|
|
188
188
|
name: string;
|
|
@@ -226,14 +226,10 @@ declare const getOrgAdapter: <O extends OrganizationOptions>(context: AuthContex
|
|
|
226
226
|
};
|
|
227
227
|
}) & (O["schema"] extends {
|
|
228
228
|
member?: {
|
|
229
|
-
additionalFields: infer Field extends Record<string,
|
|
229
|
+
additionalFields: infer Field extends Record<string, import("@better-auth/core/db").DBFieldAttribute>;
|
|
230
230
|
} | undefined;
|
|
231
|
-
} ? FieldAttributeToObject<Field> : {}) extends infer T ? { [K in keyof T]: T[K] } : never) | null>;
|
|
232
|
-
deleteMember: ({
|
|
233
|
-
memberId,
|
|
234
|
-
organizationId,
|
|
235
|
-
userId: _userId
|
|
236
|
-
}: {
|
|
231
|
+
} ? FieldAttributeToObject<Field> : {}) extends (infer T) ? { [K in keyof T]: T[K]; } : never) | null>;
|
|
232
|
+
deleteMember: ({ memberId, organizationId, userId: _userId }: {
|
|
237
233
|
memberId: string;
|
|
238
234
|
organizationId: string;
|
|
239
235
|
userId?: string;
|
|
@@ -251,10 +247,7 @@ declare const getOrgAdapter: <O extends OrganizationOptions>(context: AuthContex
|
|
|
251
247
|
userAgent?: string | null | undefined;
|
|
252
248
|
}>;
|
|
253
249
|
findOrganizationById: (organizationId: string) => Promise<InferOrganization<O> | null>;
|
|
254
|
-
checkMembership: ({
|
|
255
|
-
userId,
|
|
256
|
-
organizationId
|
|
257
|
-
}: {
|
|
250
|
+
checkMembership: ({ userId, organizationId }: {
|
|
258
251
|
userId: string;
|
|
259
252
|
organizationId: string;
|
|
260
253
|
}) => Promise<((O["teams"] extends {
|
|
@@ -286,18 +279,13 @@ declare const getOrgAdapter: <O extends OrganizationOptions>(context: AuthContex
|
|
|
286
279
|
};
|
|
287
280
|
}) & (O["schema"] extends {
|
|
288
281
|
member?: {
|
|
289
|
-
additionalFields: infer Field extends Record<string,
|
|
282
|
+
additionalFields: infer Field extends Record<string, import("@better-auth/core/db").DBFieldAttribute>;
|
|
290
283
|
} | undefined;
|
|
291
|
-
} ? FieldAttributeToObject<Field> : {}) extends infer T ? { [K in keyof T]: T[K] } : never) | null>;
|
|
284
|
+
} ? FieldAttributeToObject<Field> : {}) extends (infer T) ? { [K in keyof T]: T[K]; } : never) | null>;
|
|
292
285
|
/**
|
|
293
286
|
* @requires db
|
|
294
287
|
*/
|
|
295
|
-
findFullOrganization: ({
|
|
296
|
-
organizationId,
|
|
297
|
-
isSlug,
|
|
298
|
-
includeTeams,
|
|
299
|
-
membersLimit
|
|
300
|
-
}: {
|
|
288
|
+
findFullOrganization: ({ organizationId, isSlug, includeTeams, membersLimit }: {
|
|
301
289
|
organizationId: string;
|
|
302
290
|
isSlug?: boolean | undefined;
|
|
303
291
|
includeTeams?: boolean | undefined;
|
|
@@ -311,9 +299,9 @@ declare const getOrgAdapter: <O extends OrganizationOptions>(context: AuthContex
|
|
|
311
299
|
metadata?: any;
|
|
312
300
|
} & (O["schema"] extends {
|
|
313
301
|
organization?: {
|
|
314
|
-
additionalFields: infer Field extends Record<string,
|
|
302
|
+
additionalFields: infer Field extends Record<string, import("@better-auth/core/db").DBFieldAttribute>;
|
|
315
303
|
} | undefined;
|
|
316
|
-
} ? FieldAttributeToObject<Field> : {}) extends infer T ? { [K in keyof T]: T[K] } : never) & {
|
|
304
|
+
} ? FieldAttributeToObject<Field> : {}) extends (infer T) ? { [K in keyof T]: T[K]; } : never) & {
|
|
317
305
|
invitation: InferInvitation<O>[];
|
|
318
306
|
member: InferMember<O>[];
|
|
319
307
|
team: InferTeam<O>[] | undefined;
|
|
@@ -341,9 +329,9 @@ declare const getOrgAdapter: <O extends OrganizationOptions>(context: AuthContex
|
|
|
341
329
|
createdAt: Date;
|
|
342
330
|
}) & (O["schema"] extends {
|
|
343
331
|
invitation?: {
|
|
344
|
-
additionalFields: infer Field extends Record<string,
|
|
332
|
+
additionalFields: infer Field extends Record<string, import("@better-auth/core/db").DBFieldAttribute>;
|
|
345
333
|
} | undefined;
|
|
346
|
-
} ? FieldAttributeToObject<RemoveFieldsWithReturnedFalse<Field>> : {}) extends infer T_1 ? { [K_1 in keyof T_1]: T_1[K_1] } : never)[];
|
|
334
|
+
} ? FieldAttributeToObject<RemoveFieldsWithReturnedFalse<Field>> : {}) extends (infer T_1) ? { [K_1 in keyof T_1]: T_1[K_1]; } : never)[];
|
|
347
335
|
members: (((O["teams"] extends {
|
|
348
336
|
enabled: true;
|
|
349
337
|
} ? {
|
|
@@ -373,9 +361,9 @@ declare const getOrgAdapter: <O extends OrganizationOptions>(context: AuthContex
|
|
|
373
361
|
};
|
|
374
362
|
}) & (O["schema"] extends {
|
|
375
363
|
member?: {
|
|
376
|
-
additionalFields: infer Field extends Record<string,
|
|
364
|
+
additionalFields: infer Field extends Record<string, import("@better-auth/core/db").DBFieldAttribute>;
|
|
377
365
|
} | undefined;
|
|
378
|
-
} ? FieldAttributeToObject<RemoveFieldsWithReturnedFalse<Field>> : {}) extends infer T_2 ? { [K_2 in keyof T_2]: T_2[K_2] } : never) & {
|
|
366
|
+
} ? FieldAttributeToObject<RemoveFieldsWithReturnedFalse<Field>> : {}) extends (infer T_2) ? { [K_2 in keyof T_2]: T_2[K_2]; } : never) & {
|
|
379
367
|
user: {
|
|
380
368
|
id: string;
|
|
381
369
|
name: string;
|
|
@@ -391,9 +379,9 @@ declare const getOrgAdapter: <O extends OrganizationOptions>(context: AuthContex
|
|
|
391
379
|
updatedAt?: Date | undefined;
|
|
392
380
|
} & (O["schema"] extends {
|
|
393
381
|
team?: {
|
|
394
|
-
additionalFields: infer Field extends Record<string,
|
|
382
|
+
additionalFields: infer Field extends Record<string, import("@better-auth/core/db").DBFieldAttribute>;
|
|
395
383
|
} | undefined;
|
|
396
|
-
} ? FieldAttributeToObject<RemoveFieldsWithReturnedFalse<Field>> : {}) extends infer T_3 ? { [K_3 in keyof T_3]: T_3[K_3] } : never)[] | undefined;
|
|
384
|
+
} ? FieldAttributeToObject<RemoveFieldsWithReturnedFalse<Field>> : {}) extends (infer T_3) ? { [K_3 in keyof T_3]: T_3[K_3]; } : never)[] | undefined;
|
|
397
385
|
}) | null>;
|
|
398
386
|
listOrganizations: (userId: string) => Promise<InferOrganization<O>[]>;
|
|
399
387
|
createTeam: (data: TeamInput) => Promise<{
|
|
@@ -404,14 +392,10 @@ declare const getOrgAdapter: <O extends OrganizationOptions>(context: AuthContex
|
|
|
404
392
|
updatedAt?: Date | undefined;
|
|
405
393
|
} & (O["schema"] extends {
|
|
406
394
|
team?: {
|
|
407
|
-
additionalFields: infer Field extends Record<string,
|
|
395
|
+
additionalFields: infer Field extends Record<string, import("@better-auth/core/db").DBFieldAttribute>;
|
|
408
396
|
} | undefined;
|
|
409
|
-
} ? FieldAttributeToObject<RemoveFieldsWithReturnedFalse<Field>> : {}) extends infer T ? { [K in keyof T]: T[K] } : never>;
|
|
410
|
-
findTeamById: <IncludeMembers extends boolean>({
|
|
411
|
-
teamId,
|
|
412
|
-
organizationId,
|
|
413
|
-
includeTeamMembers
|
|
414
|
-
}: {
|
|
397
|
+
} ? FieldAttributeToObject<RemoveFieldsWithReturnedFalse<Field>> : {}) extends (infer T) ? { [K in keyof T]: T[K]; } : never>;
|
|
398
|
+
findTeamById: <IncludeMembers extends boolean>({ teamId, organizationId, includeTeamMembers }: {
|
|
415
399
|
teamId: string;
|
|
416
400
|
organizationId?: string | undefined;
|
|
417
401
|
includeTeamMembers?: IncludeMembers | undefined;
|
|
@@ -430,9 +414,9 @@ declare const getOrgAdapter: <O extends OrganizationOptions>(context: AuthContex
|
|
|
430
414
|
updatedAt?: Date | undefined;
|
|
431
415
|
} & (O["schema"] extends {
|
|
432
416
|
team?: {
|
|
433
|
-
additionalFields: infer Field extends Record<string,
|
|
417
|
+
additionalFields: infer Field extends Record<string, import("@better-auth/core/db").DBFieldAttribute>;
|
|
434
418
|
} | undefined;
|
|
435
|
-
} ? FieldAttributeToObject<RemoveFieldsWithReturnedFalse<Field>> : {}) extends infer T ? { [K in keyof T]: T[K] } : never) | null>;
|
|
419
|
+
} ? FieldAttributeToObject<RemoveFieldsWithReturnedFalse<Field>> : {}) extends (infer T) ? { [K in keyof T]: T[K]; } : never) | null>;
|
|
436
420
|
deleteTeam: (teamId: string) => Promise<void>;
|
|
437
421
|
listTeams: (organizationId: string) => Promise<({
|
|
438
422
|
id: string;
|
|
@@ -442,17 +426,10 @@ declare const getOrgAdapter: <O extends OrganizationOptions>(context: AuthContex
|
|
|
442
426
|
updatedAt?: Date | undefined;
|
|
443
427
|
} & (O["schema"] extends {
|
|
444
428
|
team?: {
|
|
445
|
-
additionalFields: infer Field extends Record<string,
|
|
429
|
+
additionalFields: infer Field extends Record<string, import("@better-auth/core/db").DBFieldAttribute>;
|
|
446
430
|
} | undefined;
|
|
447
|
-
} ? FieldAttributeToObject<RemoveFieldsWithReturnedFalse<Field>> : {}) extends infer T ? { [K in keyof T]: T[K] } : never)[]>;
|
|
448
|
-
createTeamInvitation: ({
|
|
449
|
-
email,
|
|
450
|
-
role,
|
|
451
|
-
teamId,
|
|
452
|
-
organizationId,
|
|
453
|
-
inviterId,
|
|
454
|
-
expiresIn
|
|
455
|
-
}: {
|
|
431
|
+
} ? FieldAttributeToObject<RemoveFieldsWithReturnedFalse<Field>> : {}) extends (infer T) ? { [K in keyof T]: T[K]; } : never)[]>;
|
|
432
|
+
createTeamInvitation: ({ email, role, teamId, organizationId, inviterId, expiresIn }: {
|
|
456
433
|
email: string;
|
|
457
434
|
role: string;
|
|
458
435
|
teamId: string;
|
|
@@ -482,9 +459,9 @@ declare const getOrgAdapter: <O extends OrganizationOptions>(context: AuthContex
|
|
|
482
459
|
createdAt: Date;
|
|
483
460
|
}) & (O["schema"] extends {
|
|
484
461
|
invitation?: {
|
|
485
|
-
additionalFields: infer Field extends Record<string,
|
|
462
|
+
additionalFields: infer Field extends Record<string, import("@better-auth/core/db").DBFieldAttribute>;
|
|
486
463
|
} | undefined;
|
|
487
|
-
} ? FieldAttributeToObject<RemoveFieldsWithReturnedFalse<Field>> : {}) extends infer T ? { [K in keyof T]: T[K] } : never>;
|
|
464
|
+
} ? FieldAttributeToObject<RemoveFieldsWithReturnedFalse<Field>> : {}) extends (infer T) ? { [K in keyof T]: T[K]; } : never>;
|
|
488
465
|
setActiveTeam: (sessionToken: string, teamId: string | null, ctx: GenericEndpointContext) => Promise<{
|
|
489
466
|
id: string;
|
|
490
467
|
createdAt: Date;
|
|
@@ -519,9 +496,9 @@ declare const getOrgAdapter: <O extends OrganizationOptions>(context: AuthContex
|
|
|
519
496
|
updatedAt?: Date | undefined;
|
|
520
497
|
} & (O["schema"] extends {
|
|
521
498
|
team?: {
|
|
522
|
-
additionalFields: infer Field extends Record<string,
|
|
499
|
+
additionalFields: infer Field extends Record<string, import("@better-auth/core/db").DBFieldAttribute>;
|
|
523
500
|
} | undefined;
|
|
524
|
-
} ? FieldAttributeToObject<RemoveFieldsWithReturnedFalse<Field>> : {}) extends infer T ? { [K in keyof T]: T[K] } : never)[]>;
|
|
501
|
+
} ? FieldAttributeToObject<RemoveFieldsWithReturnedFalse<Field>> : {}) extends (infer T) ? { [K in keyof T]: T[K]; } : never)[]>;
|
|
525
502
|
findTeamMember: (data: {
|
|
526
503
|
teamId: string;
|
|
527
504
|
userId: string;
|
|
@@ -583,9 +560,9 @@ declare const getOrgAdapter: <O extends OrganizationOptions>(context: AuthContex
|
|
|
583
560
|
createdAt: Date;
|
|
584
561
|
}) & (O["schema"] extends {
|
|
585
562
|
invitation?: {
|
|
586
|
-
additionalFields: infer Field extends Record<string,
|
|
563
|
+
additionalFields: infer Field extends Record<string, import("@better-auth/core/db").DBFieldAttribute>;
|
|
587
564
|
} | undefined;
|
|
588
|
-
} ? FieldAttributeToObject<Field> : {}) extends infer T ? { [K in keyof T]: T[K] } : never)[]>;
|
|
565
|
+
} ? FieldAttributeToObject<Field> : {}) extends (infer T) ? { [K in keyof T]: T[K]; } : never)[]>;
|
|
589
566
|
listUserInvitations: (email: string) => Promise<(Omit<((O["teams"] extends {
|
|
590
567
|
enabled: true;
|
|
591
568
|
} ? {
|
|
@@ -609,9 +586,9 @@ declare const getOrgAdapter: <O extends OrganizationOptions>(context: AuthContex
|
|
|
609
586
|
createdAt: Date;
|
|
610
587
|
}) & (O["schema"] extends {
|
|
611
588
|
invitation?: {
|
|
612
|
-
additionalFields: infer Field extends Record<string,
|
|
589
|
+
additionalFields: infer Field extends Record<string, import("@better-auth/core/db").DBFieldAttribute>;
|
|
613
590
|
} | undefined;
|
|
614
|
-
} ? FieldAttributeToObject<Field> : {}) extends infer T ? { [K in keyof T]: T[K] } : never) & {
|
|
591
|
+
} ? FieldAttributeToObject<Field> : {}) extends (infer T) ? { [K in keyof T]: T[K]; } : never) & {
|
|
615
592
|
organization: InferOrganization<O, false>;
|
|
616
593
|
}, "organization"> & {
|
|
617
594
|
organizationName: ({
|
|
@@ -623,21 +600,18 @@ declare const getOrgAdapter: <O extends OrganizationOptions>(context: AuthContex
|
|
|
623
600
|
metadata?: any;
|
|
624
601
|
} & (O["schema"] extends {
|
|
625
602
|
organization?: {
|
|
626
|
-
additionalFields: infer Field extends Record<string,
|
|
603
|
+
additionalFields: infer Field extends Record<string, import("@better-auth/core/db").DBFieldAttribute>;
|
|
627
604
|
} | undefined;
|
|
628
605
|
} ? FieldAttributeToObject<Field> : {}))["name"];
|
|
629
606
|
})[]>;
|
|
630
|
-
createInvitation: ({
|
|
631
|
-
invitation,
|
|
632
|
-
user
|
|
633
|
-
}: {
|
|
607
|
+
createInvitation: ({ invitation, user }: {
|
|
634
608
|
invitation: {
|
|
635
609
|
email: string;
|
|
636
610
|
role: string;
|
|
637
611
|
organizationId: string;
|
|
638
612
|
teamIds: string[];
|
|
639
613
|
} & Record<string, any>;
|
|
640
|
-
user: User
|
|
614
|
+
user: User;
|
|
641
615
|
}) => Promise<(O["teams"] extends {
|
|
642
616
|
enabled: true;
|
|
643
617
|
} ? {
|
|
@@ -661,9 +635,9 @@ declare const getOrgAdapter: <O extends OrganizationOptions>(context: AuthContex
|
|
|
661
635
|
createdAt: Date;
|
|
662
636
|
}) & (O["schema"] extends {
|
|
663
637
|
invitation?: {
|
|
664
|
-
additionalFields: infer Field extends Record<string,
|
|
638
|
+
additionalFields: infer Field extends Record<string, import("@better-auth/core/db").DBFieldAttribute>;
|
|
665
639
|
} | undefined;
|
|
666
|
-
} ? FieldAttributeToObject<Field> : {}) extends infer T ? { [K in keyof T]: T[K] } : never>;
|
|
640
|
+
} ? FieldAttributeToObject<Field> : {}) extends (infer T) ? { [K in keyof T]: T[K]; } : never>;
|
|
667
641
|
findInvitationById: (id: string) => Promise<((O["teams"] extends {
|
|
668
642
|
enabled: true;
|
|
669
643
|
} ? {
|
|
@@ -687,9 +661,9 @@ declare const getOrgAdapter: <O extends OrganizationOptions>(context: AuthContex
|
|
|
687
661
|
createdAt: Date;
|
|
688
662
|
}) & (O["schema"] extends {
|
|
689
663
|
invitation?: {
|
|
690
|
-
additionalFields: infer Field extends Record<string,
|
|
664
|
+
additionalFields: infer Field extends Record<string, import("@better-auth/core/db").DBFieldAttribute>;
|
|
691
665
|
} | undefined;
|
|
692
|
-
} ? FieldAttributeToObject<Field> : {}) extends infer T ? { [K in keyof T]: T[K] } : never) | null>;
|
|
666
|
+
} ? FieldAttributeToObject<Field> : {}) extends (infer T) ? { [K in keyof T]: T[K]; } : never) | null>;
|
|
693
667
|
findPendingInvitation: (data: {
|
|
694
668
|
email: string;
|
|
695
669
|
organizationId: string;
|
|
@@ -716,9 +690,9 @@ declare const getOrgAdapter: <O extends OrganizationOptions>(context: AuthContex
|
|
|
716
690
|
createdAt: Date;
|
|
717
691
|
}) & (O["schema"] extends {
|
|
718
692
|
invitation?: {
|
|
719
|
-
additionalFields: infer Field extends Record<string,
|
|
693
|
+
additionalFields: infer Field extends Record<string, import("@better-auth/core/db").DBFieldAttribute>;
|
|
720
694
|
} | undefined;
|
|
721
|
-
} ? FieldAttributeToObject<Field> : {}) extends infer T ? { [K in keyof T]: T[K] } : never)[]>;
|
|
695
|
+
} ? FieldAttributeToObject<Field> : {}) extends (infer T) ? { [K in keyof T]: T[K]; } : never)[]>;
|
|
722
696
|
findPendingInvitations: (data: {
|
|
723
697
|
organizationId: string;
|
|
724
698
|
}) => Promise<((O["teams"] extends {
|
|
@@ -744,9 +718,9 @@ declare const getOrgAdapter: <O extends OrganizationOptions>(context: AuthContex
|
|
|
744
718
|
createdAt: Date;
|
|
745
719
|
}) & (O["schema"] extends {
|
|
746
720
|
invitation?: {
|
|
747
|
-
additionalFields: infer Field extends Record<string,
|
|
721
|
+
additionalFields: infer Field extends Record<string, import("@better-auth/core/db").DBFieldAttribute>;
|
|
748
722
|
} | undefined;
|
|
749
|
-
} ? FieldAttributeToObject<Field> : {}) extends infer T ? { [K in keyof T]: T[K] } : never)[]>;
|
|
723
|
+
} ? FieldAttributeToObject<Field> : {}) extends (infer T) ? { [K in keyof T]: T[K]; } : never)[]>;
|
|
750
724
|
listInvitations: (data: {
|
|
751
725
|
organizationId: string;
|
|
752
726
|
}) => Promise<((O["teams"] extends {
|
|
@@ -772,9 +746,9 @@ declare const getOrgAdapter: <O extends OrganizationOptions>(context: AuthContex
|
|
|
772
746
|
createdAt: Date;
|
|
773
747
|
}) & (O["schema"] extends {
|
|
774
748
|
invitation?: {
|
|
775
|
-
additionalFields: infer Field extends Record<string,
|
|
749
|
+
additionalFields: infer Field extends Record<string, import("@better-auth/core/db").DBFieldAttribute>;
|
|
776
750
|
} | undefined;
|
|
777
|
-
} ? FieldAttributeToObject<Field> : {}) extends infer T ? { [K in keyof T]: T[K] } : never)[]>;
|
|
751
|
+
} ? FieldAttributeToObject<Field> : {}) extends (infer T) ? { [K in keyof T]: T[K]; } : never)[]>;
|
|
778
752
|
updateInvitation: (data: {
|
|
779
753
|
invitationId: string;
|
|
780
754
|
status: "pending" | "accepted" | "canceled" | "rejected";
|
|
@@ -807,9 +781,8 @@ declare const getOrgAdapter: <O extends OrganizationOptions>(context: AuthContex
|
|
|
807
781
|
createdAt: Date;
|
|
808
782
|
}) & (O["schema"] extends {
|
|
809
783
|
invitation?: {
|
|
810
|
-
additionalFields: infer Field extends Record<string,
|
|
784
|
+
additionalFields: infer Field extends Record<string, import("@better-auth/core/db").DBFieldAttribute>;
|
|
811
785
|
} | undefined;
|
|
812
|
-
} ? FieldAttributeToObject<Field> : {}) extends infer T ? { [K in keyof T]: T[K] } : never) | null>;
|
|
786
|
+
} ? FieldAttributeToObject<Field> : {}) extends (infer T) ? { [K in keyof T]: T[K]; } : never) | null>;
|
|
813
787
|
};
|
|
814
|
-
//#endregion
|
|
815
|
-
export { getOrgAdapter };
|
|
788
|
+
//#endregion
|