@bitakit/better-auth 0.2.5 → 0.3.0

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.
@@ -0,0 +1,697 @@
1
+ import type { AccessConfiguration } from '@bitakit/core';
2
+ import { type OrganizationOptions } from 'better-auth/plugins/organization';
3
+ export { membershipGuard, membershipGuardErrors, type MembershipGuardOptions } from './guard.js';
4
+ export { anyDomain, invitationPolicyAllows, invitationPolicyView, normalizeDomain, parseInvitationPolicy, storedInvitationPolicy, InvitationPolicyError, type InvitationDomain, type InvitationPolicy, type InvitationPolicyMode, type InvitationPolicyView, } from './domain-policy.js';
5
+ /** Organization options BitaKit derives from `accessConfiguration`; the app must not set them. */
6
+ declare const derived: readonly ["ac", "roles", "creatorRole", "dynamicAccessControl"];
7
+ type AppOrganizationOptions = Omit<OrganizationOptions, (typeof derived)[number]>;
8
+ /**
9
+ * Better Auth's server `organization` plugin for a BitaKit app: the roles and permissions from the
10
+ * generated `accessConfiguration`, and the membership guard (role ceiling, invitation re-validation,
11
+ * invitation domain policy) installed in the same plugin, so it cannot be left out. Every other
12
+ * organization option (invitation e-mail, hooks, teams, limits) is the app's, unchanged.
13
+ *
14
+ * ```ts
15
+ * betterAuth({ plugins: [createOrganizationPlugin(accessConfiguration, { sendInvitationEmail })] });
16
+ * ```
17
+ */
18
+ export declare function createOrganizationPlugin(configuration: AccessConfiguration, options?: AppOrganizationOptions): import("better-auth/client").DefaultOrganizationPlugin<{
19
+ dynamicAccessControl?: {
20
+ enabled: boolean;
21
+ } | undefined;
22
+ ac: import("better-auth/client").AccessControl;
23
+ roles: Record<string, import("better-auth/client").Role>;
24
+ creatorRole: string;
25
+ schema?: {
26
+ session?: {
27
+ fields?: {
28
+ activeOrganizationId?: string;
29
+ activeTeamId?: string;
30
+ };
31
+ };
32
+ organization?: {
33
+ modelName?: string;
34
+ fields?: { [key in keyof Omit<import("better-auth/client").Organization, "id">]?: string; };
35
+ additionalFields?: { [key in string]: import("better-auth").DBFieldAttribute; };
36
+ };
37
+ member?: {
38
+ modelName?: string;
39
+ fields?: { [key in keyof Omit<import("better-auth/client").Member, "id">]?: string; };
40
+ additionalFields?: { [key in string]: import("better-auth").DBFieldAttribute; };
41
+ };
42
+ invitation?: {
43
+ modelName?: string;
44
+ fields?: { [key in keyof Omit<import("better-auth/client").Invitation, "id">]?: string; };
45
+ additionalFields?: { [key in string]: import("better-auth").DBFieldAttribute; };
46
+ };
47
+ team?: {
48
+ modelName?: string;
49
+ fields?: { [key in keyof Omit<import("better-auth/client").Team, "id"> | "memberCount"]?: string; };
50
+ additionalFields?: { [key in string]: import("better-auth").DBFieldAttribute; };
51
+ };
52
+ teamMember?: {
53
+ modelName?: string;
54
+ fields?: { [key in keyof Omit<import("better-auth/client").TeamMember, "id"> | "membershipKey"]?: string; };
55
+ };
56
+ organizationRole?: {
57
+ modelName?: string;
58
+ fields?: { [key in keyof Omit<import("better-auth/client").OrganizationRole, "id">]?: string; };
59
+ additionalFields?: { [key in string]: import("better-auth").DBFieldAttribute; };
60
+ };
61
+ } | undefined | undefined;
62
+ teams?: {
63
+ enabled: boolean;
64
+ defaultTeam?: {
65
+ enabled: boolean;
66
+ customCreateDefaultTeam?: (organization: import("better-auth/client").Organization & Record<string, any>, ctx?: import("better-auth").GenericEndpointContext) => Promise<import("better-auth/client").Team & Record<string, any>>;
67
+ };
68
+ maximumTeams?: ((data: {
69
+ organizationId: string;
70
+ session: {
71
+ user: import("better-auth").User;
72
+ session: import("better-auth").Session;
73
+ } | null;
74
+ }, ctx?: import("better-auth").GenericEndpointContext) => import("better-auth").Awaitable<number>) | number;
75
+ maximumMembersPerTeam?: number | ((data: {
76
+ teamId: string;
77
+ session: {
78
+ user: import("better-auth").User;
79
+ session: import("better-auth").Session;
80
+ };
81
+ organizationId: string;
82
+ }) => import("better-auth").Awaitable<number>) | undefined;
83
+ allowRemovingAllTeams?: boolean;
84
+ } | undefined;
85
+ allowUserToCreateOrganization?: (boolean | ((user: import("better-auth").User & Record<string, any>) => import("better-auth").Awaitable<boolean>)) | undefined | undefined;
86
+ organizationLimit?: (number | ((user: import("better-auth").User & Record<string, any>) => import("better-auth").Awaitable<boolean>)) | undefined | undefined;
87
+ membershipLimit?: number | ((user: import("better-auth").User, organization: import("better-auth/client").Organization) => Promise<number> | number) | undefined | undefined;
88
+ invitationExpiresIn?: number | undefined | undefined;
89
+ invitationLimit?: number | ((data: {
90
+ user: import("better-auth").User & Record<string, any>;
91
+ organization: import("better-auth/client").Organization & Record<string, any>;
92
+ member: import("better-auth/client").Member & Record<string, any>;
93
+ }, ctx: import("better-auth").AuthContext) => import("better-auth").Awaitable<number>) | undefined | undefined;
94
+ cancelPendingInvitationsOnReInvite?: boolean | undefined | undefined;
95
+ requireEmailVerificationOnInvitation?: boolean | undefined | undefined;
96
+ sendInvitationEmail?: ((data: {
97
+ id: string;
98
+ role: string;
99
+ email: string;
100
+ organization: import("better-auth/client").Organization;
101
+ invitation: import("better-auth/client").Invitation;
102
+ inviter: import("better-auth/client").Member & {
103
+ user: import("better-auth").User;
104
+ };
105
+ }, request?: Request) => Promise<void>) | undefined | undefined;
106
+ disableOrganizationDeletion?: boolean | undefined | undefined;
107
+ organizationHooks?: {
108
+ beforeCreateOrganization?: (data: {
109
+ organization: {
110
+ name?: string;
111
+ slug?: string;
112
+ logo?: string | null;
113
+ metadata?: Record<string, any>;
114
+ [key: string]: any;
115
+ };
116
+ user: import("better-auth").User & Record<string, any>;
117
+ }) => Promise<void | {
118
+ data: Record<string, any>;
119
+ }>;
120
+ afterCreateOrganization?: (data: {
121
+ organization: import("better-auth/client").Organization & Record<string, any>;
122
+ member: import("better-auth/client").Member & Record<string, any>;
123
+ user: import("better-auth").User & Record<string, any>;
124
+ }) => Promise<void>;
125
+ beforeUpdateOrganization?: (data: {
126
+ organization: {
127
+ name?: string;
128
+ slug?: string;
129
+ logo?: string | null;
130
+ metadata?: Record<string, any>;
131
+ [key: string]: any;
132
+ };
133
+ user: import("better-auth").User & Record<string, any>;
134
+ member: import("better-auth/client").Member & Record<string, any>;
135
+ }) => Promise<void | {
136
+ data: {
137
+ name?: string;
138
+ slug?: string;
139
+ logo?: string | null;
140
+ metadata?: Record<string, any>;
141
+ [key: string]: any;
142
+ };
143
+ }>;
144
+ afterUpdateOrganization?: (data: {
145
+ organization: (import("better-auth/client").Organization & Record<string, any>) | null;
146
+ user: import("better-auth").User & Record<string, any>;
147
+ member: import("better-auth/client").Member & Record<string, any>;
148
+ }) => Promise<void>;
149
+ beforeDeleteOrganization?: (data: {
150
+ organization: import("better-auth/client").Organization & Record<string, any>;
151
+ user: import("better-auth").User & Record<string, any>;
152
+ }, ctx?: import("better-auth").GenericEndpointContext) => Promise<void>;
153
+ afterDeleteOrganization?: (data: {
154
+ organization: import("better-auth/client").Organization & Record<string, any>;
155
+ user: import("better-auth").User & Record<string, any>;
156
+ }, ctx?: import("better-auth").GenericEndpointContext) => Promise<void>;
157
+ beforeAddMember?: (data: {
158
+ member: {
159
+ userId: string;
160
+ organizationId: string;
161
+ role: string;
162
+ [key: string]: any;
163
+ };
164
+ user: import("better-auth").User & Record<string, any>;
165
+ organization: import("better-auth/client").Organization & Record<string, any>;
166
+ }) => Promise<void | {
167
+ data: Record<string, any>;
168
+ }>;
169
+ afterAddMember?: (data: {
170
+ member: import("better-auth/client").Member & Record<string, any>;
171
+ user: import("better-auth").User & Record<string, any>;
172
+ organization: import("better-auth/client").Organization & Record<string, any>;
173
+ }) => Promise<void>;
174
+ beforeRemoveMember?: (data: {
175
+ member: import("better-auth/client").Member & Record<string, any>;
176
+ user: import("better-auth").User & Record<string, any>;
177
+ organization: import("better-auth/client").Organization & Record<string, any>;
178
+ }) => Promise<void>;
179
+ afterRemoveMember?: (data: {
180
+ member: import("better-auth/client").Member & Record<string, any>;
181
+ user: import("better-auth").User & Record<string, any>;
182
+ organization: import("better-auth/client").Organization & Record<string, any>;
183
+ }) => Promise<void>;
184
+ beforeUpdateMemberRole?: (data: {
185
+ member: import("better-auth/client").Member & Record<string, any>;
186
+ newRole: string;
187
+ user: import("better-auth").User & Record<string, any>;
188
+ organization: import("better-auth/client").Organization & Record<string, any>;
189
+ }) => Promise<void | {
190
+ data: {
191
+ role: string;
192
+ [key: string]: any;
193
+ };
194
+ }>;
195
+ afterUpdateMemberRole?: (data: {
196
+ member: import("better-auth/client").Member & Record<string, any>;
197
+ previousRole: string;
198
+ user: import("better-auth").User & Record<string, any>;
199
+ organization: import("better-auth/client").Organization & Record<string, any>;
200
+ }) => Promise<void>;
201
+ beforeCreateInvitation?: (data: {
202
+ invitation: {
203
+ email: string;
204
+ role: string;
205
+ organizationId: string;
206
+ inviterId: string;
207
+ teamId?: string;
208
+ [key: string]: any;
209
+ };
210
+ inviter: import("better-auth").User & Record<string, any>;
211
+ organization: import("better-auth/client").Organization & Record<string, any>;
212
+ }) => Promise<void | {
213
+ data: Record<string, any>;
214
+ }>;
215
+ afterCreateInvitation?: (data: {
216
+ invitation: import("better-auth/client").Invitation & Record<string, any>;
217
+ inviter: import("better-auth").User & Record<string, any>;
218
+ organization: import("better-auth/client").Organization & Record<string, any>;
219
+ }) => Promise<void>;
220
+ beforeAcceptInvitation?: (data: {
221
+ invitation: import("better-auth/client").Invitation & Record<string, any>;
222
+ user: import("better-auth").User & Record<string, any>;
223
+ organization: import("better-auth/client").Organization & Record<string, any>;
224
+ }) => Promise<void>;
225
+ afterAcceptInvitation?: (data: {
226
+ invitation: import("better-auth/client").Invitation & Record<string, any>;
227
+ member: import("better-auth/client").Member & Record<string, any>;
228
+ user: import("better-auth").User & Record<string, any>;
229
+ organization: import("better-auth/client").Organization & Record<string, any>;
230
+ }) => Promise<void>;
231
+ beforeRejectInvitation?: (data: {
232
+ invitation: import("better-auth/client").Invitation & Record<string, any>;
233
+ user: import("better-auth").User & Record<string, any>;
234
+ organization: import("better-auth/client").Organization & Record<string, any>;
235
+ }) => Promise<void>;
236
+ afterRejectInvitation?: (data: {
237
+ invitation: import("better-auth/client").Invitation & Record<string, any>;
238
+ user: import("better-auth").User & Record<string, any>;
239
+ organization: import("better-auth/client").Organization & Record<string, any>;
240
+ }) => Promise<void>;
241
+ beforeCancelInvitation?: (data: {
242
+ invitation: import("better-auth/client").Invitation & Record<string, any>;
243
+ cancelledBy: import("better-auth").User & Record<string, any>;
244
+ organization: import("better-auth/client").Organization & Record<string, any>;
245
+ }) => Promise<void>;
246
+ afterCancelInvitation?: (data: {
247
+ invitation: import("better-auth/client").Invitation & Record<string, any>;
248
+ cancelledBy: import("better-auth").User & Record<string, any>;
249
+ organization: import("better-auth/client").Organization & Record<string, any>;
250
+ }) => Promise<void>;
251
+ beforeCreateTeam?: (data: {
252
+ team: {
253
+ name: string;
254
+ organizationId: string;
255
+ [key: string]: any;
256
+ };
257
+ user?: import("better-auth").User & Record<string, any>;
258
+ organization: import("better-auth/client").Organization & Record<string, any>;
259
+ }) => Promise<void | {
260
+ data: Record<string, any>;
261
+ }>;
262
+ afterCreateTeam?: (data: {
263
+ team: import("better-auth/client").Team & Record<string, any>;
264
+ user?: import("better-auth").User & Record<string, any>;
265
+ organization: import("better-auth/client").Organization & Record<string, any>;
266
+ }) => Promise<void>;
267
+ beforeUpdateTeam?: (data: {
268
+ team: import("better-auth/client").Team & Record<string, any>;
269
+ updates: {
270
+ name?: string;
271
+ [key: string]: any;
272
+ };
273
+ user: import("better-auth").User & Record<string, any>;
274
+ organization: import("better-auth/client").Organization & Record<string, any>;
275
+ }) => Promise<void | {
276
+ data: Record<string, any>;
277
+ }>;
278
+ afterUpdateTeam?: (data: {
279
+ team: (import("better-auth/client").Team & Record<string, any>) | null;
280
+ user: import("better-auth").User & Record<string, any>;
281
+ organization: import("better-auth/client").Organization & Record<string, any>;
282
+ }) => Promise<void>;
283
+ beforeDeleteTeam?: (data: {
284
+ team: import("better-auth/client").Team & Record<string, any>;
285
+ user?: import("better-auth").User & Record<string, any>;
286
+ organization: import("better-auth/client").Organization & Record<string, any>;
287
+ }) => Promise<void>;
288
+ afterDeleteTeam?: (data: {
289
+ team: import("better-auth/client").Team & Record<string, any>;
290
+ user?: import("better-auth").User & Record<string, any>;
291
+ organization: import("better-auth/client").Organization & Record<string, any>;
292
+ }) => Promise<void>;
293
+ beforeAddTeamMember?: (data: {
294
+ teamMember: {
295
+ teamId: string;
296
+ userId: string;
297
+ [key: string]: any;
298
+ };
299
+ team: import("better-auth/client").Team & Record<string, any>;
300
+ user: import("better-auth").User & Record<string, any>;
301
+ organization: import("better-auth/client").Organization & Record<string, any>;
302
+ }) => Promise<void | {
303
+ data: Record<string, any>;
304
+ }>;
305
+ afterAddTeamMember?: (data: {
306
+ teamMember: import("better-auth/client").TeamMember & Record<string, any>;
307
+ team: import("better-auth/client").Team & Record<string, any>;
308
+ user: import("better-auth").User & Record<string, any>;
309
+ organization: import("better-auth/client").Organization & Record<string, any>;
310
+ }) => Promise<void>;
311
+ beforeRemoveTeamMember?: (data: {
312
+ teamMember: import("better-auth/client").TeamMember & Record<string, any>;
313
+ team: import("better-auth/client").Team & Record<string, any>;
314
+ user: import("better-auth").User & Record<string, any>;
315
+ organization: import("better-auth/client").Organization & Record<string, any>;
316
+ }) => Promise<void>;
317
+ afterRemoveTeamMember?: (data: {
318
+ teamMember: import("better-auth/client").TeamMember & Record<string, any>;
319
+ team: import("better-auth/client").Team & Record<string, any>;
320
+ user: import("better-auth").User & Record<string, any>;
321
+ organization: import("better-auth/client").Organization & Record<string, any>;
322
+ }) => Promise<void>;
323
+ } | undefined | undefined;
324
+ }> & {
325
+ endpoints: import("better-auth/client").OrganizationEndpoints<{
326
+ dynamicAccessControl?: {
327
+ enabled: boolean;
328
+ } | undefined;
329
+ ac: import("better-auth/client").AccessControl;
330
+ roles: Record<string, import("better-auth/client").Role>;
331
+ creatorRole: string;
332
+ schema?: {
333
+ session?: {
334
+ fields?: {
335
+ activeOrganizationId?: string;
336
+ activeTeamId?: string;
337
+ };
338
+ };
339
+ organization?: {
340
+ modelName?: string;
341
+ fields?: { [key in keyof Omit<import("better-auth/client").Organization, "id">]?: string; };
342
+ additionalFields?: { [key in string]: import("better-auth").DBFieldAttribute; };
343
+ };
344
+ member?: {
345
+ modelName?: string;
346
+ fields?: { [key in keyof Omit<import("better-auth/client").Member, "id">]?: string; };
347
+ additionalFields?: { [key in string]: import("better-auth").DBFieldAttribute; };
348
+ };
349
+ invitation?: {
350
+ modelName?: string;
351
+ fields?: { [key in keyof Omit<import("better-auth/client").Invitation, "id">]?: string; };
352
+ additionalFields?: { [key in string]: import("better-auth").DBFieldAttribute; };
353
+ };
354
+ team?: {
355
+ modelName?: string;
356
+ fields?: { [key in keyof Omit<import("better-auth/client").Team, "id"> | "memberCount"]?: string; };
357
+ additionalFields?: { [key in string]: import("better-auth").DBFieldAttribute; };
358
+ };
359
+ teamMember?: {
360
+ modelName?: string;
361
+ fields?: { [key in keyof Omit<import("better-auth/client").TeamMember, "id"> | "membershipKey"]?: string; };
362
+ };
363
+ organizationRole?: {
364
+ modelName?: string;
365
+ fields?: { [key in keyof Omit<import("better-auth/client").OrganizationRole, "id">]?: string; };
366
+ additionalFields?: { [key in string]: import("better-auth").DBFieldAttribute; };
367
+ };
368
+ } | undefined | undefined;
369
+ teams?: {
370
+ enabled: boolean;
371
+ defaultTeam?: {
372
+ enabled: boolean;
373
+ customCreateDefaultTeam?: (organization: import("better-auth/client").Organization & Record<string, any>, ctx?: import("better-auth").GenericEndpointContext) => Promise<import("better-auth/client").Team & Record<string, any>>;
374
+ };
375
+ maximumTeams?: ((data: {
376
+ organizationId: string;
377
+ session: {
378
+ user: import("better-auth").User;
379
+ session: import("better-auth").Session;
380
+ } | null;
381
+ }, ctx?: import("better-auth").GenericEndpointContext) => import("better-auth").Awaitable<number>) | number;
382
+ maximumMembersPerTeam?: number | ((data: {
383
+ teamId: string;
384
+ session: {
385
+ user: import("better-auth").User;
386
+ session: import("better-auth").Session;
387
+ };
388
+ organizationId: string;
389
+ }) => import("better-auth").Awaitable<number>) | undefined;
390
+ allowRemovingAllTeams?: boolean;
391
+ } | undefined;
392
+ allowUserToCreateOrganization?: (boolean | ((user: import("better-auth").User & Record<string, any>) => import("better-auth").Awaitable<boolean>)) | undefined | undefined;
393
+ organizationLimit?: (number | ((user: import("better-auth").User & Record<string, any>) => import("better-auth").Awaitable<boolean>)) | undefined | undefined;
394
+ membershipLimit?: number | ((user: import("better-auth").User, organization: import("better-auth/client").Organization) => Promise<number> | number) | undefined | undefined;
395
+ invitationExpiresIn?: number | undefined | undefined;
396
+ invitationLimit?: number | ((data: {
397
+ user: import("better-auth").User & Record<string, any>;
398
+ organization: import("better-auth/client").Organization & Record<string, any>;
399
+ member: import("better-auth/client").Member & Record<string, any>;
400
+ }, ctx: import("better-auth").AuthContext) => import("better-auth").Awaitable<number>) | undefined | undefined;
401
+ cancelPendingInvitationsOnReInvite?: boolean | undefined | undefined;
402
+ requireEmailVerificationOnInvitation?: boolean | undefined | undefined;
403
+ sendInvitationEmail?: ((data: {
404
+ id: string;
405
+ role: string;
406
+ email: string;
407
+ organization: import("better-auth/client").Organization;
408
+ invitation: import("better-auth/client").Invitation;
409
+ inviter: import("better-auth/client").Member & {
410
+ user: import("better-auth").User;
411
+ };
412
+ }, request?: Request) => Promise<void>) | undefined | undefined;
413
+ disableOrganizationDeletion?: boolean | undefined | undefined;
414
+ organizationHooks?: {
415
+ beforeCreateOrganization?: (data: {
416
+ organization: {
417
+ name?: string;
418
+ slug?: string;
419
+ logo?: string | null;
420
+ metadata?: Record<string, any>;
421
+ [key: string]: any;
422
+ };
423
+ user: import("better-auth").User & Record<string, any>;
424
+ }) => Promise<void | {
425
+ data: Record<string, any>;
426
+ }>;
427
+ afterCreateOrganization?: (data: {
428
+ organization: import("better-auth/client").Organization & Record<string, any>;
429
+ member: import("better-auth/client").Member & Record<string, any>;
430
+ user: import("better-auth").User & Record<string, any>;
431
+ }) => Promise<void>;
432
+ beforeUpdateOrganization?: (data: {
433
+ organization: {
434
+ name?: string;
435
+ slug?: string;
436
+ logo?: string | null;
437
+ metadata?: Record<string, any>;
438
+ [key: string]: any;
439
+ };
440
+ user: import("better-auth").User & Record<string, any>;
441
+ member: import("better-auth/client").Member & Record<string, any>;
442
+ }) => Promise<void | {
443
+ data: {
444
+ name?: string;
445
+ slug?: string;
446
+ logo?: string | null;
447
+ metadata?: Record<string, any>;
448
+ [key: string]: any;
449
+ };
450
+ }>;
451
+ afterUpdateOrganization?: (data: {
452
+ organization: (import("better-auth/client").Organization & Record<string, any>) | null;
453
+ user: import("better-auth").User & Record<string, any>;
454
+ member: import("better-auth/client").Member & Record<string, any>;
455
+ }) => Promise<void>;
456
+ beforeDeleteOrganization?: (data: {
457
+ organization: import("better-auth/client").Organization & Record<string, any>;
458
+ user: import("better-auth").User & Record<string, any>;
459
+ }, ctx?: import("better-auth").GenericEndpointContext) => Promise<void>;
460
+ afterDeleteOrganization?: (data: {
461
+ organization: import("better-auth/client").Organization & Record<string, any>;
462
+ user: import("better-auth").User & Record<string, any>;
463
+ }, ctx?: import("better-auth").GenericEndpointContext) => Promise<void>;
464
+ beforeAddMember?: (data: {
465
+ member: {
466
+ userId: string;
467
+ organizationId: string;
468
+ role: string;
469
+ [key: string]: any;
470
+ };
471
+ user: import("better-auth").User & Record<string, any>;
472
+ organization: import("better-auth/client").Organization & Record<string, any>;
473
+ }) => Promise<void | {
474
+ data: Record<string, any>;
475
+ }>;
476
+ afterAddMember?: (data: {
477
+ member: import("better-auth/client").Member & Record<string, any>;
478
+ user: import("better-auth").User & Record<string, any>;
479
+ organization: import("better-auth/client").Organization & Record<string, any>;
480
+ }) => Promise<void>;
481
+ beforeRemoveMember?: (data: {
482
+ member: import("better-auth/client").Member & Record<string, any>;
483
+ user: import("better-auth").User & Record<string, any>;
484
+ organization: import("better-auth/client").Organization & Record<string, any>;
485
+ }) => Promise<void>;
486
+ afterRemoveMember?: (data: {
487
+ member: import("better-auth/client").Member & Record<string, any>;
488
+ user: import("better-auth").User & Record<string, any>;
489
+ organization: import("better-auth/client").Organization & Record<string, any>;
490
+ }) => Promise<void>;
491
+ beforeUpdateMemberRole?: (data: {
492
+ member: import("better-auth/client").Member & Record<string, any>;
493
+ newRole: string;
494
+ user: import("better-auth").User & Record<string, any>;
495
+ organization: import("better-auth/client").Organization & Record<string, any>;
496
+ }) => Promise<void | {
497
+ data: {
498
+ role: string;
499
+ [key: string]: any;
500
+ };
501
+ }>;
502
+ afterUpdateMemberRole?: (data: {
503
+ member: import("better-auth/client").Member & Record<string, any>;
504
+ previousRole: string;
505
+ user: import("better-auth").User & Record<string, any>;
506
+ organization: import("better-auth/client").Organization & Record<string, any>;
507
+ }) => Promise<void>;
508
+ beforeCreateInvitation?: (data: {
509
+ invitation: {
510
+ email: string;
511
+ role: string;
512
+ organizationId: string;
513
+ inviterId: string;
514
+ teamId?: string;
515
+ [key: string]: any;
516
+ };
517
+ inviter: import("better-auth").User & Record<string, any>;
518
+ organization: import("better-auth/client").Organization & Record<string, any>;
519
+ }) => Promise<void | {
520
+ data: Record<string, any>;
521
+ }>;
522
+ afterCreateInvitation?: (data: {
523
+ invitation: import("better-auth/client").Invitation & Record<string, any>;
524
+ inviter: import("better-auth").User & Record<string, any>;
525
+ organization: import("better-auth/client").Organization & Record<string, any>;
526
+ }) => Promise<void>;
527
+ beforeAcceptInvitation?: (data: {
528
+ invitation: import("better-auth/client").Invitation & Record<string, any>;
529
+ user: import("better-auth").User & Record<string, any>;
530
+ organization: import("better-auth/client").Organization & Record<string, any>;
531
+ }) => Promise<void>;
532
+ afterAcceptInvitation?: (data: {
533
+ invitation: import("better-auth/client").Invitation & Record<string, any>;
534
+ member: import("better-auth/client").Member & Record<string, any>;
535
+ user: import("better-auth").User & Record<string, any>;
536
+ organization: import("better-auth/client").Organization & Record<string, any>;
537
+ }) => Promise<void>;
538
+ beforeRejectInvitation?: (data: {
539
+ invitation: import("better-auth/client").Invitation & Record<string, any>;
540
+ user: import("better-auth").User & Record<string, any>;
541
+ organization: import("better-auth/client").Organization & Record<string, any>;
542
+ }) => Promise<void>;
543
+ afterRejectInvitation?: (data: {
544
+ invitation: import("better-auth/client").Invitation & Record<string, any>;
545
+ user: import("better-auth").User & Record<string, any>;
546
+ organization: import("better-auth/client").Organization & Record<string, any>;
547
+ }) => Promise<void>;
548
+ beforeCancelInvitation?: (data: {
549
+ invitation: import("better-auth/client").Invitation & Record<string, any>;
550
+ cancelledBy: import("better-auth").User & Record<string, any>;
551
+ organization: import("better-auth/client").Organization & Record<string, any>;
552
+ }) => Promise<void>;
553
+ afterCancelInvitation?: (data: {
554
+ invitation: import("better-auth/client").Invitation & Record<string, any>;
555
+ cancelledBy: import("better-auth").User & Record<string, any>;
556
+ organization: import("better-auth/client").Organization & Record<string, any>;
557
+ }) => Promise<void>;
558
+ beforeCreateTeam?: (data: {
559
+ team: {
560
+ name: string;
561
+ organizationId: string;
562
+ [key: string]: any;
563
+ };
564
+ user?: import("better-auth").User & Record<string, any>;
565
+ organization: import("better-auth/client").Organization & Record<string, any>;
566
+ }) => Promise<void | {
567
+ data: Record<string, any>;
568
+ }>;
569
+ afterCreateTeam?: (data: {
570
+ team: import("better-auth/client").Team & Record<string, any>;
571
+ user?: import("better-auth").User & Record<string, any>;
572
+ organization: import("better-auth/client").Organization & Record<string, any>;
573
+ }) => Promise<void>;
574
+ beforeUpdateTeam?: (data: {
575
+ team: import("better-auth/client").Team & Record<string, any>;
576
+ updates: {
577
+ name?: string;
578
+ [key: string]: any;
579
+ };
580
+ user: import("better-auth").User & Record<string, any>;
581
+ organization: import("better-auth/client").Organization & Record<string, any>;
582
+ }) => Promise<void | {
583
+ data: Record<string, any>;
584
+ }>;
585
+ afterUpdateTeam?: (data: {
586
+ team: (import("better-auth/client").Team & Record<string, any>) | null;
587
+ user: import("better-auth").User & Record<string, any>;
588
+ organization: import("better-auth/client").Organization & Record<string, any>;
589
+ }) => Promise<void>;
590
+ beforeDeleteTeam?: (data: {
591
+ team: import("better-auth/client").Team & Record<string, any>;
592
+ user?: import("better-auth").User & Record<string, any>;
593
+ organization: import("better-auth/client").Organization & Record<string, any>;
594
+ }) => Promise<void>;
595
+ afterDeleteTeam?: (data: {
596
+ team: import("better-auth/client").Team & Record<string, any>;
597
+ user?: import("better-auth").User & Record<string, any>;
598
+ organization: import("better-auth/client").Organization & Record<string, any>;
599
+ }) => Promise<void>;
600
+ beforeAddTeamMember?: (data: {
601
+ teamMember: {
602
+ teamId: string;
603
+ userId: string;
604
+ [key: string]: any;
605
+ };
606
+ team: import("better-auth/client").Team & Record<string, any>;
607
+ user: import("better-auth").User & Record<string, any>;
608
+ organization: import("better-auth/client").Organization & Record<string, any>;
609
+ }) => Promise<void | {
610
+ data: Record<string, any>;
611
+ }>;
612
+ afterAddTeamMember?: (data: {
613
+ teamMember: import("better-auth/client").TeamMember & Record<string, any>;
614
+ team: import("better-auth/client").Team & Record<string, any>;
615
+ user: import("better-auth").User & Record<string, any>;
616
+ organization: import("better-auth/client").Organization & Record<string, any>;
617
+ }) => Promise<void>;
618
+ beforeRemoveTeamMember?: (data: {
619
+ teamMember: import("better-auth/client").TeamMember & Record<string, any>;
620
+ team: import("better-auth/client").Team & Record<string, any>;
621
+ user: import("better-auth").User & Record<string, any>;
622
+ organization: import("better-auth/client").Organization & Record<string, any>;
623
+ }) => Promise<void>;
624
+ afterRemoveTeamMember?: (data: {
625
+ teamMember: import("better-auth/client").TeamMember & Record<string, any>;
626
+ team: import("better-auth/client").Team & Record<string, any>;
627
+ user: import("better-auth").User & Record<string, any>;
628
+ organization: import("better-auth/client").Organization & Record<string, any>;
629
+ }) => Promise<void>;
630
+ } | undefined | undefined;
631
+ }> & {
632
+ getInvitationPolicy: import("better-call").StrictEndpoint<"/organization/get-invitation-policy", {
633
+ method: "GET";
634
+ use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
635
+ session: {
636
+ session: Record<string, any> & {
637
+ id: string;
638
+ createdAt: Date;
639
+ updatedAt: Date;
640
+ userId: string;
641
+ expiresAt: Date;
642
+ token: string;
643
+ ipAddress?: string | null | undefined;
644
+ userAgent?: string | null | undefined;
645
+ };
646
+ user: Record<string, any> & {
647
+ id: string;
648
+ createdAt: Date;
649
+ updatedAt: Date;
650
+ email: string;
651
+ emailVerified: boolean;
652
+ name: string;
653
+ image?: string | null | undefined;
654
+ };
655
+ };
656
+ }>>[];
657
+ }, {
658
+ mode: import("./domain-policy.js").InvitationPolicyMode;
659
+ domains: readonly (import("./domain-policy.js").InvitationDomain & {
660
+ readonly display: string;
661
+ })[];
662
+ organizationId: string;
663
+ }>;
664
+ setInvitationPolicy: import("better-call").StrictEndpoint<"/organization/set-invitation-policy", {
665
+ method: "POST";
666
+ use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
667
+ session: {
668
+ session: Record<string, any> & {
669
+ id: string;
670
+ createdAt: Date;
671
+ updatedAt: Date;
672
+ userId: string;
673
+ expiresAt: Date;
674
+ token: string;
675
+ ipAddress?: string | null | undefined;
676
+ userAgent?: string | null | undefined;
677
+ };
678
+ user: Record<string, any> & {
679
+ id: string;
680
+ createdAt: Date;
681
+ updatedAt: Date;
682
+ email: string;
683
+ emailVerified: boolean;
684
+ name: string;
685
+ image?: string | null | undefined;
686
+ };
687
+ };
688
+ }>>[];
689
+ }, {
690
+ mode: import("./domain-policy.js").InvitationPolicyMode;
691
+ domains: readonly (import("./domain-policy.js").InvitationDomain & {
692
+ readonly display: string;
693
+ })[];
694
+ organizationId: string;
695
+ }>;
696
+ };
697
+ };