better-auth 1.6.26 → 1.6.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapters/index.d.mts +6 -1
- package/dist/api/dispatch.d.mts +1 -0
- package/dist/api/index.d.mts +508 -505
- package/dist/api/middlewares/authorization.d.mts +10 -14
- package/dist/api/middlewares/authorization.mjs +1 -2
- package/dist/api/middlewares/index.d.mts +1 -2
- package/dist/api/middlewares/origin-check.d.mts +5 -3
- package/dist/api/routes/account.d.mts +16 -13
- package/dist/api/routes/callback.d.mts +3 -1
- package/dist/api/routes/email-verification.d.mts +8 -4
- package/dist/api/routes/error.d.mts +3 -1
- package/dist/api/routes/index.d.mts +1 -2
- package/dist/api/routes/ok.d.mts +3 -1
- package/dist/api/routes/password.d.mts +10 -8
- package/dist/api/routes/session.d.mts +32 -30
- package/dist/api/routes/session.mjs +2 -3
- package/dist/api/routes/sign-in.d.mts +5 -3
- package/dist/api/routes/sign-out.d.mts +3 -1
- package/dist/api/routes/sign-up.d.mts +4 -3
- package/dist/api/routes/update-session.d.mts +5 -4
- package/dist/api/routes/update-user.d.mts +19 -18
- package/dist/auth/full.d.mts +1 -1
- package/dist/auth/minimal.d.mts +1 -1
- package/dist/client/config.d.mts +14 -12
- package/dist/client/config.mjs +2 -2
- package/dist/client/equality.d.mts +1 -0
- package/dist/client/index.d.mts +5 -6
- package/dist/client/lynx/index.d.mts +5 -4
- package/dist/client/lynx/lynx-store.d.mts +2 -1
- package/dist/client/parser.d.mts +3 -7
- package/dist/client/path-to-object.d.mts +4 -3
- package/dist/client/plugins/index.d.mts +1 -1
- package/dist/client/plugins/infer-plugin.d.mts +1 -0
- package/dist/client/query.d.mts +1 -0
- package/dist/client/react/index.d.mts +5 -4
- package/dist/client/react/react-store.d.mts +2 -1
- package/dist/client/session-atom.mjs +59 -46
- package/dist/client/session-refresh.d.mts +1 -0
- package/dist/client/solid/index.d.mts +5 -4
- package/dist/client/svelte/index.d.mts +5 -4
- package/dist/client/types.d.mts +2 -2
- package/dist/client/vanilla.d.mts +2 -1
- package/dist/client/vue/index.d.mts +5 -4
- package/dist/context/create-context.mjs +3 -3
- package/dist/context/helpers.mjs +2 -2
- package/dist/cookies/index.d.mts +7 -6
- package/dist/cookies/session-store.d.mts +0 -1
- package/dist/cookies/session-store.mjs +1 -2
- package/dist/crypto/index.d.mts +9 -2
- package/dist/crypto/jwt.d.mts +1 -0
- package/dist/crypto/password.d.mts +5 -1
- package/dist/db/adapter-base.d.mts +1 -0
- package/dist/db/adapter-kysely.d.mts +1 -0
- package/dist/db/field-converter.d.mts +1 -0
- package/dist/db/field.d.mts +10 -9
- package/dist/db/get-migration.d.mts +1 -0
- package/dist/db/get-schema.d.mts +1 -0
- package/dist/db/internal-adapter.d.mts +1 -0
- package/dist/db/internal-adapter.mjs +1 -2
- package/dist/db/revoke-unproven-account-access.d.mts +1 -0
- package/dist/db/schema.d.mts +2 -2
- package/dist/db/to-zod.d.mts +7 -3
- package/dist/db/with-hooks.d.mts +1 -0
- package/dist/index.d.mts +3 -4
- package/dist/integrations/next-js.d.mts +7 -4
- package/dist/integrations/node.d.mts +3 -2
- package/dist/integrations/svelte-kit.d.mts +9 -2
- package/dist/integrations/tanstack-start-solid.d.mts +5 -2
- package/dist/integrations/tanstack-start.d.mts +5 -2
- package/dist/oauth2/link-account.d.mts +1 -1
- package/dist/oauth2/state.d.mts +1 -0
- package/dist/oauth2/utils.d.mts +1 -0
- package/dist/package.mjs +1 -1
- package/dist/plugins/access/access.d.mts +1 -0
- package/dist/plugins/access/types.d.mts +5 -4
- package/dist/plugins/additional-fields/client.d.mts +1 -0
- package/dist/plugins/admin/access/statement.d.mts +0 -1
- package/dist/plugins/admin/admin.d.mts +137 -132
- package/dist/plugins/admin/client.d.mts +30 -30
- package/dist/plugins/admin/client.mjs +1 -1
- package/dist/plugins/admin/error-codes.d.mts +25 -23
- package/dist/plugins/admin/index.d.mts +1 -1
- package/dist/plugins/admin/schema.d.mts +1 -1
- package/dist/plugins/admin/types.d.mts +2 -3
- package/dist/plugins/anonymous/client.d.mts +11 -9
- package/dist/plugins/anonymous/client.mjs +1 -1
- package/dist/plugins/anonymous/error-codes.d.mts +10 -8
- package/dist/plugins/anonymous/index.d.mts +19 -15
- package/dist/plugins/anonymous/types.d.mts +1 -1
- package/dist/plugins/bearer/index.d.mts +8 -5
- package/dist/plugins/captcha/index.d.mts +8 -5
- package/dist/plugins/captcha/types.d.mts +1 -0
- package/dist/plugins/custom-session/client.d.mts +1 -0
- package/dist/plugins/custom-session/index.d.mts +12 -7
- package/dist/plugins/device-authorization/client.d.mts +1 -0
- package/dist/plugins/device-authorization/index.d.mts +22 -19
- package/dist/plugins/email-otp/client.d.mts +6 -4
- package/dist/plugins/email-otp/client.mjs +1 -1
- package/dist/plugins/email-otp/error-codes.d.mts +5 -3
- package/dist/plugins/email-otp/index.d.mts +76 -69
- package/dist/plugins/email-otp/types.d.mts +1 -0
- package/dist/plugins/generic-oauth/client.d.mts +11 -10
- package/dist/plugins/generic-oauth/client.mjs +1 -1
- package/dist/plugins/generic-oauth/error-codes.d.mts +10 -8
- package/dist/plugins/generic-oauth/index.d.mts +45 -41
- package/dist/plugins/generic-oauth/providers/auth0.d.mts +1 -0
- package/dist/plugins/generic-oauth/providers/gumroad.d.mts +1 -0
- package/dist/plugins/generic-oauth/providers/hubspot.d.mts +1 -0
- package/dist/plugins/generic-oauth/providers/index.d.mts +1 -2
- package/dist/plugins/generic-oauth/providers/keycloak.d.mts +1 -0
- package/dist/plugins/generic-oauth/providers/line.d.mts +1 -0
- package/dist/plugins/generic-oauth/providers/microsoft-entra-id.d.mts +1 -0
- package/dist/plugins/generic-oauth/providers/okta.d.mts +1 -0
- package/dist/plugins/generic-oauth/providers/patreon.d.mts +1 -0
- package/dist/plugins/generic-oauth/providers/slack.d.mts +1 -0
- package/dist/plugins/generic-oauth/providers/yandex.d.mts +1 -0
- package/dist/plugins/generic-oauth/types.d.mts +2 -1
- package/dist/plugins/haveibeenpwned/index.d.mts +6 -3
- package/dist/plugins/index.d.mts +1 -4
- package/dist/plugins/jwt/client.d.mts +2 -1
- package/dist/plugins/jwt/index.d.mts +12 -9
- package/dist/plugins/jwt/sign.d.mts +2 -2
- package/dist/plugins/jwt/types.d.mts +1 -1
- package/dist/plugins/jwt/utils.d.mts +4 -2
- package/dist/plugins/jwt/verify.d.mts +1 -0
- package/dist/plugins/last-login-method/index.d.mts +6 -3
- package/dist/plugins/magic-link/client.d.mts +1 -0
- package/dist/plugins/magic-link/index.d.mts +6 -4
- package/dist/plugins/mcp/client/adapters.d.mts +1 -0
- package/dist/plugins/mcp/client/index.mjs +2 -4
- package/dist/plugins/mcp/index.d.mts +12 -11
- package/dist/plugins/multi-session/client.d.mts +4 -2
- package/dist/plugins/multi-session/client.mjs +1 -1
- package/dist/plugins/multi-session/error-codes.d.mts +3 -1
- package/dist/plugins/multi-session/index.d.mts +12 -8
- package/dist/plugins/oauth-popup/client.d.mts +12 -6
- package/dist/plugins/oauth-popup/client.mjs +3 -5
- package/dist/plugins/oauth-popup/error-codes.d.mts +6 -4
- package/dist/plugins/oauth-popup/index.d.mts +12 -8
- package/dist/plugins/oauth-popup/index.mjs +1 -1
- package/dist/plugins/oauth-popup/types.d.mts +2 -1
- package/dist/plugins/oauth-proxy/index.d.mts +9 -6
- package/dist/plugins/oauth-proxy/index.mjs +2 -2
- package/dist/plugins/oidc-provider/client.d.mts +2 -1
- package/dist/plugins/oidc-provider/index.d.mts +20 -18
- package/dist/plugins/oidc-provider/schema.d.mts +1 -0
- package/dist/plugins/oidc-provider/types.d.mts +1 -1
- package/dist/plugins/one-tap/client.d.mts +3 -1
- package/dist/plugins/one-tap/index.d.mts +3 -1
- package/dist/plugins/one-time-token/client.d.mts +2 -1
- package/dist/plugins/one-time-token/index.d.mts +7 -6
- package/dist/plugins/open-api/generator.d.mts +1 -0
- package/dist/plugins/open-api/generator.mjs +5 -5
- package/dist/plugins/open-api/index.d.mts +5 -3
- package/dist/plugins/organization/access/statement.d.mts +0 -1
- package/dist/plugins/organization/adapter.d.mts +82 -56
- package/dist/plugins/organization/client.d.mts +103 -104
- package/dist/plugins/organization/client.mjs +4 -7
- package/dist/plugins/organization/error-codes.d.mts +61 -59
- package/dist/plugins/organization/has-permission.d.mts +1 -0
- package/dist/plugins/organization/has-permission.mjs +1 -1
- package/dist/plugins/organization/index.d.mts +1 -1
- package/dist/plugins/organization/organization.d.mts +33 -9
- package/dist/plugins/organization/organization.mjs +1 -1
- package/dist/plugins/organization/permission.d.mts +2 -2
- package/dist/plugins/organization/routes/crud-access-control.d.mts +147 -27
- package/dist/plugins/organization/routes/crud-invites.d.mts +186 -65
- package/dist/plugins/organization/routes/crud-invites.mjs +1 -1
- package/dist/plugins/organization/routes/crud-members.d.mts +178 -56
- package/dist/plugins/organization/routes/crud-members.mjs +1 -1
- package/dist/plugins/organization/routes/crud-org.d.mts +130 -57
- package/dist/plugins/organization/routes/crud-team.d.mts +235 -66
- package/dist/plugins/organization/schema.d.mts +4 -4
- package/dist/plugins/organization/schema.mjs +1 -1
- package/dist/plugins/organization/types.d.mts +14 -14
- package/dist/plugins/phone-number/client.d.mts +15 -13
- package/dist/plugins/phone-number/client.mjs +1 -1
- package/dist/plugins/phone-number/error-codes.d.mts +14 -12
- package/dist/plugins/phone-number/index.d.mts +47 -41
- package/dist/plugins/phone-number/types.d.mts +1 -1
- package/dist/plugins/siwe/client.d.mts +1 -0
- package/dist/plugins/siwe/index.d.mts +5 -4
- package/dist/plugins/test-utils/index.d.mts +4 -2
- package/dist/plugins/test-utils/types.d.mts +0 -1
- package/dist/plugins/two-factor/backup-codes/index.d.mts +7 -5
- package/dist/plugins/two-factor/backup-codes/index.mjs +1 -1
- package/dist/plugins/two-factor/client.d.mts +15 -12
- package/dist/plugins/two-factor/client.mjs +1 -1
- package/dist/plugins/two-factor/error-code.d.mts +12 -10
- package/dist/plugins/two-factor/index.d.mts +36 -32
- package/dist/plugins/two-factor/otp/index.d.mts +4 -2
- package/dist/plugins/two-factor/totp/index.d.mts +7 -5
- package/dist/plugins/two-factor/types.d.mts +1 -1
- package/dist/plugins/username/client.d.mts +11 -9
- package/dist/plugins/username/client.mjs +1 -1
- package/dist/plugins/username/error-codes.d.mts +10 -8
- package/dist/plugins/username/index.d.mts +22 -17
- package/dist/plugins/username/schema.d.mts +5 -3
- package/dist/state.d.mts +1 -0
- package/dist/test-utils/test-instance.d.mts +3 -5
- package/dist/types/adapter.d.mts +1 -1
- package/dist/types/api.d.mts +2 -1
- package/dist/types/auth.d.mts +1 -0
- package/dist/types/helper.d.mts +5 -5
- package/dist/types/index.d.mts +2 -2
- package/dist/types/models.d.mts +1 -0
- package/dist/types/plugins.d.mts +3 -2
- package/dist/utils/index.d.mts +1 -2
- package/dist/utils/url.d.mts +1 -0
- package/package.json +12 -11
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { FieldAttributeToObject, InferAdditionalFieldsFromPluginOptions, RemoveFieldsWithReturnedFalse } from "../../../db/field.mjs";
|
|
2
2
|
import { Role } from "../../access/types.mjs";
|
|
3
|
-
import "../../../db/index.mjs";
|
|
4
3
|
import { OrganizationOptions } from "../types.mjs";
|
|
5
4
|
import { InferOrganizationRolesFromOption, InvitationStatus } from "../schema.mjs";
|
|
6
|
-
import "../../index.mjs";
|
|
7
5
|
import { defaultRoles } from "../access/statement.mjs";
|
|
8
|
-
import "
|
|
6
|
+
import * as _$_better_auth_core0 from "@better-auth/core";
|
|
9
7
|
import { LiteralString } from "@better-auth/core";
|
|
8
|
+
import * as _$_better_auth_core_db0 from "@better-auth/core/db";
|
|
9
|
+
import * as _$better_call0 from "better-call";
|
|
10
10
|
import * as z from "zod";
|
|
11
|
+
|
|
11
12
|
//#region src/plugins/organization/routes/crud-invites.d.ts
|
|
12
13
|
type DynamicOrganizationRole<O extends OrganizationOptions> = O extends {
|
|
13
14
|
dynamicAccessControl: {
|
|
@@ -15,15 +16,15 @@ type DynamicOrganizationRole<O extends OrganizationOptions> = O extends {
|
|
|
15
16
|
};
|
|
16
17
|
} ? LiteralString : never;
|
|
17
18
|
type OrganizationInvitationRole<O extends OrganizationOptions> = InferOrganizationRolesFromOption<O> | DynamicOrganizationRole<O>;
|
|
18
|
-
declare const createInvitation: <O extends OrganizationOptions>(option: O) =>
|
|
19
|
+
declare const createInvitation: <O extends OrganizationOptions>(option: O) => _$better_call0.StrictEndpoint<"/organization/invite-member", {
|
|
19
20
|
method: "POST";
|
|
20
21
|
requireHeaders: true;
|
|
21
|
-
use: ((
|
|
22
|
+
use: (_$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
|
|
22
23
|
orgOptions: OrganizationOptions;
|
|
23
24
|
roles: typeof defaultRoles & {
|
|
24
25
|
[key: string]: Role<{}>;
|
|
25
26
|
};
|
|
26
|
-
getSession: (context:
|
|
27
|
+
getSession: (context: _$_better_auth_core0.GenericEndpointContext) => Promise<{
|
|
27
28
|
session: {
|
|
28
29
|
id: string;
|
|
29
30
|
createdAt: Date;
|
|
@@ -47,8 +48,8 @@ declare const createInvitation: <O extends OrganizationOptions>(option: O) => im
|
|
|
47
48
|
image?: string | null | undefined;
|
|
48
49
|
};
|
|
49
50
|
}>;
|
|
50
|
-
}
|
|
51
|
-
use: (
|
|
51
|
+
}>> | _$better_call0.Middleware<{
|
|
52
|
+
use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
|
|
52
53
|
session: {
|
|
53
54
|
session: Record<string, any> & {
|
|
54
55
|
id: string;
|
|
@@ -70,7 +71,31 @@ declare const createInvitation: <O extends OrganizationOptions>(option: O) => im
|
|
|
70
71
|
image?: string | null | undefined;
|
|
71
72
|
};
|
|
72
73
|
};
|
|
73
|
-
}
|
|
74
|
+
}>>[];
|
|
75
|
+
}, (inputContext: _$better_call0.MiddlewareInputContext<{
|
|
76
|
+
use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
|
|
77
|
+
session: {
|
|
78
|
+
session: Record<string, any> & {
|
|
79
|
+
id: string;
|
|
80
|
+
createdAt: Date;
|
|
81
|
+
updatedAt: Date;
|
|
82
|
+
userId: string;
|
|
83
|
+
expiresAt: Date;
|
|
84
|
+
token: string;
|
|
85
|
+
ipAddress?: string | null | undefined;
|
|
86
|
+
userAgent?: string | null | undefined;
|
|
87
|
+
};
|
|
88
|
+
user: Record<string, any> & {
|
|
89
|
+
id: string;
|
|
90
|
+
createdAt: Date;
|
|
91
|
+
updatedAt: Date;
|
|
92
|
+
email: string;
|
|
93
|
+
emailVerified: boolean;
|
|
94
|
+
name: string;
|
|
95
|
+
image?: string | null | undefined;
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
}>>[];
|
|
74
99
|
}>) => Promise<{
|
|
75
100
|
session: {
|
|
76
101
|
session: {
|
|
@@ -96,7 +121,7 @@ declare const createInvitation: <O extends OrganizationOptions>(option: O) => im
|
|
|
96
121
|
image?: string | null | undefined;
|
|
97
122
|
};
|
|
98
123
|
};
|
|
99
|
-
}
|
|
124
|
+
}>>)[];
|
|
100
125
|
body: z.ZodObject<{
|
|
101
126
|
email: z.ZodString;
|
|
102
127
|
role: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>;
|
|
@@ -205,9 +230,9 @@ declare const createInvitation: <O extends OrganizationOptions>(option: O) => im
|
|
|
205
230
|
createdAt: Date;
|
|
206
231
|
}) & (O["schema"] extends {
|
|
207
232
|
invitation?: {
|
|
208
|
-
additionalFields: infer Field extends Record<string,
|
|
233
|
+
additionalFields: infer Field extends Record<string, _$_better_auth_core_db0.DBFieldAttribute>;
|
|
209
234
|
} | undefined;
|
|
210
|
-
} ? FieldAttributeToObject<Field> : {}) extends
|
|
235
|
+
} ? FieldAttributeToObject<Field> : {}) extends infer T ? { [K in keyof T]: T[K] } : never) | ((O["teams"] extends {
|
|
211
236
|
enabled: true;
|
|
212
237
|
} ? {
|
|
213
238
|
id: string;
|
|
@@ -230,21 +255,21 @@ declare const createInvitation: <O extends OrganizationOptions>(option: O) => im
|
|
|
230
255
|
createdAt: Date;
|
|
231
256
|
}) & (O["schema"] extends {
|
|
232
257
|
invitation?: {
|
|
233
|
-
additionalFields: infer Field extends Record<string,
|
|
258
|
+
additionalFields: infer Field extends Record<string, _$_better_auth_core_db0.DBFieldAttribute>;
|
|
234
259
|
} | undefined;
|
|
235
|
-
} ? FieldAttributeToObject<RemoveFieldsWithReturnedFalse<Field>> : {}) extends
|
|
236
|
-
declare const acceptInvitation: <O extends OrganizationOptions>(options: O) =>
|
|
260
|
+
} ? FieldAttributeToObject<RemoveFieldsWithReturnedFalse<Field>> : {}) extends infer T_1 ? { [K_1 in keyof T_1]: T_1[K_1] } : never)>;
|
|
261
|
+
declare const acceptInvitation: <O extends OrganizationOptions>(options: O) => _$better_call0.StrictEndpoint<"/organization/accept-invitation", {
|
|
237
262
|
method: "POST";
|
|
238
263
|
body: z.ZodObject<{
|
|
239
264
|
invitationId: z.ZodString;
|
|
240
265
|
}, z.core.$strip>;
|
|
241
266
|
requireHeaders: true;
|
|
242
|
-
use: ((
|
|
267
|
+
use: (_$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
|
|
243
268
|
orgOptions: OrganizationOptions;
|
|
244
269
|
roles: typeof defaultRoles & {
|
|
245
270
|
[key: string]: Role<{}>;
|
|
246
271
|
};
|
|
247
|
-
getSession: (context:
|
|
272
|
+
getSession: (context: _$_better_auth_core0.GenericEndpointContext) => Promise<{
|
|
248
273
|
session: {
|
|
249
274
|
id: string;
|
|
250
275
|
createdAt: Date;
|
|
@@ -268,8 +293,8 @@ declare const acceptInvitation: <O extends OrganizationOptions>(options: O) => i
|
|
|
268
293
|
image?: string | null | undefined;
|
|
269
294
|
};
|
|
270
295
|
}>;
|
|
271
|
-
}
|
|
272
|
-
use: (
|
|
296
|
+
}>> | _$better_call0.Middleware<{
|
|
297
|
+
use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
|
|
273
298
|
session: {
|
|
274
299
|
session: Record<string, any> & {
|
|
275
300
|
id: string;
|
|
@@ -291,7 +316,31 @@ declare const acceptInvitation: <O extends OrganizationOptions>(options: O) => i
|
|
|
291
316
|
image?: string | null | undefined;
|
|
292
317
|
};
|
|
293
318
|
};
|
|
294
|
-
}
|
|
319
|
+
}>>[];
|
|
320
|
+
}, (inputContext: _$better_call0.MiddlewareInputContext<{
|
|
321
|
+
use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
|
|
322
|
+
session: {
|
|
323
|
+
session: Record<string, any> & {
|
|
324
|
+
id: string;
|
|
325
|
+
createdAt: Date;
|
|
326
|
+
updatedAt: Date;
|
|
327
|
+
userId: string;
|
|
328
|
+
expiresAt: Date;
|
|
329
|
+
token: string;
|
|
330
|
+
ipAddress?: string | null | undefined;
|
|
331
|
+
userAgent?: string | null | undefined;
|
|
332
|
+
};
|
|
333
|
+
user: Record<string, any> & {
|
|
334
|
+
id: string;
|
|
335
|
+
createdAt: Date;
|
|
336
|
+
updatedAt: Date;
|
|
337
|
+
email: string;
|
|
338
|
+
emailVerified: boolean;
|
|
339
|
+
name: string;
|
|
340
|
+
image?: string | null | undefined;
|
|
341
|
+
};
|
|
342
|
+
};
|
|
343
|
+
}>>[];
|
|
295
344
|
}>) => Promise<{
|
|
296
345
|
session: {
|
|
297
346
|
session: {
|
|
@@ -317,7 +366,7 @@ declare const acceptInvitation: <O extends OrganizationOptions>(options: O) => i
|
|
|
317
366
|
image?: string | null | undefined;
|
|
318
367
|
};
|
|
319
368
|
};
|
|
320
|
-
}
|
|
369
|
+
}>>)[];
|
|
321
370
|
metadata: {
|
|
322
371
|
openapi: {
|
|
323
372
|
description: string;
|
|
@@ -367,9 +416,9 @@ declare const acceptInvitation: <O extends OrganizationOptions>(options: O) => i
|
|
|
367
416
|
createdAt: Date;
|
|
368
417
|
}) & (O["schema"] extends {
|
|
369
418
|
invitation?: {
|
|
370
|
-
additionalFields: infer Field extends Record<string,
|
|
419
|
+
additionalFields: infer Field extends Record<string, _$_better_auth_core_db0.DBFieldAttribute>;
|
|
371
420
|
} | undefined;
|
|
372
|
-
} ? FieldAttributeToObject<Field> : {}) extends
|
|
421
|
+
} ? FieldAttributeToObject<Field> : {}) extends infer T ? { [K in keyof T]: T[K] } : never;
|
|
373
422
|
member: {
|
|
374
423
|
id: string;
|
|
375
424
|
organizationId: string;
|
|
@@ -378,18 +427,18 @@ declare const acceptInvitation: <O extends OrganizationOptions>(options: O) => i
|
|
|
378
427
|
createdAt: Date;
|
|
379
428
|
} & InferAdditionalFieldsFromPluginOptions<"member", O, false>;
|
|
380
429
|
}>;
|
|
381
|
-
declare const rejectInvitation: <O extends OrganizationOptions>(options: O) =>
|
|
430
|
+
declare const rejectInvitation: <O extends OrganizationOptions>(options: O) => _$better_call0.StrictEndpoint<"/organization/reject-invitation", {
|
|
382
431
|
method: "POST";
|
|
383
432
|
body: z.ZodObject<{
|
|
384
433
|
invitationId: z.ZodString;
|
|
385
434
|
}, z.core.$strip>;
|
|
386
435
|
requireHeaders: true;
|
|
387
|
-
use: ((
|
|
436
|
+
use: (_$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
|
|
388
437
|
orgOptions: OrganizationOptions;
|
|
389
438
|
roles: typeof defaultRoles & {
|
|
390
439
|
[key: string]: Role<{}>;
|
|
391
440
|
};
|
|
392
|
-
getSession: (context:
|
|
441
|
+
getSession: (context: _$_better_auth_core0.GenericEndpointContext) => Promise<{
|
|
393
442
|
session: {
|
|
394
443
|
id: string;
|
|
395
444
|
createdAt: Date;
|
|
@@ -413,8 +462,8 @@ declare const rejectInvitation: <O extends OrganizationOptions>(options: O) => i
|
|
|
413
462
|
image?: string | null | undefined;
|
|
414
463
|
};
|
|
415
464
|
}>;
|
|
416
|
-
}
|
|
417
|
-
use: (
|
|
465
|
+
}>> | _$better_call0.Middleware<{
|
|
466
|
+
use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
|
|
418
467
|
session: {
|
|
419
468
|
session: Record<string, any> & {
|
|
420
469
|
id: string;
|
|
@@ -436,7 +485,31 @@ declare const rejectInvitation: <O extends OrganizationOptions>(options: O) => i
|
|
|
436
485
|
image?: string | null | undefined;
|
|
437
486
|
};
|
|
438
487
|
};
|
|
439
|
-
}
|
|
488
|
+
}>>[];
|
|
489
|
+
}, (inputContext: _$better_call0.MiddlewareInputContext<{
|
|
490
|
+
use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
|
|
491
|
+
session: {
|
|
492
|
+
session: Record<string, any> & {
|
|
493
|
+
id: string;
|
|
494
|
+
createdAt: Date;
|
|
495
|
+
updatedAt: Date;
|
|
496
|
+
userId: string;
|
|
497
|
+
expiresAt: Date;
|
|
498
|
+
token: string;
|
|
499
|
+
ipAddress?: string | null | undefined;
|
|
500
|
+
userAgent?: string | null | undefined;
|
|
501
|
+
};
|
|
502
|
+
user: Record<string, any> & {
|
|
503
|
+
id: string;
|
|
504
|
+
createdAt: Date;
|
|
505
|
+
updatedAt: Date;
|
|
506
|
+
email: string;
|
|
507
|
+
emailVerified: boolean;
|
|
508
|
+
name: string;
|
|
509
|
+
image?: string | null | undefined;
|
|
510
|
+
};
|
|
511
|
+
};
|
|
512
|
+
}>>[];
|
|
440
513
|
}>) => Promise<{
|
|
441
514
|
session: {
|
|
442
515
|
session: {
|
|
@@ -462,7 +535,7 @@ declare const rejectInvitation: <O extends OrganizationOptions>(options: O) => i
|
|
|
462
535
|
image?: string | null | undefined;
|
|
463
536
|
};
|
|
464
537
|
};
|
|
465
|
-
}
|
|
538
|
+
}>>)[];
|
|
466
539
|
metadata: {
|
|
467
540
|
openapi: {
|
|
468
541
|
description: string;
|
|
@@ -502,18 +575,18 @@ declare const rejectInvitation: <O extends OrganizationOptions>(options: O) => i
|
|
|
502
575
|
} | null;
|
|
503
576
|
member: null;
|
|
504
577
|
}>;
|
|
505
|
-
declare const cancelInvitation: <O extends OrganizationOptions>(options: O) =>
|
|
578
|
+
declare const cancelInvitation: <O extends OrganizationOptions>(options: O) => _$better_call0.StrictEndpoint<"/organization/cancel-invitation", {
|
|
506
579
|
method: "POST";
|
|
507
580
|
body: z.ZodObject<{
|
|
508
581
|
invitationId: z.ZodString;
|
|
509
582
|
}, z.core.$strip>;
|
|
510
583
|
requireHeaders: true;
|
|
511
|
-
use: ((
|
|
584
|
+
use: (_$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
|
|
512
585
|
orgOptions: OrganizationOptions;
|
|
513
586
|
roles: typeof defaultRoles & {
|
|
514
587
|
[key: string]: Role<{}>;
|
|
515
588
|
};
|
|
516
|
-
getSession: (context:
|
|
589
|
+
getSession: (context: _$_better_auth_core0.GenericEndpointContext) => Promise<{
|
|
517
590
|
session: {
|
|
518
591
|
id: string;
|
|
519
592
|
createdAt: Date;
|
|
@@ -537,8 +610,32 @@ declare const cancelInvitation: <O extends OrganizationOptions>(options: O) => i
|
|
|
537
610
|
image?: string | null | undefined;
|
|
538
611
|
};
|
|
539
612
|
}>;
|
|
540
|
-
}
|
|
541
|
-
use: (
|
|
613
|
+
}>> | _$better_call0.Middleware<{
|
|
614
|
+
use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
|
|
615
|
+
session: {
|
|
616
|
+
session: Record<string, any> & {
|
|
617
|
+
id: string;
|
|
618
|
+
createdAt: Date;
|
|
619
|
+
updatedAt: Date;
|
|
620
|
+
userId: string;
|
|
621
|
+
expiresAt: Date;
|
|
622
|
+
token: string;
|
|
623
|
+
ipAddress?: string | null | undefined;
|
|
624
|
+
userAgent?: string | null | undefined;
|
|
625
|
+
};
|
|
626
|
+
user: Record<string, any> & {
|
|
627
|
+
id: string;
|
|
628
|
+
createdAt: Date;
|
|
629
|
+
updatedAt: Date;
|
|
630
|
+
email: string;
|
|
631
|
+
emailVerified: boolean;
|
|
632
|
+
name: string;
|
|
633
|
+
image?: string | null | undefined;
|
|
634
|
+
};
|
|
635
|
+
};
|
|
636
|
+
}>>[];
|
|
637
|
+
}, (inputContext: _$better_call0.MiddlewareInputContext<{
|
|
638
|
+
use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
|
|
542
639
|
session: {
|
|
543
640
|
session: Record<string, any> & {
|
|
544
641
|
id: string;
|
|
@@ -560,7 +657,7 @@ declare const cancelInvitation: <O extends OrganizationOptions>(options: O) => i
|
|
|
560
657
|
image?: string | null | undefined;
|
|
561
658
|
};
|
|
562
659
|
};
|
|
563
|
-
}
|
|
660
|
+
}>>[];
|
|
564
661
|
}>) => Promise<{
|
|
565
662
|
session: {
|
|
566
663
|
session: {
|
|
@@ -586,7 +683,7 @@ declare const cancelInvitation: <O extends OrganizationOptions>(options: O) => i
|
|
|
586
683
|
image?: string | null | undefined;
|
|
587
684
|
};
|
|
588
685
|
};
|
|
589
|
-
}
|
|
686
|
+
}>>)[];
|
|
590
687
|
openapi: {
|
|
591
688
|
operationId: string;
|
|
592
689
|
description: string;
|
|
@@ -631,17 +728,17 @@ declare const cancelInvitation: <O extends OrganizationOptions>(options: O) => i
|
|
|
631
728
|
createdAt: Date;
|
|
632
729
|
}) & (O["schema"] extends {
|
|
633
730
|
invitation?: {
|
|
634
|
-
additionalFields: infer Field extends Record<string,
|
|
731
|
+
additionalFields: infer Field extends Record<string, _$_better_auth_core_db0.DBFieldAttribute>;
|
|
635
732
|
} | undefined;
|
|
636
|
-
} ? FieldAttributeToObject<Field> : {}) extends
|
|
637
|
-
declare const getInvitation: <O extends OrganizationOptions>(options: O) =>
|
|
733
|
+
} ? FieldAttributeToObject<Field> : {}) extends infer T ? { [K in keyof T]: T[K] } : never) | null>;
|
|
734
|
+
declare const getInvitation: <O extends OrganizationOptions>(options: O) => _$better_call0.StrictEndpoint<"/organization/get-invitation", {
|
|
638
735
|
method: "GET";
|
|
639
|
-
use: (
|
|
736
|
+
use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
|
|
640
737
|
orgOptions: OrganizationOptions;
|
|
641
738
|
roles: typeof defaultRoles & {
|
|
642
739
|
[key: string]: Role<{}>;
|
|
643
740
|
};
|
|
644
|
-
getSession: (context:
|
|
741
|
+
getSession: (context: _$_better_auth_core0.GenericEndpointContext) => Promise<{
|
|
645
742
|
session: {
|
|
646
743
|
id: string;
|
|
647
744
|
createdAt: Date;
|
|
@@ -665,7 +762,7 @@ declare const getInvitation: <O extends OrganizationOptions>(options: O) => impo
|
|
|
665
762
|
image?: string | null | undefined;
|
|
666
763
|
};
|
|
667
764
|
}>;
|
|
668
|
-
}
|
|
765
|
+
}>>[];
|
|
669
766
|
requireHeaders: true;
|
|
670
767
|
query: z.ZodObject<{
|
|
671
768
|
id: z.ZodString;
|
|
@@ -743,9 +840,9 @@ declare const getInvitation: <O extends OrganizationOptions>(options: O) => impo
|
|
|
743
840
|
createdAt: Date;
|
|
744
841
|
}) & (O["schema"] extends {
|
|
745
842
|
invitation?: {
|
|
746
|
-
additionalFields: infer Field extends Record<string,
|
|
843
|
+
additionalFields: infer Field extends Record<string, _$_better_auth_core_db0.DBFieldAttribute>;
|
|
747
844
|
} | undefined;
|
|
748
|
-
} ? FieldAttributeToObject<Field> : {}) extends
|
|
845
|
+
} ? FieldAttributeToObject<Field> : {}) extends infer T ? { [K in keyof T]: T[K] } : never) & {
|
|
749
846
|
organizationName: ({
|
|
750
847
|
id: string;
|
|
751
848
|
name: string;
|
|
@@ -755,7 +852,7 @@ declare const getInvitation: <O extends OrganizationOptions>(options: O) => impo
|
|
|
755
852
|
metadata?: any;
|
|
756
853
|
} & (O["schema"] extends {
|
|
757
854
|
organization?: {
|
|
758
|
-
additionalFields: infer Field extends Record<string,
|
|
855
|
+
additionalFields: infer Field extends Record<string, _$_better_auth_core_db0.DBFieldAttribute>;
|
|
759
856
|
} | undefined;
|
|
760
857
|
} ? FieldAttributeToObject<RemoveFieldsWithReturnedFalse<Field>> : {}))["name"];
|
|
761
858
|
organizationSlug: ({
|
|
@@ -767,20 +864,20 @@ declare const getInvitation: <O extends OrganizationOptions>(options: O) => impo
|
|
|
767
864
|
metadata?: any;
|
|
768
865
|
} & (O["schema"] extends {
|
|
769
866
|
organization?: {
|
|
770
|
-
additionalFields: infer Field extends Record<string,
|
|
867
|
+
additionalFields: infer Field extends Record<string, _$_better_auth_core_db0.DBFieldAttribute>;
|
|
771
868
|
} | undefined;
|
|
772
869
|
} ? FieldAttributeToObject<RemoveFieldsWithReturnedFalse<Field>> : {}))["slug"];
|
|
773
870
|
inviterEmail: string;
|
|
774
871
|
}>;
|
|
775
|
-
declare const listInvitations: <O extends OrganizationOptions>(options: O) =>
|
|
872
|
+
declare const listInvitations: <O extends OrganizationOptions>(options: O) => _$better_call0.StrictEndpoint<"/organization/list-invitations", {
|
|
776
873
|
method: "GET";
|
|
777
874
|
requireHeaders: true;
|
|
778
|
-
use: ((
|
|
875
|
+
use: (_$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
|
|
779
876
|
orgOptions: OrganizationOptions;
|
|
780
877
|
roles: typeof defaultRoles & {
|
|
781
878
|
[key: string]: Role<{}>;
|
|
782
879
|
};
|
|
783
|
-
getSession: (context:
|
|
880
|
+
getSession: (context: _$_better_auth_core0.GenericEndpointContext) => Promise<{
|
|
784
881
|
session: {
|
|
785
882
|
id: string;
|
|
786
883
|
createdAt: Date;
|
|
@@ -804,8 +901,32 @@ declare const listInvitations: <O extends OrganizationOptions>(options: O) => im
|
|
|
804
901
|
image?: string | null | undefined;
|
|
805
902
|
};
|
|
806
903
|
}>;
|
|
807
|
-
}
|
|
808
|
-
use: (
|
|
904
|
+
}>> | _$better_call0.Middleware<{
|
|
905
|
+
use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
|
|
906
|
+
session: {
|
|
907
|
+
session: Record<string, any> & {
|
|
908
|
+
id: string;
|
|
909
|
+
createdAt: Date;
|
|
910
|
+
updatedAt: Date;
|
|
911
|
+
userId: string;
|
|
912
|
+
expiresAt: Date;
|
|
913
|
+
token: string;
|
|
914
|
+
ipAddress?: string | null | undefined;
|
|
915
|
+
userAgent?: string | null | undefined;
|
|
916
|
+
};
|
|
917
|
+
user: Record<string, any> & {
|
|
918
|
+
id: string;
|
|
919
|
+
createdAt: Date;
|
|
920
|
+
updatedAt: Date;
|
|
921
|
+
email: string;
|
|
922
|
+
emailVerified: boolean;
|
|
923
|
+
name: string;
|
|
924
|
+
image?: string | null | undefined;
|
|
925
|
+
};
|
|
926
|
+
};
|
|
927
|
+
}>>[];
|
|
928
|
+
}, (inputContext: _$better_call0.MiddlewareInputContext<{
|
|
929
|
+
use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
|
|
809
930
|
session: {
|
|
810
931
|
session: Record<string, any> & {
|
|
811
932
|
id: string;
|
|
@@ -827,7 +948,7 @@ declare const listInvitations: <O extends OrganizationOptions>(options: O) => im
|
|
|
827
948
|
image?: string | null | undefined;
|
|
828
949
|
};
|
|
829
950
|
};
|
|
830
|
-
}
|
|
951
|
+
}>>[];
|
|
831
952
|
}>) => Promise<{
|
|
832
953
|
session: {
|
|
833
954
|
session: {
|
|
@@ -853,7 +974,7 @@ declare const listInvitations: <O extends OrganizationOptions>(options: O) => im
|
|
|
853
974
|
image?: string | null | undefined;
|
|
854
975
|
};
|
|
855
976
|
};
|
|
856
|
-
}
|
|
977
|
+
}>>)[];
|
|
857
978
|
query: z.ZodOptional<z.ZodObject<{
|
|
858
979
|
organizationId: z.ZodOptional<z.ZodString>;
|
|
859
980
|
}, z.core.$strip>>;
|
|
@@ -880,20 +1001,20 @@ declare const listInvitations: <O extends OrganizationOptions>(options: O) => im
|
|
|
880
1001
|
createdAt: Date;
|
|
881
1002
|
}) & (O["schema"] extends {
|
|
882
1003
|
invitation?: {
|
|
883
|
-
additionalFields: infer Field extends Record<string,
|
|
1004
|
+
additionalFields: infer Field extends Record<string, _$_better_auth_core_db0.DBFieldAttribute>;
|
|
884
1005
|
} | undefined;
|
|
885
|
-
} ? FieldAttributeToObject<Field> : {}) extends
|
|
1006
|
+
} ? FieldAttributeToObject<Field> : {}) extends infer T ? { [K in keyof T]: T[K] } : never)[]>;
|
|
886
1007
|
/**
|
|
887
1008
|
* List all invitations a user has received
|
|
888
1009
|
*/
|
|
889
|
-
declare const listUserInvitations: <O extends OrganizationOptions>(options: O) =>
|
|
1010
|
+
declare const listUserInvitations: <O extends OrganizationOptions>(options: O) => _$better_call0.StrictEndpoint<"/organization/list-user-invitations", {
|
|
890
1011
|
method: "GET";
|
|
891
|
-
use: (
|
|
1012
|
+
use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
|
|
892
1013
|
orgOptions: OrganizationOptions;
|
|
893
1014
|
roles: typeof defaultRoles & {
|
|
894
1015
|
[key: string]: Role<{}>;
|
|
895
1016
|
};
|
|
896
|
-
getSession: (context:
|
|
1017
|
+
getSession: (context: _$_better_auth_core0.GenericEndpointContext) => Promise<{
|
|
897
1018
|
session: {
|
|
898
1019
|
id: string;
|
|
899
1020
|
createdAt: Date;
|
|
@@ -917,7 +1038,7 @@ declare const listUserInvitations: <O extends OrganizationOptions>(options: O) =
|
|
|
917
1038
|
image?: string | null | undefined;
|
|
918
1039
|
};
|
|
919
1040
|
}>;
|
|
920
|
-
}
|
|
1041
|
+
}>>[];
|
|
921
1042
|
query: z.ZodOptional<z.ZodObject<{
|
|
922
1043
|
email: z.ZodOptional<z.ZodString>;
|
|
923
1044
|
}, z.core.$strip>>;
|
|
@@ -1000,9 +1121,9 @@ declare const listUserInvitations: <O extends OrganizationOptions>(options: O) =
|
|
|
1000
1121
|
createdAt: Date;
|
|
1001
1122
|
}) & (O["schema"] extends {
|
|
1002
1123
|
invitation?: {
|
|
1003
|
-
additionalFields: infer Field extends Record<string,
|
|
1124
|
+
additionalFields: infer Field extends Record<string, _$_better_auth_core_db0.DBFieldAttribute>;
|
|
1004
1125
|
} | undefined;
|
|
1005
|
-
} ? FieldAttributeToObject<Field> : {}) extends
|
|
1126
|
+
} ? FieldAttributeToObject<Field> : {}) extends infer T ? { [K in keyof T]: T[K] } : never) & {
|
|
1006
1127
|
organization: {
|
|
1007
1128
|
id: string;
|
|
1008
1129
|
name: string;
|
|
@@ -1012,9 +1133,9 @@ declare const listUserInvitations: <O extends OrganizationOptions>(options: O) =
|
|
|
1012
1133
|
metadata?: any;
|
|
1013
1134
|
} & (O["schema"] extends {
|
|
1014
1135
|
organization?: {
|
|
1015
|
-
additionalFields: infer Field extends Record<string,
|
|
1136
|
+
additionalFields: infer Field extends Record<string, _$_better_auth_core_db0.DBFieldAttribute>;
|
|
1016
1137
|
} | undefined;
|
|
1017
|
-
} ? FieldAttributeToObject<Field> : {}) extends
|
|
1138
|
+
} ? FieldAttributeToObject<Field> : {}) extends infer T_1 ? { [K_1 in keyof T_1]: T_1[K_1] } : never;
|
|
1018
1139
|
}, "organization"> & {
|
|
1019
1140
|
organizationName: ({
|
|
1020
1141
|
id: string;
|
|
@@ -1025,7 +1146,7 @@ declare const listUserInvitations: <O extends OrganizationOptions>(options: O) =
|
|
|
1025
1146
|
metadata?: any;
|
|
1026
1147
|
} & (O["schema"] extends {
|
|
1027
1148
|
organization?: {
|
|
1028
|
-
additionalFields: infer Field extends Record<string,
|
|
1149
|
+
additionalFields: infer Field extends Record<string, _$_better_auth_core_db0.DBFieldAttribute>;
|
|
1029
1150
|
} | undefined;
|
|
1030
1151
|
} ? FieldAttributeToObject<Field> : {}))["name"];
|
|
1031
1152
|
})[]>;
|
|
@@ -103,7 +103,7 @@ const createInvitation = (option) => {
|
|
|
103
103
|
const rolesArray = roles.split(",").map((r) => r.trim()).filter(Boolean);
|
|
104
104
|
const defaults = Object.keys(defaultRoles);
|
|
105
105
|
const customRoles = Object.keys(ctx.context.orgOptions.roles || {});
|
|
106
|
-
const validStaticRoles =
|
|
106
|
+
const validStaticRoles = new Set([...defaults, ...customRoles]);
|
|
107
107
|
const unknownRoles = rolesArray.filter((role) => !validStaticRoles.has(role));
|
|
108
108
|
if (unknownRoles.length > 0) if (ctx.context.orgOptions.dynamicAccessControl?.enabled) {
|
|
109
109
|
const foundRoleNames = (await ctx.context.adapter.findMany({
|