@agentuity/auth 1.0.28 → 1.0.30

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.
@@ -171,16 +171,7 @@ export declare function getDefaultClientPlugins(): ({
171
171
  };
172
172
  };
173
173
  organization: {
174
- checkRolePermission: <R extends "member" | "admin" | "owner">(data: ({
175
- permission: {
176
- readonly organization?: ("update" | "delete")[] | undefined;
177
- readonly member?: ("create" | "update" | "delete")[] | undefined;
178
- readonly invitation?: ("create" | "cancel")[] | undefined;
179
- readonly team?: ("create" | "update" | "delete")[] | undefined;
180
- readonly ac?: ("create" | "update" | "delete" | "read")[] | undefined;
181
- };
182
- permissions?: never | undefined;
183
- } | {
174
+ checkRolePermission: <R extends "member" | "admin" | "owner">(data: {
184
175
  permissions: {
185
176
  readonly organization?: ("update" | "delete")[] | undefined;
186
177
  readonly member?: ("create" | "update" | "delete")[] | undefined;
@@ -188,8 +179,7 @@ export declare function getDefaultClientPlugins(): ({
188
179
  readonly team?: ("create" | "update" | "delete")[] | undefined;
189
180
  readonly ac?: ("create" | "update" | "delete" | "read")[] | undefined;
190
181
  };
191
- permission?: never | undefined;
192
- }) & {
182
+ } & {
193
183
  role: R;
194
184
  }) => boolean;
195
185
  };
@@ -270,1056 +260,106 @@ export declare function getDefaultClientPlugins(): ({
270
260
  matcher(path: string): boolean;
271
261
  signal: "$activeMemberRoleSignal";
272
262
  })[];
263
+ $ERROR_CODES: {
264
+ YOU_ARE_NOT_ALLOWED_TO_CREATE_A_NEW_ORGANIZATION: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_CREATE_A_NEW_ORGANIZATION">;
265
+ YOU_HAVE_REACHED_THE_MAXIMUM_NUMBER_OF_ORGANIZATIONS: import("better-auth").RawError<"YOU_HAVE_REACHED_THE_MAXIMUM_NUMBER_OF_ORGANIZATIONS">;
266
+ ORGANIZATION_ALREADY_EXISTS: import("better-auth").RawError<"ORGANIZATION_ALREADY_EXISTS">;
267
+ ORGANIZATION_SLUG_ALREADY_TAKEN: import("better-auth").RawError<"ORGANIZATION_SLUG_ALREADY_TAKEN">;
268
+ ORGANIZATION_NOT_FOUND: import("better-auth").RawError<"ORGANIZATION_NOT_FOUND">;
269
+ USER_IS_NOT_A_MEMBER_OF_THE_ORGANIZATION: import("better-auth").RawError<"USER_IS_NOT_A_MEMBER_OF_THE_ORGANIZATION">;
270
+ YOU_ARE_NOT_ALLOWED_TO_UPDATE_THIS_ORGANIZATION: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_UPDATE_THIS_ORGANIZATION">;
271
+ YOU_ARE_NOT_ALLOWED_TO_DELETE_THIS_ORGANIZATION: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_DELETE_THIS_ORGANIZATION">;
272
+ NO_ACTIVE_ORGANIZATION: import("better-auth").RawError<"NO_ACTIVE_ORGANIZATION">;
273
+ USER_IS_ALREADY_A_MEMBER_OF_THIS_ORGANIZATION: import("better-auth").RawError<"USER_IS_ALREADY_A_MEMBER_OF_THIS_ORGANIZATION">;
274
+ MEMBER_NOT_FOUND: import("better-auth").RawError<"MEMBER_NOT_FOUND">;
275
+ ROLE_NOT_FOUND: import("better-auth").RawError<"ROLE_NOT_FOUND">;
276
+ YOU_ARE_NOT_ALLOWED_TO_CREATE_A_NEW_TEAM: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_CREATE_A_NEW_TEAM">;
277
+ TEAM_ALREADY_EXISTS: import("better-auth").RawError<"TEAM_ALREADY_EXISTS">;
278
+ TEAM_NOT_FOUND: import("better-auth").RawError<"TEAM_NOT_FOUND">;
279
+ YOU_CANNOT_LEAVE_THE_ORGANIZATION_AS_THE_ONLY_OWNER: import("better-auth").RawError<"YOU_CANNOT_LEAVE_THE_ORGANIZATION_AS_THE_ONLY_OWNER">;
280
+ YOU_CANNOT_LEAVE_THE_ORGANIZATION_WITHOUT_AN_OWNER: import("better-auth").RawError<"YOU_CANNOT_LEAVE_THE_ORGANIZATION_WITHOUT_AN_OWNER">;
281
+ YOU_ARE_NOT_ALLOWED_TO_DELETE_THIS_MEMBER: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_DELETE_THIS_MEMBER">;
282
+ YOU_ARE_NOT_ALLOWED_TO_INVITE_USERS_TO_THIS_ORGANIZATION: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_INVITE_USERS_TO_THIS_ORGANIZATION">;
283
+ USER_IS_ALREADY_INVITED_TO_THIS_ORGANIZATION: import("better-auth").RawError<"USER_IS_ALREADY_INVITED_TO_THIS_ORGANIZATION">;
284
+ INVITATION_NOT_FOUND: import("better-auth").RawError<"INVITATION_NOT_FOUND">;
285
+ YOU_ARE_NOT_THE_RECIPIENT_OF_THE_INVITATION: import("better-auth").RawError<"YOU_ARE_NOT_THE_RECIPIENT_OF_THE_INVITATION">;
286
+ EMAIL_VERIFICATION_REQUIRED_BEFORE_ACCEPTING_OR_REJECTING_INVITATION: import("better-auth").RawError<"EMAIL_VERIFICATION_REQUIRED_BEFORE_ACCEPTING_OR_REJECTING_INVITATION">;
287
+ YOU_ARE_NOT_ALLOWED_TO_CANCEL_THIS_INVITATION: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_CANCEL_THIS_INVITATION">;
288
+ INVITER_IS_NO_LONGER_A_MEMBER_OF_THE_ORGANIZATION: import("better-auth").RawError<"INVITER_IS_NO_LONGER_A_MEMBER_OF_THE_ORGANIZATION">;
289
+ YOU_ARE_NOT_ALLOWED_TO_INVITE_USER_WITH_THIS_ROLE: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_INVITE_USER_WITH_THIS_ROLE">;
290
+ FAILED_TO_RETRIEVE_INVITATION: import("better-auth").RawError<"FAILED_TO_RETRIEVE_INVITATION">;
291
+ YOU_HAVE_REACHED_THE_MAXIMUM_NUMBER_OF_TEAMS: import("better-auth").RawError<"YOU_HAVE_REACHED_THE_MAXIMUM_NUMBER_OF_TEAMS">;
292
+ UNABLE_TO_REMOVE_LAST_TEAM: import("better-auth").RawError<"UNABLE_TO_REMOVE_LAST_TEAM">;
293
+ YOU_ARE_NOT_ALLOWED_TO_UPDATE_THIS_MEMBER: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_UPDATE_THIS_MEMBER">;
294
+ ORGANIZATION_MEMBERSHIP_LIMIT_REACHED: import("better-auth").RawError<"ORGANIZATION_MEMBERSHIP_LIMIT_REACHED">;
295
+ YOU_ARE_NOT_ALLOWED_TO_CREATE_TEAMS_IN_THIS_ORGANIZATION: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_CREATE_TEAMS_IN_THIS_ORGANIZATION">;
296
+ YOU_ARE_NOT_ALLOWED_TO_DELETE_TEAMS_IN_THIS_ORGANIZATION: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_DELETE_TEAMS_IN_THIS_ORGANIZATION">;
297
+ YOU_ARE_NOT_ALLOWED_TO_UPDATE_THIS_TEAM: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_UPDATE_THIS_TEAM">;
298
+ YOU_ARE_NOT_ALLOWED_TO_DELETE_THIS_TEAM: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_DELETE_THIS_TEAM">;
299
+ INVITATION_LIMIT_REACHED: import("better-auth").RawError<"INVITATION_LIMIT_REACHED">;
300
+ TEAM_MEMBER_LIMIT_REACHED: import("better-auth").RawError<"TEAM_MEMBER_LIMIT_REACHED">;
301
+ USER_IS_NOT_A_MEMBER_OF_THE_TEAM: import("better-auth").RawError<"USER_IS_NOT_A_MEMBER_OF_THE_TEAM">;
302
+ YOU_CAN_NOT_ACCESS_THE_MEMBERS_OF_THIS_TEAM: import("better-auth").RawError<"YOU_CAN_NOT_ACCESS_THE_MEMBERS_OF_THIS_TEAM">;
303
+ YOU_DO_NOT_HAVE_AN_ACTIVE_TEAM: import("better-auth").RawError<"YOU_DO_NOT_HAVE_AN_ACTIVE_TEAM">;
304
+ YOU_ARE_NOT_ALLOWED_TO_CREATE_A_NEW_TEAM_MEMBER: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_CREATE_A_NEW_TEAM_MEMBER">;
305
+ YOU_ARE_NOT_ALLOWED_TO_REMOVE_A_TEAM_MEMBER: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_REMOVE_A_TEAM_MEMBER">;
306
+ YOU_ARE_NOT_ALLOWED_TO_ACCESS_THIS_ORGANIZATION: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_ACCESS_THIS_ORGANIZATION">;
307
+ YOU_ARE_NOT_A_MEMBER_OF_THIS_ORGANIZATION: import("better-auth").RawError<"YOU_ARE_NOT_A_MEMBER_OF_THIS_ORGANIZATION">;
308
+ MISSING_AC_INSTANCE: import("better-auth").RawError<"MISSING_AC_INSTANCE">;
309
+ YOU_MUST_BE_IN_AN_ORGANIZATION_TO_CREATE_A_ROLE: import("better-auth").RawError<"YOU_MUST_BE_IN_AN_ORGANIZATION_TO_CREATE_A_ROLE">;
310
+ YOU_ARE_NOT_ALLOWED_TO_CREATE_A_ROLE: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_CREATE_A_ROLE">;
311
+ YOU_ARE_NOT_ALLOWED_TO_UPDATE_A_ROLE: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_UPDATE_A_ROLE">;
312
+ YOU_ARE_NOT_ALLOWED_TO_DELETE_A_ROLE: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_DELETE_A_ROLE">;
313
+ YOU_ARE_NOT_ALLOWED_TO_READ_A_ROLE: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_READ_A_ROLE">;
314
+ YOU_ARE_NOT_ALLOWED_TO_LIST_A_ROLE: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_LIST_A_ROLE">;
315
+ YOU_ARE_NOT_ALLOWED_TO_GET_A_ROLE: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_GET_A_ROLE">;
316
+ TOO_MANY_ROLES: import("better-auth").RawError<"TOO_MANY_ROLES">;
317
+ INVALID_RESOURCE: import("better-auth").RawError<"INVALID_RESOURCE">;
318
+ ROLE_NAME_IS_ALREADY_TAKEN: import("better-auth").RawError<"ROLE_NAME_IS_ALREADY_TAKEN">;
319
+ CANNOT_DELETE_A_PRE_DEFINED_ROLE: import("better-auth").RawError<"CANNOT_DELETE_A_PRE_DEFINED_ROLE">;
320
+ ROLE_IS_ASSIGNED_TO_MEMBERS: import("better-auth").RawError<"ROLE_IS_ASSIGNED_TO_MEMBERS">;
321
+ };
273
322
  } | {
274
323
  id: "api-key";
275
- $InferServerPlugin: ReturnType<(options?: import("better-auth/plugins").ApiKeyOptions | undefined) => {
276
- id: "api-key";
277
- $ERROR_CODES: {
278
- readonly INVALID_METADATA_TYPE: "metadata must be an object or undefined";
279
- readonly REFILL_AMOUNT_AND_INTERVAL_REQUIRED: "refillAmount is required when refillInterval is provided";
280
- readonly REFILL_INTERVAL_AND_AMOUNT_REQUIRED: "refillInterval is required when refillAmount is provided";
281
- readonly USER_BANNED: "User is banned";
282
- readonly UNAUTHORIZED_SESSION: "Unauthorized or invalid session";
283
- readonly KEY_NOT_FOUND: "API Key not found";
284
- readonly KEY_DISABLED: "API Key is disabled";
285
- readonly KEY_EXPIRED: "API Key has expired";
286
- readonly USAGE_EXCEEDED: "API Key has reached its usage limit";
287
- readonly KEY_NOT_RECOVERABLE: "API Key is not recoverable";
288
- readonly EXPIRES_IN_IS_TOO_SMALL: "The expiresIn is smaller than the predefined minimum value.";
289
- readonly EXPIRES_IN_IS_TOO_LARGE: "The expiresIn is larger than the predefined maximum value.";
290
- readonly INVALID_REMAINING: "The remaining count is either too large or too small.";
291
- readonly INVALID_PREFIX_LENGTH: "The prefix length is either too large or too small.";
292
- readonly INVALID_NAME_LENGTH: "The name length is either too large or too small.";
293
- readonly METADATA_DISABLED: "Metadata is disabled.";
294
- readonly RATE_LIMIT_EXCEEDED: "Rate limit exceeded.";
295
- readonly NO_VALUES_TO_UPDATE: "No values to update.";
296
- readonly KEY_DISABLED_EXPIRATION: "Custom key expiration values are disabled.";
297
- readonly INVALID_API_KEY: "Invalid API key.";
298
- readonly INVALID_USER_ID_FROM_API_KEY: "The user id from the API key is invalid.";
299
- readonly INVALID_API_KEY_GETTER_RETURN_TYPE: "API Key getter returned an invalid key type. Expected string.";
300
- readonly SERVER_ONLY_PROPERTY: "The property you're trying to set can only be set from the server auth instance only.";
301
- readonly FAILED_TO_UPDATE_API_KEY: "Failed to update API key";
302
- readonly NAME_REQUIRED: "API Key name is required.";
303
- };
304
- hooks: {
305
- before: {
306
- matcher: (ctx: import("better-auth").HookEndpointContext) => boolean;
307
- handler: (inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
308
- user: {
309
- id: string;
310
- createdAt: Date;
311
- updatedAt: Date;
312
- email: string;
313
- emailVerified: boolean;
314
- name: string;
315
- image?: string | null | undefined;
316
- };
317
- session: {
318
- id: string;
319
- token: string;
320
- userId: string;
321
- userAgent: string | null;
322
- ipAddress: string | null;
323
- createdAt: Date;
324
- updatedAt: Date;
325
- expiresAt: Date;
326
- };
327
- } | {
328
- context: import("better-auth").MiddlewareContext<import("better-auth").MiddlewareOptions, {
329
- returned?: unknown | undefined;
330
- responseHeaders?: Headers | undefined;
331
- } & import("better-auth").PluginContext & import("better-auth").InfoContext & {
332
- options: import("better-auth").BetterAuthOptions;
333
- appName: string;
334
- baseURL: string;
335
- trustedOrigins: string[];
336
- isTrustedOrigin: (url: string, settings?: {
337
- allowRelativePaths: boolean;
338
- }) => boolean;
339
- oauthConfig: {
340
- skipStateCookieCheck?: boolean | undefined;
341
- storeStateStrategy: "database" | "cookie";
342
- };
343
- newSession: {
344
- session: import("better-auth").Session & Record<string, any>;
345
- user: import("better-auth").User & Record<string, any>;
346
- } | null;
347
- session: {
348
- session: import("better-auth").Session & Record<string, any>;
349
- user: import("better-auth").User & Record<string, any>;
350
- } | null;
351
- setNewSession: (session: {
352
- session: import("better-auth").Session & Record<string, any>;
353
- user: import("better-auth").User & Record<string, any>;
354
- } | null) => void;
355
- socialProviders: import("better-auth").OAuthProvider[];
356
- authCookies: import("better-auth").BetterAuthCookies;
357
- logger: ReturnType<(options?: import("better-auth").Logger | undefined) => import("better-auth").InternalLogger>;
358
- rateLimit: {
359
- enabled: boolean;
360
- window: number;
361
- max: number;
362
- storage: "memory" | "database" | "secondary-storage";
363
- } & Omit<import("better-auth").BetterAuthRateLimitOptions, "enabled" | "window" | "max" | "storage">;
364
- adapter: import("better-auth").DBAdapter<import("better-auth").BetterAuthOptions>;
365
- internalAdapter: import("better-auth").InternalAdapter<import("better-auth").BetterAuthOptions>;
366
- createAuthCookie: (cookieName: string, overrideAttributes?: Partial<import("better-auth").CookieOptions> | undefined) => import("better-auth").BetterAuthCookie;
367
- secret: string;
368
- sessionConfig: {
369
- updateAge: number;
370
- expiresIn: number;
371
- freshAge: number;
372
- cookieRefreshCache: false | {
373
- enabled: true;
374
- updateAge: number;
375
- };
376
- };
377
- generateId: (options: {
378
- model: import("better-auth").ModelNames;
379
- size?: number | undefined;
380
- }) => string | false;
381
- secondaryStorage: import("better-auth").SecondaryStorage | undefined;
382
- password: {
383
- hash: (password: string) => Promise<string>;
384
- verify: (data: {
385
- password: string;
386
- hash: string;
387
- }) => Promise<boolean>;
388
- config: {
389
- minPasswordLength: number;
390
- maxPasswordLength: number;
391
- };
392
- checkPassword: (userId: string, ctx: import("better-auth").GenericEndpointContext<import("better-auth").BetterAuthOptions>) => Promise<boolean>;
393
- };
394
- tables: import("better-auth").BetterAuthDBSchema;
395
- runMigrations: () => Promise<void>;
396
- publishTelemetry: (event: {
397
- type: string;
398
- anonymousId?: string | undefined;
399
- payload: Record<string, any>;
400
- }) => Promise<void>;
401
- skipOriginCheck: boolean | string[];
402
- skipCSRFCheck: boolean;
403
- runInBackground: (promise: Promise<unknown>) => void;
404
- runInBackgroundOrAwait: (promise: Promise<unknown> | void) => import("better-auth").Awaitable<unknown>;
405
- }>;
406
- }>;
407
- }[];
408
- };
409
- endpoints: {
410
- createApiKey: import("better-auth").StrictEndpoint<"/api-key/create", {
411
- method: "POST";
412
- body: import("zod").ZodObject<{
413
- name: import("zod").ZodOptional<import("zod").ZodString>;
414
- expiresIn: import("zod").ZodDefault<import("zod").ZodNullable<import("zod").ZodOptional<import("zod").ZodNumber>>>;
415
- userId: import("zod").ZodOptional<import("zod").ZodCoercedString<unknown>>;
416
- prefix: import("zod").ZodOptional<import("zod").ZodString>;
417
- remaining: import("zod").ZodDefault<import("zod").ZodNullable<import("zod").ZodOptional<import("zod").ZodNumber>>>;
418
- metadata: import("zod").ZodOptional<import("zod").ZodAny>;
419
- refillAmount: import("zod").ZodOptional<import("zod").ZodNumber>;
420
- refillInterval: import("zod").ZodOptional<import("zod").ZodNumber>;
421
- rateLimitTimeWindow: import("zod").ZodOptional<import("zod").ZodNumber>;
422
- rateLimitMax: import("zod").ZodOptional<import("zod").ZodNumber>;
423
- rateLimitEnabled: import("zod").ZodOptional<import("zod").ZodBoolean>;
424
- permissions: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString>>>;
425
- }, import("better-auth").$strip>;
426
- metadata: {
427
- openapi: {
428
- description: string;
429
- responses: {
430
- "200": {
431
- description: string;
432
- content: {
433
- "application/json": {
434
- schema: {
435
- type: "object";
436
- properties: {
437
- id: {
438
- type: string;
439
- description: string;
440
- };
441
- createdAt: {
442
- type: string;
443
- format: string;
444
- description: string;
445
- };
446
- updatedAt: {
447
- type: string;
448
- format: string;
449
- description: string;
450
- };
451
- name: {
452
- type: string;
453
- nullable: boolean;
454
- description: string;
455
- };
456
- prefix: {
457
- type: string;
458
- nullable: boolean;
459
- description: string;
460
- };
461
- start: {
462
- type: string;
463
- nullable: boolean;
464
- description: string;
465
- };
466
- key: {
467
- type: string;
468
- description: string;
469
- };
470
- enabled: {
471
- type: string;
472
- description: string;
473
- };
474
- expiresAt: {
475
- type: string;
476
- format: string;
477
- nullable: boolean;
478
- description: string;
479
- };
480
- userId: {
481
- type: string;
482
- description: string;
483
- };
484
- lastRefillAt: {
485
- type: string;
486
- format: string;
487
- nullable: boolean;
488
- description: string;
489
- };
490
- lastRequest: {
491
- type: string;
492
- format: string;
493
- nullable: boolean;
494
- description: string;
495
- };
496
- metadata: {
497
- type: string;
498
- nullable: boolean;
499
- additionalProperties: boolean;
500
- description: string;
501
- };
502
- rateLimitMax: {
503
- type: string;
504
- nullable: boolean;
505
- description: string;
506
- };
507
- rateLimitTimeWindow: {
508
- type: string;
509
- nullable: boolean;
510
- description: string;
511
- };
512
- remaining: {
513
- type: string;
514
- nullable: boolean;
515
- description: string;
516
- };
517
- refillAmount: {
518
- type: string;
519
- nullable: boolean;
520
- description: string;
521
- };
522
- refillInterval: {
523
- type: string;
524
- nullable: boolean;
525
- description: string;
526
- };
527
- rateLimitEnabled: {
528
- type: string;
529
- description: string;
530
- };
531
- requestCount: {
532
- type: string;
533
- description: string;
534
- };
535
- permissions: {
536
- type: string;
537
- nullable: boolean;
538
- additionalProperties: {
539
- type: string;
540
- items: {
541
- type: string;
542
- };
543
- };
544
- description: string;
545
- };
546
- };
547
- required: string[];
548
- };
549
- };
550
- };
551
- };
552
- };
553
- };
554
- };
555
- }, {
556
- key: string;
557
- metadata: any;
558
- permissions: any;
559
- id: string;
560
- name: string | null;
561
- start: string | null;
562
- prefix: string | null;
563
- userId: string;
564
- refillInterval: number | null;
565
- refillAmount: number | null;
566
- lastRefillAt: Date | null;
567
- enabled: boolean;
568
- rateLimitEnabled: boolean;
569
- rateLimitTimeWindow: number | null;
570
- rateLimitMax: number | null;
571
- requestCount: number;
572
- remaining: number | null;
573
- lastRequest: Date | null;
574
- expiresAt: Date | null;
575
- createdAt: Date;
576
- updatedAt: Date;
577
- }>;
578
- verifyApiKey: import("better-auth").StrictEndpoint<string, {
579
- method: "POST";
580
- body: import("zod").ZodObject<{
581
- key: import("zod").ZodString;
582
- permissions: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString>>>;
583
- }, import("better-auth").$strip>;
584
- }, {
585
- valid: boolean;
586
- error: {
587
- message: "Invalid API key.";
588
- code: "KEY_NOT_FOUND";
589
- };
590
- key: null;
591
- } | {
592
- valid: boolean;
593
- error: {
594
- message: string | undefined;
595
- code: string;
596
- cause?: unknown;
597
- };
598
- key: null;
599
- } | {
600
- valid: boolean;
601
- error: {
602
- message: "Invalid API key.";
603
- code: "INVALID_API_KEY";
604
- };
605
- key: null;
606
- } | {
607
- valid: boolean;
608
- error: null;
609
- key: Omit<import("better-auth/plugins").ApiKey, "key"> | null;
610
- }>;
611
- getApiKey: import("better-auth").StrictEndpoint<"/api-key/get", {
612
- method: "GET";
613
- query: import("zod").ZodObject<{
614
- id: import("zod").ZodString;
615
- }, import("better-auth").$strip>;
616
- use: ((inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
617
- session: {
618
- session: Record<string, any> & {
619
- id: string;
620
- createdAt: Date;
621
- updatedAt: Date;
622
- userId: string;
623
- expiresAt: Date;
624
- token: string;
625
- ipAddress?: string | null | undefined;
626
- userAgent?: string | null | undefined;
627
- };
628
- user: Record<string, any> & {
629
- id: string;
630
- createdAt: Date;
631
- updatedAt: Date;
632
- email: string;
633
- emailVerified: boolean;
634
- name: string;
635
- image?: string | null | undefined;
636
- };
637
- };
638
- }>)[];
639
- metadata: {
640
- openapi: {
641
- description: string;
642
- responses: {
643
- "200": {
644
- description: string;
645
- content: {
646
- "application/json": {
647
- schema: {
648
- type: "object";
649
- properties: {
650
- id: {
651
- type: string;
652
- description: string;
653
- };
654
- name: {
655
- type: string;
656
- nullable: boolean;
657
- description: string;
658
- };
659
- start: {
660
- type: string;
661
- nullable: boolean;
662
- description: string;
663
- };
664
- prefix: {
665
- type: string;
666
- nullable: boolean;
667
- description: string;
668
- };
669
- userId: {
670
- type: string;
671
- description: string;
672
- };
673
- refillInterval: {
674
- type: string;
675
- nullable: boolean;
676
- description: string;
677
- };
678
- refillAmount: {
679
- type: string;
680
- nullable: boolean;
681
- description: string;
682
- };
683
- lastRefillAt: {
684
- type: string;
685
- format: string;
686
- nullable: boolean;
687
- description: string;
688
- };
689
- enabled: {
690
- type: string;
691
- description: string;
692
- default: boolean;
693
- };
694
- rateLimitEnabled: {
695
- type: string;
696
- description: string;
697
- };
698
- rateLimitTimeWindow: {
699
- type: string;
700
- nullable: boolean;
701
- description: string;
702
- };
703
- rateLimitMax: {
704
- type: string;
705
- nullable: boolean;
706
- description: string;
707
- };
708
- requestCount: {
709
- type: string;
710
- description: string;
711
- };
712
- remaining: {
713
- type: string;
714
- nullable: boolean;
715
- description: string;
716
- };
717
- lastRequest: {
718
- type: string;
719
- format: string;
720
- nullable: boolean;
721
- description: string;
722
- };
723
- expiresAt: {
724
- type: string;
725
- format: string;
726
- nullable: boolean;
727
- description: string;
728
- };
729
- createdAt: {
730
- type: string;
731
- format: string;
732
- description: string;
733
- };
734
- updatedAt: {
735
- type: string;
736
- format: string;
737
- description: string;
738
- };
739
- metadata: {
740
- type: string;
741
- nullable: boolean;
742
- additionalProperties: boolean;
743
- description: string;
744
- };
745
- permissions: {
746
- type: string;
747
- nullable: boolean;
748
- description: string;
749
- };
750
- };
751
- required: string[];
752
- };
753
- };
754
- };
755
- };
756
- };
757
- };
758
- };
759
- }, {
760
- metadata: Record<string, any> | null;
761
- permissions: {
762
- [key: string]: string[];
763
- } | null;
764
- id: string;
765
- name: string | null;
766
- start: string | null;
767
- prefix: string | null;
768
- userId: string;
769
- refillInterval: number | null;
770
- refillAmount: number | null;
771
- lastRefillAt: Date | null;
772
- enabled: boolean;
773
- rateLimitEnabled: boolean;
774
- rateLimitTimeWindow: number | null;
775
- rateLimitMax: number | null;
776
- requestCount: number;
777
- remaining: number | null;
778
- lastRequest: Date | null;
779
- expiresAt: Date | null;
780
- createdAt: Date;
781
- updatedAt: Date;
782
- }>;
783
- updateApiKey: import("better-auth").StrictEndpoint<"/api-key/update", {
784
- method: "POST";
785
- body: import("zod").ZodObject<{
786
- keyId: import("zod").ZodString;
787
- userId: import("zod").ZodOptional<import("zod").ZodCoercedString<unknown>>;
788
- name: import("zod").ZodOptional<import("zod").ZodString>;
789
- enabled: import("zod").ZodOptional<import("zod").ZodBoolean>;
790
- remaining: import("zod").ZodOptional<import("zod").ZodNumber>;
791
- refillAmount: import("zod").ZodOptional<import("zod").ZodNumber>;
792
- refillInterval: import("zod").ZodOptional<import("zod").ZodNumber>;
793
- metadata: import("zod").ZodOptional<import("zod").ZodAny>;
794
- expiresIn: import("zod").ZodNullable<import("zod").ZodOptional<import("zod").ZodNumber>>;
795
- rateLimitEnabled: import("zod").ZodOptional<import("zod").ZodBoolean>;
796
- rateLimitTimeWindow: import("zod").ZodOptional<import("zod").ZodNumber>;
797
- rateLimitMax: import("zod").ZodOptional<import("zod").ZodNumber>;
798
- permissions: import("zod").ZodNullable<import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString>>>>;
799
- }, import("better-auth").$strip>;
800
- metadata: {
801
- openapi: {
802
- description: string;
803
- responses: {
804
- "200": {
805
- description: string;
806
- content: {
807
- "application/json": {
808
- schema: {
809
- type: "object";
810
- properties: {
811
- id: {
812
- type: string;
813
- description: string;
814
- };
815
- name: {
816
- type: string;
817
- nullable: boolean;
818
- description: string;
819
- };
820
- start: {
821
- type: string;
822
- nullable: boolean;
823
- description: string;
824
- };
825
- prefix: {
826
- type: string;
827
- nullable: boolean;
828
- description: string;
829
- };
830
- userId: {
831
- type: string;
832
- description: string;
833
- };
834
- refillInterval: {
835
- type: string;
836
- nullable: boolean;
837
- description: string;
838
- };
839
- refillAmount: {
840
- type: string;
841
- nullable: boolean;
842
- description: string;
843
- };
844
- lastRefillAt: {
845
- type: string;
846
- format: string;
847
- nullable: boolean;
848
- description: string;
849
- };
850
- enabled: {
851
- type: string;
852
- description: string;
853
- default: boolean;
854
- };
855
- rateLimitEnabled: {
856
- type: string;
857
- description: string;
858
- };
859
- rateLimitTimeWindow: {
860
- type: string;
861
- nullable: boolean;
862
- description: string;
863
- };
864
- rateLimitMax: {
865
- type: string;
866
- nullable: boolean;
867
- description: string;
868
- };
869
- requestCount: {
870
- type: string;
871
- description: string;
872
- };
873
- remaining: {
874
- type: string;
875
- nullable: boolean;
876
- description: string;
877
- };
878
- lastRequest: {
879
- type: string;
880
- format: string;
881
- nullable: boolean;
882
- description: string;
883
- };
884
- expiresAt: {
885
- type: string;
886
- format: string;
887
- nullable: boolean;
888
- description: string;
889
- };
890
- createdAt: {
891
- type: string;
892
- format: string;
893
- description: string;
894
- };
895
- updatedAt: {
896
- type: string;
897
- format: string;
898
- description: string;
899
- };
900
- metadata: {
901
- type: string;
902
- nullable: boolean;
903
- additionalProperties: boolean;
904
- description: string;
905
- };
906
- permissions: {
907
- type: string;
908
- nullable: boolean;
909
- description: string;
910
- };
911
- };
912
- required: string[];
913
- };
914
- };
915
- };
916
- };
917
- };
918
- };
919
- };
920
- }, {
921
- metadata: Record<string, any> | null;
922
- permissions: {
923
- [key: string]: string[];
924
- } | null;
925
- id: string;
926
- name: string | null;
927
- start: string | null;
928
- prefix: string | null;
929
- userId: string;
930
- refillInterval: number | null;
931
- refillAmount: number | null;
932
- lastRefillAt: Date | null;
933
- enabled: boolean;
934
- rateLimitEnabled: boolean;
935
- rateLimitTimeWindow: number | null;
936
- rateLimitMax: number | null;
937
- requestCount: number;
938
- remaining: number | null;
939
- lastRequest: Date | null;
940
- expiresAt: Date | null;
941
- createdAt: Date;
942
- updatedAt: Date;
943
- }>;
944
- deleteApiKey: import("better-auth").StrictEndpoint<"/api-key/delete", {
945
- method: "POST";
946
- body: import("zod").ZodObject<{
947
- keyId: import("zod").ZodString;
948
- }, import("better-auth").$strip>;
949
- use: ((inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
950
- session: {
951
- session: Record<string, any> & {
952
- id: string;
953
- createdAt: Date;
954
- updatedAt: Date;
955
- userId: string;
956
- expiresAt: Date;
957
- token: string;
958
- ipAddress?: string | null | undefined;
959
- userAgent?: string | null | undefined;
960
- };
961
- user: Record<string, any> & {
962
- id: string;
963
- createdAt: Date;
964
- updatedAt: Date;
965
- email: string;
966
- emailVerified: boolean;
967
- name: string;
968
- image?: string | null | undefined;
969
- };
970
- };
971
- }>)[];
972
- metadata: {
973
- openapi: {
974
- description: string;
975
- requestBody: {
976
- content: {
977
- "application/json": {
978
- schema: {
979
- type: "object";
980
- properties: {
981
- keyId: {
982
- type: string;
983
- description: string;
984
- };
985
- };
986
- required: string[];
987
- };
988
- };
989
- };
990
- };
991
- responses: {
992
- "200": {
993
- description: string;
994
- content: {
995
- "application/json": {
996
- schema: {
997
- type: "object";
998
- properties: {
999
- success: {
1000
- type: string;
1001
- description: string;
1002
- };
1003
- };
1004
- required: string[];
1005
- };
1006
- };
1007
- };
1008
- };
1009
- };
1010
- };
1011
- };
1012
- }, {
1013
- success: boolean;
1014
- }>;
1015
- listApiKeys: import("better-auth").StrictEndpoint<"/api-key/list", {
1016
- method: "GET";
1017
- use: ((inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
1018
- session: {
1019
- session: Record<string, any> & {
1020
- id: string;
1021
- createdAt: Date;
1022
- updatedAt: Date;
1023
- userId: string;
1024
- expiresAt: Date;
1025
- token: string;
1026
- ipAddress?: string | null | undefined;
1027
- userAgent?: string | null | undefined;
1028
- };
1029
- user: Record<string, any> & {
1030
- id: string;
1031
- createdAt: Date;
1032
- updatedAt: Date;
1033
- email: string;
1034
- emailVerified: boolean;
1035
- name: string;
1036
- image?: string | null | undefined;
1037
- };
1038
- };
1039
- }>)[];
1040
- metadata: {
1041
- openapi: {
1042
- description: string;
1043
- responses: {
1044
- "200": {
1045
- description: string;
1046
- content: {
1047
- "application/json": {
1048
- schema: {
1049
- type: "array";
1050
- items: {
1051
- type: string;
1052
- properties: {
1053
- id: {
1054
- type: string;
1055
- description: string;
1056
- };
1057
- name: {
1058
- type: string;
1059
- nullable: boolean;
1060
- description: string;
1061
- };
1062
- start: {
1063
- type: string;
1064
- nullable: boolean;
1065
- description: string;
1066
- };
1067
- prefix: {
1068
- type: string;
1069
- nullable: boolean;
1070
- description: string;
1071
- };
1072
- userId: {
1073
- type: string;
1074
- description: string;
1075
- };
1076
- refillInterval: {
1077
- type: string;
1078
- nullable: boolean;
1079
- description: string;
1080
- };
1081
- refillAmount: {
1082
- type: string;
1083
- nullable: boolean;
1084
- description: string;
1085
- };
1086
- lastRefillAt: {
1087
- type: string;
1088
- format: string;
1089
- nullable: boolean;
1090
- description: string;
1091
- };
1092
- enabled: {
1093
- type: string;
1094
- description: string;
1095
- default: boolean;
1096
- };
1097
- rateLimitEnabled: {
1098
- type: string;
1099
- description: string;
1100
- };
1101
- rateLimitTimeWindow: {
1102
- type: string;
1103
- nullable: boolean;
1104
- description: string;
1105
- };
1106
- rateLimitMax: {
1107
- type: string;
1108
- nullable: boolean;
1109
- description: string;
1110
- };
1111
- requestCount: {
1112
- type: string;
1113
- description: string;
1114
- };
1115
- remaining: {
1116
- type: string;
1117
- nullable: boolean;
1118
- description: string;
1119
- };
1120
- lastRequest: {
1121
- type: string;
1122
- format: string;
1123
- nullable: boolean;
1124
- description: string;
1125
- };
1126
- expiresAt: {
1127
- type: string;
1128
- format: string;
1129
- nullable: boolean;
1130
- description: string;
1131
- };
1132
- createdAt: {
1133
- type: string;
1134
- format: string;
1135
- description: string;
1136
- };
1137
- updatedAt: {
1138
- type: string;
1139
- format: string;
1140
- description: string;
1141
- };
1142
- metadata: {
1143
- type: string;
1144
- nullable: boolean;
1145
- additionalProperties: boolean;
1146
- description: string;
1147
- };
1148
- permissions: {
1149
- type: string;
1150
- nullable: boolean;
1151
- description: string;
1152
- };
1153
- };
1154
- required: string[];
1155
- };
1156
- };
1157
- };
1158
- };
1159
- };
1160
- };
1161
- };
1162
- };
1163
- }, {
1164
- metadata: Record<string, any> | null;
1165
- permissions: {
1166
- [key: string]: string[];
1167
- } | null;
1168
- id: string;
1169
- name: string | null;
1170
- start: string | null;
1171
- prefix: string | null;
1172
- userId: string;
1173
- refillInterval: number | null;
1174
- refillAmount: number | null;
1175
- lastRefillAt: Date | null;
1176
- enabled: boolean;
1177
- rateLimitEnabled: boolean;
1178
- rateLimitTimeWindow: number | null;
1179
- rateLimitMax: number | null;
1180
- requestCount: number;
1181
- remaining: number | null;
1182
- lastRequest: Date | null;
1183
- expiresAt: Date | null;
1184
- createdAt: Date;
1185
- updatedAt: Date;
1186
- }[]>;
1187
- deleteAllExpiredApiKeys: import("better-auth").StrictEndpoint<string, {
1188
- method: "POST";
1189
- }, {
1190
- success: boolean;
1191
- error: unknown;
1192
- }>;
1193
- };
1194
- schema: {
1195
- apikey: {
1196
- fields: {
1197
- name: {
1198
- type: "string";
1199
- required: false;
1200
- input: false;
1201
- };
1202
- start: {
1203
- type: "string";
1204
- required: false;
1205
- input: false;
1206
- };
1207
- prefix: {
1208
- type: "string";
1209
- required: false;
1210
- input: false;
1211
- };
1212
- key: {
1213
- type: "string";
1214
- required: true;
1215
- input: false;
1216
- index: true;
1217
- };
1218
- userId: {
1219
- type: "string";
1220
- references: {
1221
- model: string;
1222
- field: string;
1223
- onDelete: "cascade";
1224
- };
1225
- required: true;
1226
- input: false;
1227
- index: true;
1228
- };
1229
- refillInterval: {
1230
- type: "number";
1231
- required: false;
1232
- input: false;
1233
- };
1234
- refillAmount: {
1235
- type: "number";
1236
- required: false;
1237
- input: false;
1238
- };
1239
- lastRefillAt: {
1240
- type: "date";
1241
- required: false;
1242
- input: false;
1243
- };
1244
- enabled: {
1245
- type: "boolean";
1246
- required: false;
1247
- input: false;
1248
- defaultValue: true;
1249
- };
1250
- rateLimitEnabled: {
1251
- type: "boolean";
1252
- required: false;
1253
- input: false;
1254
- defaultValue: true;
1255
- };
1256
- rateLimitTimeWindow: {
1257
- type: "number";
1258
- required: false;
1259
- input: false;
1260
- defaultValue: number;
1261
- };
1262
- rateLimitMax: {
1263
- type: "number";
1264
- required: false;
1265
- input: false;
1266
- defaultValue: number;
1267
- };
1268
- requestCount: {
1269
- type: "number";
1270
- required: false;
1271
- input: false;
1272
- defaultValue: number;
1273
- };
1274
- remaining: {
1275
- type: "number";
1276
- required: false;
1277
- input: false;
1278
- };
1279
- lastRequest: {
1280
- type: "date";
1281
- required: false;
1282
- input: false;
1283
- };
1284
- expiresAt: {
1285
- type: "date";
1286
- required: false;
1287
- input: false;
1288
- };
1289
- createdAt: {
1290
- type: "date";
1291
- required: true;
1292
- input: false;
1293
- };
1294
- updatedAt: {
1295
- type: "date";
1296
- required: true;
1297
- input: false;
1298
- };
1299
- permissions: {
1300
- type: "string";
1301
- required: false;
1302
- input: false;
1303
- };
1304
- metadata: {
1305
- type: "string";
1306
- required: false;
1307
- input: true;
1308
- transform: {
1309
- input(value: import("better-auth").DBPrimitive): string;
1310
- output(value: import("better-auth").DBPrimitive): any;
1311
- };
1312
- };
1313
- };
1314
- };
1315
- };
1316
- options: import("better-auth/plugins").ApiKeyOptions | undefined;
1317
- }>;
324
+ $InferServerPlugin: ReturnType<typeof import("@better-auth/api-key").apiKey>;
1318
325
  pathMethods: {
1319
326
  "/api-key/create": "POST";
1320
327
  "/api-key/delete": "POST";
1321
328
  "/api-key/delete-all-expired-api-keys": "POST";
1322
329
  };
330
+ $ERROR_CODES: {
331
+ INVALID_METADATA_TYPE: import("better-auth").RawError<"INVALID_METADATA_TYPE">;
332
+ REFILL_AMOUNT_AND_INTERVAL_REQUIRED: import("better-auth").RawError<"REFILL_AMOUNT_AND_INTERVAL_REQUIRED">;
333
+ REFILL_INTERVAL_AND_AMOUNT_REQUIRED: import("better-auth").RawError<"REFILL_INTERVAL_AND_AMOUNT_REQUIRED">;
334
+ USER_BANNED: import("better-auth").RawError<"USER_BANNED">;
335
+ UNAUTHORIZED_SESSION: import("better-auth").RawError<"UNAUTHORIZED_SESSION">;
336
+ KEY_NOT_FOUND: import("better-auth").RawError<"KEY_NOT_FOUND">;
337
+ KEY_DISABLED: import("better-auth").RawError<"KEY_DISABLED">;
338
+ KEY_EXPIRED: import("better-auth").RawError<"KEY_EXPIRED">;
339
+ USAGE_EXCEEDED: import("better-auth").RawError<"USAGE_EXCEEDED">;
340
+ KEY_NOT_RECOVERABLE: import("better-auth").RawError<"KEY_NOT_RECOVERABLE">;
341
+ EXPIRES_IN_IS_TOO_SMALL: import("better-auth").RawError<"EXPIRES_IN_IS_TOO_SMALL">;
342
+ EXPIRES_IN_IS_TOO_LARGE: import("better-auth").RawError<"EXPIRES_IN_IS_TOO_LARGE">;
343
+ INVALID_REMAINING: import("better-auth").RawError<"INVALID_REMAINING">;
344
+ INVALID_PREFIX_LENGTH: import("better-auth").RawError<"INVALID_PREFIX_LENGTH">;
345
+ INVALID_NAME_LENGTH: import("better-auth").RawError<"INVALID_NAME_LENGTH">;
346
+ METADATA_DISABLED: import("better-auth").RawError<"METADATA_DISABLED">;
347
+ RATE_LIMIT_EXCEEDED: import("better-auth").RawError<"RATE_LIMIT_EXCEEDED">;
348
+ NO_VALUES_TO_UPDATE: import("better-auth").RawError<"NO_VALUES_TO_UPDATE">;
349
+ KEY_DISABLED_EXPIRATION: import("better-auth").RawError<"KEY_DISABLED_EXPIRATION">;
350
+ INVALID_API_KEY: import("better-auth").RawError<"INVALID_API_KEY">;
351
+ INVALID_USER_ID_FROM_API_KEY: import("better-auth").RawError<"INVALID_USER_ID_FROM_API_KEY">;
352
+ INVALID_REFERENCE_ID_FROM_API_KEY: import("better-auth").RawError<"INVALID_REFERENCE_ID_FROM_API_KEY">;
353
+ INVALID_API_KEY_GETTER_RETURN_TYPE: import("better-auth").RawError<"INVALID_API_KEY_GETTER_RETURN_TYPE">;
354
+ SERVER_ONLY_PROPERTY: import("better-auth").RawError<"SERVER_ONLY_PROPERTY">;
355
+ FAILED_TO_UPDATE_API_KEY: import("better-auth").RawError<"FAILED_TO_UPDATE_API_KEY">;
356
+ NAME_REQUIRED: import("better-auth").RawError<"NAME_REQUIRED">;
357
+ ORGANIZATION_ID_REQUIRED: import("better-auth").RawError<"ORGANIZATION_ID_REQUIRED">;
358
+ USER_NOT_MEMBER_OF_ORGANIZATION: import("better-auth").RawError<"USER_NOT_MEMBER_OF_ORGANIZATION">;
359
+ INSUFFICIENT_API_KEY_PERMISSIONS: import("better-auth").RawError<"INSUFFICIENT_API_KEY_PERMISSIONS">;
360
+ NO_DEFAULT_API_KEY_CONFIGURATION_FOUND: import("better-auth").RawError<"NO_DEFAULT_API_KEY_CONFIGURATION_FOUND">;
361
+ ORGANIZATION_PLUGIN_REQUIRED: import("better-auth").RawError<"ORGANIZATION_PLUGIN_REQUIRED">;
362
+ };
1323
363
  })[];
1324
364
  /**
1325
365
  * Create a pre-configured Auth client.