@better-auth/api-key 1.5.7-beta.1 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1,3 +1,3 @@
1
- import { n as ApiKeyConfigurationOptions, r as ApiKeyOptions, t as ApiKey } from "./types-BR70O3Q3.mjs";
2
- import { i as API_KEY_ERROR_CODES, n as apiKey, r as defaultKeyHasher, t as API_KEY_TABLE_NAME } from "./index-WXH3i1Uh.mjs";
1
+ import { i as API_KEY_ERROR_CODES, n as apiKey, r as defaultKeyHasher, t as API_KEY_TABLE_NAME } from "./index-CajK1bx0.mjs";
2
+ import { n as ApiKeyConfigurationOptions, r as ApiKeyOptions, t as ApiKey } from "./types-CCe5L05Y.mjs";
3
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 { t as API_KEY_ERROR_CODES } from "./error-codes-C8MQDPqn.mjs";
1
+ import { n as API_KEY_ERROR_CODES, t as PACKAGE_VERSION } from "./version-8TBaF5K2.mjs";
2
2
  import { createAuthEndpoint, createAuthMiddleware } from "@better-auth/core/api";
3
3
  import { base64Url } from "@better-auth/utils/base64";
4
4
  import { createHash } from "@better-auth/utils/hash";
@@ -2149,6 +2149,7 @@ function apiKey(_configurations, _options) {
2149
2149
  });
