better-auth 0.0.2-beta.7 → 0.0.2

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.
Files changed (96) hide show
  1. package/dist/access.d.ts +4 -0
  2. package/dist/access.js +126 -0
  3. package/dist/access.js.map +1 -0
  4. package/dist/cli.d.ts +2 -0
  5. package/dist/cli.js +553 -0
  6. package/dist/cli.js.map +1 -0
  7. package/dist/client/plugins.d.ts +2436 -0
  8. package/dist/client/plugins.js +411 -0
  9. package/dist/client/plugins.js.map +1 -0
  10. package/dist/client-A2Mt04KQ.d.ts +3503 -0
  11. package/dist/client.d.ts +1433 -0
  12. package/dist/client.js +693 -0
  13. package/dist/client.js.map +1 -0
  14. package/dist/helper-B5_2Vzba.d.ts +14 -0
  15. package/dist/index-Dg4eEXZW.d.ts +24 -0
  16. package/dist/index-W5nXvJ-p.d.ts +1498 -0
  17. package/dist/index.d.ts +6 -4
  18. package/dist/index.js +2195 -1191
  19. package/dist/index.js.map +1 -1
  20. package/dist/next-js.d.ts +14 -0
  21. package/dist/next-js.js +14 -0
  22. package/dist/next-js.js.map +1 -0
  23. package/dist/plugins.d.ts +892 -49
  24. package/dist/plugins.js +3951 -253
  25. package/dist/plugins.js.map +1 -1
  26. package/dist/preact.d.ts +8 -0
  27. package/dist/preact.js +294 -0
  28. package/dist/preact.js.map +1 -0
  29. package/dist/react.d.ts +14 -0
  30. package/dist/react.js +314 -0
  31. package/dist/react.js.map +1 -0
  32. package/dist/schema-BOszzrbQ.d.ts +792 -0
  33. package/dist/social.d.ts +4 -0
  34. package/dist/social.js +509 -0
  35. package/dist/social.js.map +1 -0
  36. package/dist/solid-start.d.ts +18 -0
  37. package/dist/solid-start.js +14 -0
  38. package/dist/solid-start.js.map +1 -0
  39. package/dist/solid.d.ts +2790 -0
  40. package/dist/solid.js +306 -0
  41. package/dist/solid.js.map +1 -0
  42. package/dist/statement-COylZd3J.d.ts +81 -0
  43. package/dist/svelte-kit.d.ts +10 -7
  44. package/dist/svelte-kit.js +12 -17
  45. package/dist/svelte-kit.js.map +1 -1
  46. package/dist/svelte.d.ts +2791 -0
  47. package/dist/svelte.js +304 -0
  48. package/dist/svelte.js.map +1 -0
  49. package/dist/type-DbMyI3b5.d.ts +5724 -0
  50. package/dist/types.d.ts +7 -0
  51. package/dist/types.js +1 -0
  52. package/dist/types.js.map +1 -0
  53. package/dist/vue.d.ts +14 -0
  54. package/dist/vue.js +311 -0
  55. package/dist/vue.js.map +1 -0
  56. package/package.json +80 -54
  57. package/LICENSE +0 -21
  58. package/dist/actions.d.ts +0 -33
  59. package/dist/actions.js +0 -1373
  60. package/dist/actions.js.map +0 -1
  61. package/dist/adapters/drizzle-adapter.d.ts +0 -10
  62. package/dist/adapters/drizzle-adapter.js +0 -1095
  63. package/dist/adapters/drizzle-adapter.js.map +0 -1
  64. package/dist/adapters/memory.d.ts +0 -8
  65. package/dist/adapters/memory.js +0 -136
  66. package/dist/adapters/memory.js.map +0 -1
  67. package/dist/adapters/mongodb-adapter.d.ts +0 -9
  68. package/dist/adapters/mongodb-adapter.js +0 -97
  69. package/dist/adapters/mongodb-adapter.js.map +0 -1
  70. package/dist/adapters/prisma-adapter.d.ts +0 -7
  71. package/dist/adapters/prisma-adapter.js +0 -144
  72. package/dist/adapters/prisma-adapter.js.map +0 -1
  73. package/dist/adapters/redis-adapter.d.ts +0 -7
  74. package/dist/adapters/redis-adapter.js +0 -65
  75. package/dist/adapters/redis-adapter.js.map +0 -1
  76. package/dist/adapters.d.ts +0 -3
  77. package/dist/adapters.js +0 -206
  78. package/dist/adapters.js.map +0 -1
  79. package/dist/h3.d.ts +0 -10
  80. package/dist/h3.js +0 -326
  81. package/dist/h3.js.map +0 -1
  82. package/dist/hono.d.ts +0 -10
  83. package/dist/hono.js +0 -25
  84. package/dist/hono.js.map +0 -1
  85. package/dist/index-UcTu1vUg.d.ts +0 -107
  86. package/dist/next.d.ts +0 -17
  87. package/dist/next.js +0 -26
  88. package/dist/next.js.map +0 -1
  89. package/dist/options-CH15FEBw.d.ts +0 -1562
  90. package/dist/providers.d.ts +0 -3
  91. package/dist/providers.js +0 -653
  92. package/dist/providers.js.map +0 -1
  93. package/dist/routes/session.d.ts +0 -39
  94. package/dist/routes/session.js +0 -128
  95. package/dist/routes/session.js.map +0 -1
  96. package/dist/types-DAxaMWCy.d.ts +0 -136
