@better-auth/api-key 1.6.27 → 1.6.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/client.d.mts CHANGED
@@ -1,5 +1,7 @@
1
- import { n as ApiKeyConfigurationOptions, r as ApiKeyOptions, t as ApiKey } from "./types-BYqswa0N.mjs";
2
- import { i as API_KEY_ERROR_CODES, n as apiKey } from "./index-5ylKSUSG.mjs";
1
+ import { n as ApiKeyConfigurationOptions, r as ApiKeyOptions, t as ApiKey } from "./types-B8ewwiB4.mjs";
2
+ import { i as API_KEY_ERROR_CODES, n as apiKey } from "./index-Du_Uke1v.mjs";
3
+ import * as _$better_auth0 from "better-auth";
4
+
3
5
  //#region src/client.d.ts
4
6
  declare const apiKeyClient: () => {
5
7
  id: "api-key";
@@ -11,39 +13,39 @@ declare const apiKeyClient: () => {
11
13
  "/api-key/delete-all-expired-api-keys": "POST";
12
14
  };
13
15
  $ERROR_CODES: {
14
- INVALID_METADATA_TYPE: import("better-auth").RawError<"INVALID_METADATA_TYPE">;
15
- REFILL_AMOUNT_AND_INTERVAL_REQUIRED: import("better-auth").RawError<"REFILL_AMOUNT_AND_INTERVAL_REQUIRED">;
16
- REFILL_INTERVAL_AND_AMOUNT_REQUIRED: import("better-auth").RawError<"REFILL_INTERVAL_AND_AMOUNT_REQUIRED">;
17
- USER_BANNED: import("better-auth").RawError<"USER_BANNED">;
18
- UNAUTHORIZED_SESSION: import("better-auth").RawError<"UNAUTHORIZED_SESSION">;
19
- KEY_NOT_FOUND: import("better-auth").RawError<"KEY_NOT_FOUND">;
20
- KEY_DISABLED: import("better-auth").RawError<"KEY_DISABLED">;
21
- KEY_EXPIRED: import("better-auth").RawError<"KEY_EXPIRED">;
22
- USAGE_EXCEEDED: import("better-auth").RawError<"USAGE_EXCEEDED">;
23
- KEY_NOT_RECOVERABLE: import("better-auth").RawError<"KEY_NOT_RECOVERABLE">;
24
- EXPIRES_IN_IS_TOO_SMALL: import("better-auth").RawError<"EXPIRES_IN_IS_TOO_SMALL">;
25
- EXPIRES_IN_IS_TOO_LARGE: import("better-auth").RawError<"EXPIRES_IN_IS_TOO_LARGE">;
26
- INVALID_REMAINING: import("better-auth").RawError<"INVALID_REMAINING">;
27
- INVALID_PREFIX_LENGTH: import("better-auth").RawError<"INVALID_PREFIX_LENGTH">;
28
- INVALID_NAME_LENGTH: import("better-auth").RawError<"INVALID_NAME_LENGTH">;
29
- METADATA_DISABLED: import("better-auth").RawError<"METADATA_DISABLED">;
30
- RATE_LIMIT_EXCEEDED: import("better-auth").RawError<"RATE_LIMIT_EXCEEDED">;
31
- NO_VALUES_TO_UPDATE: import("better-auth").RawError<"NO_VALUES_TO_UPDATE">;
32
- KEY_DISABLED_EXPIRATION: import("better-auth").RawError<"KEY_DISABLED_EXPIRATION">;
33
- INVALID_API_KEY: import("better-auth").RawError<"INVALID_API_KEY">;
34
- INVALID_USER_ID_FROM_API_KEY: import("better-auth").RawError<"INVALID_USER_ID_FROM_API_KEY">;
35
- INVALID_REFERENCE_ID_FROM_API_KEY: import("better-auth").RawError<"INVALID_REFERENCE_ID_FROM_API_KEY">;
36
- INVALID_API_KEY_GETTER_RETURN_TYPE: import("better-auth").RawError<"INVALID_API_KEY_GETTER_RETURN_TYPE">;
37
- SERVER_ONLY_PROPERTY: import("better-auth").RawError<"SERVER_ONLY_PROPERTY">;
38
- FAILED_TO_UPDATE_API_KEY: import("better-auth").RawError<"FAILED_TO_UPDATE_API_KEY">;
39
- NAME_REQUIRED: import("better-auth").RawError<"NAME_REQUIRED">;
40
- ORGANIZATION_ID_REQUIRED: import("better-auth").RawError<"ORGANIZATION_ID_REQUIRED">;
41
- USER_NOT_MEMBER_OF_ORGANIZATION: import("better-auth").RawError<"USER_NOT_MEMBER_OF_ORGANIZATION">;
42
- INSUFFICIENT_API_KEY_PERMISSIONS: import("better-auth").RawError<"INSUFFICIENT_API_KEY_PERMISSIONS">;
43
- NO_DEFAULT_API_KEY_CONFIGURATION_FOUND: import("better-auth").RawError<"NO_DEFAULT_API_KEY_CONFIGURATION_FOUND">;
44
- ORGANIZATION_PLUGIN_REQUIRED: import("better-auth").RawError<"ORGANIZATION_PLUGIN_REQUIRED">;
16
+ INVALID_METADATA_TYPE: _$better_auth0.RawError<"INVALID_METADATA_TYPE">;
17
+ REFILL_AMOUNT_AND_INTERVAL_REQUIRED: _$better_auth0.RawError<"REFILL_AMOUNT_AND_INTERVAL_REQUIRED">;
18
+ REFILL_INTERVAL_AND_AMOUNT_REQUIRED: _$better_auth0.RawError<"REFILL_INTERVAL_AND_AMOUNT_REQUIRED">;
19
+ USER_BANNED: _$better_auth0.RawError<"USER_BANNED">;
20
+ UNAUTHORIZED_SESSION: _$better_auth0.RawError<"UNAUTHORIZED_SESSION">;
21
+ KEY_NOT_FOUND: _$better_auth0.RawError<"KEY_NOT_FOUND">;
22
+ KEY_DISABLED: _$better_auth0.RawError<"KEY_DISABLED">;
23
+ KEY_EXPIRED: _$better_auth0.RawError<"KEY_EXPIRED">;
24
+ USAGE_EXCEEDED: _$better_auth0.RawError<"USAGE_EXCEEDED">;
25
+ KEY_NOT_RECOVERABLE: _$better_auth0.RawError<"KEY_NOT_RECOVERABLE">;
26
+ EXPIRES_IN_IS_TOO_SMALL: _$better_auth0.RawError<"EXPIRES_IN_IS_TOO_SMALL">;
27
+ EXPIRES_IN_IS_TOO_LARGE: _$better_auth0.RawError<"EXPIRES_IN_IS_TOO_LARGE">;
28
+ INVALID_REMAINING: _$better_auth0.RawError<"INVALID_REMAINING">;
29
+ INVALID_PREFIX_LENGTH: _$better_auth0.RawError<"INVALID_PREFIX_LENGTH">;
30
+ INVALID_NAME_LENGTH: _$better_auth0.RawError<"INVALID_NAME_LENGTH">;
31
+ METADATA_DISABLED: _$better_auth0.RawError<"METADATA_DISABLED">;
32
+ RATE_LIMIT_EXCEEDED: _$better_auth0.RawError<"RATE_LIMIT_EXCEEDED">;
33
+ NO_VALUES_TO_UPDATE: _$better_auth0.RawError<"NO_VALUES_TO_UPDATE">;
34
+ KEY_DISABLED_EXPIRATION: _$better_auth0.RawError<"KEY_DISABLED_EXPIRATION">;
35
+ INVALID_API_KEY: _$better_auth0.RawError<"INVALID_API_KEY">;
36
+ INVALID_USER_ID_FROM_API_KEY: _$better_auth0.RawError<"INVALID_USER_ID_FROM_API_KEY">;
37
+ INVALID_REFERENCE_ID_FROM_API_KEY: _$better_auth0.RawError<"INVALID_REFERENCE_ID_FROM_API_KEY">;
38
+ INVALID_API_KEY_GETTER_RETURN_TYPE: _$better_auth0.RawError<"INVALID_API_KEY_GETTER_RETURN_TYPE">;
39
+ SERVER_ONLY_PROPERTY: _$better_auth0.RawError<"SERVER_ONLY_PROPERTY">;
40
+ FAILED_TO_UPDATE_API_KEY: _$better_auth0.RawError<"FAILED_TO_UPDATE_API_KEY">;
41
+ NAME_REQUIRED: _$better_auth0.RawError<"NAME_REQUIRED">;
42
+ ORGANIZATION_ID_REQUIRED: _$better_auth0.RawError<"ORGANIZATION_ID_REQUIRED">;
43
+ USER_NOT_MEMBER_OF_ORGANIZATION: _$better_auth0.RawError<"USER_NOT_MEMBER_OF_ORGANIZATION">;
44
+ INSUFFICIENT_API_KEY_PERMISSIONS: _$better_auth0.RawError<"INSUFFICIENT_API_KEY_PERMISSIONS">;
45
+ NO_DEFAULT_API_KEY_CONFIGURATION_FOUND: _$better_auth0.RawError<"NO_DEFAULT_API_KEY_CONFIGURATION_FOUND">;
46
+ ORGANIZATION_PLUGIN_REQUIRED: _$better_auth0.RawError<"ORGANIZATION_PLUGIN_REQUIRED">;
45
47
  };
46
48
  };