2150
2150
  return {
2151
2151
  id: "api-key",
2152
+ version: PACKAGE_VERSION,
2152
2153
  $ERROR_CODES: API_KEY_ERROR_CODES,
2153
2154
  hooks: { before: [{
2154
2155
  matcher: (ctx) => !!findApiKeyAndConfig(ctx),
@@ -2213,5 +2214,3 @@ function apiKey(_configurations, _options) {
2213
2214
  }
2214
2215
  //#endregion
2215
2216
  export { API_KEY_ERROR_CODES, API_KEY_TABLE_NAME, apiKey, defaultKeyHasher };
2216
-
2217
- //# sourceMappingURL=index.mjs.map
@@ -551,5 +551,4 @@ type ApiKey = {
551
551
  } | null) | undefined;
552
552
  };
553
553
  //#endregion
554
- export { ApiKeyConfigurationOptions as n, ApiKeyOptions as r, ApiKey as t };
555
- //# sourceMappingURL=types-BR70O3Q3.d.mts.map
554
+ export { ApiKeyConfigurationOptions as n, ApiKeyOptions as r, ApiKey as t };
package/dist/types.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { n as ApiKeyConfigurationOptions, r as ApiKeyOptions, t as ApiKey } from "./types-BR70O3Q3.mjs";
1
+ import { n as ApiKeyConfigurationOptions, r as ApiKeyOptions, t as ApiKey } from "./types-CCe5L05Y.mjs";
2
2
  export { ApiKey, ApiKeyConfigurationOptions, ApiKeyOptions };
@@ -34,6 +34,7 @@ const API_KEY_ERROR_CODES = defineErrorCodes({
34
34
  ORGANIZATION_PLUGIN_REQUIRED: "Organization plugin is required for organization-owned API keys. Please install and configure the organization plugin."
35
35
  });
36
36
  //#endregion
37
- export { API_KEY_ERROR_CODES as t };
38
-
39
- //# sourceMappingURL=error-codes-C8MQDPqn.mjs.map
37
+ //#region src/version.ts
38
+ const PACKAGE_VERSION = "1.6.0";
39
+ //#endregion
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.5.7-beta.1",
3
+ "version": "1.6.0",
4
4
  "description": "API Key plugin for Better Auth.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -19,6 +19,7 @@
19
19
  "publishConfig": {
20
20
  "access": "public"
21
21
  },
22
+ "sideEffects": false,
22
23
  "files": [
23
24
  "dist"
24
25
  ],
@@ -60,18 +61,18 @@
60
61
  },
61
62
  "devDependencies": {
62
63
  "tsdown": "0.21.1",
63
- "@better-auth/core": "1.5.7-beta.1",
64
- "better-auth": "1.5.7-beta.1"
64
+ "@better-auth/core": "1.6.0",
65
+ "better-auth": "1.6.0"
65
66
  },
66
67
  "peerDependencies": {
67
- "@better-auth/utils": "0.3.1",
68
- "@better-auth/core": "1.5.7-beta.1",
69
- "better-auth": "1.5.7-beta.1"
68
+ "@better-auth/utils": "0.4.0",
69
+ "@better-auth/core": "^1.6.0",
70
+ "better-auth": "^1.6.0"
70
71
  },
71
72
  "scripts": {
72
73
  "build": "tsdown",
73
74
  "dev": "tsdown --watch",
74
- "lint:package": "publint run --strict",
75
+ "lint:package": "publint run --strict --pack false",
75
76
  "lint:types": "attw --profile esm-only --pack .",
76
77
  "typecheck": "tsc --project tsconfig.json",
77
78
  "test": "vitest",
@@ -1 +0,0 @@
1
- {"version":3,"file":"client.mjs","names":[],"sources":["../src/client.ts"],"sourcesContent":["import type { BetterAuthClientPlugin } from \"@better-auth/core\";\nimport type { apiKey } from \".\";\nimport { API_KEY_ERROR_CODES } from \"./error-codes\";\n\nexport * from \"./error-codes\";\n\nexport const apiKeyClient = () => {\n\treturn {\n\t\tid: \"api-key\",\n\t\t$InferServerPlugin: {} as ReturnType<typeof apiKey>,\n\t\tpathMethods: {\n\t\t\t\"/api-key/create\": \"POST\",\n\t\t\t\"/api-key/delete\": \"POST\",\n\t\t\t\"/api-key/delete-all-expired-api-keys\": \"POST\",\n\t\t},\n\t\t$ERROR_CODES: API_KEY_ERROR_CODES,\n\t} satisfies BetterAuthClientPlugin;\n};\n\nexport type ApiKeyClientPlugin = ReturnType<typeof apiKeyClient>;\n\nexport type * from \"./types\";\n"],"mappings":";;AAMA,MAAa,qBAAqB;AACjC,QAAO;EACN,IAAI;EACJ,oBAAoB,EAAE;EACtB,aAAa;GACZ,mBAAmB;GACnB,mBAAmB;GACnB,wCAAwC;GACxC;EACD,cAAc;EACd"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"error-codes-C8MQDPqn.mjs","names":[],"sources":["../src/error-codes.ts"],"sourcesContent":["import { defineErrorCodes } from \"@better-auth/core/utils/error-codes\";\n\nexport const API_KEY_ERROR_CODES = defineErrorCodes({\n\tINVALID_METADATA_TYPE: \"metadata must be an object or undefined\",\n\tREFILL_AMOUNT_AND_INTERVAL_REQUIRED:\n\t\t\"refillAmount is required when refillInterval is provided\",\n\tREFILL_INTERVAL_AND_AMOUNT_REQUIRED:\n\t\t\"refillInterval is required when refillAmount is provided\",\n\tUSER_BANNED: \"User is banned\",\n\tUNAUTHORIZED_SESSION: \"Unauthorized or invalid session\",\n\tKEY_NOT_FOUND: \"API Key not found\",\n\tKEY_DISABLED: \"API Key is disabled\",\n\tKEY_EXPIRED: \"API Key has expired\",\n\tUSAGE_EXCEEDED: \"API Key has reached its usage limit\",\n\tKEY_NOT_RECOVERABLE: \"API Key is not recoverable\",\n\tEXPIRES_IN_IS_TOO_SMALL:\n\t\t\"The expiresIn is smaller than the predefined minimum value.\",\n\tEXPIRES_IN_IS_TOO_LARGE:\n\t\t\"The expiresIn is larger than the predefined maximum value.\",\n\tINVALID_REMAINING: \"The remaining count is either too large or too small.\",\n\tINVALID_PREFIX_LENGTH: \"The prefix length is either too large or too small.\",\n\tINVALID_NAME_LENGTH: \"The name length is either too large or too small.\",\n\tMETADATA_DISABLED: \"Metadata is disabled.\",\n\tRATE_LIMIT_EXCEEDED: \"Rate limit exceeded.\",\n\tNO_VALUES_TO_UPDATE: \"No values to update.\",\n\tKEY_DISABLED_EXPIRATION: \"Custom key expiration values are disabled.\",\n\tINVALID_API_KEY: \"Invalid API key.\",\n\tINVALID_USER_ID_FROM_API_KEY: \"The user id from the API key is invalid.\",\n\tINVALID_REFERENCE_ID_FROM_API_KEY:\n\t\t\"The reference id from the API key is invalid.\",\n\tINVALID_API_KEY_GETTER_RETURN_TYPE:\n\t\t\"API Key getter returned an invalid key type. Expected string.\",\n\tSERVER_ONLY_PROPERTY:\n\t\t\"The property you're trying to set can only be set from the server auth instance only.\",\n\tFAILED_TO_UPDATE_API_KEY: \"Failed to update API key\",\n\tNAME_REQUIRED: \"API Key name is required.\",\n\tORGANIZATION_ID_REQUIRED:\n\t\t\"Organization ID is required for organization-owned API keys.\",\n\tUSER_NOT_MEMBER_OF_ORGANIZATION:\n\t\t\"You are not a member of the organization that owns this API key.\",\n\tINSUFFICIENT_API_KEY_PERMISSIONS:\n\t\t\"You do not have permission to perform this action on organization API keys.\",\n\tNO_DEFAULT_API_KEY_CONFIGURATION_FOUND:\n\t\t\"No default api-key configuration found.\",\n\tORGANIZATION_PLUGIN_REQUIRED:\n\t\t\"Organization plugin is required for organization-owned API keys. Please install and configure the organization plugin.\",\n});\n"],"mappings":";;AAEA,MAAa,sBAAsB,iBAAiB;CACnD,uBAAuB;CACvB,qCACC;CACD,qCACC;CACD,aAAa;CACb,sBAAsB;CACtB,eAAe;CACf,cAAc;CACd,aAAa;CACb,gBAAgB;CAChB,qBAAqB;CACrB,yBACC;CACD,yBACC;CACD,mBAAmB;CACnB,uBAAuB;CACvB,qBAAqB;CACrB,mBAAmB;CACnB,qBAAqB;CACrB,qBAAqB;CACrB,yBAAyB;CACzB,iBAAiB;CACjB,8BAA8B;CAC9B,mCACC;CACD,oCACC;CACD,sBACC;CACD,0BAA0B;CAC1B,eAAe;CACf,0BACC;CACD,iCACC;CACD,kCACC;CACD,wCACC;CACD,8BACC;CACD,CAAC"}