@bitakit/better-auth 0.2.5 → 0.3.1

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