47
49
  type ApiKeyClientPlugin = ReturnType<typeof apiKeyClient>;
48
50
  //#endregion
49
- export { API_KEY_ERROR_CODES, type ApiKey, ApiKeyClientPlugin, type ApiKeyConfigurationOptions, type ApiKeyOptions, apiKeyClient };
51
+ export { API_KEY_ERROR_CODES, ApiKey, ApiKeyClientPlugin, ApiKeyConfigurationOptions, ApiKeyOptions, apiKeyClient };
package/dist/client.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { n as API_KEY_ERROR_CODES, t as PACKAGE_VERSION } from "./version-BQwkRUb6.mjs";
1
+ import { n as API_KEY_ERROR_CODES, t as PACKAGE_VERSION } from "./version-D0spFpe1.mjs";
2
2
  //#region src/client.ts
3
3
  const apiKeyClient = () => {
4
4
  return {
@@ -1,38 +1,43 @@
1
- import { n as ApiKeyConfigurationOptions, r as ApiKeyOptions, t as ApiKey } from "./types-BYqswa0N.mjs";
1
+ import { n as ApiKeyConfigurationOptions, r as ApiKeyOptions, t as ApiKey } from "./types-B8ewwiB4.mjs";
2
+ import * as _$better_auth0 from "better-auth";
3
+ import * as _$zod from "zod";
4
+ import * as _$better_call0 from "better-call";
5
+ import * as _$zod_v4_core0 from "zod/v4/core";
2
6
  import { HookEndpointContext } from "@better-auth/core";
7
+
3
8
  //#region src/error-codes.d.ts
4
9
  declare const API_KEY_ERROR_CODES: {
5
- INVALID_METADATA_TYPE: import("better-auth").RawError<"INVALID_METADATA_TYPE">;
6
- REFILL_AMOUNT_AND_INTERVAL_REQUIRED: import("better-auth").RawError<"REFILL_AMOUNT_AND_INTERVAL_REQUIRED">;
7
- REFILL_INTERVAL_AND_AMOUNT_REQUIRED: import("better-auth").RawError<"REFILL_INTERVAL_AND_AMOUNT_REQUIRED">;
8
- USER_BANNED: import("better-auth").RawError<"USER_BANNED">;
9
- UNAUTHORIZED_SESSION: import("better-auth").RawError<"UNAUTHORIZED_SESSION">;
10
- KEY_NOT_FOUND: import("better-auth").RawError<"KEY_NOT_FOUND">;
11
- KEY_DISABLED: import("better-auth").RawError<"KEY_DISABLED">;
12
- KEY_EXPIRED: import("better-auth").RawError<"KEY_EXPIRED">;
13
- USAGE_EXCEEDED: import("better-auth").RawError<"USAGE_EXCEEDED">;
14
- KEY_NOT_RECOVERABLE: import("better-auth").RawError<"KEY_NOT_RECOVERABLE">;
15
- EXPIRES_IN_IS_TOO_SMALL: import("better-auth").RawError<"EXPIRES_IN_IS_TOO_SMALL">;
16
- EXPIRES_IN_IS_TOO_LARGE: import("better-auth").RawError<"EXPIRES_IN_IS_TOO_LARGE">;
17
- INVALID_REMAINING: import("better-auth").RawError<"INVALID_REMAINING">;
18
- INVALID_PREFIX_LENGTH: import("better-auth").RawError<"INVALID_PREFIX_LENGTH">;
19
- INVALID_NAME_LENGTH: import("better-auth").RawError<"INVALID_NAME_LENGTH">;
20
- METADATA_DISABLED: import("better-auth").RawError<"METADATA_DISABLED">;
21
- RATE_LIMIT_EXCEEDED: import("better-auth").RawError<"RATE_LIMIT_EXCEEDED">;
22
- NO_VALUES_TO_UPDATE: import("better-auth").RawError<"NO_VALUES_TO_UPDATE">;
23
- KEY_DISABLED_EXPIRATION: import("better-auth").RawError<"KEY_DISABLED_EXPIRATION">;
24
- INVALID_API_KEY: import("better-auth").RawError<"INVALID_API_KEY">;
25
- INVALID_USER_ID_FROM_API_KEY: import("better-auth").RawError<"INVALID_USER_ID_FROM_API_KEY">;
26
- INVALID_REFERENCE_ID_FROM_API_KEY: import("better-auth").RawError<"INVALID_REFERENCE_ID_FROM_API_KEY">;
27
- INVALID_API_KEY_GETTER_RETURN_TYPE: import("better-auth").RawError<"INVALID_API_KEY_GETTER_RETURN_TYPE">;
28
- SERVER_ONLY_PROPERTY: import("better-auth").RawError<"SERVER_ONLY_PROPERTY">;
29
- FAILED_TO_UPDATE_API_KEY: import("better-auth").RawError<"FAILED_TO_UPDATE_API_KEY">;
30
- NAME_REQUIRED: import("better-auth").RawError<"NAME_REQUIRED">;
31
- ORGANIZATION_ID_REQUIRED: import("better-auth").RawError<"ORGANIZATION_ID_REQUIRED">;
32
- USER_NOT_MEMBER_OF_ORGANIZATION: import("better-auth").RawError<"USER_NOT_MEMBER_OF_ORGANIZATION">;
33
- INSUFFICIENT_API_KEY_PERMISSIONS: import("better-auth").RawError<"INSUFFICIENT_API_KEY_PERMISSIONS">;
34
- NO_DEFAULT_API_KEY_CONFIGURATION_FOUND: import("better-auth").RawError<"NO_DEFAULT_API_KEY_CONFIGURATION_FOUND">;
35
- ORGANIZATION_PLUGIN_REQUIRED: import("better-auth").RawError<"ORGANIZATION_PLUGIN_REQUIRED">;
10
+ INVALID_METADATA_TYPE: _$better_auth0.RawError<"INVALID_METADATA_TYPE">;
11
+ REFILL_AMOUNT_AND_INTERVAL_REQUIRED: _$better_auth0.RawError<"REFILL_AMOUNT_AND_INTERVAL_REQUIRED">;
12
+ REFILL_INTERVAL_AND_AMOUNT_REQUIRED: _$better_auth0.RawError<"REFILL_INTERVAL_AND_AMOUNT_REQUIRED">;
13
+ USER_BANNED: _$better_auth0.RawError<"USER_BANNED">;
14
+ UNAUTHORIZED_SESSION: _$better_auth0.RawError<"UNAUTHORIZED_SESSION">;
15
+ KEY_NOT_FOUND: _$better_auth0.RawError<"KEY_NOT_FOUND">;
16
+ KEY_DISABLED: _$better_auth0.RawError<"KEY_DISABLED">;
17
+ KEY_EXPIRED: _$better_auth0.RawError<"KEY_EXPIRED">;
18
+ USAGE_EXCEEDED: _$better_auth0.RawError<"USAGE_EXCEEDED">;
19
+ KEY_NOT_RECOVERABLE: _$better_auth0.RawError<"KEY_NOT_RECOVERABLE">;
20
+ EXPIRES_IN_IS_TOO_SMALL: _$better_auth0.RawError<"EXPIRES_IN_IS_TOO_SMALL">;
21
+ EXPIRES_IN_IS_TOO_LARGE: _$better_auth0.RawError<"EXPIRES_IN_IS_TOO_LARGE">;
22
+ INVALID_REMAINING: _$better_auth0.RawError<"INVALID_REMAINING">;
23
+ INVALID_PREFIX_LENGTH: _$better_auth0.RawError<"INVALID_PREFIX_LENGTH">;
24
+ INVALID_NAME_LENGTH: _$better_auth0.RawError<"INVALID_NAME_LENGTH">;
25
+ METADATA_DISABLED: _$better_auth0.RawError<"METADATA_DISABLED">;
26
+ RATE_LIMIT_EXCEEDED: _$better_auth0.RawError<"RATE_LIMIT_EXCEEDED">;
27
+ NO_VALUES_TO_UPDATE: _$better_auth0.RawError<"NO_VALUES_TO_UPDATE">;
28
+ KEY_DISABLED_EXPIRATION: _$better_auth0.RawError<"KEY_DISABLED_EXPIRATION">;
29
+ INVALID_API_KEY: _$better_auth0.RawError<"INVALID_API_KEY">;
30
+ INVALID_USER_ID_FROM_API_KEY: _$better_auth0.RawError<"INVALID_USER_ID_FROM_API_KEY">;
31
+ INVALID_REFERENCE_ID_FROM_API_KEY: _$better_auth0.RawError<"INVALID_REFERENCE_ID_FROM_API_KEY">;
32
+ INVALID_API_KEY_GETTER_RETURN_TYPE: _$better_auth0.RawError<"INVALID_API_KEY_GETTER_RETURN_TYPE">;
33
+ SERVER_ONLY_PROPERTY: _$better_auth0.RawError<"SERVER_ONLY_PROPERTY">;
34
+ FAILED_TO_UPDATE_API_KEY: _$better_auth0.RawError<"FAILED_TO_UPDATE_API_KEY">;
35
+ NAME_REQUIRED: _$better_auth0.RawError<"NAME_REQUIRED">;
36
+ ORGANIZATION_ID_REQUIRED: _$better_auth0.RawError<"ORGANIZATION_ID_REQUIRED">;
37
+ USER_NOT_MEMBER_OF_ORGANIZATION: _$better_auth0.RawError<"USER_NOT_MEMBER_OF_ORGANIZATION">;
38
+ INSUFFICIENT_API_KEY_PERMISSIONS: _$better_auth0.RawError<"INSUFFICIENT_API_KEY_PERMISSIONS">;
39
+ NO_DEFAULT_API_KEY_CONFIGURATION_FOUND: _$better_auth0.RawError<"NO_DEFAULT_API_KEY_CONFIGURATION_FOUND">;
40
+ ORGANIZATION_PLUGIN_REQUIRED: _$better_auth0.RawError<"ORGANIZATION_PLUGIN_REQUIRED">;
36
41
  };
37
42
  //#endregion
38
43
  //#region src/index.d.ts
@@ -49,42 +54,42 @@ declare function apiKey(_configurations?: (ApiKeyConfigurationOptions & ApiKeyOp
49
54
  id: "api-key";
50
55
  version: string;
51
56
  $ERROR_CODES: {
52
- INVALID_METADATA_TYPE: import("better-auth").RawError<"INVALID_METADATA_TYPE">;
53
- REFILL_AMOUNT_AND_INTERVAL_REQUIRED: import("better-auth").RawError<"REFILL_AMOUNT_AND_INTERVAL_REQUIRED">;
54
- REFILL_INTERVAL_AND_AMOUNT_REQUIRED: import("better-auth").RawError<"REFILL_INTERVAL_AND_AMOUNT_REQUIRED">;
55
- USER_BANNED: import("better-auth").RawError<"USER_BANNED">;
56
- UNAUTHORIZED_SESSION: import("better-auth").RawError<"UNAUTHORIZED_SESSION">;
57
- KEY_NOT_FOUND: import("better-auth").RawError<"KEY_NOT_FOUND">;
58
- KEY_DISABLED: import("better-auth").RawError<"KEY_DISABLED">;
59
- KEY_EXPIRED: import("better-auth").RawError<"KEY_EXPIRED">;
60
- USAGE_EXCEEDED: import("better-auth").RawError<"USAGE_EXCEEDED">;
61
- KEY_NOT_RECOVERABLE: import("better-auth").RawError<"KEY_NOT_RECOVERABLE">;
62
- EXPIRES_IN_IS_TOO_SMALL: import("better-auth").RawError<"EXPIRES_IN_IS_TOO_SMALL">;
63
- EXPIRES_IN_IS_TOO_LARGE: import("better-auth").RawError<"EXPIRES_IN_IS_TOO_LARGE">;
64
- INVALID_REMAINING: import("better-auth").RawError<"INVALID_REMAINING">;
65
- INVALID_PREFIX_LENGTH: import("better-auth").RawError<"INVALID_PREFIX_LENGTH">;
66
- INVALID_NAME_LENGTH: import("better-auth").RawError<"INVALID_NAME_LENGTH">;
67
- METADATA_DISABLED: import("better-auth").RawError<"METADATA_DISABLED">;
68
- RATE_LIMIT_EXCEEDED: import("better-auth").RawError<"RATE_LIMIT_EXCEEDED">;
69
- NO_VALUES_TO_UPDATE: import("better-auth").RawError<"NO_VALUES_TO_UPDATE">;
70
- KEY_DISABLED_EXPIRATION: import("better-auth").RawError<"KEY_DISABLED_EXPIRATION">;
71
- INVALID_API_KEY: import("better-auth").RawError<"INVALID_API_KEY">;
72
- INVALID_USER_ID_FROM_API_KEY: import("better-auth").RawError<"INVALID_USER_ID_FROM_API_KEY">;
73
- INVALID_REFERENCE_ID_FROM_API_KEY: import("better-auth").RawError<"INVALID_REFERENCE_ID_FROM_API_KEY">;
74
- INVALID_API_KEY_GETTER_RETURN_TYPE: import("better-auth").RawError<"INVALID_API_KEY_GETTER_RETURN_TYPE">;
75
- SERVER_ONLY_PROPERTY: import("better-auth").RawError<"SERVER_ONLY_PROPERTY">;
76
- FAILED_TO_UPDATE_API_KEY: import("better-auth").RawError<"FAILED_TO_UPDATE_API_KEY">;
77
- NAME_REQUIRED: import("better-auth").RawError<"NAME_REQUIRED">;
78
- ORGANIZATION_ID_REQUIRED: import("better-auth").RawError<"ORGANIZATION_ID_REQUIRED">;
79
- USER_NOT_MEMBER_OF_ORGANIZATION: import("better-auth").RawError<"USER_NOT_MEMBER_OF_ORGANIZATION">;
80
- INSUFFICIENT_API_KEY_PERMISSIONS: import("better-auth").RawError<"INSUFFICIENT_API_KEY_PERMISSIONS">;
81
- NO_DEFAULT_API_KEY_CONFIGURATION_FOUND: import("better-auth").RawError<"NO_DEFAULT_API_KEY_CONFIGURATION_FOUND">;
82
- ORGANIZATION_PLUGIN_REQUIRED: import("better-auth").RawError<"ORGANIZATION_PLUGIN_REQUIRED">;
57
+ INVALID_METADATA_TYPE: _$better_auth0.RawError<"INVALID_METADATA_TYPE">;
58
+ REFILL_AMOUNT_AND_INTERVAL_REQUIRED: _$better_auth0.RawError<"REFILL_AMOUNT_AND_INTERVAL_REQUIRED">;
59
+ REFILL_INTERVAL_AND_AMOUNT_REQUIRED: _$better_auth0.RawError<"REFILL_INTERVAL_AND_AMOUNT_REQUIRED">;
60
+ USER_BANNED: _$better_auth0.RawError<"USER_BANNED">;
61
+ UNAUTHORIZED_SESSION: _$better_auth0.RawError<"UNAUTHORIZED_SESSION">;
62
+ KEY_NOT_FOUND: _$better_auth0.RawError<"KEY_NOT_FOUND">;
63
+ KEY_DISABLED: _$better_auth0.RawError<"KEY_DISABLED">;
64
+ KEY_EXPIRED: _$better_auth0.RawError<"KEY_EXPIRED">;
65
+ USAGE_EXCEEDED: _$better_auth0.RawError<"USAGE_EXCEEDED">;
66
+ KEY_NOT_RECOVERABLE: _$better_auth0.RawError<"KEY_NOT_RECOVERABLE">;
67
+ EXPIRES_IN_IS_TOO_SMALL: _$better_auth0.RawError<"EXPIRES_IN_IS_TOO_SMALL">;
68
+ EXPIRES_IN_IS_TOO_LARGE: _$better_auth0.RawError<"EXPIRES_IN_IS_TOO_LARGE">;
69
+ INVALID_REMAINING: _$better_auth0.RawError<"INVALID_REMAINING">;
70
+ INVALID_PREFIX_LENGTH: _$better_auth0.RawError<"INVALID_PREFIX_LENGTH">;
71
+ INVALID_NAME_LENGTH: _$better_auth0.RawError<"INVALID_NAME_LENGTH">;
72
+ METADATA_DISABLED: _$better_auth0.RawError<"METADATA_DISABLED">;
73
+ RATE_LIMIT_EXCEEDED: _$better_auth0.RawError<"RATE_LIMIT_EXCEEDED">;
74
+ NO_VALUES_TO_UPDATE: _$better_auth0.RawError<"NO_VALUES_TO_UPDATE">;
75
+ KEY_DISABLED_EXPIRATION: _$better_auth0.RawError<"KEY_DISABLED_EXPIRATION">;
76
+ INVALID_API_KEY: _$better_auth0.RawError<"INVALID_API_KEY">;
77
+ INVALID_USER_ID_FROM_API_KEY: _$better_auth0.RawError<"INVALID_USER_ID_FROM_API_KEY">;
78
+ INVALID_REFERENCE_ID_FROM_API_KEY: _$better_auth0.RawError<"INVALID_REFERENCE_ID_FROM_API_KEY">;
79
+ INVALID_API_KEY_GETTER_RETURN_TYPE: _$better_auth0.RawError<"INVALID_API_KEY_GETTER_RETURN_TYPE">;
80
+ SERVER_ONLY_PROPERTY: _$better_auth0.RawError<"SERVER_ONLY_PROPERTY">;
81
+ FAILED_TO_UPDATE_API_KEY: _$better_auth0.RawError<"FAILED_TO_UPDATE_API_KEY">;
82
+ NAME_REQUIRED: _$better_auth0.RawError<"NAME_REQUIRED">;
83
+ ORGANIZATION_ID_REQUIRED: _$better_auth0.RawError<"ORGANIZATION_ID_REQUIRED">;
84
+ USER_NOT_MEMBER_OF_ORGANIZATION: _$better_auth0.RawError<"USER_NOT_MEMBER_OF_ORGANIZATION">;
85
+ INSUFFICIENT_API_KEY_PERMISSIONS: _$better_auth0.RawError<"INSUFFICIENT_API_KEY_PERMISSIONS">;
86
+ NO_DEFAULT_API_KEY_CONFIGURATION_FOUND: _$better_auth0.RawError<"NO_DEFAULT_API_KEY_CONFIGURATION_FOUND">;
87
+ ORGANIZATION_PLUGIN_REQUIRED: _$better_auth0.RawError<"ORGANIZATION_PLUGIN_REQUIRED">;
83
88
  };
84
89
  hooks: {
85
90
  before: {
86
91
  matcher: (ctx: HookEndpointContext) => boolean;
87
- handler: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
92
+ handler: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
88
93
  user: {
89
94
  id: string;
90
95
  createdAt: Date;
@@ -105,8 +110,8 @@ declare function apiKey(_configurations?: (ApiKeyConfigurationOptions & ApiKeyOp
105
110
  expiresAt: Date;
106
111
  };
107
112
  } | {
108
- context: import("better-call").MiddlewareContext<import("better-call").MiddlewareOptions, import("better-auth").PluginContext<import("better-auth").BetterAuthOptions> & import("better-auth").InfoContext & {
109
- options: import("better-auth").BetterAuthOptions;
113
+ context: _$better_call0.MiddlewareContext<_$better_call0.MiddlewareOptions, _$better_auth0.PluginContext<_$better_auth0.BetterAuthOptions> & _$better_auth0.InfoContext & {
114
+ options: _$better_auth0.BetterAuthOptions;
110
115
  trustedOrigins: string[];
111
116
  trustedProviders: string[];
112
117
  isTrustedOrigin: (url: string, settings?: {
@@ -179,20 +184,20 @@ declare function apiKey(_configurations?: (ApiKeyConfigurationOptions & ApiKeyOp
179
184
  image?: string | null | undefined;
180
185
  } & Record<string, any>;
181
186
  } | null) => void;
182
- socialProviders: import("better-auth").OAuthProvider[];
183
- authCookies: import("better-auth").BetterAuthCookies;
184
- logger: ReturnType<typeof import("better-auth").createLogger>;
187
+ socialProviders: _$better_auth0.OAuthProvider[];
188
+ authCookies: _$better_auth0.BetterAuthCookies;
189
+ logger: ReturnType<typeof _$better_auth0.createLogger>;
185
190
  rateLimit: {
186
191
  enabled: boolean;
187
192
  window: number;
188
193
  max: number;
189
194
  storage: "memory" | "database" | "secondary-storage";
190
- } & Omit<import("better-auth").BetterAuthRateLimitOptions, "enabled" | "window" | "max" | "storage">;
191
- adapter: import("better-auth").DBAdapter<import("better-auth").BetterAuthOptions>;
192
- internalAdapter: import("better-auth").InternalAdapter<import("better-auth").BetterAuthOptions>;
193
- createAuthCookie: (cookieName: string, overrideAttributes?: Partial<import("better-call").CookieOptions> | undefined) => import("better-auth").BetterAuthCookie;
195
+ } & Omit<_$better_auth0.BetterAuthRateLimitOptions, "enabled" | "window" | "max" | "storage">;
196
+ adapter: _$better_auth0.DBAdapter<_$better_auth0.BetterAuthOptions>;
197
+ internalAdapter: _$better_auth0.InternalAdapter<_$better_auth0.BetterAuthOptions>;
198
+ createAuthCookie: (cookieName: string, overrideAttributes?: Partial<_$better_call0.CookieOptions> | undefined) => _$better_auth0.BetterAuthCookie;
194
199
  secret: string;
195
- secretConfig: string | import("better-auth").SecretConfig;
200
+ secretConfig: string | _$better_auth0.SecretConfig;
196
201
  sessionConfig: {
197
202
  updateAge: number;
198
203
  expiresIn: number;
@@ -203,10 +208,10 @@ declare function apiKey(_configurations?: (ApiKeyConfigurationOptions & ApiKeyOp
203
208
  };
204
209
  };
205
210
  generateId: (options: {
206
- model: import("better-auth").ModelNames;
211
+ model: _$better_auth0.ModelNames;
207
212
  size?: number | undefined;
208
213
  }) => string | false;
209
- secondaryStorage: import("better-auth").SecondaryStorage | undefined;
214
+ secondaryStorage: _$better_auth0.SecondaryStorage | undefined;
210
215
  password: {
211
216
  hash: (password: string) => Promise<string>;
212
217
  verify: (data: {
@@ -217,9 +222,9 @@ declare function apiKey(_configurations?: (ApiKeyConfigurationOptions & ApiKeyOp
217
222
  minPasswordLength: number;
218
223
  maxPasswordLength: number;
219
224
  };
220
- checkPassword: (userId: string, ctx: import("better-auth").GenericEndpointContext<import("better-auth").BetterAuthOptions>) => Promise<boolean>;
225
+ checkPassword: (userId: string, ctx: _$better_auth0.GenericEndpointContext<_$better_auth0.BetterAuthOptions>) => Promise<boolean>;
221
226
  };
222
- tables: import("better-auth").BetterAuthDBSchema;
227
+ tables: _$better_auth0.BetterAuthDBSchema;
223
228
  runMigrations: () => Promise<void>;
224
229
  publishTelemetry: (event: {
225
230
  type: string;
@@ -229,7 +234,7 @@ declare function apiKey(_configurations?: (ApiKeyConfigurationOptions & ApiKeyOp
229
234
  skipOriginCheck: boolean | string[];
230
235
  skipCSRFCheck: boolean;
231
236
  runInBackground: (promise: Promise<unknown>) => void;
232
- runInBackgroundOrAwait: (promise: Promise<unknown> | void) => import("better-auth").Awaitable<unknown>;
237
+ runInBackgroundOrAwait: (promise: Promise<unknown> | void) => _$better_auth0.Awaitable<unknown>;
233
238
  } & {
234
239
  returned?: unknown | undefined;
235
240
  responseHeaders?: Headers | undefined;
@@ -253,24 +258,24 @@ declare function apiKey(_configurations?: (ApiKeyConfigurationOptions & ApiKeyOp
253
258
  *
254
259
  * @see [Read our docs to learn more.](https://better-auth.com/docs/plugins/api-key#api-method-api-key-create)
255
260
  */
256
- createApiKey: import("better-call").StrictEndpoint<"/api-key/create", {
261
+ createApiKey: _$better_call0.StrictEndpoint<"/api-key/create", {
257
262
  method: "POST";
258
- body: import("zod").ZodObject<{
259
- configId: import("zod").ZodOptional<import("zod").ZodString>;
260
- name: import("zod").ZodOptional<import("zod").ZodString>;
261
- expiresIn: import("zod").ZodDefault<import("zod").ZodNullable<import("zod").ZodOptional<import("zod").ZodNumber>>>;
262
- prefix: import("zod").ZodOptional<import("zod").ZodString>;
263
- remaining: import("zod").ZodDefault<import("zod").ZodNullable<import("zod").ZodOptional<import("zod").ZodNumber>>>;
264
- metadata: import("zod").ZodOptional<import("zod").ZodAny>;
265
- refillAmount: import("zod").ZodOptional<import("zod").ZodNumber>;
266
- refillInterval: import("zod").ZodOptional<import("zod").ZodNumber>;
267
- rateLimitTimeWindow: import("zod").ZodOptional<import("zod").ZodNumber>;
268
- rateLimitMax: import("zod").ZodOptional<import("zod").ZodNumber>;
269
- rateLimitEnabled: import("zod").ZodOptional<import("zod").ZodBoolean>;
270
- permissions: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString>>>;
271
- userId: import("zod").ZodOptional<import("zod").ZodCoercedString<unknown>>;
272
- organizationId: import("zod").ZodOptional<import("zod").ZodCoercedString<unknown>>;
273
- }, import("zod/v4/core").$strip>;
263
+ body: _$zod.ZodObject<{
264
+ configId: _$zod.ZodOptional<_$zod.ZodString>;
265
+ name: _$zod.ZodOptional<_$zod.ZodString>;
266
+ expiresIn: _$zod.ZodDefault<_$zod.ZodNullable<_$zod.ZodOptional<_$zod.ZodNumber>>>;
267
+ prefix: _$zod.ZodOptional<_$zod.ZodString>;
268
+ remaining: _$zod.ZodDefault<_$zod.ZodNullable<_$zod.ZodOptional<_$zod.ZodNumber>>>;
269
+ metadata: _$zod.ZodOptional<_$zod.ZodAny>;
270
+ refillAmount: _$zod.ZodOptional<_$zod.ZodNumber>;
271
+ refillInterval: _$zod.ZodOptional<_$zod.ZodNumber>;
272
+ rateLimitTimeWindow: _$zod.ZodOptional<_$zod.ZodNumber>;
273
+ rateLimitMax: _$zod.ZodOptional<_$zod.ZodNumber>;
274
+ rateLimitEnabled: _$zod.ZodOptional<_$zod.ZodBoolean>;
275
+ permissions: _$zod.ZodOptional<_$zod.ZodRecord<_$zod.ZodString, _$zod.ZodArray<_$zod.ZodString>>>;
276
+ userId: _$zod.ZodOptional<_$zod.ZodCoercedString<unknown>>;
277
+ organizationId: _$zod.ZodOptional<_$zod.ZodCoercedString<unknown>>;
278
+ }, _$zod_v4_core0.$strip>;
274
279
  metadata: {
275
280
  openapi: {
276
281
  description: string;
@@ -436,17 +441,17 @@ declare function apiKey(_configurations?: (ApiKeyConfigurationOptions & ApiKeyOp
436
441
  *
437
442
  * @see [Read our docs to learn more.](https://better-auth.com/docs/plugins/api-key#api-method-api-key-verify)
438
443
  */
439
- verifyApiKey: import("better-call").StrictEndpoint<string, {
444
+ verifyApiKey: _$better_call0.StrictEndpoint<string, {
440
445
  method: "POST";
441
- body: import("zod").ZodObject<{
442
- configId: import("zod").ZodOptional<import("zod").ZodString>;
443
- key: import("zod").ZodString;
444
- permissions: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString>>>;
445
- }, import("zod/v4/core").$strip>;
446
+ body: _$zod.ZodObject<{
447
+ configId: _$zod.ZodOptional<_$zod.ZodString>;
448
+ key: _$zod.ZodString;
449
+ permissions: _$zod.ZodOptional<_$zod.ZodRecord<_$zod.ZodString, _$zod.ZodArray<_$zod.ZodString>>>;
450
+ }, _$zod_v4_core0.$strip>;
446
451
  }, {
447
452
  valid: boolean;
448
453
  error: {
449
- message: import("better-auth").RawError<"INVALID_API_KEY">;
454
+ message: _$better_auth0.RawError<"INVALID_API_KEY">;
450
455
  code: "KEY_NOT_FOUND";
451
456
  };
452
457
  key: null;
@@ -461,7 +466,7 @@ declare function apiKey(_configurations?: (ApiKeyConfigurationOptions & ApiKeyOp
461
466
  } | {
462
467
  valid: boolean;
463
468
  error: {
464
- message: import("better-auth").RawError<"INVALID_API_KEY">;
469
+ message: _$better_auth0.RawError<"INVALID_API_KEY">;
465
470
  code: "INVALID_API_KEY";
466
471
  };
467
472
  key: null;
@@ -485,13 +490,13 @@ declare function apiKey(_configurations?: (ApiKeyConfigurationOptions & ApiKeyOp
485
490
  *
486
491
  * @see [Read our docs to learn more.](https://better-auth.com/docs/plugins/api-key#api-method-api-key-get)
487
492
  */
488
- getApiKey: import("better-call").StrictEndpoint<"/api-key/get", {
493
+ getApiKey: _$better_call0.StrictEndpoint<"/api-key/get", {
489
494
  method: "GET";
490
- query: import("zod").ZodObject<{
491
- configId: import("zod").ZodOptional<import("zod").ZodString>;
492
- id: import("zod").ZodString;
493
- }, import("zod/v4/core").$strip>;
494
- use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
495
+ query: _$zod.ZodObject<{
496
+ configId: _$zod.ZodOptional<_$zod.ZodString>;
497
+ id: _$zod.ZodString;
498
+ }, _$zod_v4_core0.$strip>;
499
+ use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
495
500
  session: {
496
501
  session: Record<string, any> & {
497
502
  id: string;
@@ -674,24 +679,24 @@ declare function apiKey(_configurations?: (ApiKeyConfigurationOptions & ApiKeyOp
674
679
  *
675
680
  * @see [Read our docs to learn more.](https://better-auth.com/docs/plugins/api-key#api-method-api-key-update)
676
681
  */
677
- updateApiKey: import("better-call").StrictEndpoint<"/api-key/update", {
682
+ updateApiKey: _$better_call0.StrictEndpoint<"/api-key/update", {
678
683
  method: "POST";
679
- body: import("zod").ZodObject<{
680
- configId: import("zod").ZodOptional<import("zod").ZodString>;
681
- keyId: import("zod").ZodString;
682
- userId: import("zod").ZodOptional<import("zod").ZodCoercedString<unknown>>;
683
- name: import("zod").ZodOptional<import("zod").ZodString>;
684
- enabled: import("zod").ZodOptional<import("zod").ZodBoolean>;
685
- remaining: import("zod").ZodOptional<import("zod").ZodNumber>;
686
- refillAmount: import("zod").ZodOptional<import("zod").ZodNumber>;
687
- refillInterval: import("zod").ZodOptional<import("zod").ZodNumber>;
688
- metadata: import("zod").ZodOptional<import("zod").ZodAny>;
689
- expiresIn: import("zod").ZodNullable<import("zod").ZodOptional<import("zod").ZodNumber>>;
690
- rateLimitEnabled: import("zod").ZodOptional<import("zod").ZodBoolean>;
691
- rateLimitTimeWindow: import("zod").ZodOptional<import("zod").ZodNumber>;
692
- rateLimitMax: import("zod").ZodOptional<import("zod").ZodNumber>;
693
- permissions: import("zod").ZodNullable<import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString>>>>;
694
- }, import("zod/v4/core").$strip>;
684
+ body: _$zod.ZodObject<{
685
+ configId: _$zod.ZodOptional<_$zod.ZodString>;
686
+ keyId: _$zod.ZodString;
687
+ userId: _$zod.ZodOptional<_$zod.ZodCoercedString<unknown>>;
688
+ name: _$zod.ZodOptional<_$zod.ZodString>;
689
+ enabled: _$zod.ZodOptional<_$zod.ZodBoolean>;
690
+ remaining: _$zod.ZodOptional<_$zod.ZodNumber>;
691
+ refillAmount: _$zod.ZodOptional<_$zod.ZodNumber>;
692
+ refillInterval: _$zod.ZodOptional<_$zod.ZodNumber>;
693
+ metadata: _$zod.ZodOptional<_$zod.ZodAny>;
694
+ expiresIn: _$zod.ZodNullable<_$zod.ZodOptional<_$zod.ZodNumber>>;
695
+ rateLimitEnabled: _$zod.ZodOptional<_$zod.ZodBoolean>;
696
+ rateLimitTimeWindow: _$zod.ZodOptional<_$zod.ZodNumber>;
697
+ rateLimitMax: _$zod.ZodOptional<_$zod.ZodNumber>;
698
+ permissions: _$zod.ZodNullable<_$zod.ZodOptional<_$zod.ZodRecord<_$zod.ZodString, _$zod.ZodArray<_$zod.ZodString>>>>;
699
+ }, _$zod_v4_core0.$strip>;
695
700
  metadata: {
696
701
  openapi: {
697
702
  description: string;
@@ -852,13 +857,13 @@ declare function apiKey(_configurations?: (ApiKeyConfigurationOptions & ApiKeyOp
852
857
  *
853
858
  * @see [Read our docs to learn more.](https://better-auth.com/docs/plugins/api-key#api-method-api-key-delete)
854
859
  */
855
- deleteApiKey: import("better-call").StrictEndpoint<"/api-key/delete", {
860
+ deleteApiKey: _$better_call0.StrictEndpoint<"/api-key/delete", {
856
861
  method: "POST";
857
- body: import("zod").ZodObject<{
858
- configId: import("zod").ZodOptional<import("zod").ZodString>;
859
- keyId: import("zod").ZodString;
860
- }, import("zod/v4/core").$strip>;
861
- use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
862
+ body: _$zod.ZodObject<{
863
+ configId: _$zod.ZodOptional<_$zod.ZodString>;
864
+ keyId: _$zod.ZodString;
865
+ }, _$zod_v4_core0.$strip>;
866
+ use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
862
867
  session: {
863
868
  session: Record<string, any> & {
864
869
  id: string;
@@ -939,9 +944,9 @@ declare function apiKey(_configurations?: (ApiKeyConfigurationOptions & ApiKeyOp
939
944
  *
940
945
  * @see [Read our docs to learn more.](https://better-auth.com/docs/plugins/api-key#api-method-api-key-list)
941
946
  */
942
- listApiKeys: import("better-call").StrictEndpoint<"/api-key/list", {
947
+ listApiKeys: _$better_call0.StrictEndpoint<"/api-key/list", {
943
948
  method: "GET";
944
- use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
949
+ use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
945
950
  session: {
946
951
  session: Record<string, any> & {
947
952
  id: string;
@@ -964,17 +969,17 @@ declare function apiKey(_configurations?: (ApiKeyConfigurationOptions & ApiKeyOp
964
969
  };
965
970
  };
966
971
  }>>[];
967
- query: import("zod").ZodOptional<import("zod").ZodObject<{
968
- configId: import("zod").ZodOptional<import("zod").ZodString>;
969
- organizationId: import("zod").ZodOptional<import("zod").ZodString>;
970
- limit: import("zod").ZodOptional<import("zod").ZodCoercedNumber<unknown>>;
971
- offset: import("zod").ZodOptional<import("zod").ZodCoercedNumber<unknown>>;
972
- sortBy: import("zod").ZodOptional<import("zod").ZodString>;
973
- sortDirection: import("zod").ZodOptional<import("zod").ZodEnum<{
972
+ query: _$zod.ZodOptional<_$zod.ZodObject<{
973
+ configId: _$zod.ZodOptional<_$zod.ZodString>;
974
+ organizationId: _$zod.ZodOptional<_$zod.ZodString>;
975
+ limit: _$zod.ZodOptional<_$zod.ZodCoercedNumber<unknown>>;
976
+ offset: _$zod.ZodOptional<_$zod.ZodCoercedNumber<unknown>>;
977
+ sortBy: _$zod.ZodOptional<_$zod.ZodString>;
978
+ sortDirection: _$zod.ZodOptional<_$zod.ZodEnum<{
974
979
  asc: "asc";
975
980
  desc: "desc";
976
981
  }>>;
977
- }, import("zod/v4/core").$strip>>;
982
+ }, _$zod_v4_core0.$strip>>;
978
983
  metadata: {
979
984
  openapi: {
980
985
  description: string;
@@ -1160,7 +1165,7 @@ declare function apiKey(_configurations?: (ApiKeyConfigurationOptions & ApiKeyOp
1160
1165
  *
1161
1166
  * @see [Read our docs to learn more.](https://better-auth.com/docs/plugins/api-key#api-method-api-key-delete-all-expired-api-keys)
1162
1167
  */
1163
- deleteAllExpiredApiKeys: import("better-call").StrictEndpoint<string, {
1168
+ deleteAllExpiredApiKeys: _$better_call0.StrictEndpoint<string, {
1164
1169
  method: "POST";
1165
1170
  }, {
1166
1171
  success: boolean;
@@ -1284,8 +1289,8 @@ declare function apiKey(_configurations?: (ApiKeyConfigurationOptions & ApiKeyOp
1284
1289
  required: false;
1285
1290
  input: true;
1286
1291
  transform: {
1287
- input(value: import("better-auth").DBPrimitive): string;
1288
- output(value: import("better-auth").DBPrimitive): any;
1292
+ input(value: _$better_auth0.DBPrimitive): string;
1293
+ output(value: _$better_auth0.DBPrimitive): any;
1289
1294
  };
1290
1295
  };
1291
1296
  };
package/dist/index.d.mts CHANGED
@@ -1,3 +1,3 @@
1
- import { n as ApiKeyConfigurationOptions, r as ApiKeyOptions, t as ApiKey } from "./types-BYqswa0N.mjs";
2
- import { i as API_KEY_ERROR_CODES, n as apiKey, r as defaultKeyHasher, t as API_KEY_TABLE_NAME } from "./index-5ylKSUSG.mjs";
3
- export { API_KEY_ERROR_CODES, API_KEY_TABLE_NAME, type ApiKey, type ApiKeyConfigurationOptions, type ApiKeyOptions, apiKey, defaultKeyHasher };
1
+ import { n as ApiKeyConfigurationOptions, r as ApiKeyOptions, t as ApiKey } from "./types-B8ewwiB4.mjs";
2
+ import { i as API_KEY_ERROR_CODES, n as apiKey, r as defaultKeyHasher, t as API_KEY_TABLE_NAME } from "./index-Du_Uke1v.mjs";
3
+ export { API_KEY_ERROR_CODES, API_KEY_TABLE_NAME, ApiKey, ApiKeyConfigurationOptions, ApiKeyOptions, apiKey, defaultKeyHasher };
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { n as API_KEY_ERROR_CODES, t as PACKAGE_VERSION } from "./version-BQwkRUb6.mjs";
1
+ import { n as API_KEY_ERROR_CODES, t as PACKAGE_VERSION } from "./version-D0spFpe1.mjs";
2
2
  import { createAuthEndpoint, createAuthMiddleware } from "@better-auth/core/api";
3
3
  import { getIp } from "@better-auth/core/utils/ip";
4
4
  import { base64Url } from "@better-auth/utils/base64";
@@ -732,9 +732,7 @@ function createApiKey({ defaultKeyGenerator, configurations, schema, deleteAllEx
732
732
  const keyGenerator = opts.customKeyGenerator || defaultKeyGenerator;
733
733
  const session = await getSessionFromCtx(ctx, { disableCookieCache: true });
734
734
  const isClientRequest = ctx.request || ctx.headers;
735
- if (isClientRequest && (() => {
736
- return refillAmount !== void 0 || refillInterval !== void 0 || rateLimitMax !== void 0 || rateLimitTimeWindow !== void 0 || rateLimitEnabled !== void 0 || permissions !== void 0 || remaining !== null;
737
- })()) throw APIError$1.from("BAD_REQUEST", API_KEY_ERROR_CODES.SERVER_ONLY_PROPERTY);
735
+ if (isClientRequest && (refillAmount !== void 0 || refillInterval !== void 0 || rateLimitMax !== void 0 || rateLimitTimeWindow !== void 0 || rateLimitEnabled !== void 0 || permissions !== void 0 || remaining !== null)) throw APIError$1.from("BAD_REQUEST", API_KEY_ERROR_CODES.SERVER_ONLY_PROPERTY);
738
736
  if (ctx.request && ctx.body.userId !== void 0) throw APIError$1.from("UNAUTHORIZED", API_KEY_ERROR_CODES.UNAUTHORIZED_SESSION);
739
737
  const referencesType = opts.references ?? "user";
740
738
  let referenceId;
@@ -1,8 +1,13 @@
1
+ import * as _$better_auth0 from "better-auth";
1
2
  import { Statements } from "better-auth/plugins/access";
2
3
  import { Awaitable, GenericEndpointContext, HookEndpointContext, LiteralString } from "@better-auth/core";
3
4
  import { InferOptionSchema } from "better-auth/types";
5
+
4
6
  //#region src/schema.d.ts
5
- declare const apiKeySchema: ({ defaultRateLimitMax, defaultTimeWindow }: {
7
+ declare const apiKeySchema: ({
8
+ defaultRateLimitMax,
9
+ defaultTimeWindow
10
+ }: {
6
11
  defaultTimeWindow: number;
7
12
  defaultRateLimitMax: number;
8
13
  }) => {
@@ -187,8 +192,8 @@ declare const apiKeySchema: ({ defaultRateLimitMax, defaultTimeWindow }: {
187
192
  required: false;
188
193
  input: true;
189
194
  transform: {
190
- input(value: import("better-auth").DBPrimitive): string;
191
- output(value: import("better-auth").DBPrimitive): any;
195
+ input(value: _$better_auth0.DBPrimitive): string;
196
+ output(value: _$better_auth0.DBPrimitive): any;
192
197
  };
193
198
  };
194
199
  };
package/dist/types.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { n as ApiKeyConfigurationOptions, r as ApiKeyOptions, t as ApiKey } from "./types-BYqswa0N.mjs";
1
+ import { n as ApiKeyConfigurationOptions, r as ApiKeyOptions, t as ApiKey } from "./types-B8ewwiB4.mjs";
2
2
  export { ApiKey, ApiKeyConfigurationOptions, ApiKeyOptions };
@@ -35,6 +35,6 @@ const API_KEY_ERROR_CODES = defineErrorCodes({
35
35
  });
36
36
  //#endregion
37
37
  //#region src/version.ts
38
- const PACKAGE_VERSION = "1.6.27";
38
+ const PACKAGE_VERSION = "1.6.28";
39
39
  //#endregion
40
40
  export { API_KEY_ERROR_CODES as n, PACKAGE_VERSION as t };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@better-auth/api-key",
3
- "version": "1.6.27",
3
+ "version": "1.6.28",
4
4
  "description": "API Key plugin for Better Auth.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -60,15 +60,15 @@
60
60
  "zod": "^4.3.6"
61
61
  },
62
62
  "devDependencies": {
63
- "tsdown": "0.22.7",
64
- "@better-auth/core": "1.6.27",
65
- "better-auth": "1.6.27"
63
+ "tsdown": "0.21.10",
64
+ "@better-auth/core": "1.6.28",
65
+ "better-auth": "1.6.28"
66
66
  },
67
67
  "peerDependencies": {
68
68
  "@better-auth/utils": "0.4.2",
69
69
  "better-call": "1.4.0",
70
- "@better-auth/core": "^1.6.27",
71
- "better-auth": "^1.6.27"
70
+ "@better-auth/core": "^1.6.28",
71
+ "better-auth": "^1.6.28"
72
72
  },
73
73
  "scripts": {
74
74
  "build": "tsdown",