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,31 +1,30 @@
|
|
|
1
1
|
import { FieldAttributeToObject, InferAdditionalFieldsFromPluginOptions, RemoveFieldsWithReturnedFalse } from "../../../db/field.mjs";
|
|
2
2
|
import { PrettifyDeep } from "../../../types/helper.mjs";
|
|
3
3
|
import { Role } from "../../access/types.mjs";
|
|
4
|
+
import "../../../db/index.mjs";
|
|
4
5
|
import { OrganizationOptions } from "../types.mjs";
|
|
5
6
|
import { teamSchema } from "../schema.mjs";
|
|
7
|
+
import "../../index.mjs";
|
|
6
8
|
import { defaultRoles } from "../access/statement.mjs";
|
|
7
|
-
import
|
|
8
|
-
import * as _$_better_auth_core_db0 from "@better-auth/core/db";
|
|
9
|
-
import * as _$better_call0 from "better-call";
|
|
9
|
+
import "../access/index.mjs";
|
|
10
10
|
import * as z from "zod";
|
|
11
|
-
|
|
12
11
|
//#region src/plugins/organization/routes/crud-team.d.ts
|
|
13
12
|
declare const teamBaseSchema: z.ZodObject<{
|
|
14
13
|
name: z.ZodString;
|
|
15
14
|
organizationId: z.ZodOptional<z.ZodString>;
|
|
16
15
|
}, z.core.$strip>;
|
|
17
|
-
declare const createTeam: <O extends OrganizationOptions>(options: O) =>
|
|
16
|
+
export declare const createTeam: <O extends OrganizationOptions>(options: O) => import("better-call").StrictEndpoint<"/organization/create-team", {
|
|
18
17
|
method: "POST";
|
|
19
18
|
body: z.ZodObject<{
|
|
20
19
|
name: z.ZodString;
|
|
21
20
|
organizationId: z.ZodOptional<z.ZodString>;
|
|
22
21
|
}, z.core.$strip>;
|
|
23
|
-
use:
|
|
22
|
+
use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
24
23
|
orgOptions: OrganizationOptions;
|
|
25
24
|
roles: typeof defaultRoles & {
|
|
26
25
|
[key: string]: Role<{}>;
|
|
27
26
|
};
|
|
28
|
-
getSession: (context:
|
|
27
|
+
getSession: (context: import("@better-auth/core").GenericEndpointContext) => Promise<{
|
|
29
28
|
session: {
|
|
30
29
|
id: string;
|
|
31
30
|
createdAt: Date;
|
|
@@ -103,21 +102,21 @@ declare const createTeam: <O extends OrganizationOptions>(options: O) => _$bette
|
|
|
103
102
|
updatedAt?: Date | undefined;
|
|
104
103
|
} & (O["schema"] extends {
|
|
105
104
|
team?: {
|
|
106
|
-
additionalFields: infer Field extends Record<string,
|
|
105
|
+
additionalFields: infer Field extends Record<string, import("@better-auth/core/db").DBFieldAttribute>;
|
|
107
106
|
} | undefined;
|
|
108
|
-
} ? FieldAttributeToObject<RemoveFieldsWithReturnedFalse<Field>> : {}) extends infer T ? { [K in keyof T]: T[K] } : never>;
|
|
109
|
-
declare const removeTeam: <O extends OrganizationOptions>(options: O) =>
|
|
107
|
+
} ? FieldAttributeToObject<RemoveFieldsWithReturnedFalse<Field>> : {}) extends (infer T) ? { [K in keyof T]: T[K]; } : never>;
|
|
108
|
+
export declare const removeTeam: <O extends OrganizationOptions>(options: O) => import("better-call").StrictEndpoint<"/organization/remove-team", {
|
|
110
109
|
method: "POST";
|
|
111
110
|
body: z.ZodObject<{
|
|
112
111
|
teamId: z.ZodString;
|
|
113
112
|
organizationId: z.ZodOptional<z.ZodString>;
|
|
114
113
|
}, z.core.$strip>;
|
|
115
|
-
use:
|
|
114
|
+
use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
116
115
|
orgOptions: OrganizationOptions;
|
|
117
116
|
roles: typeof defaultRoles & {
|
|
118
117
|
[key: string]: Role<{}>;
|
|
119
118
|
};
|
|
120
|
-
getSession: (context:
|
|
119
|
+
getSession: (context: import("@better-auth/core").GenericEndpointContext) => Promise<{
|
|
121
120
|
session: {
|
|
122
121
|
id: string;
|
|
123
122
|
createdAt: Date;
|
|
@@ -170,7 +169,7 @@ declare const removeTeam: <O extends OrganizationOptions>(options: O) => _$bette
|
|
|
170
169
|
}, {
|
|
171
170
|
message: string;
|
|
172
171
|
}>;
|
|
173
|
-
declare const updateTeam: <O extends OrganizationOptions>(options: O) =>
|
|
172
|
+
export declare const updateTeam: <O extends OrganizationOptions>(options: O) => import("better-call").StrictEndpoint<"/organization/update-team", {
|
|
174
173
|
method: "POST";
|
|
175
174
|
body: z.ZodObject<{
|
|
176
175
|
teamId: z.ZodString;
|
|
@@ -180,12 +179,12 @@ declare const updateTeam: <O extends OrganizationOptions>(options: O) => _$bette
|
|
|
180
179
|
}, z.core.$strip>;
|
|
181
180
|
}, z.core.$strip>;
|
|
182
181
|
requireHeaders: true;
|
|
183
|
-
use: (
|
|
182
|
+
use: (import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
184
183
|
orgOptions: OrganizationOptions;
|
|
185
184
|
roles: typeof defaultRoles & {
|
|
186
185
|
[key: string]: Role<{}>;
|
|
187
186
|
};
|
|
188
|
-
getSession: (context:
|
|
187
|
+
getSession: (context: import("@better-auth/core").GenericEndpointContext) => Promise<{
|
|
189
188
|
session: {
|
|
190
189
|
id: string;
|
|
191
190
|
createdAt: Date;
|
|
@@ -209,8 +208,8 @@ declare const updateTeam: <O extends OrganizationOptions>(options: O) => _$bette
|
|
|
209
208
|
image?: string | null | undefined;
|
|
210
209
|
};
|
|
211
210
|
}>;
|
|
212
|
-
}>> |
|
|
213
|
-
use:
|
|
211
|
+
}>> | import("better-call").Middleware<{
|
|
212
|
+
use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
214
213
|
session: {
|
|
215
214
|
session: Record<string, any> & {
|
|
216
215
|
id: string;
|
|
@@ -233,8 +232,8 @@ declare const updateTeam: <O extends OrganizationOptions>(options: O) => _$bette
|
|
|
233
232
|
};
|
|
234
233
|
};
|
|
235
234
|
}>>[];
|
|
236
|
-
}, (inputContext:
|
|
237
|
-
use:
|
|
235
|
+
}, (inputContext: import("better-call").MiddlewareInputContext<{
|
|
236
|
+
use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
238
237
|
session: {
|
|
239
238
|
session: Record<string, any> & {
|
|
240
239
|
id: string;
|
|
@@ -339,10 +338,10 @@ declare const updateTeam: <O extends OrganizationOptions>(options: O) => _$bette
|
|
|
339
338
|
updatedAt?: Date | undefined;
|
|
340
339
|
} & (O["schema"] extends {
|
|
341
340
|
team?: {
|
|
342
|
-
additionalFields: infer Field extends Record<string,
|
|
341
|
+
additionalFields: infer Field extends Record<string, import("@better-auth/core/db").DBFieldAttribute>;
|
|
343
342
|
} | undefined;
|
|
344
|
-
} ? FieldAttributeToObject<RemoveFieldsWithReturnedFalse<Field>> : {}) extends infer T ? { [K in keyof T]: T[K] } : never) | null>;
|
|
345
|
-
declare const listOrganizationTeams: <O extends OrganizationOptions>(options: O) =>
|
|
343
|
+
} ? FieldAttributeToObject<RemoveFieldsWithReturnedFalse<Field>> : {}) extends (infer T) ? { [K in keyof T]: T[K]; } : never) | null>;
|
|
344
|
+
export declare const listOrganizationTeams: <O extends OrganizationOptions>(options: O) => import("better-call").StrictEndpoint<"/organization/list-teams", {
|
|
346
345
|
method: "GET";
|
|
347
346
|
query: z.ZodOptional<z.ZodObject<{
|
|
348
347
|
organizationId: z.ZodOptional<z.ZodString>;
|
|
@@ -394,12 +393,12 @@ declare const listOrganizationTeams: <O extends OrganizationOptions>(options: O)
|
|
|
394
393
|
};
|
|
395
394
|
};
|
|
396
395
|
requireHeaders: true;
|
|
397
|
-
use: (
|
|
396
|
+
use: (import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
398
397
|
orgOptions: OrganizationOptions;
|
|
399
398
|
roles: typeof defaultRoles & {
|
|
400
399
|
[key: string]: Role<{}>;
|
|
401
400
|
};
|
|
402
|
-
getSession: (context:
|
|
401
|
+
getSession: (context: import("@better-auth/core").GenericEndpointContext) => Promise<{
|
|
403
402
|
session: {
|
|
404
403
|
id: string;
|
|
405
404
|
createdAt: Date;
|
|
@@ -423,8 +422,8 @@ declare const listOrganizationTeams: <O extends OrganizationOptions>(options: O)
|
|
|
423
422
|
image?: string | null | undefined;
|
|
424
423
|
};
|
|
425
424
|
}>;
|
|
426
|
-
}>> |
|
|
427
|
-
use:
|
|
425
|
+
}>> | import("better-call").Middleware<{
|
|
426
|
+
use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
428
427
|
session: {
|
|
429
428
|
session: Record<string, any> & {
|
|
430
429
|
id: string;
|
|
@@ -447,8 +446,8 @@ declare const listOrganizationTeams: <O extends OrganizationOptions>(options: O)
|
|
|
447
446
|
};
|
|
448
447
|
};
|
|
449
448
|
}>>[];
|
|
450
|
-
}, (inputContext:
|
|
451
|
-
use:
|
|
449
|
+
}, (inputContext: import("better-call").MiddlewareInputContext<{
|
|
450
|
+
use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
452
451
|
session: {
|
|
453
452
|
session: Record<string, any> & {
|
|
454
453
|
id: string;
|
|
@@ -505,21 +504,21 @@ declare const listOrganizationTeams: <O extends OrganizationOptions>(options: O)
|
|
|
505
504
|
updatedAt?: Date | undefined;
|
|
506
505
|
} & (O["schema"] extends {
|
|
507
506
|
team?: {
|
|
508
|
-
additionalFields: infer Field extends Record<string,
|
|
507
|
+
additionalFields: infer Field extends Record<string, import("@better-auth/core/db").DBFieldAttribute>;
|
|
509
508
|
} | undefined;
|
|
510
|
-
} ? FieldAttributeToObject<RemoveFieldsWithReturnedFalse<Field>> : {}) extends infer T ? { [K in keyof T]: T[K] } : never)[]>;
|
|
511
|
-
declare const setActiveTeam: <O extends OrganizationOptions>(options: O) =>
|
|
509
|
+
} ? FieldAttributeToObject<RemoveFieldsWithReturnedFalse<Field>> : {}) extends (infer T) ? { [K in keyof T]: T[K]; } : never)[]>;
|
|
510
|
+
export declare const setActiveTeam: <O extends OrganizationOptions>(options: O) => import("better-call").StrictEndpoint<"/organization/set-active-team", {
|
|
512
511
|
method: "POST";
|
|
513
512
|
body: z.ZodObject<{
|
|
514
513
|
teamId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
515
514
|
}, z.core.$strip>;
|
|
516
515
|
requireHeaders: true;
|
|
517
|
-
use: (
|
|
516
|
+
use: (import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
518
517
|
orgOptions: OrganizationOptions;
|
|
519
518
|
roles: typeof defaultRoles & {
|
|
520
519
|
[key: string]: Role<{}>;
|
|
521
520
|
};
|
|
522
|
-
getSession: (context:
|
|
521
|
+
getSession: (context: import("@better-auth/core").GenericEndpointContext) => Promise<{
|
|
523
522
|
session: {
|
|
524
523
|
id: string;
|
|
525
524
|
createdAt: Date;
|
|
@@ -543,8 +542,8 @@ declare const setActiveTeam: <O extends OrganizationOptions>(options: O) => _$be
|
|
|
543
542
|
image?: string | null | undefined;
|
|
544
543
|
};
|
|
545
544
|
}>;
|
|
546
|
-
}>> |
|
|
547
|
-
use:
|
|
545
|
+
}>> | import("better-call").Middleware<{
|
|
546
|
+
use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
548
547
|
session: {
|
|
549
548
|
session: Record<string, any> & {
|
|
550
549
|
id: string;
|
|
@@ -567,8 +566,8 @@ declare const setActiveTeam: <O extends OrganizationOptions>(options: O) => _$be
|
|
|
567
566
|
};
|
|
568
567
|
};
|
|
569
568
|
}>>[];
|
|
570
|
-
}, (inputContext:
|
|
571
|
-
use:
|
|
569
|
+
}, (inputContext: import("better-call").MiddlewareInputContext<{
|
|
570
|
+
use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
572
571
|
session: {
|
|
573
572
|
session: Record<string, any> & {
|
|
574
573
|
id: string;
|
|
@@ -643,7 +642,7 @@ declare const setActiveTeam: <O extends OrganizationOptions>(options: O) => _$be
|
|
|
643
642
|
createdAt: Date;
|
|
644
643
|
updatedAt?: Date | undefined;
|
|
645
644
|
} | null>;
|
|
646
|
-
declare const listUserTeams: <O extends OrganizationOptions>(options: O) =>
|
|
645
|
+
export declare const listUserTeams: <O extends OrganizationOptions>(options: O) => import("better-call").StrictEndpoint<"/organization/list-user-teams", {
|
|
647
646
|
method: "GET";
|
|
648
647
|
query: z.ZodOptional<z.ZodObject<{
|
|
649
648
|
userId: z.ZodOptional<z.ZodString>;
|
|
@@ -673,12 +672,12 @@ declare const listUserTeams: <O extends OrganizationOptions>(options: O) => _$be
|
|
|
673
672
|
};
|
|
674
673
|
};
|
|
675
674
|
requireHeaders: true;
|
|
676
|
-
use: (
|
|
675
|
+
use: (import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
677
676
|
orgOptions: OrganizationOptions;
|
|
678
677
|
roles: typeof defaultRoles & {
|
|
679
678
|
[key: string]: Role<{}>;
|
|
680
679
|
};
|
|
681
|
-
getSession: (context:
|
|
680
|
+
getSession: (context: import("@better-auth/core").GenericEndpointContext) => Promise<{
|
|
682
681
|
session: {
|
|
683
682
|
id: string;
|
|
684
683
|
createdAt: Date;
|
|
@@ -702,8 +701,8 @@ declare const listUserTeams: <O extends OrganizationOptions>(options: O) => _$be
|
|
|
702
701
|
image?: string | null | undefined;
|
|
703
702
|
};
|
|
704
703
|
}>;
|
|
705
|
-
}>> |
|
|
706
|
-
use:
|
|
704
|
+
}>> | import("better-call").Middleware<{
|
|
705
|
+
use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
707
706
|
session: {
|
|
708
707
|
session: Record<string, any> & {
|
|
709
708
|
id: string;
|
|
@@ -726,8 +725,8 @@ declare const listUserTeams: <O extends OrganizationOptions>(options: O) => _$be
|
|
|
726
725
|
};
|
|
727
726
|
};
|
|
728
727
|
}>>[];
|
|
729
|
-
}, (inputContext:
|
|
730
|
-
use:
|
|
728
|
+
}, (inputContext: import("better-call").MiddlewareInputContext<{
|
|
729
|
+
use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
731
730
|
session: {
|
|
732
731
|
session: Record<string, any> & {
|
|
733
732
|
id: string;
|
|
@@ -783,7 +782,7 @@ declare const listUserTeams: <O extends OrganizationOptions>(options: O) => _$be
|
|
|
783
782
|
createdAt: Date;
|
|
784
783
|
updatedAt?: Date | undefined;
|
|
785
784
|
}[]>;
|
|
786
|
-
declare const listTeamMembers: <O extends OrganizationOptions>(options: O) =>
|
|
785
|
+
export declare const listTeamMembers: <O extends OrganizationOptions>(options: O) => import("better-call").StrictEndpoint<"/organization/list-team-members", {
|
|
787
786
|
method: "GET";
|
|
788
787
|
query: z.ZodOptional<z.ZodObject<{
|
|
789
788
|
teamId: z.ZodOptional<z.ZodString>;
|
|
@@ -831,12 +830,12 @@ declare const listTeamMembers: <O extends OrganizationOptions>(options: O) => _$
|
|
|
831
830
|
};
|
|
832
831
|
};
|
|
833
832
|
requireHeaders: true;
|
|
834
|
-
use: (
|
|
833
|
+
use: (import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
835
834
|
orgOptions: OrganizationOptions;
|
|
836
835
|
roles: typeof defaultRoles & {
|
|
837
836
|
[key: string]: Role<{}>;
|
|
838
837
|
};
|
|
839
|
-
getSession: (context:
|
|
838
|
+
getSession: (context: import("@better-auth/core").GenericEndpointContext) => Promise<{
|
|
840
839
|
session: {
|
|
841
840
|
id: string;
|
|
842
841
|
createdAt: Date;
|
|
@@ -860,8 +859,8 @@ declare const listTeamMembers: <O extends OrganizationOptions>(options: O) => _$
|
|
|
860
859
|
image?: string | null | undefined;
|
|
861
860
|
};
|
|
862
861
|
}>;
|
|
863
|
-
}>> |
|
|
864
|
-
use:
|
|
862
|
+
}>> | import("better-call").Middleware<{
|
|
863
|
+
use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
865
864
|
session: {
|
|
866
865
|
session: Record<string, any> & {
|
|
867
866
|
id: string;
|
|
@@ -884,8 +883,8 @@ declare const listTeamMembers: <O extends OrganizationOptions>(options: O) => _$
|
|
|
884
883
|
};
|
|
885
884
|
};
|
|
886
885
|
}>>[];
|
|
887
|
-
}, (inputContext:
|
|
888
|
-
use:
|
|
886
|
+
}, (inputContext: import("better-call").MiddlewareInputContext<{
|
|
887
|
+
use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
889
888
|
session: {
|
|
890
889
|
session: Record<string, any> & {
|
|
891
890
|
id: string;
|
|
@@ -940,7 +939,7 @@ declare const listTeamMembers: <O extends OrganizationOptions>(options: O) => _$
|
|
|
940
939
|
userId: string;
|
|
941
940
|
createdAt: Date;
|
|
942
941
|
}[]>;
|
|
943
|
-
declare const addTeamMember: <O extends OrganizationOptions>(options: O) =>
|
|
942
|
+
export declare const addTeamMember: <O extends OrganizationOptions>(options: O) => import("better-call").StrictEndpoint<"/organization/add-team-member", {
|
|
944
943
|
method: "POST";
|
|
945
944
|
body: z.ZodObject<{
|
|
946
945
|
teamId: z.ZodString;
|
|
@@ -986,12 +985,12 @@ declare const addTeamMember: <O extends OrganizationOptions>(options: O) => _$be
|
|
|
986
985
|
};
|
|
987
986
|
};
|
|
988
987
|
requireHeaders: true;
|
|
989
|
-
use: (
|
|
988
|
+
use: (import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
990
989
|
orgOptions: OrganizationOptions;
|
|
991
990
|
roles: typeof defaultRoles & {
|
|
992
991
|
[key: string]: Role<{}>;
|
|
993
992
|
};
|
|
994
|
-
getSession: (context:
|
|
993
|
+
getSession: (context: import("@better-auth/core").GenericEndpointContext) => Promise<{
|
|
995
994
|
session: {
|
|
996
995
|
id: string;
|
|
997
996
|
createdAt: Date;
|
|
@@ -1015,8 +1014,8 @@ declare const addTeamMember: <O extends OrganizationOptions>(options: O) => _$be
|
|
|
1015
1014
|
image?: string | null | undefined;
|
|
1016
1015
|
};
|
|
1017
1016
|
}>;
|
|
1018
|
-
}>> |
|
|
1019
|
-
use:
|
|
1017
|
+
}>> | import("better-call").Middleware<{
|
|
1018
|
+
use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
1020
1019
|
session: {
|
|
1021
1020
|
session: Record<string, any> & {
|
|
1022
1021
|
id: string;
|
|
@@ -1039,8 +1038,8 @@ declare const addTeamMember: <O extends OrganizationOptions>(options: O) => _$be
|
|
|
1039
1038
|
};
|
|
1040
1039
|
};
|
|
1041
1040
|
}>>[];
|
|
1042
|
-
}, (inputContext:
|
|
1043
|
-
use:
|
|
1041
|
+
}, (inputContext: import("better-call").MiddlewareInputContext<{
|
|
1042
|
+
use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
1044
1043
|
session: {
|
|
1045
1044
|
session: Record<string, any> & {
|
|
1046
1045
|
id: string;
|
|
@@ -1095,7 +1094,7 @@ declare const addTeamMember: <O extends OrganizationOptions>(options: O) => _$be
|
|
|
1095
1094
|
userId: string;
|
|
1096
1095
|
createdAt: Date;
|
|
1097
1096
|
}>;
|
|
1098
|
-
declare const removeTeamMember: <O extends OrganizationOptions>(options: O) =>
|
|
1097
|
+
export declare const removeTeamMember: <O extends OrganizationOptions>(options: O) => import("better-call").StrictEndpoint<"/organization/remove-team-member", {
|
|
1099
1098
|
method: "POST";
|
|
1100
1099
|
body: z.ZodObject<{
|
|
1101
1100
|
teamId: z.ZodString;
|
|
@@ -1128,12 +1127,12 @@ declare const removeTeamMember: <O extends OrganizationOptions>(options: O) => _
|
|
|
1128
1127
|
};
|
|
1129
1128
|
};
|
|
1130
1129
|
requireHeaders: true;
|
|
1131
|
-
use: (
|
|
1130
|
+
use: (import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
1132
1131
|
orgOptions: OrganizationOptions;
|
|
1133
1132
|
roles: typeof defaultRoles & {
|
|
1134
1133
|
[key: string]: Role<{}>;
|
|
1135
1134
|
};
|
|
1136
|
-
getSession: (context:
|
|
1135
|
+
getSession: (context: import("@better-auth/core").GenericEndpointContext) => Promise<{
|
|
1137
1136
|
session: {
|
|
1138
1137
|
id: string;
|
|
1139
1138
|
createdAt: Date;
|
|
@@ -1157,8 +1156,8 @@ declare const removeTeamMember: <O extends OrganizationOptions>(options: O) => _
|
|
|
1157
1156
|
image?: string | null | undefined;
|
|
1158
1157
|
};
|
|
1159
1158
|
}>;
|
|
1160
|
-
}>> |
|
|
1161
|
-
use:
|
|
1159
|
+
}>> | import("better-call").Middleware<{
|
|
1160
|
+
use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
1162
1161
|
session: {
|
|
1163
1162
|
session: Record<string, any> & {
|
|
1164
1163
|
id: string;
|
|
@@ -1181,8 +1180,8 @@ declare const removeTeamMember: <O extends OrganizationOptions>(options: O) => _
|
|
|
1181
1180
|
};
|
|
1182
1181
|
};
|
|
1183
1182
|
}>>[];
|
|
1184
|
-
}, (inputContext:
|
|
1185
|
-
use:
|
|
1183
|
+
}, (inputContext: import("better-call").MiddlewareInputContext<{
|
|
1184
|
+
use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
1186
1185
|
session: {
|
|
1187
1186
|
session: Record<string, any> & {
|
|
1188
1187
|
id: string;
|
|
@@ -1235,4 +1234,4 @@ declare const removeTeamMember: <O extends OrganizationOptions>(options: O) => _
|
|
|
1235
1234
|
message: string;
|
|
1236
1235
|
}>;
|
|
1237
1236
|
//#endregion
|
|
1238
|
-
export {
|
|
1237
|
+
export {};
|
|
@@ -414,8 +414,9 @@ const setActiveTeam = (options) => createAuthEndpoint("/organization/set-active-
|
|
|
414
414
|
const session = ctx.context.session;
|
|
415
415
|
if (ctx.body.teamId === null) {
|
|
416
416
|
if (!session.session.activeTeamId) return ctx.json(null);
|
|
417
|
+
const updatedSession = await adapter.setActiveTeam(session.session.token, null, ctx);
|
|
417
418
|
await setSessionCookie(ctx, {
|
|
418
|
-
session:
|
|
419
|
+
session: updatedSession,
|
|
419
420
|
user: session.user
|
|
420
421
|
});
|
|
421
422
|
return ctx.json(null);
|
|
@@ -437,8 +438,9 @@ const setActiveTeam = (options) => createAuthEndpoint("/organization/set-active-
|
|
|
437
438
|
teamId,
|
|
438
439
|
userId: session.user.id
|
|
439
440
|
})) throw APIError.from("FORBIDDEN", ORGANIZATION_ERROR_CODES.USER_IS_NOT_A_MEMBER_OF_THE_TEAM);
|
|
441
|
+
const updatedSession = await adapter.setActiveTeam(session.session.token, team.id, ctx);
|
|
440
442
|
await setSessionCookie(ctx, {
|
|
441
|
-
session:
|
|
443
|
+
session: updatedSession,
|
|
442
444
|
user: session.user
|
|
443
445
|
});
|
|
444
446
|
return ctx.json(team);
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { FieldAttributeToObject, RemoveFieldsWithReturnedFalse } from "../../db/field.mjs";
|
|
2
|
+
import "../../db/index.mjs";
|
|
2
3
|
import { OrganizationOptions } from "./types.mjs";
|
|
3
4
|
import { BetterAuthPluginDBSchema, DBFieldAttribute } from "@better-auth/core/db";
|
|
4
5
|
import { Prettify } from "better-call";
|
|
5
6
|
import * as z from "zod";
|
|
6
|
-
|
|
7
7
|
//#region src/plugins/organization/schema.d.ts
|
|
8
8
|
type InferSchema<Schema extends BetterAuthPluginDBSchema, TableName extends string, DefaultFields> = {
|
|
9
9
|
modelName: Schema[TableName] extends {
|
|
10
10
|
modelName: infer M;
|
|
11
11
|
} ? M extends string ? M : string : string;
|
|
12
|
-
fields: { [K in keyof DefaultFields]: DefaultFields[K] } & (Schema[TableName] extends {
|
|
12
|
+
fields: { [K in keyof DefaultFields]: DefaultFields[K]; } & (Schema[TableName] extends {
|
|
13
13
|
additionalFields: infer F;
|
|
14
14
|
} ? F : {});
|
|
15
15
|
};
|
|
@@ -200,7 +200,7 @@ interface SessionDefaultFields {
|
|
|
200
200
|
input: false;
|
|
201
201
|
};
|
|
202
202
|
}
|
|
203
|
-
type OrganizationSchema<O extends OrganizationOptions> = (O["dynamicAccessControl"] extends {
|
|
203
|
+
export type OrganizationSchema<O extends OrganizationOptions> = (O["dynamicAccessControl"] extends {
|
|
204
204
|
enabled: true;
|
|
205
205
|
} ? {
|
|
206
206
|
organizationRole: InferSchema<O["schema"] extends BetterAuthPluginDBSchema ? O["schema"] : {}, "organizationRole", OrganizationRoleDefaultFields>;
|
|
@@ -242,14 +242,14 @@ type OrganizationSchema<O extends OrganizationOptions> = (O["dynamicAccessContro
|
|
|
242
242
|
} : {});
|
|
243
243
|
};
|
|
244
244
|
};
|
|
245
|
-
declare const roleSchema: z.ZodString;
|
|
246
|
-
declare const invitationStatus: z.ZodDefault<z.ZodEnum<{
|
|
245
|
+
export declare const roleSchema: z.ZodString;
|
|
246
|
+
export declare const invitationStatus: z.ZodDefault<z.ZodEnum<{
|
|
247
247
|
pending: "pending";
|
|
248
248
|
accepted: "accepted";
|
|
249
249
|
rejected: "rejected";
|
|
250
250
|
canceled: "canceled";
|
|
251
251
|
}>>;
|
|
252
|
-
declare const organizationSchema: z.ZodObject<{
|
|
252
|
+
export declare const organizationSchema: z.ZodObject<{
|
|
253
253
|
id: z.ZodDefault<z.ZodString>;
|
|
254
254
|
name: z.ZodString;
|
|
255
255
|
slug: z.ZodString;
|
|
@@ -257,14 +257,14 @@ declare const organizationSchema: z.ZodObject<{
|
|
|
257
257
|
metadata: z.ZodOptional<z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodPipe<z.ZodString, z.ZodTransform<any, string>>]>>;
|
|
258
258
|
createdAt: z.ZodDate;
|
|
259
259
|
}, z.core.$strip>;
|
|
260
|
-
declare const memberSchema: z.ZodObject<{
|
|
260
|
+
export declare const memberSchema: z.ZodObject<{
|
|
261
261
|
id: z.ZodDefault<z.ZodString>;
|
|
262
262
|
organizationId: z.ZodString;
|
|
263
263
|
userId: z.ZodCoercedString<unknown>;
|
|
264
264
|
role: z.ZodString;
|
|
265
265
|
createdAt: z.ZodDefault<z.ZodDate>;
|
|
266
266
|
}, z.core.$strip>;
|
|
267
|
-
declare const invitationSchema: z.ZodObject<{
|
|
267
|
+
export declare const invitationSchema: z.ZodObject<{
|
|
268
268
|
id: z.ZodDefault<z.ZodString>;
|
|
269
269
|
organizationId: z.ZodString;
|
|
270
270
|
email: z.ZodString;
|
|
@@ -280,20 +280,20 @@ declare const invitationSchema: z.ZodObject<{
|
|
|
280
280
|
expiresAt: z.ZodDate;
|
|
281
281
|
createdAt: z.ZodDefault<z.ZodDate>;
|
|
282
282
|
}, z.core.$strip>;
|
|
283
|
-
declare const teamSchema: z.ZodObject<{
|
|
283
|
+
export declare const teamSchema: z.ZodObject<{
|
|
284
284
|
id: z.ZodDefault<z.ZodString>;
|
|
285
285
|
name: z.ZodString;
|
|
286
286
|
organizationId: z.ZodString;
|
|
287
287
|
createdAt: z.ZodDate;
|
|
288
288
|
updatedAt: z.ZodOptional<z.ZodDate>;
|
|
289
289
|
}, z.core.$strip>;
|
|
290
|
-
declare const teamMemberSchema: z.ZodObject<{
|
|
290
|
+
export declare const teamMemberSchema: z.ZodObject<{
|
|
291
291
|
id: z.ZodDefault<z.ZodString>;
|
|
292
292
|
teamId: z.ZodString;
|
|
293
293
|
userId: z.ZodString;
|
|
294
294
|
createdAt: z.ZodDefault<z.ZodDate>;
|
|
295
295
|
}, z.core.$strip>;
|
|
296
|
-
declare const organizationRoleSchema: z.ZodObject<{
|
|
296
|
+
export declare const organizationRoleSchema: z.ZodObject<{
|
|
297
297
|
id: z.ZodDefault<z.ZodString>;
|
|
298
298
|
organizationId: z.ZodString;
|
|
299
299
|
role: z.ZodString;
|
|
@@ -301,18 +301,18 @@ declare const organizationRoleSchema: z.ZodObject<{
|
|
|
301
301
|
createdAt: z.ZodDefault<z.ZodDate>;
|
|
302
302
|
updatedAt: z.ZodOptional<z.ZodDate>;
|
|
303
303
|
}, z.core.$strip>;
|
|
304
|
-
type Organization = z.infer<typeof organizationSchema>;
|
|
305
|
-
type Member = z.infer<typeof memberSchema>;
|
|
306
|
-
type TeamMember = z.infer<typeof teamMemberSchema>;
|
|
307
|
-
type Team = z.infer<typeof teamSchema>;
|
|
308
|
-
type Invitation = z.infer<typeof invitationSchema>;
|
|
309
|
-
type InvitationInput = z.input<typeof invitationSchema>;
|
|
310
|
-
type MemberInput = z.input<typeof memberSchema>;
|
|
311
|
-
type TeamMemberInput = z.input<typeof teamMemberSchema>;
|
|
312
|
-
type OrganizationInput = z.input<typeof organizationSchema>;
|
|
313
|
-
type TeamInput = z.input<typeof teamSchema>;
|
|
314
|
-
type OrganizationRole = z.infer<typeof organizationRoleSchema>;
|
|
315
|
-
declare const defaultRolesSchema: z.ZodUnion<readonly [z.ZodEnum<{
|
|
304
|
+
export type Organization = z.infer<typeof organizationSchema>;
|
|
305
|
+
export type Member = z.infer<typeof memberSchema>;
|
|
306
|
+
export type TeamMember = z.infer<typeof teamMemberSchema>;
|
|
307
|
+
export type Team = z.infer<typeof teamSchema>;
|
|
308
|
+
export type Invitation = z.infer<typeof invitationSchema>;
|
|
309
|
+
export type InvitationInput = z.input<typeof invitationSchema>;
|
|
310
|
+
export type MemberInput = z.input<typeof memberSchema>;
|
|
311
|
+
export type TeamMemberInput = z.input<typeof teamMemberSchema>;
|
|
312
|
+
export type OrganizationInput = z.input<typeof organizationSchema>;
|
|
313
|
+
export type TeamInput = z.input<typeof teamSchema>;
|
|
314
|
+
export type OrganizationRole = z.infer<typeof organizationRoleSchema>;
|
|
315
|
+
export declare const defaultRolesSchema: z.ZodUnion<readonly [z.ZodEnum<{
|
|
316
316
|
admin: "admin";
|
|
317
317
|
member: "member";
|
|
318
318
|
owner: "owner";
|
|
@@ -326,15 +326,15 @@ type CustomRolesSchema<O> = O extends {
|
|
|
326
326
|
[key: string]: any;
|
|
327
327
|
};
|
|
328
328
|
} ? z.ZodType<keyof O["roles"] | Array<keyof O["roles"]>> : typeof defaultRolesSchema;
|
|
329
|
-
type InferOrganizationZodRolesFromOption<O extends OrganizationOptions | undefined> = CustomRolesSchema<O>;
|
|
330
|
-
type InferOrganizationRolesFromOption<O extends OrganizationOptions | undefined> = O extends {
|
|
329
|
+
export type InferOrganizationZodRolesFromOption<O extends OrganizationOptions | undefined> = CustomRolesSchema<O>;
|
|
330
|
+
export type InferOrganizationRolesFromOption<O extends OrganizationOptions | undefined> = O extends {
|
|
331
331
|
roles: any;
|
|
332
|
-
} ? keyof O["roles"] extends infer K extends string ? K : "admin" | "member" | "owner" : "admin" | "member" | "owner";
|
|
333
|
-
type InvitationStatus = "pending" | "accepted" | "rejected" | "canceled";
|
|
332
|
+
} ? keyof O["roles"] extends (infer K extends string) ? K : "admin" | "member" | "owner" : "admin" | "member" | "owner";
|
|
333
|
+
export type InvitationStatus = "pending" | "accepted" | "rejected" | "canceled";
|
|
334
334
|
type InferAdditionalFieldsOutput<SchemaName extends string, Options extends OrganizationOptions, isClientSide extends boolean> = Options["schema"] extends { [key in SchemaName]?: {
|
|
335
335
|
additionalFields: infer Field extends Record<string, DBFieldAttribute>;
|
|
336
|
-
} } ? isClientSide extends true ? FieldAttributeToObject<RemoveFieldsWithReturnedFalse<Field>> : FieldAttributeToObject<Field> : {};
|
|
337
|
-
type InferMember<O extends OrganizationOptions, isClientSide extends boolean = true> = Prettify<(O["teams"] extends {
|
|
336
|
+
}; } ? isClientSide extends true ? FieldAttributeToObject<RemoveFieldsWithReturnedFalse<Field>> : FieldAttributeToObject<Field> : {};
|
|
337
|
+
export type InferMember<O extends OrganizationOptions, isClientSide extends boolean = true> = Prettify<(O["teams"] extends {
|
|
338
338
|
enabled: true;
|
|
339
339
|
} ? {
|
|
340
340
|
id: string;
|
|
@@ -362,9 +362,9 @@ type InferMember<O extends OrganizationOptions, isClientSide extends boolean = t
|
|
|
362
362
|
image?: string | undefined;
|
|
363
363
|
};
|
|
364
364
|
}) & InferAdditionalFieldsOutput<"member", O, isClientSide>>;
|
|
365
|
-
type InferOrganization<O extends OrganizationOptions, isClientSide extends boolean = true> = Prettify<Organization & InferAdditionalFieldsOutput<"organization", O, isClientSide>>;
|
|
366
|
-
type InferTeam<O extends OrganizationOptions, isClientSide extends boolean = true> = Prettify<Team & InferAdditionalFieldsOutput<"team", O, isClientSide>>;
|
|
367
|
-
type InferInvitation<O extends OrganizationOptions, isClientSide extends boolean = true> = Prettify<(O["teams"] extends {
|
|
365
|
+
export type InferOrganization<O extends OrganizationOptions, isClientSide extends boolean = true> = Prettify<Organization & InferAdditionalFieldsOutput<"organization", O, isClientSide>>;
|
|
366
|
+
export type InferTeam<O extends OrganizationOptions, isClientSide extends boolean = true> = Prettify<Team & InferAdditionalFieldsOutput<"team", O, isClientSide>>;
|
|
367
|
+
export type InferInvitation<O extends OrganizationOptions, isClientSide extends boolean = true> = Prettify<(O["teams"] extends {
|
|
368
368
|
enabled: true;
|
|
369
369
|
} ? {
|
|
370
370
|
id: string;
|
|
@@ -387,4 +387,4 @@ type InferInvitation<O extends OrganizationOptions, isClientSide extends boolean
|
|
|
387
387
|
createdAt: Date;
|
|
388
388
|
}) & InferAdditionalFieldsOutput<"invitation", O, isClientSide>>;
|
|
389
389
|
//#endregion
|
|
390
|
-
export {
|
|
390
|
+
export {};
|