@@ -0,0 +1,2436 @@
1
+ import { M as Member, I as Invitation, O as OrganizationOptions } from '../client-A2Mt04KQ.js';
2
+ export { g as getPasskeyActions, p as passkeyClient, t as twoFactorClient } from '../client-A2Mt04KQ.js';
3
+ import { b as AuthProxySignal, u as useAuthStore, a as useAuthStore$1 } from '../type-DbMyI3b5.js';
4
+ import { g as defaultRoles, R as Role, A as AccessControl, S as StatementsPrimitive } from '../statement-COylZd3J.js';
5
+ import { S as Session, U as User } from '../schema-BOszzrbQ.js';
6
+ import * as better_call from 'better-call';
7
+ import * as zod from 'zod';
8
+ import * as nanostores from 'nanostores';
9
+ import * as _vue_reactivity from '@vue/reactivity';
10
+ import * as _nanostores_vue from '@nanostores/vue';
11
+ import * as _nanostores_react from '@nanostores/react';
12
+ import * as _better_fetch_fetch from '@better-fetch/fetch';
13
+ import { useAuthStore as useAuthStore$2 } from '../preact.js';
14
+ import '../index-W5nXvJ-p.js';
15
+ import '../helper-B5_2Vzba.js';
16
+ import 'kysely';
17
+ import '@simplewebauthn/types';
18
+ import '@nanostores/solid';
19
+ import 'arctic';
20
+
21
+ interface OrganizationClientOptions {
22
+ ac: AccessControl;
23
+ roles?: {
24
+ [key in "admin" | "member" | "owner"]?: Role<any>;
25
+ };
26
+ }
27
+ declare const organizationClient: <O extends OrganizationClientOptions>(options?: O) => ($fetch: _better_fetch_fetch.BetterFetch) => {
28
+ integrations: {
29
+ react(useStore: typeof _nanostores_react.useStore): {
30
+ organization: {
31
+ useActiveOrganization(): {
32
+ id: string;
33
+ name: string;
34
+ slug: string;
35
+ members: Member[];
36
+ invitations: Invitation[];
37
+ } | null;
38
+ useListOrganization(): {
39
+ id: string;
40
+ name: string;
41
+ slug: string;
42
+ }[] | null;
43
+ useInvitation(): {
44
+ data: null;
45
+ error: {
46
+ message?: string | undefined;
47
+ status: number;
48
+ statusText: string;
49
+ };
50
+ } | {
51
+ error: {
52
+ message: string;
53
+ status: number;
54
+ data: null;
55
+ };
56
+ data: null;
57
+ } | {
58
+ data: {
59
+ id: string;
60
+ expiresAt: Date;
61
+ status: "pending" | "accepted" | "rejected" | "canceled";
62
+ email: string;
63
+ organizationId: string;
64
+ role: "admin" | "member" | "owner";
65
+ inviterId: string;
66
+ organizationName: string;
67
+ organizationSlug: string;
68
+ inviterEmail: string;
69
+ inviterName: string;
70
+ };
71
+ error: null;
72
+ };
73
+ };
74
+ };
75
+ vue(useStore: typeof _nanostores_vue.useStore): {
76
+ useActiveOrganization(): Readonly<_vue_reactivity.Ref<{
77
+ readonly id: string;
78
+ readonly name: string;
79
+ readonly slug: string;
80
+ readonly members: readonly {
81
+ readonly id: string;
82
+ readonly userId: string;
83
+ readonly name: string;
84
+ readonly email: string;
85
+ readonly organizationId: string;
86
+ readonly role: "admin" | "member" | "owner";
87
+ }[];
88
+ readonly invitations: readonly {
89
+ readonly id: string;
90
+ readonly expiresAt: Date;
91
+ readonly status: "pending" | "accepted" | "rejected" | "canceled";
92
+ readonly email: string;
93
+ readonly organizationId: string;
94
+ readonly role: "admin" | "member" | "owner";
95
+ readonly inviterId: string;
96
+ }[];
97
+ } | null>>;
98
+ useListOrganization(): Readonly<_vue_reactivity.Ref<readonly {
99
+ readonly id: string;
100
+ readonly name: string;
101
+ readonly slug: string;
102
+ }[] | null>>;
103
+ useInvitation(): Readonly<_vue_reactivity.Ref<{
104
+ readonly data: null;
105
+ readonly error: {
106
+ readonly message?: string | undefined;
107
+ readonly status: number;
108
+ readonly statusText: string;
109
+ };
110
+ } | {
111
+ readonly error: {
112
+ readonly message: string;
113
+ readonly status: number;
114
+ readonly data: null;
115
+ };
116
+ readonly data: null;
117
+ } | {
118
+ readonly data: {
119
+ readonly id: string;
120
+ readonly expiresAt: Date;
121
+ readonly status: "pending" | "accepted" | "rejected" | "canceled";
122
+ readonly email: string;
123
+ readonly organizationId: string;
124
+ readonly role: "admin" | "member" | "owner";
125
+ readonly inviterId: string;
126
+ readonly organizationName: string;
127
+ readonly organizationSlug: string;
128
+ readonly inviterEmail: string;
129
+ readonly inviterName: string;
130
+ };
131
+ readonly error: null;
132
+ }>>;
133
+ };
134
+ preact(useStore: typeof _nanostores_react.useStore): {
135
+ useActiveOrganization(): {
136
+ id: string;
137
+ name: string;
138
+ slug: string;
139
+ members: Member[];
140
+ invitations: Invitation[];
141
+ } | null;
142
+ useListOrganization(): {
143
+ id: string;
144
+ name: string;
145
+ slug: string;
146
+ }[] | null;
147
+ useInvitation(): {
148
+ data: null;
149
+ error: {
150
+ message?: string | undefined;
151
+ status: number;
152
+ statusText: string;
153
+ };
154
+ } | {
155
+ error: {
156
+ message: string;
157
+ status: number;
158
+ data: null;
159
+ };
160
+ data: null;
161
+ } | {
162
+ data: {
163
+ id: string;
164
+ expiresAt: Date;
165
+ status: "pending" | "accepted" | "rejected" | "canceled";
166
+ email: string;
167
+ organizationId: string;
168
+ role: "admin" | "member" | "owner";
169
+ inviterId: string;
170
+ organizationName: string;
171
+ organizationSlug: string;
172
+ inviterEmail: string;
173
+ inviterName: string;
174
+ };
175
+ error: null;
176
+ };
177
+ };
178
+ svelte(): {
179
+ $activeOrganization: nanostores.ReadableAtom<{
180
+ id: string;
181
+ name: string;
182
+ slug: string;
183
+ members: Member[];
184
+ invitations: Invitation[];
185
+ } | null>;
186
+ $listOrganizations: nanostores.ReadableAtom<{
187
+ id: string;
188
+ name: string;
189
+ slug: string;
190
+ }[] | null>;
191
+ $invitation: nanostores.ReadableAtom<{
192
+ data: null;
193
+ error: {
194
+ message?: string | undefined;
195
+ status: number;
196
+ statusText: string;
197
+ };
198
+ } | {
199
+ error: {
200
+ message: string;
201
+ status: number;
202
+ data: null;
203
+ };
204
+ data: null;
205
+ } | {
206
+ data: {
207
+ id: string;
208
+ expiresAt: Date;
209
+ status: "pending" | "accepted" | "rejected" | "canceled";
210
+ email: string;
211
+ organizationId: string;
212
+ role: "admin" | "member" | "owner";
213
+ inviterId: string;
214
+ organizationName: string;
215
+ organizationSlug: string;
216
+ inviterEmail: string;
217
+ inviterName: string;
218
+ };
219
+ error: null;
220
+ }>;
221
+ };
222
+ };
223
+ plugin: {
224
+ id: "organization";
225
+ endpoints: {
226
+ hasPermission: {
227
+ (ctx_0: better_call.Context<"/organization/has-permission", {
228
+ method: "POST";
229
+ requireHeaders: true;
230
+ body: zod.ZodObject<{
231
+ permission: zod.ZodObject<{
232
+ readonly organization: zod.ZodOptional<zod.ZodArray<zod.ZodLiteral<"update" | "delete">, "many">>;
233
+ readonly member: zod.ZodOptional<zod.ZodArray<zod.ZodLiteral<"update" | "delete" | "create">, "many">>;
234
+ readonly invitation: zod.ZodOptional<zod.ZodArray<zod.ZodLiteral<"create" | "cancel">, "many">>;
235
+ }, zod.UnknownKeysParam, zod.ZodTypeAny, {
236
+ member?: ("update" | "delete" | "create")[] | undefined;
237
+ organization?: ("update" | "delete")[] | undefined;
238
+ invitation?: ("create" | "cancel")[] | undefined;
239
+ }, {
240
+ member?: ("update" | "delete" | "create")[] | undefined;
241
+ organization?: ("update" | "delete")[] | undefined;
242
+ invitation?: ("create" | "cancel")[] | undefined;
243
+ }>;
244
+ }, zod.UnknownKeysParam, zod.ZodTypeAny, {
245
+ permission: {
246
+ member?: ("update" | "delete" | "create")[] | undefined;
247
+ organization?: ("update" | "delete")[] | undefined;
248
+ invitation?: ("create" | "cancel")[] | undefined;
249
+ };
250
+ }, {
251
+ permission: {
252
+ member?: ("update" | "delete" | "create")[] | undefined;
253
+ organization?: ("update" | "delete")[] | undefined;
254
+ invitation?: ("create" | "cancel")[] | undefined;
255
+ };
256
+ }>;
257
+ use: better_call.Endpoint<better_call.Handler<string, {
258
+ use: better_call.Endpoint<better_call.Handler<string, better_call.EndpointOptions, {
259
+ session: {
260
+ session: {
261
+ id: string;
262
+ userId: string;
263
+ expiresAt: Date;
264
+ ipAddress?: string | undefined;
265
+ userAgent?: string | undefined;
266
+ };
267
+ user: {
268
+ id: string;
269
+ name: string;
270
+ email: string;
271
+ emailVerified: boolean;
272
+ createdAt: Date;
273
+ updatedAt: Date;
274
+ image?: string | undefined;
275
+ };
276
+ };
277
+ }>, better_call.EndpointOptions>[];
278
+ } & {
279
+ method: "*";
280
+ }, {
281
+ session: {
282
+ session: Session & {
283
+ activeOrganizationId?: string;
284
+ };
285
+ user: User;
286
+ };
287
+ }>, {
288
+ use: better_call.Endpoint<better_call.Handler<string, better_call.EndpointOptions, {
289
+ session: {
290
+ session: {
291
+ id: string;
292
+ userId: string;
293
+ expiresAt: Date;
294
+ ipAddress?: string | undefined;
295
+ userAgent?: string | undefined;
296
+ };
297
+ user: {
298
+ id: string;
299
+ name: string;
300
+ email: string;
301
+ emailVerified: boolean;
302
+ createdAt: Date;
303
+ updatedAt: Date;
304
+ image?: string | undefined;
305
+ };
306
+ };
307
+ }>, better_call.EndpointOptions>[];
308
+ } & {
309
+ method: "*";
310
+ }>[];
311
+ }>): Promise<{
312
+ error: string;
313
+ success: boolean;
314
+ } | {
315
+ error: null;
316
+ success: boolean;
317
+ }>;
318
+ path: "/organization/has-permission";
319
+ options: {
320
+ method: "POST";
321
+ requireHeaders: true;
322
+ body: zod.ZodObject<{
323
+ permission: zod.ZodObject<{
324
+ readonly organization: zod.ZodOptional<zod.ZodArray<zod.ZodLiteral<"update" | "delete">, "many">>;
325
+ readonly member: zod.ZodOptional<zod.ZodArray<zod.ZodLiteral<"update" | "delete" | "create">, "many">>;
326
+ readonly invitation: zod.ZodOptional<zod.ZodArray<zod.ZodLiteral<"create" | "cancel">, "many">>;
327
+ }, zod.UnknownKeysParam, zod.ZodTypeAny, {
328
+ member?: ("update" | "delete" | "create")[] | undefined;
329
+ organization?: ("update" | "delete")[] | undefined;
330
+ invitation?: ("create" | "cancel")[] | undefined;
331
+ }, {
332
+ member?: ("update" | "delete" | "create")[] | undefined;
333
+ organization?: ("update" | "delete")[] | undefined;
334
+ invitation?: ("create" | "cancel")[] | undefined;
335
+ }>;
336
+ }, zod.UnknownKeysParam, zod.ZodTypeAny, {
337
+ permission: {
338
+ member?: ("update" | "delete" | "create")[] | undefined;
339
+ organization?: ("update" | "delete")[] | undefined;
340
+ invitation?: ("create" | "cancel")[] | undefined;
341
+ };
342
+ }, {
343
+ permission: {
344
+ member?: ("update" | "delete" | "create")[] | undefined;
345
+ organization?: ("update" | "delete")[] | undefined;
346
+ invitation?: ("create" | "cancel")[] | undefined;
347
+ };
348
+ }>;
349
+ use: better_call.Endpoint<better_call.Handler<string, {
350
+ use: better_call.Endpoint<better_call.Handler<string, better_call.EndpointOptions, {
351
+ session: {
352
+ session: {
353
+ id: string;
354
+ userId: string;
355
+ expiresAt: Date;
356
+ ipAddress?: string | undefined;
357
+ userAgent?: string | undefined;
358
+ };
359
+ user: {
360
+ id: string;
361
+ name: string;
362
+ email: string;
363
+ emailVerified: boolean;
364
+ createdAt: Date;
365
+ updatedAt: Date;
366
+ image?: string | undefined;
367
+ };
368
+ };
369
+ }>, better_call.EndpointOptions>[];
370
+ } & {
371
+ method: "*";
372
+ }, {
373
+ session: {
374
+ session: Session & {
375
+ activeOrganizationId?: string;
376
+ };
377
+ user: User;
378
+ };
379
+ }>, {
380
+ use: better_call.Endpoint<better_call.Handler<string, better_call.EndpointOptions, {
381
+ session: {
382
+ session: {
383
+ id: string;
384
+ userId: string;
385
+ expiresAt: Date;
386
+ ipAddress?: string | undefined;
387
+ userAgent?: string | undefined;
388
+ };
389
+ user: {
390
+ id: string;
391
+ name: string;
392
+ email: string;
393
+ emailVerified: boolean;
394
+ createdAt: Date;
395
+ updatedAt: Date;
396
+ image?: string | undefined;
397
+ };
398
+ };
399
+ }>, better_call.EndpointOptions>[];
400
+ } & {
401
+ method: "*";
402
+ }>[];
403
+ };
404
+ method: better_call.Method | better_call.Method[];
405
+ headers: Headers;
406
+ };
407
+ createOrganization: {
408
+ (ctx_0: better_call.Context<"/organization/create", {
409
+ method: "POST";
410
+ body: zod.ZodObject<{
411
+ name: zod.ZodString;
412
+ slug: zod.ZodString;
413
+ userId: zod.ZodOptional<zod.ZodString>;
414
+ }, "strip", zod.ZodTypeAny, {
415
+ name: string;
416
+ slug: string;
417
+ userId?: string | undefined;
418
+ }, {
419
+ name: string;
420
+ slug: string;
421
+ userId?: string | undefined;
422
+ }>;
423
+ use: (better_call.Endpoint<better_call.Handler<string, better_call.EndpointOptions, {
424
+ orgOptions: OrganizationOptions;
425
+ roles: typeof defaultRoles & {
426
+ [key: string]: Role<{}>;
427
+ };
428
+ getSession: (context: better_call.Context<any, any>) => Promise<{
429
+ session: Session & {
430
+ activeOrganizationId?: string;
431
+ };
432
+ user: User;
433
+ }>;
434
+ }>, better_call.EndpointOptions> | better_call.Endpoint<better_call.Handler<string, {
435
+ use: better_call.Endpoint<better_call.Handler<string, better_call.EndpointOptions, {
436
+ session: {
437
+ session: {
438
+ id: string;
439
+ userId: string;
440
+ expiresAt: Date;
441
+ ipAddress?: string | undefined;
442
+ userAgent?: string | undefined;
443
+ };
444
+ user: {
445
+ id: string;
446
+ name: string;
447
+ email: string;
448
+ emailVerified: boolean;
449
+ createdAt: Date;
450
+ updatedAt: Date;
451
+ image?: string | undefined;
452
+ };
453
+ };
454
+ }>, better_call.EndpointOptions>[];
455
+ } & {
456
+ method: "*";
457
+ }, {
458
+ session: {
459
+ session: Session & {
460
+ activeOrganizationId?: string;
461
+ };
462
+ user: User;
463
+ };
464
+ }>, {
465
+ use: better_call.Endpoint<better_call.Handler<string, better_call.EndpointOptions, {
466
+ session: {
467
+ session: {
468
+ id: string;
469
+ userId: string;
470
+ expiresAt: Date;
471
+ ipAddress?: string | undefined;
472
+ userAgent?: string | undefined;
473
+ };
474
+ user: {
475
+ id: string;
476
+ name: string;
477
+ email: string;
478
+ emailVerified: boolean;
479
+ createdAt: Date;
480
+ updatedAt: Date;
481
+ image?: string | undefined;
482
+ };
483
+ };
484
+ }>, better_call.EndpointOptions>[];
485
+ } & {
486
+ method: "*";
487
+ }>)[];
488
+ }>): Promise<{
489
+ members: {
490
+ id: string;
491
+ userId: string;
492
+ name: string;
493
+ email: string;
494
+ organizationId: string;
495
+ role: "admin" | "member" | "owner";
496
+ }[];
497
+ id: string;
498
+ name: string;
499
+ slug: string;
500
+ } | null>;
501
+ path: "/organization/create";
502
+ options: {
503
+ method: "POST";
504
+ body: zod.ZodObject<{
505
+ name: zod.ZodString;
506
+ slug: zod.ZodString;
507
+ userId: zod.ZodOptional<zod.ZodString>;
508
+ }, "strip", zod.ZodTypeAny, {
509
+ name: string;
510
+ slug: string;
511
+ userId?: string | undefined;
512
+ }, {
513
+ name: string;
514
+ slug: string;
515
+ userId?: string | undefined;
516
+ }>;
517
+ use: (better_call.Endpoint<better_call.Handler<string, better_call.EndpointOptions, {
518
+ orgOptions: OrganizationOptions;
519
+ roles: typeof defaultRoles & {
520
+ [key: string]: Role<{}>;
521
+ };
522
+ getSession: (context: better_call.Context<any, any>) => Promise<{
523
+ session: Session & {
524
+ activeOrganizationId?: string;
525
+ };
526
+ user: User;
527
+ }>;
528
+ }>, better_call.EndpointOptions> | better_call.Endpoint<better_call.Handler<string, {
529
+ use: better_call.Endpoint<better_call.Handler<string, better_call.EndpointOptions, {
530
+ session: {
531
+ session: {
532
+ id: string;
533
+ userId: string;
534
+ expiresAt: Date;
535
+ ipAddress?: string | undefined;
536
+ userAgent?: string | undefined;
537
+ };
538
+ user: {
539
+ id: string;
540
+ name: string;
541
+ email: string;
542
+ emailVerified: boolean;
543
+ createdAt: Date;
544
+ updatedAt: Date;
545
+ image?: string | undefined;
546
+ };
547
+ };
548
+ }>, better_call.EndpointOptions>[];
549
+ } & {
550
+ method: "*";
551
+ }, {
552
+ session: {
553
+ session: Session & {
554
+ activeOrganizationId?: string;
555
+ };
556
+ user: User;
557
+ };
558
+ }>, {
559
+ use: better_call.Endpoint<better_call.Handler<string, better_call.EndpointOptions, {
560
+ session: {
561
+ session: {
562
+ id: string;
563
+ userId: string;
564
+ expiresAt: Date;
565
+ ipAddress?: string | undefined;
566
+ userAgent?: string | undefined;
567
+ };
568
+ user: {
569
+ id: string;
570
+ name: string;
571
+ email: string;
572
+ emailVerified: boolean;
573
+ createdAt: Date;
574
+ updatedAt: Date;
575
+ image?: string | undefined;
576
+ };
577
+ };
578
+ }>, better_call.EndpointOptions>[];
579
+ } & {
580
+ method: "*";
581
+ }>)[];
582
+ };
583
+ method: better_call.Method | better_call.Method[];
584
+ headers: Headers;
585
+ };
586
+ updateOrganization: {
587
+ (ctx_0: better_call.Context<"/organization/update", {
588
+ method: "POST";
589
+ body: zod.ZodObject<{
590
+ name: zod.ZodOptional<zod.ZodString>;
591
+ slug: zod.ZodOptional<zod.ZodString>;
592
+ orgId: zod.ZodOptional<zod.ZodString>;
593
+ }, "strip", zod.ZodTypeAny, {
594
+ name?: string | undefined;
595
+ slug?: string | undefined;
596
+ orgId?: string | undefined;
597
+ }, {
598
+ name?: string | undefined;
599
+ slug?: string | undefined;
600
+ orgId?: string | undefined;
601
+ }>;
602
+ requireHeaders: true;
603
+ use: better_call.Endpoint<better_call.Handler<string, better_call.EndpointOptions, {
604
+ orgOptions: OrganizationOptions;
605
+ roles: typeof defaultRoles & {
606
+ [key: string]: Role<{}>;
607
+ };
608
+ getSession: (context: better_call.Context<any, any>) => Promise<{
609
+ session: Session & {
610
+ activeOrganizationId?: string;
611
+ };
612
+ user: User;
613
+ }>;
614
+ }>, better_call.EndpointOptions>[];
615
+ }>): Promise<{
616
+ id: string;
617
+ name: string;
618
+ slug: string;
619
+ } | null>;
620
+ path: "/organization/update";
621
+ options: {
622
+ method: "POST";
623
+ body: zod.ZodObject<{
624
+ name: zod.ZodOptional<zod.ZodString>;
625
+ slug: zod.ZodOptional<zod.ZodString>;
626
+ orgId: zod.ZodOptional<zod.ZodString>;
627
+ }, "strip", zod.ZodTypeAny, {
628
+ name?: string | undefined;
629
+ slug?: string | undefined;
630
+ orgId?: string | undefined;
631
+ }, {
632
+ name?: string | undefined;
633
+ slug?: string | undefined;
634
+ orgId?: string | undefined;
635
+ }>;
636
+ requireHeaders: true;
637
+ use: better_call.Endpoint<better_call.Handler<string, better_call.EndpointOptions, {
638
+ orgOptions: OrganizationOptions;
639
+ roles: typeof defaultRoles & {
640
+ [key: string]: Role<{}>;
641
+ };
642
+ getSession: (context: better_call.Context<any, any>) => Promise<{
643
+ session: Session & {
644
+ activeOrganizationId?: string;
645
+ };
646
+ user: User;
647
+ }>;
648
+ }>, better_call.EndpointOptions>[];
649
+ };
650
+ method: better_call.Method | better_call.Method[];
651
+ headers: Headers;
652
+ };
653
+ setActiveOrganization: {
654
+ (ctx_0: better_call.Context<"/organization/set-active", {
655
+ method: "POST";
656
+ body: zod.ZodObject<{
657
+ orgId: zod.ZodString;
658
+ }, "strip", zod.ZodTypeAny, {
659
+ orgId: string;
660
+ }, {
661
+ orgId: string;
662
+ }>;
663
+ use: (better_call.Endpoint<better_call.Handler<string, better_call.EndpointOptions, {
664
+ session: {
665
+ session: {
666
+ id: string;
667
+ userId: string;
668
+ expiresAt: Date;
669
+ ipAddress?: string | undefined;
670
+ userAgent?: string | undefined;
671
+ };
672
+ user: {
673
+ id: string;
674
+ name: string;
675
+ email: string;
676
+ emailVerified: boolean;
677
+ createdAt: Date;
678
+ updatedAt: Date;
679
+ image?: string | undefined;
680
+ };
681
+ };
682
+ }>, better_call.EndpointOptions> | better_call.Endpoint<better_call.Handler<string, better_call.EndpointOptions, {
683
+ orgOptions: OrganizationOptions;
684
+ roles: typeof defaultRoles & {
685
+ [key: string]: Role<{}>;
686
+ };
687
+ getSession: (context: better_call.Context<any, any>) => Promise<{
688
+ session: Session & {
689
+ activeOrganizationId?: string;
690
+ };
691
+ user: User;
692
+ }>;
693
+ }>, better_call.EndpointOptions>)[];
694
+ }>): Promise<{
695
+ members: {
696
+ id: string;
697
+ userId: string;
698
+ name: string;
699
+ email: string;
700
+ organizationId: string;
701
+ role: "admin" | "member" | "owner";
702
+ }[];
703
+ invitations: {
704
+ id: string;
705
+ expiresAt: Date;
706
+ status: "pending" | "accepted" | "rejected" | "canceled";
707
+ email: string;
708
+ organizationId: string;
709
+ role: "admin" | "member" | "owner";
710
+ inviterId: string;
711
+ }[];
712
+ id: string;
713
+ name: string;
714
+ slug: string;
715
+ } | null>;
716
+ path: "/organization/set-active";
717
+ options: {
718
+ method: "POST";
719
+ body: zod.ZodObject<{
720
+ orgId: zod.ZodString;
721
+ }, "strip", zod.ZodTypeAny, {
722
+ orgId: string;
723
+ }, {
724
+ orgId: string;
725
+ }>;
726
+ use: (better_call.Endpoint<better_call.Handler<string, better_call.EndpointOptions, {
727
+ session: {
728
+ session: {
729
+ id: string;
730
+ userId: string;
731
+ expiresAt: Date;
732
+ ipAddress?: string | undefined;
733
+ userAgent?: string | undefined;
734
+ };
735
+ user: {
736
+ id: string;
737
+ name: string;
738
+ email: string;
739
+ emailVerified: boolean;
740
+ createdAt: Date;
741
+ updatedAt: Date;
742
+ image?: string | undefined;
743
+ };
744
+ };
745
+ }>, better_call.EndpointOptions> | better_call.Endpoint<better_call.Handler<string, better_call.EndpointOptions, {
746
+ orgOptions: OrganizationOptions;
747
+ roles: typeof defaultRoles & {
748
+ [key: string]: Role<{}>;
749
+ };
750
+ getSession: (context: better_call.Context<any, any>) => Promise<{
751
+ session: Session & {
752
+ activeOrganizationId?: string;
753
+ };
754
+ user: User;
755
+ }>;
756
+ }>, better_call.EndpointOptions>)[];
757
+ };
758
+ method: better_call.Method | better_call.Method[];
759
+ headers: Headers;
760
+ };
761
+ getFullOrganization: {
762
+ (ctx_0: better_call.Context<"/organization/full", {
763
+ method: "GET";
764
+ query: zod.ZodObject<{
765
+ orgId: zod.ZodOptional<zod.ZodString>;
766
+ }, "strip", zod.ZodTypeAny, {
767
+ orgId?: string | undefined;
768
+ }, {
769
+ orgId?: string | undefined;
770
+ }>;
771
+ requireHeaders: true;
772
+ use: (better_call.Endpoint<better_call.Handler<string, better_call.EndpointOptions, {
773
+ orgOptions: OrganizationOptions;
774
+ roles: typeof defaultRoles & {
775
+ [key: string]: Role<{}>;
776
+ };
777
+ getSession: (context: better_call.Context<any, any>) => Promise<{
778
+ session: Session & {
779
+ activeOrganizationId?: string;
780
+ };
781
+ user: User;
782
+ }>;
783
+ }>, better_call.EndpointOptions> | better_call.Endpoint<better_call.Handler<string, {
784
+ use: better_call.Endpoint<better_call.Handler<string, better_call.EndpointOptions, {
785
+ session: {
786
+ session: {
787
+ id: string;
788
+ userId: string;
789
+ expiresAt: Date;
790
+ ipAddress?: string | undefined;
791
+ userAgent?: string | undefined;
792
+ };
793
+ user: {
794
+ id: string;
795
+ name: string;
796
+ email: string;
797
+ emailVerified: boolean;
798
+ createdAt: Date;
799
+ updatedAt: Date;
800
+ image?: string | undefined;
801
+ };
802
+ };
803
+ }>, better_call.EndpointOptions>[];
804
+ } & {
805
+ method: "*";
806
+ }, {
807
+ session: {
808
+ session: Session & {
809
+ activeOrganizationId?: string;
810
+ };
811
+ user: User;
812
+ };
813
+ }>, {
814
+ use: better_call.Endpoint<better_call.Handler<string, better_call.EndpointOptions, {
815
+ session: {
816
+ session: {
817
+ id: string;
818
+ userId: string;
819
+ expiresAt: Date;
820
+ ipAddress?: string | undefined;
821
+ userAgent?: string | undefined;
822
+ };
823
+ user: {
824
+ id: string;
825
+ name: string;
826
+ email: string;
827
+ emailVerified: boolean;
828
+ createdAt: Date;
829
+ updatedAt: Date;
830
+ image?: string | undefined;
831
+ };
832
+ };
833
+ }>, better_call.EndpointOptions>[];
834
+ } & {
835
+ method: "*";
836
+ }>)[];
837
+ }>): Promise<{
838
+ members: {
839
+ id: string;
840
+ userId: string;
841
+ name: string;
842
+ email: string;
843
+ organizationId: string;
844
+ role: "admin" | "member" | "owner";
845
+ }[];
846
+ invitations: {
847
+ id: string;
848
+ expiresAt: Date;
849
+ status: "pending" | "accepted" | "rejected" | "canceled";
850
+ email: string;
851
+ organizationId: string;
852
+ role: "admin" | "member" | "owner";
853
+ inviterId: string;
854
+ }[];
855
+ id: string;
856
+ name: string;
857
+ slug: string;
858
+ } | null>;
859
+ path: "/organization/full";
860
+ options: {
861
+ method: "GET";
862
+ query: zod.ZodObject<{
863
+ orgId: zod.ZodOptional<zod.ZodString>;
864
+ }, "strip", zod.ZodTypeAny, {
865
+ orgId?: string | undefined;
866
+ }, {
867
+ orgId?: string | undefined;
868
+ }>;
869
+ requireHeaders: true;
870
+ use: (better_call.Endpoint<better_call.Handler<string, better_call.EndpointOptions, {
871
+ orgOptions: OrganizationOptions;
872
+ roles: typeof defaultRoles & {
873
+ [key: string]: Role<{}>;
874
+ };
875
+ getSession: (context: better_call.Context<any, any>) => Promise<{
876
+ session: Session & {
877
+ activeOrganizationId?: string;
878
+ };
879
+ user: User;
880
+ }>;
881
+ }>, better_call.EndpointOptions> | better_call.Endpoint<better_call.Handler<string, {
882
+ use: better_call.Endpoint<better_call.Handler<string, better_call.EndpointOptions, {
883
+ session: {
884
+ session: {
885
+ id: string;
886
+ userId: string;
887
+ expiresAt: Date;
888
+ ipAddress?: string | undefined;
889
+ userAgent?: string | undefined;
890
+ };
891
+ user: {
892
+ id: string;
893
+ name: string;
894
+ email: string;
895
+ emailVerified: boolean;
896
+ createdAt: Date;
897
+ updatedAt: Date;
898
+ image?: string | undefined;
899
+ };
900
+ };
901
+ }>, better_call.EndpointOptions>[];
902
+ } & {
903
+ method: "*";
904
+ }, {
905
+ session: {
906
+ session: Session & {
907
+ activeOrganizationId?: string;
908
+ };
909
+ user: User;
910
+ };
911
+ }>, {
912
+ use: better_call.Endpoint<better_call.Handler<string, better_call.EndpointOptions, {
913
+ session: {
914
+ session: {
915
+ id: string;
916
+ userId: string;
917
+ expiresAt: Date;
918
+ ipAddress?: string | undefined;
919
+ userAgent?: string | undefined;
920
+ };
921
+ user: {
922
+ id: string;
923
+ name: string;
924
+ email: string;
925
+ emailVerified: boolean;
926
+ createdAt: Date;
927
+ updatedAt: Date;
928
+ image?: string | undefined;
929
+ };
930
+ };
931
+ }>, better_call.EndpointOptions>[];
932
+ } & {
933
+ method: "*";
934
+ }>)[];
935
+ };
936
+ method: better_call.Method | better_call.Method[];
937
+ headers: Headers;
938
+ };
939
+ listOrganization: {
940
+ (ctx_0?: better_call.Context<"/organization/list", {
941
+ method: "GET";
942
+ use: (better_call.Endpoint<better_call.Handler<string, better_call.EndpointOptions, {
943
+ orgOptions: OrganizationOptions;
944
+ roles: typeof defaultRoles & {
945
+ [key: string]: Role<{}>;
946
+ };
947
+ getSession: (context: better_call.Context<any, any>) => Promise<{
948
+ session: Session & {
949
+ activeOrganizationId?: string;
950
+ };
951
+ user: User;
952
+ }>;
953
+ }>, better_call.EndpointOptions> | better_call.Endpoint<better_call.Handler<string, {
954
+ use: better_call.Endpoint<better_call.Handler<string, better_call.EndpointOptions, {
955
+ session: {
956
+ session: {
957
+ id: string;
958
+ userId: string;
959
+ expiresAt: Date;
960
+ ipAddress?: string | undefined;
961
+ userAgent?: string | undefined;
962
+ };
963
+ user: {
964
+ id: string;
965
+ name: string;
966
+ email: string;
967
+ emailVerified: boolean;
968
+ createdAt: Date;
969
+ updatedAt: Date;
970
+ image?: string | undefined;
971
+ };
972
+ };
973
+ }>, better_call.EndpointOptions>[];
974
+ } & {
975
+ method: "*";
976
+ }, {
977
+ session: {
978
+ session: Session & {
979
+ activeOrganizationId?: string;
980
+ };
981
+ user: User;
982
+ };
983
+ }>, {
984
+ use: better_call.Endpoint<better_call.Handler<string, better_call.EndpointOptions, {
985
+ session: {
986
+ session: {
987
+ id: string;
988
+ userId: string;
989
+ expiresAt: Date;
990
+ ipAddress?: string | undefined;
991
+ userAgent?: string | undefined;
992
+ };
993
+ user: {
994
+ id: string;
995
+ name: string;
996
+ email: string;
997
+ emailVerified: boolean;
998
+ createdAt: Date;
999
+ updatedAt: Date;
1000
+ image?: string | undefined;
1001
+ };
1002
+ };
1003
+ }>, better_call.EndpointOptions>[];
1004
+ } & {
1005
+ method: "*";
1006
+ }>)[];
1007
+ }> | undefined): Promise<{
1008
+ id: string;
1009
+ name: string;
1010
+ slug: string;
1011
+ }[]>;
1012
+ path: "/organization/list";
1013
+ options: {
1014
+ method: "GET";
1015
+ use: (better_call.Endpoint<better_call.Handler<string, better_call.EndpointOptions, {
1016
+ orgOptions: OrganizationOptions;
1017
+ roles: typeof defaultRoles & {
1018
+ [key: string]: Role<{}>;
1019
+ };
1020
+ getSession: (context: better_call.Context<any, any>) => Promise<{
1021
+ session: Session & {
1022
+ activeOrganizationId?: string;
1023
+ };
1024
+ user: User;
1025
+ }>;
1026
+ }>, better_call.EndpointOptions> | better_call.Endpoint<better_call.Handler<string, {
1027
+ use: better_call.Endpoint<better_call.Handler<string, better_call.EndpointOptions, {
1028
+ session: {
1029
+ session: {
1030
+ id: string;
1031
+ userId: string;
1032
+ expiresAt: Date;
1033
+ ipAddress?: string | undefined;
1034
+ userAgent?: string | undefined;
1035
+ };
1036
+ user: {
1037
+ id: string;
1038
+ name: string;
1039
+ email: string;
1040
+ emailVerified: boolean;
1041
+ createdAt: Date;
1042
+ updatedAt: Date;
1043
+ image?: string | undefined;
1044
+ };
1045
+ };
1046
+ }>, better_call.EndpointOptions>[];
1047
+ } & {
1048
+ method: "*";
1049
+ }, {
1050
+ session: {
1051
+ session: Session & {
1052
+ activeOrganizationId?: string;
1053
+ };
1054
+ user: User;
1055
+ };
1056
+ }>, {
1057
+ use: better_call.Endpoint<better_call.Handler<string, better_call.EndpointOptions, {
1058
+ session: {
1059
+ session: {
1060
+ id: string;
1061
+ userId: string;
1062
+ expiresAt: Date;
1063
+ ipAddress?: string | undefined;
1064
+ userAgent?: string | undefined;
1065
+ };
1066
+ user: {
1067
+ id: string;
1068
+ name: string;
1069
+ email: string;
1070
+ emailVerified: boolean;
1071
+ createdAt: Date;
1072
+ updatedAt: Date;
1073
+ image?: string | undefined;
1074
+ };
1075
+ };
1076
+ }>, better_call.EndpointOptions>[];
1077
+ } & {
1078
+ method: "*";
1079
+ }>)[];
1080
+ };
1081
+ method: better_call.Method | better_call.Method[];
1082
+ headers: Headers;
1083
+ };
1084
+ createInvitation: {
1085
+ (ctx_0: better_call.Context<"/organization/invite-member", {
1086
+ method: "POST";
1087
+ use: (better_call.Endpoint<better_call.Handler<string, better_call.EndpointOptions, {
1088
+ orgOptions: OrganizationOptions;
1089
+ roles: typeof defaultRoles & {
1090
+ [key: string]: Role<{}>;
1091
+ };
1092
+ getSession: (context: better_call.Context<any, any>) => Promise<{
1093
+ session: Session & {
1094
+ activeOrganizationId?: string;
1095
+ };
1096
+ user: User;
1097
+ }>;
1098
+ }>, better_call.EndpointOptions> | better_call.Endpoint<better_call.Handler<string, {
1099
+ use: better_call.Endpoint<better_call.Handler<string, better_call.EndpointOptions, {
1100
+ session: {
1101
+ session: {
1102
+ id: string;
1103
+ userId: string;
1104
+ expiresAt: Date;
1105
+ ipAddress?: string | undefined;
1106
+ userAgent?: string | undefined;
1107
+ };
1108
+ user: {
1109
+ id: string;
1110
+ name: string;
1111
+ email: string;
1112
+ emailVerified: boolean;
1113
+ createdAt: Date;
1114
+ updatedAt: Date;
1115
+ image?: string | undefined;
1116
+ };
1117
+ };
1118
+ }>, better_call.EndpointOptions>[];
1119
+ } & {
1120
+ method: "*";
1121
+ }, {
1122
+ session: {
1123
+ session: Session & {
1124
+ activeOrganizationId?: string;
1125
+ };
1126
+ user: User;
1127
+ };
1128
+ }>, {
1129
+ use: better_call.Endpoint<better_call.Handler<string, better_call.EndpointOptions, {
1130
+ session: {
1131
+ session: {
1132
+ id: string;
1133
+ userId: string;
1134
+ expiresAt: Date;
1135
+ ipAddress?: string | undefined;
1136
+ userAgent?: string | undefined;
1137
+ };
1138
+ user: {
1139
+ id: string;
1140
+ name: string;
1141
+ email: string;
1142
+ emailVerified: boolean;
1143
+ createdAt: Date;
1144
+ updatedAt: Date;
1145
+ image?: string | undefined;
1146
+ };
1147
+ };
1148
+ }>, better_call.EndpointOptions>[];
1149
+ } & {
1150
+ method: "*";
1151
+ }>)[];
1152
+ body: zod.ZodObject<{
1153
+ email: zod.ZodString;
1154
+ role: zod.ZodEnum<["admin", "member", "owner"]>;
1155
+ organizationId: zod.ZodOptional<zod.ZodString>;
1156
+ resend: zod.ZodOptional<zod.ZodBoolean>;
1157
+ }, "strip", zod.ZodTypeAny, {
1158
+ email: string;
1159
+ role: "admin" | "member" | "owner";
1160
+ organizationId?: string | undefined;
1161
+ resend?: boolean | undefined;
1162
+ }, {
1163
+ email: string;
1164
+ role: "admin" | "member" | "owner";
1165
+ organizationId?: string | undefined;
1166
+ resend?: boolean | undefined;
1167
+ }>;
1168
+ }>): Promise<{
1169
+ id: string;
1170
+ expiresAt: Date;
1171
+ status: "pending" | "accepted" | "rejected" | "canceled";
1172
+ email: string;
1173
+ organizationId: string;
1174
+ role: "admin" | "member" | "owner";
1175
+ inviterId: string;
1176
+ } | null>;
1177
+ path: "/organization/invite-member";
1178
+ options: {
1179
+ method: "POST";
1180
+ use: (better_call.Endpoint<better_call.Handler<string, better_call.EndpointOptions, {
1181
+ orgOptions: OrganizationOptions;
1182
+ roles: typeof defaultRoles & {
1183
+ [key: string]: Role<{}>;
1184
+ };
1185
+ getSession: (context: better_call.Context<any, any>) => Promise<{
1186
+ session: Session & {
1187
+ activeOrganizationId?: string;
1188
+ };
1189
+ user: User;
1190
+ }>;
1191
+ }>, better_call.EndpointOptions> | better_call.Endpoint<better_call.Handler<string, {
1192
+ use: better_call.Endpoint<better_call.Handler<string, better_call.EndpointOptions, {
1193
+ session: {
1194
+ session: {
1195
+ id: string;
1196
+ userId: string;
1197
+ expiresAt: Date;
1198
+ ipAddress?: string | undefined;
1199
+ userAgent?: string | undefined;
1200
+ };
1201
+ user: {
1202
+ id: string;
1203
+ name: string;
1204
+ email: string;
1205
+ emailVerified: boolean;
1206
+ createdAt: Date;
1207
+ updatedAt: Date;
1208
+ image?: string | undefined;
1209
+ };
1210
+ };
1211
+ }>, better_call.EndpointOptions>[];
1212
+ } & {
1213
+ method: "*";
1214
+ }, {
1215
+ session: {
1216
+ session: Session & {
1217
+ activeOrganizationId?: string;
1218
+ };
1219
+ user: User;
1220
+ };
1221
+ }>, {
1222
+ use: better_call.Endpoint<better_call.Handler<string, better_call.EndpointOptions, {
1223
+ session: {
1224
+ session: {
1225
+ id: string;
1226
+ userId: string;
1227
+ expiresAt: Date;
1228
+ ipAddress?: string | undefined;
1229
+ userAgent?: string | undefined;
1230
+ };
1231
+ user: {
1232
+ id: string;
1233
+ name: string;
1234
+ email: string;
1235
+ emailVerified: boolean;
1236
+ createdAt: Date;
1237
+ updatedAt: Date;
1238
+ image?: string | undefined;
1239
+ };
1240
+ };
1241
+ }>, better_call.EndpointOptions>[];
1242
+ } & {
1243
+ method: "*";
1244
+ }>)[];
1245
+ body: zod.ZodObject<{
1246
+ email: zod.ZodString;
1247
+ role: zod.ZodEnum<["admin", "member", "owner"]>;
1248
+ organizationId: zod.ZodOptional<zod.ZodString>;
1249
+ resend: zod.ZodOptional<zod.ZodBoolean>;
1250
+ }, "strip", zod.ZodTypeAny, {
1251
+ email: string;
1252
+ role: "admin" | "member" | "owner";
1253
+ organizationId?: string | undefined;
1254
+ resend?: boolean | undefined;
1255
+ }, {
1256
+ email: string;
1257
+ role: "admin" | "member" | "owner";
1258
+ organizationId?: string | undefined;
1259
+ resend?: boolean | undefined;
1260
+ }>;
1261
+ };
1262
+ method: better_call.Method | better_call.Method[];
1263
+ headers: Headers;
1264
+ };
1265
+ cancelInvitation: {
1266
+ (ctx_0: better_call.Context<"/organization/cancel-invitation", {
1267
+ method: "POST";
1268
+ body: zod.ZodObject<{
1269
+ invitationId: zod.ZodString;
1270
+ }, "strip", zod.ZodTypeAny, {
1271
+ invitationId: string;
1272
+ }, {
1273
+ invitationId: string;
1274
+ }>;
1275
+ use: (better_call.Endpoint<better_call.Handler<string, better_call.EndpointOptions, {
1276
+ orgOptions: OrganizationOptions;
1277
+ roles: typeof defaultRoles & {
1278
+ [key: string]: Role<{}>;
1279
+ };
1280
+ getSession: (context: better_call.Context<any, any>) => Promise<{
1281
+ session: Session & {
1282
+ activeOrganizationId?: string;
1283
+ };
1284
+ user: User;
1285
+ }>;
1286
+ }>, better_call.EndpointOptions> | better_call.Endpoint<better_call.Handler<string, {
1287
+ use: better_call.Endpoint<better_call.Handler<string, better_call.EndpointOptions, {
1288
+ session: {
1289
+ session: {
1290
+ id: string;
1291
+ userId: string;
1292
+ expiresAt: Date;
1293
+ ipAddress?: string | undefined;
1294
+ userAgent?: string | undefined;
1295
+ };
1296
+ user: {
1297
+ id: string;
1298
+ name: string;
1299
+ email: string;
1300
+ emailVerified: boolean;
1301
+ createdAt: Date;
1302
+ updatedAt: Date;
1303
+ image?: string | undefined;
1304
+ };
1305
+ };
1306
+ }>, better_call.EndpointOptions>[];
1307
+ } & {
1308
+ method: "*";
1309
+ }, {
1310
+ session: {
1311
+ session: Session & {
1312
+ activeOrganizationId?: string;
1313
+ };
1314
+ user: User;
1315
+ };
1316
+ }>, {
1317
+ use: better_call.Endpoint<better_call.Handler<string, better_call.EndpointOptions, {
1318
+ session: {
1319
+ session: {
1320
+ id: string;
1321
+ userId: string;
1322
+ expiresAt: Date;
1323
+ ipAddress?: string | undefined;
1324
+ userAgent?: string | undefined;
1325
+ };
1326
+ user: {
1327
+ id: string;
1328
+ name: string;
1329
+ email: string;
1330
+ emailVerified: boolean;
1331
+ createdAt: Date;
1332
+ updatedAt: Date;
1333
+ image?: string | undefined;
1334
+ };
1335
+ };
1336
+ }>, better_call.EndpointOptions>[];
1337
+ } & {
1338
+ method: "*";
1339
+ }>)[];
1340
+ }>): Promise<{
1341
+ id: string;
1342
+ expiresAt: Date;
1343
+ status: "pending" | "accepted" | "rejected" | "canceled";
1344
+ email: string;
1345
+ organizationId: string;
1346
+ role: "admin" | "member" | "owner";
1347
+ inviterId: string;
1348
+ } | null>;
1349
+ path: "/organization/cancel-invitation";
1350
+ options: {
1351
+ method: "POST";
1352
+ body: zod.ZodObject<{
1353
+ invitationId: zod.ZodString;
1354
+ }, "strip", zod.ZodTypeAny, {
1355
+ invitationId: string;
1356
+ }, {
1357
+ invitationId: string;
1358
+ }>;
1359
+ use: (better_call.Endpoint<better_call.Handler<string, better_call.EndpointOptions, {
1360
+ orgOptions: OrganizationOptions;
1361
+ roles: typeof defaultRoles & {
1362
+ [key: string]: Role<{}>;
1363
+ };
1364
+ getSession: (context: better_call.Context<any, any>) => Promise<{
1365
+ session: Session & {
1366
+ activeOrganizationId?: string;
1367
+ };
1368
+ user: User;
1369
+ }>;
1370
+ }>, better_call.EndpointOptions> | better_call.Endpoint<better_call.Handler<string, {
1371
+ use: better_call.Endpoint<better_call.Handler<string, better_call.EndpointOptions, {
1372
+ session: {
1373
+ session: {
1374
+ id: string;
1375
+ userId: string;
1376
+ expiresAt: Date;
1377
+ ipAddress?: string | undefined;
1378
+ userAgent?: string | undefined;
1379
+ };
1380
+ user: {
1381
+ id: string;
1382
+ name: string;
1383
+ email: string;
1384
+ emailVerified: boolean;
1385
+ createdAt: Date;
1386
+ updatedAt: Date;
1387
+ image?: string | undefined;
1388
+ };
1389
+ };
1390
+ }>, better_call.EndpointOptions>[];
1391
+ } & {
1392
+ method: "*";
1393
+ }, {
1394
+ session: {
1395
+ session: Session & {
1396
+ activeOrganizationId?: string;
1397
+ };
1398
+ user: User;
1399
+ };
1400
+ }>, {
1401
+ use: better_call.Endpoint<better_call.Handler<string, better_call.EndpointOptions, {
1402
+ session: {
1403
+ session: {
1404
+ id: string;
1405
+ userId: string;
1406
+ expiresAt: Date;
1407
+ ipAddress?: string | undefined;
1408
+ userAgent?: string | undefined;
1409
+ };
1410
+ user: {
1411
+ id: string;
1412
+ name: string;
1413
+ email: string;
1414
+ emailVerified: boolean;
1415
+ createdAt: Date;
1416
+ updatedAt: Date;
1417
+ image?: string | undefined;
1418
+ };
1419
+ };
1420
+ }>, better_call.EndpointOptions>[];
1421
+ } & {
1422
+ method: "*";
1423
+ }>)[];
1424
+ };
1425
+ method: better_call.Method | better_call.Method[];
1426
+ headers: Headers;
1427
+ };
1428
+ acceptInvitation: {
1429
+ (ctx_0: better_call.Context<"/organization/accept-invitation", {
1430
+ method: "POST";
1431
+ body: zod.ZodObject<{
1432
+ invitationId: zod.ZodString;
1433
+ }, "strip", zod.ZodTypeAny, {
1434
+ invitationId: string;
1435
+ }, {
1436
+ invitationId: string;
1437
+ }>;
1438
+ use: (better_call.Endpoint<better_call.Handler<string, better_call.EndpointOptions, {
1439
+ orgOptions: OrganizationOptions;
1440
+ roles: typeof defaultRoles & {
1441
+ [key: string]: Role<{}>;
1442
+ };
1443
+ getSession: (context: better_call.Context<any, any>) => Promise<{
1444
+ session: Session & {
1445
+ activeOrganizationId?: string;
1446
+ };
1447
+ user: User;
1448
+ }>;
1449
+ }>, better_call.EndpointOptions> | better_call.Endpoint<better_call.Handler<string, {
1450
+ use: better_call.Endpoint<better_call.Handler<string, better_call.EndpointOptions, {
1451
+ session: {
1452
+ session: {
1453
+ id: string;
1454
+ userId: string;
1455
+ expiresAt: Date;
1456
+ ipAddress?: string | undefined;
1457
+ userAgent?: string | undefined;
1458
+ };
1459
+ user: {
1460
+ id: string;
1461
+ name: string;
1462
+ email: string;
1463
+ emailVerified: boolean;
1464
+ createdAt: Date;
1465
+ updatedAt: Date;
1466
+ image?: string | undefined;
1467
+ };
1468
+ };
1469
+ }>, better_call.EndpointOptions>[];
1470
+ } & {
1471
+ method: "*";
1472
+ }, {
1473
+ session: {
1474
+ session: Session & {
1475
+ activeOrganizationId?: string;
1476
+ };
1477
+ user: User;
1478
+ };
1479
+ }>, {
1480
+ use: better_call.Endpoint<better_call.Handler<string, better_call.EndpointOptions, {
1481
+ session: {
1482
+ session: {
1483
+ id: string;
1484
+ userId: string;
1485
+ expiresAt: Date;
1486
+ ipAddress?: string | undefined;
1487
+ userAgent?: string | undefined;
1488
+ };
1489
+ user: {
1490
+ id: string;
1491
+ name: string;
1492
+ email: string;
1493
+ emailVerified: boolean;
1494
+ createdAt: Date;
1495
+ updatedAt: Date;
1496
+ image?: string | undefined;
1497
+ };
1498
+ };
1499
+ }>, better_call.EndpointOptions>[];
1500
+ } & {
1501
+ method: "*";
1502
+ }>)[];
1503
+ }>): Promise<{
1504
+ invitation: {
1505
+ id: string;
1506
+ expiresAt: Date;
1507
+ status: "pending" | "accepted" | "rejected" | "canceled";
1508
+ email: string;
1509
+ organizationId: string;
1510
+ role: "admin" | "member" | "owner";
1511
+ inviterId: string;
1512
+ };
1513
+ member: {
1514
+ id: string;
1515
+ userId: string;
1516
+ name: string;
1517
+ email: string;
1518
+ organizationId: string;
1519
+ role: "admin" | "member" | "owner";
1520
+ };
1521
+ } | null>;
1522
+ path: "/organization/accept-invitation";
1523
+ options: {
1524
+ method: "POST";
1525
+ body: zod.ZodObject<{
1526
+ invitationId: zod.ZodString;
1527
+ }, "strip", zod.ZodTypeAny, {
1528
+ invitationId: string;
1529
+ }, {
1530
+ invitationId: string;
1531
+ }>;
1532
+ use: (better_call.Endpoint<better_call.Handler<string, better_call.EndpointOptions, {
1533
+ orgOptions: OrganizationOptions;
1534
+ roles: typeof defaultRoles & {
1535
+ [key: string]: Role<{}>;
1536
+ };
1537
+ getSession: (context: better_call.Context<any, any>) => Promise<{
1538
+ session: Session & {
1539
+ activeOrganizationId?: string;
1540
+ };
1541
+ user: User;
1542
+ }>;
1543
+ }>, better_call.EndpointOptions> | better_call.Endpoint<better_call.Handler<string, {
1544
+ use: better_call.Endpoint<better_call.Handler<string, better_call.EndpointOptions, {
1545
+ session: {
1546
+ session: {
1547
+ id: string;
1548
+ userId: string;
1549
+ expiresAt: Date;
1550
+ ipAddress?: string | undefined;
1551
+ userAgent?: string | undefined;
1552
+ };
1553
+ user: {
1554
+ id: string;
1555
+ name: string;
1556
+ email: string;
1557
+ emailVerified: boolean;
1558
+ createdAt: Date;
1559
+ updatedAt: Date;
1560
+ image?: string | undefined;
1561
+ };
1562
+ };
1563
+ }>, better_call.EndpointOptions>[];
1564
+ } & {
1565
+ method: "*";
1566
+ }, {
1567
+ session: {
1568
+ session: Session & {
1569
+ activeOrganizationId?: string;
1570
+ };
1571
+ user: User;
1572
+ };
1573
+ }>, {
1574
+ use: better_call.Endpoint<better_call.Handler<string, better_call.EndpointOptions, {
1575
+ session: {
1576
+ session: {
1577
+ id: string;
1578
+ userId: string;
1579
+ expiresAt: Date;
1580
+ ipAddress?: string | undefined;
1581
+ userAgent?: string | undefined;
1582
+ };
1583
+ user: {
1584
+ id: string;
1585
+ name: string;
1586
+ email: string;
1587
+ emailVerified: boolean;
1588
+ createdAt: Date;
1589
+ updatedAt: Date;
1590
+ image?: string | undefined;
1591
+ };
1592
+ };
1593
+ }>, better_call.EndpointOptions>[];
1594
+ } & {
1595
+ method: "*";
1596
+ }>)[];
1597
+ };
1598
+ method: better_call.Method | better_call.Method[];
1599
+ headers: Headers;
1600
+ };
1601
+ getActiveInvitation: {
1602
+ (ctx_0: better_call.Context<"/organization/get-active-invitation", {
1603
+ method: "GET";
1604
+ use: better_call.Endpoint<better_call.Handler<string, better_call.EndpointOptions, {
1605
+ orgOptions: OrganizationOptions;
1606
+ roles: typeof defaultRoles & {
1607
+ [key: string]: Role<{}>;
1608
+ };
1609
+ getSession: (context: better_call.Context<any, any>) => Promise<{
1610
+ session: Session & {
1611
+ activeOrganizationId?: string;
1612
+ };
1613
+ user: User;
1614
+ }>;
1615
+ }>, better_call.EndpointOptions>[];
1616
+ query: zod.ZodObject<{
1617
+ id: zod.ZodString;
1618
+ }, "strip", zod.ZodTypeAny, {
1619
+ id: string;
1620
+ }, {
1621
+ id: string;
1622
+ }>;
1623
+ }>): Promise<{
1624
+ organizationName: string;
1625
+ organizationSlug: string;
1626
+ inviterEmail: string;
1627
+ inviterName: string;
1628
+ id: string;
1629
+ expiresAt: Date;
1630
+ status: "pending" | "accepted" | "rejected" | "canceled";
1631
+ email: string;
1632
+ organizationId: string;
1633
+ role: "admin" | "member" | "owner";
1634
+ inviterId: string;
1635
+ } | null>;
1636
+ path: "/organization/get-active-invitation";
1637
+ options: {
1638
+ method: "GET";
1639
+ use: better_call.Endpoint<better_call.Handler<string, better_call.EndpointOptions, {
1640
+ orgOptions: OrganizationOptions;
1641
+ roles: typeof defaultRoles & {
1642
+ [key: string]: Role<{}>;
1643
+ };
1644
+ getSession: (context: better_call.Context<any, any>) => Promise<{
1645
+ session: Session & {
1646
+ activeOrganizationId?: string;
1647
+ };
1648
+ user: User;
1649
+ }>;
1650
+ }>, better_call.EndpointOptions>[];
1651
+ query: zod.ZodObject<{
1652
+ id: zod.ZodString;
1653
+ }, "strip", zod.ZodTypeAny, {
1654
+ id: string;
1655
+ }, {
1656
+ id: string;
1657
+ }>;
1658
+ };
1659
+ method: better_call.Method | better_call.Method[];
1660
+ headers: Headers;
1661
+ };
1662
+ rejectInvitation: {
1663
+ (ctx_0: better_call.Context<"/organization/reject-invitation", {
1664
+ method: "POST";
1665
+ body: zod.ZodObject<{
1666
+ invitationId: zod.ZodString;
1667
+ }, "strip", zod.ZodTypeAny, {
1668
+ invitationId: string;
1669
+ }, {
1670
+ invitationId: string;
1671
+ }>;
1672
+ use: (better_call.Endpoint<better_call.Handler<string, better_call.EndpointOptions, {
1673
+ orgOptions: OrganizationOptions;
1674
+ roles: typeof defaultRoles & {
1675
+ [key: string]: Role<{}>;
1676
+ };
1677
+ getSession: (context: better_call.Context<any, any>) => Promise<{
1678
+ session: Session & {
1679
+ activeOrganizationId?: string;
1680
+ };
1681
+ user: User;
1682
+ }>;
1683
+ }>, better_call.EndpointOptions> | better_call.Endpoint<better_call.Handler<string, {
1684
+ use: better_call.Endpoint<better_call.Handler<string, better_call.EndpointOptions, {
1685
+ session: {
1686
+ session: {
1687
+ id: string;
1688
+ userId: string;
1689
+ expiresAt: Date;
1690
+ ipAddress?: string | undefined;
1691
+ userAgent?: string | undefined;
1692
+ };
1693
+ user: {
1694
+ id: string;
1695
+ name: string;
1696
+ email: string;
1697
+ emailVerified: boolean;
1698
+ createdAt: Date;
1699
+ updatedAt: Date;
1700
+ image?: string | undefined;
1701
+ };
1702
+ };
1703
+ }>, better_call.EndpointOptions>[];
1704
+ } & {
1705
+ method: "*";
1706
+ }, {
1707
+ session: {
1708
+ session: Session & {
1709
+ activeOrganizationId?: string;
1710
+ };
1711
+ user: User;
1712
+ };
1713
+ }>, {
1714
+ use: better_call.Endpoint<better_call.Handler<string, better_call.EndpointOptions, {
1715
+ session: {
1716
+ session: {
1717
+ id: string;
1718
+ userId: string;
1719
+ expiresAt: Date;
1720
+ ipAddress?: string | undefined;
1721
+ userAgent?: string | undefined;
1722
+ };
1723
+ user: {
1724
+ id: string;
1725
+ name: string;
1726
+ email: string;
1727
+ emailVerified: boolean;
1728
+ createdAt: Date;
1729
+ updatedAt: Date;
1730
+ image?: string | undefined;
1731
+ };
1732
+ };
1733
+ }>, better_call.EndpointOptions>[];
1734
+ } & {
1735
+ method: "*";
1736
+ }>)[];
1737
+ }>): Promise<{
1738
+ invitation: {
1739
+ id: string;
1740
+ expiresAt: Date;
1741
+ status: "pending" | "accepted" | "rejected" | "canceled";
1742
+ email: string;
1743
+ organizationId: string;
1744
+ role: "admin" | "member" | "owner";
1745
+ inviterId: string;
1746
+ };
1747
+ member: null;
1748
+ } | null>;
1749
+ path: "/organization/reject-invitation";
1750
+ options: {
1751
+ method: "POST";
1752
+ body: zod.ZodObject<{
1753
+ invitationId: zod.ZodString;
1754
+ }, "strip", zod.ZodTypeAny, {
1755
+ invitationId: string;
1756
+ }, {
1757
+ invitationId: string;
1758
+ }>;
1759
+ use: (better_call.Endpoint<better_call.Handler<string, better_call.EndpointOptions, {
1760
+ orgOptions: OrganizationOptions;
1761
+ roles: typeof defaultRoles & {
1762
+ [key: string]: Role<{}>;
1763
+ };
1764
+ getSession: (context: better_call.Context<any, any>) => Promise<{
1765
+ session: Session & {
1766
+ activeOrganizationId?: string;
1767
+ };
1768
+ user: User;
1769
+ }>;
1770
+ }>, better_call.EndpointOptions> | better_call.Endpoint<better_call.Handler<string, {
1771
+ use: better_call.Endpoint<better_call.Handler<string, better_call.EndpointOptions, {
1772
+ session: {
1773
+ session: {
1774
+ id: string;
1775
+ userId: string;
1776
+ expiresAt: Date;
1777
+ ipAddress?: string | undefined;
1778
+ userAgent?: string | undefined;
1779
+ };
1780
+ user: {
1781
+ id: string;
1782
+ name: string;
1783
+ email: string;
1784
+ emailVerified: boolean;
1785
+ createdAt: Date;
1786
+ updatedAt: Date;
1787
+ image?: string | undefined;
1788
+ };
1789
+ };
1790
+ }>, better_call.EndpointOptions>[];
1791
+ } & {
1792
+ method: "*";
1793
+ }, {
1794
+ session: {
1795
+ session: Session & {
1796
+ activeOrganizationId?: string;
1797
+ };
1798
+ user: User;
1799
+ };
1800
+ }>, {
1801
+ use: better_call.Endpoint<better_call.Handler<string, better_call.EndpointOptions, {
1802
+ session: {
1803
+ session: {
1804
+ id: string;
1805
+ userId: string;
1806
+ expiresAt: Date;
1807
+ ipAddress?: string | undefined;
1808
+ userAgent?: string | undefined;
1809
+ };
1810
+ user: {
1811
+ id: string;
1812
+ name: string;
1813
+ email: string;
1814
+ emailVerified: boolean;
1815
+ createdAt: Date;
1816
+ updatedAt: Date;
1817
+ image?: string | undefined;
1818
+ };
1819
+ };
1820
+ }>, better_call.EndpointOptions>[];
1821
+ } & {
1822
+ method: "*";
1823
+ }>)[];
1824
+ };
1825
+ method: better_call.Method | better_call.Method[];
1826
+ headers: Headers;
1827
+ };
1828
+ removeMember: {
1829
+ (ctx_0: better_call.Context<"/organization/remove-member", {
1830
+ method: "POST";
1831
+ body: zod.ZodObject<{
1832
+ memberId: zod.ZodString;
1833
+ }, "strip", zod.ZodTypeAny, {
1834
+ memberId: string;
1835
+ }, {
1836
+ memberId: string;
1837
+ }>;
1838
+ use: (better_call.Endpoint<better_call.Handler<string, better_call.EndpointOptions, {
1839
+ orgOptions: OrganizationOptions;
1840
+ roles: typeof defaultRoles & {
1841
+ [key: string]: Role<{}>;
1842
+ };
1843
+ getSession: (context: better_call.Context<any, any>) => Promise<{
1844
+ session: Session & {
1845
+ activeOrganizationId?: string;
1846
+ };
1847
+ user: User;
1848
+ }>;
1849
+ }>, better_call.EndpointOptions> | better_call.Endpoint<better_call.Handler<string, {
1850
+ use: better_call.Endpoint<better_call.Handler<string, better_call.EndpointOptions, {
1851
+ session: {
1852
+ session: {
1853
+ id: string;
1854
+ userId: string;
1855
+ expiresAt: Date;
1856
+ ipAddress?: string | undefined;
1857
+ userAgent?: string | undefined;
1858
+ };
1859
+ user: {
1860
+ id: string;
1861
+ name: string;
1862
+ email: string;
1863
+ emailVerified: boolean;
1864
+ createdAt: Date;
1865
+ updatedAt: Date;
1866
+ image?: string | undefined;
1867
+ };
1868
+ };
1869
+ }>, better_call.EndpointOptions>[];
1870
+ } & {
1871
+ method: "*";
1872
+ }, {
1873
+ session: {
1874
+ session: Session & {
1875
+ activeOrganizationId?: string;
1876
+ };
1877
+ user: User;
1878
+ };
1879
+ }>, {
1880
+ use: better_call.Endpoint<better_call.Handler<string, better_call.EndpointOptions, {
1881
+ session: {
1882
+ session: {
1883
+ id: string;
1884
+ userId: string;
1885
+ expiresAt: Date;
1886
+ ipAddress?: string | undefined;
1887
+ userAgent?: string | undefined;
1888
+ };
1889
+ user: {
1890
+ id: string;
1891
+ name: string;
1892
+ email: string;
1893
+ emailVerified: boolean;
1894
+ createdAt: Date;
1895
+ updatedAt: Date;
1896
+ image?: string | undefined;
1897
+ };
1898
+ };
1899
+ }>, better_call.EndpointOptions>[];
1900
+ } & {
1901
+ method: "*";
1902
+ }>)[];
1903
+ }>): Promise<void | null>;
1904
+ path: "/organization/remove-member";
1905
+ options: {
1906
+ method: "POST";
1907
+ body: zod.ZodObject<{
1908
+ memberId: zod.ZodString;
1909
+ }, "strip", zod.ZodTypeAny, {
1910
+ memberId: string;
1911
+ }, {
1912
+ memberId: string;
1913
+ }>;
1914
+ use: (better_call.Endpoint<better_call.Handler<string, better_call.EndpointOptions, {
1915
+ orgOptions: OrganizationOptions;
1916
+ roles: typeof defaultRoles & {
1917
+ [key: string]: Role<{}>;
1918
+ };
1919
+ getSession: (context: better_call.Context<any, any>) => Promise<{
1920
+ session: Session & {
1921
+ activeOrganizationId?: string;
1922
+ };
1923
+ user: User;
1924
+ }>;
1925
+ }>, better_call.EndpointOptions> | better_call.Endpoint<better_call.Handler<string, {
1926
+ use: better_call.Endpoint<better_call.Handler<string, better_call.EndpointOptions, {
1927
+ session: {
1928
+ session: {
1929
+ id: string;
1930
+ userId: string;
1931
+ expiresAt: Date;
1932
+ ipAddress?: string | undefined;
1933
+ userAgent?: string | undefined;
1934
+ };
1935
+ user: {
1936
+ id: string;
1937
+ name: string;
1938
+ email: string;
1939
+ emailVerified: boolean;
1940
+ createdAt: Date;
1941
+ updatedAt: Date;
1942
+ image?: string | undefined;
1943
+ };
1944
+ };
1945
+ }>, better_call.EndpointOptions>[];
1946
+ } & {
1947
+ method: "*";
1948
+ }, {
1949
+ session: {
1950
+ session: Session & {
1951
+ activeOrganizationId?: string;
1952
+ };
1953
+ user: User;
1954
+ };
1955
+ }>, {
1956
+ use: better_call.Endpoint<better_call.Handler<string, better_call.EndpointOptions, {
1957
+ session: {
1958
+ session: {
1959
+ id: string;
1960
+ userId: string;
1961
+ expiresAt: Date;
1962
+ ipAddress?: string | undefined;
1963
+ userAgent?: string | undefined;
1964
+ };
1965
+ user: {
1966
+ id: string;
1967
+ name: string;
1968
+ email: string;
1969
+ emailVerified: boolean;
1970
+ createdAt: Date;
1971
+ updatedAt: Date;
1972
+ image?: string | undefined;
1973
+ };
1974
+ };
1975
+ }>, better_call.EndpointOptions>[];
1976
+ } & {
1977
+ method: "*";
1978
+ }>)[];
1979
+ };
1980
+ method: better_call.Method | better_call.Method[];
1981
+ headers: Headers;
1982
+ };
1983
+ updateMember: {
1984
+ (ctx_0: better_call.Context<"/organization/update-member", {
1985
+ method: "POST";
1986
+ body: zod.ZodObject<{
1987
+ memberId: zod.ZodString;
1988
+ role: zod.ZodString;
1989
+ }, "strip", zod.ZodTypeAny, {
1990
+ role: string;
1991
+ memberId: string;
1992
+ }, {
1993
+ role: string;
1994
+ memberId: string;
1995
+ }>;
1996
+ use: (better_call.Endpoint<better_call.Handler<string, better_call.EndpointOptions, {
1997
+ orgOptions: OrganizationOptions;
1998
+ roles: typeof defaultRoles & {
1999
+ [key: string]: Role<{}>;
2000
+ };
2001
+ getSession: (context: better_call.Context<any, any>) => Promise<{
2002
+ session: Session & {
2003
+ activeOrganizationId?: string;
2004
+ };
2005
+ user: User;
2006
+ }>;
2007
+ }>, better_call.EndpointOptions> | better_call.Endpoint<better_call.Handler<string, {
2008
+ use: better_call.Endpoint<better_call.Handler<string, better_call.EndpointOptions, {
2009
+ session: {
2010
+ session: {
2011
+ id: string;
2012
+ userId: string;
2013
+ expiresAt: Date;
2014
+ ipAddress?: string | undefined;
2015
+ userAgent?: string | undefined;
2016
+ };
2017
+ user: {
2018
+ id: string;
2019
+ name: string;
2020
+ email: string;
2021
+ emailVerified: boolean;
2022
+ createdAt: Date;
2023
+ updatedAt: Date;
2024
+ image?: string | undefined;
2025
+ };
2026
+ };
2027
+ }>, better_call.EndpointOptions>[];
2028
+ } & {
2029
+ method: "*";
2030
+ }, {
2031
+ session: {
2032
+ session: Session & {
2033
+ activeOrganizationId?: string;
2034
+ };
2035
+ user: User;
2036
+ };
2037
+ }>, {
2038
+ use: better_call.Endpoint<better_call.Handler<string, better_call.EndpointOptions, {
2039
+ session: {
2040
+ session: {
2041
+ id: string;
2042
+ userId: string;
2043
+ expiresAt: Date;
2044
+ ipAddress?: string | undefined;
2045
+ userAgent?: string | undefined;
2046
+ };
2047
+ user: {
2048
+ id: string;
2049
+ name: string;
2050
+ email: string;
2051
+ emailVerified: boolean;
2052
+ createdAt: Date;
2053
+ updatedAt: Date;
2054
+ image?: string | undefined;
2055
+ };
2056
+ };
2057
+ }>, better_call.EndpointOptions>[];
2058
+ } & {
2059
+ method: "*";
2060
+ }>)[];
2061
+ }>): Promise<{
2062
+ id: string;
2063
+ userId: string;
2064
+ name: string;
2065
+ email: string;
2066
+ organizationId: string;
2067
+ role: "admin" | "member" | "owner";
2068
+ } | null>;
2069
+ path: "/organization/update-member";
2070
+ options: {
2071
+ method: "POST";
2072
+ body: zod.ZodObject<{
2073
+ memberId: zod.ZodString;
2074
+ role: zod.ZodString;
2075
+ }, "strip", zod.ZodTypeAny, {
2076
+ role: string;
2077
+ memberId: string;
2078
+ }, {
2079
+ role: string;
2080
+ memberId: string;
2081
+ }>;
2082
+ use: (better_call.Endpoint<better_call.Handler<string, better_call.EndpointOptions, {
2083
+ orgOptions: OrganizationOptions;
2084
+ roles: typeof defaultRoles & {
2085
+ [key: string]: Role<{}>;
2086
+ };
2087
+ getSession: (context: better_call.Context<any, any>) => Promise<{
2088
+ session: Session & {
2089
+ activeOrganizationId?: string;
2090
+ };
2091
+ user: User;
2092
+ }>;
2093
+ }>, better_call.EndpointOptions> | better_call.Endpoint<better_call.Handler<string, {
2094
+ use: better_call.Endpoint<better_call.Handler<string, better_call.EndpointOptions, {
2095
+ session: {
2096
+ session: {
2097
+ id: string;
2098
+ userId: string;
2099
+ expiresAt: Date;
2100
+ ipAddress?: string | undefined;
2101
+ userAgent?: string | undefined;
2102
+ };
2103
+ user: {
2104
+ id: string;
2105
+ name: string;
2106
+ email: string;
2107
+ emailVerified: boolean;
2108
+ createdAt: Date;
2109
+ updatedAt: Date;
2110
+ image?: string | undefined;
2111
+ };
2112
+ };
2113
+ }>, better_call.EndpointOptions>[];
2114
+ } & {
2115
+ method: "*";
2116
+ }, {
2117
+ session: {
2118
+ session: Session & {
2119
+ activeOrganizationId?: string;
2120
+ };
2121
+ user: User;
2122
+ };
2123
+ }>, {
2124
+ use: better_call.Endpoint<better_call.Handler<string, better_call.EndpointOptions, {
2125
+ session: {
2126
+ session: {
2127
+ id: string;
2128
+ userId: string;
2129
+ expiresAt: Date;
2130
+ ipAddress?: string | undefined;
2131
+ userAgent?: string | undefined;
2132
+ };
2133
+ user: {
2134
+ id: string;
2135
+ name: string;
2136
+ email: string;
2137
+ emailVerified: boolean;
2138
+ createdAt: Date;
2139
+ updatedAt: Date;
2140
+ image?: string | undefined;
2141
+ };
2142
+ };
2143
+ }>, better_call.EndpointOptions>[];
2144
+ } & {
2145
+ method: "*";
2146
+ }>)[];
2147
+ };
2148
+ method: better_call.Method | better_call.Method[];
2149
+ headers: Headers;
2150
+ };
2151
+ };
2152
+ schema: {
2153
+ session: {
2154
+ fields: {
2155
+ activeOrganizationId: {
2156
+ type: "string";
2157
+ required: false;
2158
+ };
2159
+ };
2160
+ };
2161
+ organization: {
2162
+ fields: {
2163
+ name: {
2164
+ type: "string";
2165
+ };
2166
+ slug: {
2167
+ type: "string";
2168
+ unique: true;
2169
+ };
2170
+ };
2171
+ };
2172
+ member: {
2173
+ fields: {
2174
+ organizationId: {
2175
+ type: "string";
2176
+ required: true;
2177
+ };
2178
+ userId: {
2179
+ type: "string";
2180
+ required: true;
2181
+ };
2182
+ email: {
2183
+ type: "string";
2184
+ required: true;
2185
+ };
2186
+ name: {
2187
+ type: "string";
2188
+ };
2189
+ role: {
2190
+ type: "string";
2191
+ required: true;
2192
+ defaultValue: string;
2193
+ };
2194
+ };
2195
+ };
2196
+ invitation: {
2197
+ fields: {
2198
+ organizationId: {
2199
+ type: "string";
2200
+ required: true;
2201
+ };
2202
+ email: {
2203
+ type: "string";
2204
+ required: true;
2205
+ };
2206
+ role: {
2207
+ type: "string";
2208
+ required: false;
2209
+ };
2210
+ status: {
2211
+ type: "string";
2212
+ required: true;
2213
+ defaultValue: string;
2214
+ };
2215
+ expiresAt: {
2216
+ type: "date";
2217
+ required: true;
2218
+ };
2219
+ inviterId: {
2220
+ type: "string";
2221
+ references: {
2222
+ model: string;
2223
+ field: string;
2224
+ };
2225
+ };
2226
+ };
2227
+ };
2228
+ };
2229
+ };
2230
+ id: string;
2231
+ actions?: {
2232
+ organization: {
2233
+ setActive(orgId: string | null): void;
2234
+ setInvitationId: (id: string | null) => void;
2235
+ hasPermission: (permission: Partial<{ [key in keyof (O["ac"] extends AccessControl<infer S extends StatementsPrimitive> ? S extends Record<string, any[]> ? S & {
2236
+ readonly organization: readonly ["update", "delete"];
2237
+ readonly member: readonly ["create", "update", "delete"];
2238
+ readonly invitation: readonly ["create", "cancel"];
2239
+ } : {
2240
+ readonly organization: readonly ["update", "delete"];
2241
+ readonly member: readonly ["create", "update", "delete"];
2242
+ readonly invitation: readonly ["create", "cancel"];
2243
+ } : {
2244
+ readonly organization: readonly ["update", "delete"];
2245
+ readonly member: readonly ["create", "update", "delete"];
2246
+ readonly invitation: readonly ["create", "cancel"];
2247
+ })]: (O["ac"] extends AccessControl<infer S extends StatementsPrimitive> ? S extends Record<string, any[]> ? S & {
2248
+ readonly organization: readonly ["update", "delete"];
2249
+ readonly member: readonly ["create", "update", "delete"];
2250
+ readonly invitation: readonly ["create", "cancel"];
2251
+ } : {
2252
+ readonly organization: readonly ["update", "delete"];
2253
+ readonly member: readonly ["create", "update", "delete"];
2254
+ readonly invitation: readonly ["create", "cancel"];
2255
+ } : {
2256
+ readonly organization: readonly ["update", "delete"];
2257
+ readonly member: readonly ["create", "update", "delete"];
2258
+ readonly invitation: readonly ["create", "cancel"];
2259
+ })[key][number][]; }>) => Promise<void>;
2260
+ };
2261
+ } | undefined;
2262
+ authProxySignal?: AuthProxySignal[];
2263
+ signals?: Record<string, nanostores.PreinitializedWritableAtom<boolean>>;
2264
+ atoms?: Record<string, nanostores.Atom<any>>;
2265
+ pathMethods?: Record<string, "POST" | "GET">;
2266
+ fetchPlugins?: _better_fetch_fetch.BetterFetchPlugin[];
2267
+ };
2268
+
2269
+ declare const usernameClient: ($fetch: _better_fetch_fetch.BetterFetch) => {
2270
+ integrations: {
2271
+ react?: ((useStore: typeof useAuthStore) => Record<string, any>) | undefined;
2272
+ vue?: ((useStore: typeof useAuthStore$1) => Record<string, any>) | undefined;
2273
+ preact?: ((useStore: typeof useAuthStore$2) => Record<string, any>) | undefined;
2274
+ svelte?: (() => Record<string, any>) | undefined;
2275
+ };
2276
+ plugin: {
2277
+ id: "username";
2278
+ endpoints: {
2279
+ signInUsername: {
2280
+ (ctx_0: better_call.Context<"/sign-in/username", {
2281
+ method: "POST";
2282
+ body: zod.ZodObject<{
2283
+ username: zod.ZodString;
2284
+ password: zod.ZodString;
2285
+ dontRememberMe: zod.ZodOptional<zod.ZodBoolean>;
2286
+ callbackURL: zod.ZodOptional<zod.ZodString>;
2287
+ }, "strip", zod.ZodTypeAny, {
2288
+ password: string;
2289
+ username: string;
2290
+ callbackURL?: string | undefined;
2291
+ dontRememberMe?: boolean | undefined;
2292
+ }, {
2293
+ password: string;
2294
+ username: string;
2295
+ callbackURL?: string | undefined;
2296
+ dontRememberMe?: boolean | undefined;
2297
+ }>;
2298
+ }>): Promise<{
2299
+ user: {
2300
+ id: string;
2301
+ name: string;
2302
+ email: string;
2303
+ emailVerified: boolean;
2304
+ createdAt: Date;
2305
+ updatedAt: Date;
2306
+ image?: string | undefined;
2307
+ };
2308
+ session: {
2309
+ id: string;
2310
+ userId: string;
2311
+ expiresAt: Date;
2312
+ ipAddress?: string | undefined;
2313
+ userAgent?: string | undefined;
2314
+ };
2315
+ redirect: boolean;
2316
+ url: string | undefined;
2317
+ }>;
2318
+ path: "/sign-in/username";
2319
+ options: {
2320
+ method: "POST";
2321
+ body: zod.ZodObject<{
2322
+ username: zod.ZodString;
2323
+ password: zod.ZodString;
2324
+ dontRememberMe: zod.ZodOptional<zod.ZodBoolean>;
2325
+ callbackURL: zod.ZodOptional<zod.ZodString>;
2326
+ }, "strip", zod.ZodTypeAny, {
2327
+ password: string;
2328
+ username: string;
2329
+ callbackURL?: string | undefined;
2330
+ dontRememberMe?: boolean | undefined;
2331
+ }, {
2332
+ password: string;
2333
+ username: string;
2334
+ callbackURL?: string | undefined;
2335
+ dontRememberMe?: boolean | undefined;
2336
+ }>;
2337
+ };
2338
+ method: better_call.Method | better_call.Method[];
2339
+ headers: Headers;
2340
+ };
2341
+ signUpUsername: {
2342
+ (ctx_0: better_call.Context<"/sign-up/username", {
2343
+ method: "POST";
2344
+ body: zod.ZodObject<{
2345
+ username: zod.ZodString;
2346
+ name: zod.ZodString;
2347
+ email: zod.ZodString;
2348
+ password: zod.ZodString;
2349
+ image: zod.ZodOptional<zod.ZodString>;
2350
+ callbackURL: zod.ZodOptional<zod.ZodString>;
2351
+ }, "strip", zod.ZodTypeAny, {
2352
+ password: string;
2353
+ name: string;
2354
+ email: string;
2355
+ username: string;
2356
+ image?: string | undefined;
2357
+ callbackURL?: string | undefined;
2358
+ }, {
2359
+ password: string;
2360
+ name: string;
2361
+ email: string;
2362
+ username: string;
2363
+ image?: string | undefined;
2364
+ callbackURL?: string | undefined;
2365
+ }>;
2366
+ }>): Promise<{
2367
+ user: {
2368
+ id: string;
2369
+ name: string;
2370
+ email: string;
2371
+ emailVerified: boolean;
2372
+ createdAt: Date;
2373
+ updatedAt: Date;
2374
+ image?: string | undefined;
2375
+ };
2376
+ session: {
2377
+ id: string;
2378
+ userId: string;
2379
+ expiresAt: Date;
2380
+ ipAddress?: string | undefined;
2381
+ userAgent?: string | undefined;
2382
+ };
2383
+ } | null>;
2384
+ path: "/sign-up/username";
2385
+ options: {
2386
+ method: "POST";
2387
+ body: zod.ZodObject<{
2388
+ username: zod.ZodString;
2389
+ name: zod.ZodString;
2390
+ email: zod.ZodString;
2391
+ password: zod.ZodString;
2392
+ image: zod.ZodOptional<zod.ZodString>;
2393
+ callbackURL: zod.ZodOptional<zod.ZodString>;
2394
+ }, "strip", zod.ZodTypeAny, {
2395
+ password: string;
2396
+ name: string;
2397
+ email: string;
2398
+ username: string;
2399
+ image?: string | undefined;
2400
+ callbackURL?: string | undefined;
2401
+ }, {
2402
+ password: string;
2403
+ name: string;
2404
+ email: string;
2405
+ username: string;
2406
+ image?: string | undefined;
2407
+ callbackURL?: string | undefined;
2408
+ }>;
2409
+ };
2410
+ method: better_call.Method | better_call.Method[];
2411
+ headers: Headers;
2412
+ };
2413
+ };
2414
+ schema: {
2415
+ user: {
2416
+ fields: {
2417
+ username: {
2418
+ type: "string";
2419
+ required: false;
2420
+ unique: true;
2421
+ returned: true;
2422
+ };
2423
+ };
2424
+ };
2425
+ };
2426
+ };
2427
+ id: string;
2428
+ actions?: Record<string, any> | undefined;
2429
+ authProxySignal?: AuthProxySignal[];
2430
+ signals?: Record<string, nanostores.PreinitializedWritableAtom<boolean>>;
2431
+ atoms?: Record<string, nanostores.Atom<any>>;
2432
+ pathMethods?: Record<string, "POST" | "GET">;
2433
+ fetchPlugins?: _better_fetch_fetch.BetterFetchPlugin[];
2434
+ };
2435
+
2436
+ export { organizationClient, usernameClient };