From f781b9c62229879ad84c95b589912ca74d4f4b77 Mon Sep 17 00:00:00 2001 From: James P Date: Tue, 8 Oct 2024 16:10:15 -0400 Subject: [PATCH 1/9] chore: Add RSS feed (#2283) * Adds an RSS feed so we can crosspost / rank * add pnpm lock --- apps/www/app/feed.xml/route.ts | 37 +++++++ apps/www/package.json | 2 + pnpm-lock.yaml | 179 ++++++++++++++++----------------- 3 files changed, 123 insertions(+), 95 deletions(-) create mode 100644 apps/www/app/feed.xml/route.ts diff --git a/apps/www/app/feed.xml/route.ts b/apps/www/app/feed.xml/route.ts new file mode 100644 index 0000000000..cdca05473f --- /dev/null +++ b/apps/www/app/feed.xml/route.ts @@ -0,0 +1,37 @@ +import RSS from "rss"; +import { type Post, allPosts } from "content-collections"; +import { authors } from "@/content/blog/authors"; +const feed = new RSS({ + title: "Unkey", + description: "Open Source API Development platform", + site_url: "https://unkey.com", + feed_url: `https://unkey.com/feed.xml`, + copyright: `${new Date().getFullYear()} Unkey`, + language: "en", + pubDate: new Date(), +}); + +const posts = allPosts.sort((a: Post, b: Post) => { + return new Date(b.date).getTime() - new Date(a.date).getTime(); +}); + +export async function GET() { + posts.map((post) => { + const author = authors[post.author]; + feed.item({ + title: post.title, + guid: `https://unkey.com/blog/${post.slug}`, + url: `https://unkey.com/blog/${post.slug}`, + date: post.date, + description: post.description, + author: author.name, + categories: post.tags || [], + }); + }); + + return new Response(feed.xml({ indent: true }), { + headers: { + "Content-Type": "application/atom+xml; charset=utf-8", + }, + }); +} diff --git a/apps/www/package.json b/apps/www/package.json index 3105146b9f..aa2995ed5e 100644 --- a/apps/www/package.json +++ b/apps/www/package.json @@ -52,6 +52,7 @@ "react-syntax-highlighter": "^15.5.0", "rehype-raw": "^7.0.0", "remark-gfm": "^3.0.1", + "rss": "^1.2.2", "shiki": "^1.12.0", "tailwind-merge": "^2.2.2", "tailwindcss-animate": "^1.0.7", @@ -70,6 +71,7 @@ "@types/react": "^18.3.11", "@types/react-dom": "^18.3.0", "@types/react-syntax-highlighter": "^15.5.13", + "@types/rss": "^0.0.32", "autoprefixer": "^10.4.19", "postcss": "^8", "tailwindcss": "^3.4.3", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index bfcb94c918..7eb3ced4c6 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1094,6 +1094,9 @@ importers: remark-gfm: specifier: ^3.0.1 version: 3.0.1 + rss: + specifier: ^1.2.2 + version: 1.2.2 shiki: specifier: ^1.12.0 version: 1.12.0 @@ -1143,6 +1146,9 @@ importers: '@types/react-syntax-highlighter': specifier: ^15.5.13 version: 15.5.13 + '@types/rss': + specifier: ^0.0.32 + version: 0.0.32 autoprefixer: specifier: ^10.4.19 version: 10.4.20(postcss@8.4.38) @@ -1188,7 +1194,7 @@ importers: devDependencies: checkly: specifier: latest - version: 4.9.0(@types/node@20.14.9)(typescript@5.5.3) + version: 4.7.0(@types/node@20.14.9)(typescript@5.5.3) ts-node: specifier: 10.9.1 version: 10.9.1(@types/node@20.14.9)(typescript@5.5.3) @@ -6030,25 +6036,35 @@ packages: - typescript dev: true - /@oclif/core@4.0.27: - resolution: {integrity: sha512-9j92jHr6k2tjQ6/mIwNi46Gqw+qbPFQ02mxT5T8/nxO2fgsPL3qL0kb9SR1il5AVfqpgLIG3uLUcw87rgaioUg==} + /@oclif/core@3.27.0: + resolution: {integrity: sha512-Fg93aNFvXzBq5L7ztVHFP2nYwWU1oTCq48G0TjF/qC1UN36KWa2H5Hsm72kERd5x/sjy2M2Tn4kDEorUlpXOlw==} engines: {node: '>=18.0.0'} dependencies: + '@types/cli-progress': 3.11.6 ansi-escapes: 4.3.2 - ansis: 3.3.2 + ansi-styles: 4.3.0 + cardinal: 2.1.1 + chalk: 4.1.2 clean-stack: 3.0.1 - cli-spinners: 2.9.2 + cli-progress: 3.12.0 + color: 4.2.3 debug: 4.3.7(supports-color@8.1.1) ejs: 3.1.10 get-package-type: 0.1.0 globby: 11.1.0 + hyperlinker: 1.0.0 indent-string: 4.0.0 - is-wsl: 3.1.0 - lilconfig: 3.1.2 + is-wsl: 2.2.0 + js-yaml: 3.14.1 minimatch: 9.0.5 - semver: 7.6.3 + natural-orderby: 2.0.3 + object-treeify: 1.1.33 + password-prompt: 1.1.3 + slice-ansi: 4.0.0 string-width: 4.2.3 + strip-ansi: 6.0.1 supports-color: 8.1.1 + supports-hyperlinks: 2.3.0 widest-line: 3.1.0 wordwrap: 1.0.0 wrap-ansi: 7.0.0 @@ -6080,20 +6096,18 @@ packages: - typescript dev: true - /@oclif/plugin-plugins@5.4.4: - resolution: {integrity: sha512-p30fo3JPtbOqTJOX9A/8qKV/14XWt8xFgG/goVfIkuKBAO+cdY78ag8pYatlpzsYzJhO27X1MFn0WkkPWo36Ww==} + /@oclif/plugin-plugins@4.1.12: + resolution: {integrity: sha512-lYNoqoQJz+p4AOMZ9N5k7OkLk/HZJSdaybJ4rWfDZ76pQ7AcrLEPtREi2wLfcwcrzKoBMsrwBoMTf3PnmpW7ZQ==} engines: {node: '>=18.0.0'} dependencies: - '@oclif/core': 4.0.27 - ansis: 3.3.2 + '@oclif/core': 3.27.0 + chalk: 5.3.0 debug: 4.3.7(supports-color@8.1.1) - npm: 10.9.0 - npm-package-arg: 11.0.3 - npm-run-path: 5.3.0 - object-treeify: 4.0.1 + npm: 10.2.3 + npm-run-path: 4.0.1 semver: 7.6.3 + shelljs: 0.8.5 validate-npm-package-name: 5.0.1 - which: 4.0.0 yarn: 1.22.22 transitivePeerDependencies: - supports-color @@ -10690,6 +10704,10 @@ packages: resolution: {integrity: sha512-wWKOClTTiizcZhXnPY4wikVAwmdYHp8q6DmC+EJUzAMsycb7HB32Kh9RN4+0gExjmPmZSAQjgURXIGATPegAvA==} dev: false + /@types/rss@0.0.32: + resolution: {integrity: sha512-2oKNqKyUY4RSdvl5eZR1n2Q9yvw3XTe3mQHsFPn9alaNBxfPnbXBtGP8R0SV8pK1PrVnLul0zx7izbm5/gF5Qw==} + dev: true + /@types/semver@7.5.8: resolution: {integrity: sha512-I8EUhyrgfLrcTkzV3TSsGyl1tSuPrEDzr0yd5m90UgNxQkyDXULk3b6MlQqTCpZpNtWe1K0hzclnZkTcLBe2UQ==} dev: true @@ -11567,11 +11585,6 @@ packages: resolution: {integrity: sha512-QXu7BPrP29VllRxH8GwB7x5iX5qWKAAMLqKQGWTeLWVlNHNOpVMJ91dsxQAIWXpjuW5wqvxu3Jd/nRjrJ+0pqg==} dev: true - /ansis@3.3.2: - resolution: {integrity: sha512-cFthbBlt+Oi0i9Pv/j6YdVWJh54CtjGACaMPCIrEV4Ha7HWsIjXDwseYV79TIL0B4+KfSwD5S70PeQDkPUd1rA==} - engines: {node: '>=15'} - dev: true - /any-promise@1.3.0: resolution: {integrity: sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==} @@ -11702,6 +11715,11 @@ packages: tslib: 2.7.0 dev: true + /astral-regex@2.0.0: + resolution: {integrity: sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==} + engines: {node: '>=8'} + dev: true + /astring@1.9.0: resolution: {integrity: sha512-LElXdjswlqjWrPpJFg1Fx4wpkOCxj1TDHlSV4PlaRxHGWko024xICaa97ZkMfs6DRKlCguiAI+rbXv5GWwXIkg==} hasBin: true @@ -11790,8 +11808,8 @@ packages: resolution: {integrity: sha512-NZKeq9AfyQvEeNlN0zSYAaWrmBffJh3IELMZfRpJVWgrpEbtEpnjvzqBPf+mxoI287JohRDoa+/nsfqqiZmF6g==} engines: {node: '>= 6.0.0'} - /axios@1.7.4: - resolution: {integrity: sha512-DukmaFRnY6AzAALSH4J2M3k6PkaC+MfaAGdEERRWcC9q3/TWQwLpHR8ZRLKTdQ3aBDL64EdluRDjJqKw+BPZEw==} + /axios@1.6.2: + resolution: {integrity: sha512-7i24Ri4pmDRfJTR7LDBhsOTtcm+9kjX5WiY1X3wIisx6G9So3pfMkEiU7emUBe46oceVImccTEM3k6C5dbVW8A==} dependencies: follow-redirects: 1.15.9 form-data: 4.0.0 @@ -12181,21 +12199,21 @@ packages: get-func-name: 2.0.2 dev: true - /checkly@4.9.0(@types/node@20.14.9)(typescript@5.5.3): - resolution: {integrity: sha512-LqohEntErF7dJaJPsEpjvr/O9wUfzBRac6DOXgFDMEw+dNi19oBAcspdOqVGjPjMoCZ9/s5b5tSJI1pusY4mJQ==} + /checkly@4.7.0(@types/node@20.14.9)(typescript@5.5.3): + resolution: {integrity: sha512-OVEn7iUrtTs/YrxmNcWo7jQkH+e5LS0/KhF+MmIi8DbrCc8sCBppO1JyEnjoKcslCkV/Rilad66LShI6V/cqvQ==} engines: {node: '>=16.0.0'} hasBin: true dependencies: '@oclif/core': 2.8.11(@types/node@20.14.9)(typescript@5.5.3) '@oclif/plugin-help': 5.1.20 '@oclif/plugin-not-found': 2.3.23(@types/node@20.14.9)(typescript@5.5.3) - '@oclif/plugin-plugins': 5.4.4 + '@oclif/plugin-plugins': 4.1.12 '@oclif/plugin-warn-if-update-available': 2.0.24(@types/node@20.14.9)(typescript@5.5.3) '@typescript-eslint/typescript-estree': 6.19.0(typescript@5.5.3) acorn: 8.8.1 acorn-walk: 8.2.0 async-mqtt: 2.6.3 - axios: 1.7.4 + axios: 1.6.2 chalk: 4.1.2 ci-info: 3.8.0 conf: 10.2.0 @@ -16171,13 +16189,6 @@ packages: resolution: {integrity: sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==} dev: true - /hosted-git-info@7.0.2: - resolution: {integrity: sha512-puUZAUKT5m8Zzvs72XWy3HtvVbTWljRE66cP60bxJzAqf2DgICo7lYTY2IHUmLnNpjYvw5bvmoHvPc0QO2a62w==} - engines: {node: ^16.14.0 || >=18.0.0} - dependencies: - lru-cache: 10.4.3 - dev: true - /html-escaper@2.0.2: resolution: {integrity: sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==} dev: false @@ -16445,7 +16456,6 @@ packages: /interpret@1.4.0: resolution: {integrity: sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==} engines: {node: '>= 0.10'} - dev: false /invariant@2.2.4: resolution: {integrity: sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA==} @@ -16587,12 +16597,6 @@ packages: hasBin: true dev: true - /is-docker@3.0.0: - resolution: {integrity: sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ==} - engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - hasBin: true - dev: true - /is-electron@2.2.2: resolution: {integrity: sha512-FO/Rhvz5tuw4MCWkpMzHFKWD2LsfHzIb7i6MdPYZ/KW7AlxawyLkqdy+jPZP1WubqEADE3O4FUENlJHDfQASRg==} dev: false @@ -16640,14 +16644,6 @@ packages: /is-hexadecimal@2.0.1: resolution: {integrity: sha512-DgZQp241c8oO6cA1SbTEWiXeoxV42vlcJxgH+B3hi1AiqqKruZR3ZGF8In3fj4+/y/7rHvlOZLZtgJ/4ttYGZg==} - /is-inside-container@1.0.0: - resolution: {integrity: sha512-KIYLCCJghfHZxqjYBE7rEy0OBuTd5xCHS7tHVgvCLkx7StIoaxwNW3hCALgEUjFfeRk+MG/Qxmp/vtETEF3tRA==} - engines: {node: '>=14.16'} - hasBin: true - dependencies: - is-docker: 3.0.0 - dev: true - /is-interactive@1.0.0: resolution: {integrity: sha512-2HvIEKRoqS62guEC+qBjpvRubdX910WCMuJTZ+I9yvqKU2/12eSL549HMwtabb4oupdj2sMP50k+XJfB/8JE6w==} engines: {node: '>=8'} @@ -16850,24 +16846,12 @@ packages: is-docker: 2.2.1 dev: true - /is-wsl@3.1.0: - resolution: {integrity: sha512-UcVfVfaK4Sc4m7X3dUSoHoozQGBEFeDC+zVo06t98xe8CzHSZZBekNXH+tu0NalHolcJ/QAGqS46Hef7QXBIMw==} - engines: {node: '>=16'} - dependencies: - is-inside-container: 1.0.0 - dev: true - /isarray@2.0.5: resolution: {integrity: sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==} /isexe@2.0.0: resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==} - /isexe@3.1.1: - resolution: {integrity: sha512-LpB/54B+/2J5hqQ7imZHfdU31OlgQqx7ZicVlkm9kzg9/w8GKLEcFfJl/t7DCEDueOyBAD6zCCwTO6Fzs0NoEQ==} - engines: {node: '>=16'} - dev: true - /isomorphic-fetch@3.0.0: resolution: {integrity: sha512-qvUtwJ3j6qwsF3jLxkZ72qCgjMysPzDfeV240JHiGZsANBYd+EEuu35v7dfrJ9Up0Ak07D7GGSkGhCHTqg/5wA==} dependencies: @@ -18682,10 +18666,22 @@ packages: braces: 3.0.3 picomatch: 2.3.1 + /mime-db@1.25.0: + resolution: {integrity: sha512-5k547tI4Cy+Lddr/hdjNbBEWBwSl8EBc5aSdKvedav8DReADgWJzcYiktaRIw3GtGC1jjwldXtTzvqJZmtvC7w==} + engines: {node: '>= 0.6'} + dev: false + /mime-db@1.52.0: resolution: {integrity: sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==} engines: {node: '>= 0.6'} + /mime-types@2.1.13: + resolution: {integrity: sha512-ryBDp1Z/6X90UvjUK3RksH0IBPM137T7cmg4OgD5wQBojlAiUwuok0QeELkim/72EtcYuNlmbkrcGuxj3Kl0YQ==} + engines: {node: '>= 0.6'} + dependencies: + mime-db: 1.25.0 + dev: false + /mime-types@2.1.35: resolution: {integrity: sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==} engines: {node: '>= 0.6'} @@ -19343,16 +19339,6 @@ packages: resolution: {integrity: sha512-IO9QvjUMWxPQQhs60oOu10CRkWCiZzSUkzbXGGV9pviYl1fXYcvkzQ5jV9z8Y6un8ARoVRl4EtC6v6jNqbaJ/w==} engines: {node: '>=14.16'} - /npm-package-arg@11.0.3: - resolution: {integrity: sha512-sHGJy8sOC1YraBywpzQlIKBE4pBbGbiF95U6Auspzyem956E0+FtDtsx1ZxlOJkQCZ1AFXAY/yuvtFYrOxF+Bw==} - engines: {node: ^16.14.0 || >=18.0.0} - dependencies: - hosted-git-info: 7.0.2 - proc-log: 4.2.0 - semver: 7.6.3 - validate-npm-package-name: 5.0.1 - dev: true - /npm-run-path@4.0.1: resolution: {integrity: sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==} engines: {node: '>=8'} @@ -19371,8 +19357,8 @@ packages: engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dev: false - /npm@10.9.0: - resolution: {integrity: sha512-ZanDioFylI9helNhl2LNd+ErmVD+H5I53ry41ixlLyCBgkuYb+58CvbAp99hW+zr5L9W4X7CchSoeqKdngOLSw==} + /npm@10.2.3: + resolution: {integrity: sha512-GbUui/rHTl0mW8HhJSn4A0Xg89yCR3I9otgJT1i0z1QBPOVlgbh6rlcUTpHT8Gut9O1SJjWRUU0nEcAymhG2tQ==} engines: {node: ^18.17.0 || >=20.5.0} hasBin: true dev: true @@ -19384,7 +19370,6 @@ packages: - '@npmcli/map-workspaces' - '@npmcli/package-json' - '@npmcli/promise-spawn' - - '@npmcli/redact' - '@npmcli/run-script' - '@sigstore/tuf' - abbrev @@ -19393,6 +19378,8 @@ packages: - chalk - ci-info - cli-columns + - cli-table3 + - columnify - fastest-levenshtein - fs-minipass - glob @@ -19428,6 +19415,7 @@ packages: - npm-profile - npm-registry-fetch - npm-user-validate + - npmlog - p-map - pacote - parse-conflict-json @@ -19437,6 +19425,7 @@ packages: - semver - spdx-expression-parse - ssri + - strip-ansi - supports-color - tar - text-table @@ -19512,11 +19501,6 @@ packages: engines: {node: '>= 10'} dev: true - /object-treeify@4.0.1: - resolution: {integrity: sha512-Y6tg5rHfsefSkfKujv2SwHulInROy/rCL5F4w0QOWxut8AnxYxf0YmNhTh95Zfyxpsudo66uqkux0ACFnyMSgQ==} - engines: {node: '>= 16'} - dev: true - /object-values@1.0.0: resolution: {integrity: sha512-+8hwcz/JnQ9EpLIXzN0Rs7DLsBpJNT/xYehtB/jU93tHYr5BFEO8E+JGQNOSqE7opVzz5cGksKFHt7uUJVLSjQ==} engines: {node: '>=0.10.0'} @@ -20304,11 +20288,6 @@ packages: '@probe.gl/stats': 3.6.0 dev: false - /proc-log@4.2.0: - resolution: {integrity: sha512-g8+OnU/L2v+wyiVK+D5fA34J7EH8jZ8DDlvwhRCMxmMj7UCBvxiO1mGeN+36JXIKF4zevU4kRBd8lVgG9vLelA==} - engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} - dev: true - /process-nextick-args@2.0.1: resolution: {integrity: sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==} dev: true @@ -20963,7 +20942,6 @@ packages: engines: {node: '>= 0.10'} dependencies: resolve: 1.22.8 - dev: false /redent@3.0.0: resolution: {integrity: sha512-6tDA8g98We0zd0GvVeMT9arEOnTw9qM03L9cJXaCjrip1OO764RDBLBfrB4cwzNGDj5OA5ioymC9GkizgWJDUg==} @@ -21509,6 +21487,13 @@ packages: fsevents: 2.3.3 dev: true + /rss@1.2.2: + resolution: {integrity: sha512-xUhRTgslHeCBeHAqaWSbOYTydN2f0tAzNXvzh3stjz7QDhQMzdgHf3pfgNIngeytQflrFPfy6axHilTETr6gDg==} + dependencies: + mime-types: 2.1.13 + xml: 1.0.1 + dev: false + /run-async@2.4.1: resolution: {integrity: sha512-tvVnVv01b8c1RrA6Ep7JkStj85Guv/YrMcwqYQnwjsAS2cTmmPGBBjAjpCW7RrSodNSoE2/qg9O4bceNvUuDgQ==} engines: {node: '>=0.12.0'} @@ -21782,7 +21767,6 @@ packages: glob: 7.2.3 interpret: 1.4.0 rechoir: 0.6.2 - dev: false /shiki@0.14.7: resolution: {integrity: sha512-dNPAPrxSc87ua2sKJ3H5dQ/6ZaY8RNnaAqK+t0eG7p0Soi2ydiqbGOTaZCqaYvA/uZYfS1LJnemt3Q+mSfcPCg==} @@ -21873,6 +21857,15 @@ packages: engines: {node: '>=8'} dev: true + /slice-ansi@4.0.0: + resolution: {integrity: sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ==} + engines: {node: '>=10'} + dependencies: + ansi-styles: 4.3.0 + astral-regex: 2.0.0 + is-fullwidth-code-point: 3.0.0 + dev: true + /slice-ansi@5.0.0: resolution: {integrity: sha512-FC+lgizVPfie0kkhqUScwRu1O/lF6NOgJmlCgK+/LYxDCTk8sGelYaHDhFcDN+Sn3Cv+3VSa4Byeo+IMCzpMgQ==} engines: {node: '>=12'} @@ -24124,14 +24117,6 @@ packages: dependencies: isexe: 2.0.0 - /which@4.0.0: - resolution: {integrity: sha512-GlaYyEb07DPxYCKhKzplCWBJtvxZcZMrL+4UkrTSJHHPyZU4mYYTv3qaOe77H7EODLSSopAUFAc6W8U4yqvscg==} - engines: {node: ^16.13.0 || >=18.0.0} - hasBin: true - dependencies: - isexe: 3.1.1 - dev: true - /why-is-node-running@2.3.0: resolution: {integrity: sha512-hUrmaWBdVDcxvYqnyh09zunKzROWjbZTiNy8dBEjkS7ehEDQibXJ7XvlmtbwuTclUiIyN+CyXQD4Vmko8fNm8w==} engines: {node: '>=8'} @@ -24354,6 +24339,10 @@ packages: xmlbuilder: 11.0.1 dev: true + /xml@1.0.1: + resolution: {integrity: sha512-huCv9IH9Tcf95zuYCsQraZtWnJvBtLVE0QHMOs8bWyZAFZNDcYjsPq1nEx8jKA9y+Beo9v+7OBPRisQTjinQMw==} + dev: false + /xmlbuilder@11.0.1: resolution: {integrity: sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA==} engines: {node: '>=4.0'} From 4200df32c4ee43149e8542b9676558c9e5932a10 Mon Sep 17 00:00:00 2001 From: James P Date: Tue, 8 Oct 2024 17:46:59 -0400 Subject: [PATCH 2/9] Update route.ts --- apps/www/app/feed.xml/route.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/www/app/feed.xml/route.ts b/apps/www/app/feed.xml/route.ts index cdca05473f..5054b485fc 100644 --- a/apps/www/app/feed.xml/route.ts +++ b/apps/www/app/feed.xml/route.ts @@ -5,7 +5,7 @@ const feed = new RSS({ title: "Unkey", description: "Open Source API Development platform", site_url: "https://unkey.com", - feed_url: `https://unkey.com/feed.xml`, + feed_url: "https://unkey.com/feed.xml", copyright: `${new Date().getFullYear()} Unkey`, language: "en", pubDate: new Date(), From 8bb83db834c5041295fe2614444032cfc0dc7f22 Mon Sep 17 00:00:00 2001 From: James P Date: Tue, 8 Oct 2024 21:54:18 -0400 Subject: [PATCH 3/9] Update nextjs.mdx --- apps/docs/quickstart/ratelimiting/nextjs.mdx | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/apps/docs/quickstart/ratelimiting/nextjs.mdx b/apps/docs/quickstart/ratelimiting/nextjs.mdx index 46fe3678a0..74255500e3 100644 --- a/apps/docs/quickstart/ratelimiting/nextjs.mdx +++ b/apps/docs/quickstart/ratelimiting/nextjs.mdx @@ -85,15 +85,15 @@ import { NextResponse } from 'next/server'; import {Ratelimit } from "@unkey/ratelimit"; const limiter = new Ratelimit({ -namespace: "hono-example", -limit: 2, -duration: "30s", -rootKey: process.env.UNKEY_ROOT_KEY + namespace: "next-example", + limit: 2, + duration: "30s", + rootKey: process.env.UNKEY_ROOT_KEY }); export const POST = (async (req) => { const identifier = getUserId(); // or ip or anything else you want - const ratelimit = await unkey.limit(identifier) + const ratelimit = await limiter.limit(identifier) if (!ratelimit.success){ return new NextResponse("Please try again later", {status: 429}); } @@ -107,9 +107,9 @@ export const POST = (async (req) => { - + ```bash - bun run dev + npm run dev ``` @@ -122,11 +122,12 @@ export const POST = (async (req) => { yarn run dev ``` - + ```bash - npm run dev + bun run dev ``` + From e6d52608525a4977d179aed144ac54db7b48efae Mon Sep 17 00:00:00 2001 From: James P Date: Tue, 8 Oct 2024 21:57:19 -0400 Subject: [PATCH 4/9] Update nextjs.mdx --- apps/docs/quickstart/ratelimiting/nextjs.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/docs/quickstart/ratelimiting/nextjs.mdx b/apps/docs/quickstart/ratelimiting/nextjs.mdx index 74255500e3..381a28250f 100644 --- a/apps/docs/quickstart/ratelimiting/nextjs.mdx +++ b/apps/docs/quickstart/ratelimiting/nextjs.mdx @@ -82,7 +82,7 @@ Create a new route and add the following code ```ts /app/protected/route.ts import { NextResponse } from 'next/server'; -import {Ratelimit } from "@unkey/ratelimit"; +import { Ratelimit } from "@unkey/ratelimit"; const limiter = new Ratelimit({ namespace: "next-example", From 755a5f3fcfcb8a7cd2f1626d824272d07cfabccd Mon Sep 17 00:00:00 2001 From: James P Date: Tue, 8 Oct 2024 21:59:24 -0400 Subject: [PATCH 5/9] Update bun.mdx --- apps/docs/quickstart/ratelimiting/bun.mdx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/docs/quickstart/ratelimiting/bun.mdx b/apps/docs/quickstart/ratelimiting/bun.mdx index 80192a3260..c19bd045c4 100644 --- a/apps/docs/quickstart/ratelimiting/bun.mdx +++ b/apps/docs/quickstart/ratelimiting/bun.mdx @@ -58,17 +58,17 @@ duration = amount of time to limit against for example "30s" **/ const limiter = new Ratelimit({ -namespace: "bun-example", -limit: 2, -duration: "30s", -rootKey: process.env.UNKEY_ROOT_KEY + namespace: "bun-example", + limit: 2, + duration: "30s", + rootKey: process.env.UNKEY_ROOT_KEY }) const server = Bun.serve({ async fetch(req) { const identifier = req.getUserId() // or ip or anything else you want - const ratelimit = await unkey.limit(identifier) + const ratelimit = await limiter.limit(identifier) if (!ratelimit.success){ return Response("try again later", { status: 429 }) } From 4d2eb01877db69fff24f895b8d005dea1ef04c08 Mon Sep 17 00:00:00 2001 From: James P Date: Tue, 8 Oct 2024 22:00:18 -0400 Subject: [PATCH 6/9] Update hono.mdx --- apps/docs/quickstart/ratelimiting/hono.mdx | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/apps/docs/quickstart/ratelimiting/hono.mdx b/apps/docs/quickstart/ratelimiting/hono.mdx index f83d033238..f525247b24 100644 --- a/apps/docs/quickstart/ratelimiting/hono.mdx +++ b/apps/docs/quickstart/ratelimiting/hono.mdx @@ -82,20 +82,20 @@ Create a new route and add the following code ```ts /src/index.ts import { Hono } from "hono"; -import {Ratelimit } from "@unkey/ratelimit"; +import { Ratelimit } from "@unkey/ratelimit"; const app = new Hono(); const limiter = new Ratelimit({ -namespace: "hono-example", -limit: 2, -duration: "30s", -rootKey: process.env.UNKEY_ROOT_KEY + namespace: "hono-example", + limit: 2, + duration: "30s", + rootKey: process.env.UNKEY_ROOT_KEY }); app.get("/", (c) => { const identifier = getUserId(); // or ip or anything else you want - const ratelimit = await unkey.limit(identifier) + const ratelimit = await limiter.limit(identifier) if (!ratelimit.success){ return c.status(429).text("Please try again later") } @@ -110,12 +110,12 @@ export default app; - + ```bash - bun run dev + npm run dev ``` - + ```bash pnpm run dev ``` @@ -125,9 +125,9 @@ export default app; yarn run dev ``` - + ```bash - npm run dev + bun run dev ``` From c8583041900d400046d624a28a95115f3e085a5e Mon Sep 17 00:00:00 2001 From: James P Date: Tue, 8 Oct 2024 22:01:08 -0400 Subject: [PATCH 7/9] Update express.mdx --- apps/docs/quickstart/ratelimiting/express.mdx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/docs/quickstart/ratelimiting/express.mdx b/apps/docs/quickstart/ratelimiting/express.mdx index f00be16bb9..909a97708e 100644 --- a/apps/docs/quickstart/ratelimiting/express.mdx +++ b/apps/docs/quickstart/ratelimiting/express.mdx @@ -80,10 +80,10 @@ duration = amount of time to limit against for example "30s" **/ const limiter = new Ratelimit({ -namespace: "express-example", -limit: 2, -duration: "30s", -rootKey: process.env.UNKEY_ROOT_KEY + namespace: "express-example", + limit: 2, + duration: "30s", + rootKey: process.env.UNKEY_ROOT_KEY }); @@ -95,7 +95,7 @@ app.get('/', (req: Request, res: Response) => { app.get('/secret', async (req: Request, res: Response) => { const identifier = req.getUserId() // or ip or anything else you want - const ratelimit = await unkey.limit(identifier) + const ratelimit = await limiter.limit(identifier) if (!ratelimit.success){ res.status(429).send("Please try again later") } From 2b3dd6fcc4dc6dede149e97fabe421efa613b2be Mon Sep 17 00:00:00 2001 From: James P Date: Tue, 8 Oct 2024 22:02:23 -0400 Subject: [PATCH 8/9] Update hono.mdx --- apps/docs/quickstart/ratelimiting/hono.mdx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/docs/quickstart/ratelimiting/hono.mdx b/apps/docs/quickstart/ratelimiting/hono.mdx index f525247b24..491acc8ac8 100644 --- a/apps/docs/quickstart/ratelimiting/hono.mdx +++ b/apps/docs/quickstart/ratelimiting/hono.mdx @@ -87,10 +87,10 @@ import { Ratelimit } from "@unkey/ratelimit"; const app = new Hono(); const limiter = new Ratelimit({ - namespace: "hono-example", - limit: 2, - duration: "30s", - rootKey: process.env.UNKEY_ROOT_KEY + namespace: "hono-example", + limit: 2, + duration: "30s", + rootKey: process.env.UNKEY_ROOT_KEY }); app.get("/", (c) => { From b01d946fd5ca1c862c4519ac077a33792620f146 Mon Sep 17 00:00:00 2001 From: Andreas Thomas Date: Wed, 9 Oct 2024 13:42:59 +0200 Subject: [PATCH 9/9] chore: warn on unused imports (#2285) * chore: warn on unused imports * fix: import React and exclude it from rule --- .../lib/db-marketing/schemas/searchQuery.ts | 2 +- .../src/lib/db-marketing/schemas/serper.ts | 3 - apps/billing/src/lib/tinybird.ts | 1 - .../billing/src/trigger/downgrade-requests.ts | 4 +- apps/billing/src/trigger/invoicing.ts | 1 - .../permissions/[permissionId]/page.tsx | 1 - .../authorization/roles/[roleId]/page.tsx | 1 - .../@breadcrumb/authorization/roles/page.tsx | 1 - .../app/(app)/@breadcrumb/identities/page.tsx | 3 - .../[keyId]/settings/update-key-ratelimit.tsx | 1 - apps/dashboard/app/(app)/apis/client.tsx | 1 - .../app/(app)/authorization/layout.tsx | 4 - .../dashboard/app/(app)/identities/layout.tsx | 4 - apps/dashboard/app/(app)/identities/page.tsx | 12 +- .../overrides/[overrideId]/settings.tsx | 10 -- .../semantic-cache/[gatewayId]/logs/page.tsx | 1 - .../app/(app)/semantic-cache/page.tsx | 1 - .../app/(app)/settings/billing/plans/page.tsx | 1 - .../[keyId]/permissions/permission_toggle.tsx | 2 - apps/dashboard/app/new/keys.tsx | 1 - apps/dashboard/app/theme-provider.tsx | 1 - .../dashboard/create-key-button.tsx | 1 - .../components/dashboard/loading.tsx | 2 +- .../lib/trpc/routers/key/updateName.ts | 2 +- .../lib/trpc/routers/key/updateOwnerId.ts | 1 - .../lib/trpc/routers/key/updateRootKeyName.ts | 1 - apps/dashboard/lib/trpc/routers/rbac.ts | 1 - apps/logdrain/src/worker.ts | 2 +- apps/play/app/page-bk.tsx | 1 - apps/play/app/page.tsx | 1 - .../accelerate/components/audit-logs-ga.tsx | 2 - .../accelerate/components/recovering-keys.tsx | 2 - apps/www/app/accelerate/components/rive.tsx | 1 - .../accelerate/components/semantic-cache.tsx | 2 - .../app/accelerate/components/swagground.tsx | 2 - .../app/accelerate/components/unkey-cache.tsx | 2 - apps/www/app/feed.xml/route.ts | 4 +- apps/www/app/hero/hero-main-section.tsx | 4 +- apps/www/app/page.tsx | 1 - apps/www/app/pricing/discover.tsx | 2 +- apps/www/components/blog/darkTheme.ts | 1 - apps/www/components/blog/suggested-blogs.tsx | 1 - apps/www/components/hashed-keys.tsx | 2 +- apps/www/components/mdx-content.tsx | 1 - apps/www/components/navbar/navigation.tsx | 3 +- apps/www/components/template/codeblock.tsx | 2 +- .../components/template/mdx-components.tsx | 1 - biome.json | 3 +- internal/resend/emails/payment_issue.tsx | 2 + .../emails/secret_scanning_key_detected.tsx | 2 + internal/resend/emails/subscription_ended.tsx | 5 +- internal/resend/emails/trial_ended.tsx | 1 + internal/resend/emails/welcome_email.tsx | 2 + internal/resend/src/client.tsx | 1 - packages/api/src/openapi.d.ts | 120 ++++++++++++++++++ .../cache/src/middleware/encryption.test.ts | 2 +- packages/cache/src/middleware/encryption.ts | 2 +- tools/migrate/auditlog-import.ts | 2 +- tools/migrate/main.ts | 2 +- 59 files changed, 152 insertions(+), 93 deletions(-) diff --git a/apps/billing/src/lib/db-marketing/schemas/searchQuery.ts b/apps/billing/src/lib/db-marketing/schemas/searchQuery.ts index 6161b303ae..29e4fcd08e 100644 --- a/apps/billing/src/lib/db-marketing/schemas/searchQuery.ts +++ b/apps/billing/src/lib/db-marketing/schemas/searchQuery.ts @@ -1,4 +1,4 @@ -import { relations, sql } from "drizzle-orm"; +import { relations } from "drizzle-orm"; import { boolean, index, diff --git a/apps/billing/src/lib/db-marketing/schemas/serper.ts b/apps/billing/src/lib/db-marketing/schemas/serper.ts index 4bbc593240..9b99eadeec 100644 --- a/apps/billing/src/lib/db-marketing/schemas/serper.ts +++ b/apps/billing/src/lib/db-marketing/schemas/serper.ts @@ -1,7 +1,4 @@ -import { db } from "@/lib/db-marketing/client"; -import type * as serper from "@/lib/serper"; import { relations } from "drizzle-orm"; -import { eq } from "drizzle-orm"; import { index, int, json, mysqlTable, text, timestamp, varchar } from "drizzle-orm/mysql-core"; import { createSelectSchema } from "drizzle-zod"; import type { z } from "zod"; diff --git a/apps/billing/src/lib/tinybird.ts b/apps/billing/src/lib/tinybird.ts index b6cf6b9a4c..4eaf645b81 100644 --- a/apps/billing/src/lib/tinybird.ts +++ b/apps/billing/src/lib/tinybird.ts @@ -1,5 +1,4 @@ import { Tinybird as Client } from "@chronark/zod-bird"; -import { newId } from "@unkey/id"; import { z } from "zod"; export class Tinybird { diff --git a/apps/billing/src/trigger/downgrade-requests.ts b/apps/billing/src/trigger/downgrade-requests.ts index a20991da02..a3942fdb07 100644 --- a/apps/billing/src/trigger/downgrade-requests.ts +++ b/apps/billing/src/trigger/downgrade-requests.ts @@ -1,7 +1,5 @@ import { connectDatabase, eq, schema } from "@/lib/db"; -import { env } from "@/lib/env"; -import { eventTrigger } from "@trigger.dev/sdk"; -import { logger, task } from "@trigger.dev/sdk/v3"; +import { task } from "@trigger.dev/sdk/v3"; export const downgradeTask = task({ id: "billing_downgrade", diff --git a/apps/billing/src/trigger/invoicing.ts b/apps/billing/src/trigger/invoicing.ts index 04cdf06f83..cb1e65266b 100644 --- a/apps/billing/src/trigger/invoicing.ts +++ b/apps/billing/src/trigger/invoicing.ts @@ -2,7 +2,6 @@ import { logger, schedules } from "@trigger.dev/sdk/v3"; import { connectDatabase } from "@/lib/db"; -import Stripe from "stripe"; import { createInvoiceTask } from "./create-invoice"; import { downgradeTask } from "./downgrade-requests"; diff --git a/apps/dashboard/app/(app)/@breadcrumb/authorization/permissions/[permissionId]/page.tsx b/apps/dashboard/app/(app)/@breadcrumb/authorization/permissions/[permissionId]/page.tsx index 8ffd960e18..ab0f5b8b15 100644 --- a/apps/dashboard/app/(app)/@breadcrumb/authorization/permissions/[permissionId]/page.tsx +++ b/apps/dashboard/app/(app)/@breadcrumb/authorization/permissions/[permissionId]/page.tsx @@ -8,7 +8,6 @@ import { } from "@/components/ui/breadcrumb"; import { BreadcrumbSkeleton } from "@/components/dashboard/breadcrumb-skeleton"; -import { getTenantId } from "@/lib/auth"; import { db } from "@/lib/db"; import { unstable_cache as cache } from "next/cache"; import { Suspense } from "react"; diff --git a/apps/dashboard/app/(app)/@breadcrumb/authorization/roles/[roleId]/page.tsx b/apps/dashboard/app/(app)/@breadcrumb/authorization/roles/[roleId]/page.tsx index 6491b344ff..0313340ea9 100644 --- a/apps/dashboard/app/(app)/@breadcrumb/authorization/roles/[roleId]/page.tsx +++ b/apps/dashboard/app/(app)/@breadcrumb/authorization/roles/[roleId]/page.tsx @@ -8,7 +8,6 @@ import { } from "@/components/ui/breadcrumb"; import { BreadcrumbSkeleton } from "@/components/dashboard/breadcrumb-skeleton"; -import { getTenantId } from "@/lib/auth"; import { db } from "@/lib/db"; import { unstable_cache as cache } from "next/cache"; import { Suspense } from "react"; diff --git a/apps/dashboard/app/(app)/@breadcrumb/authorization/roles/page.tsx b/apps/dashboard/app/(app)/@breadcrumb/authorization/roles/page.tsx index a4bfec6721..a4ddaadccf 100644 --- a/apps/dashboard/app/(app)/@breadcrumb/authorization/roles/page.tsx +++ b/apps/dashboard/app/(app)/@breadcrumb/authorization/roles/page.tsx @@ -1,7 +1,6 @@ import { Breadcrumb, BreadcrumbItem, - BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, diff --git a/apps/dashboard/app/(app)/@breadcrumb/identities/page.tsx b/apps/dashboard/app/(app)/@breadcrumb/identities/page.tsx index 0c9a2b052b..72cad67391 100644 --- a/apps/dashboard/app/(app)/@breadcrumb/identities/page.tsx +++ b/apps/dashboard/app/(app)/@breadcrumb/identities/page.tsx @@ -1,11 +1,8 @@ -import { Badge } from "@/components/ui/badge"; import { Breadcrumb, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, - BreadcrumbPage, - BreadcrumbSeparator, } from "@/components/ui/breadcrumb"; export const dynamic = "force-dynamic"; diff --git a/apps/dashboard/app/(app)/apis/[apiId]/keys/[keyAuthId]/[keyId]/settings/update-key-ratelimit.tsx b/apps/dashboard/app/(app)/apis/[apiId]/keys/[keyAuthId]/[keyId]/settings/update-key-ratelimit.tsx index a74b2cad4e..bb4aae4d2f 100644 --- a/apps/dashboard/app/(app)/apis/[apiId]/keys/[keyAuthId]/[keyId]/settings/update-key-ratelimit.tsx +++ b/apps/dashboard/app/(app)/apis/[apiId]/keys/[keyAuthId]/[keyId]/settings/update-key-ratelimit.tsx @@ -25,7 +25,6 @@ import { toast } from "@/components/ui/toaster"; import { trpc } from "@/lib/trpc/client"; import { cn } from "@/lib/utils"; import { zodResolver } from "@hookform/resolvers/zod"; -import type { Key } from "@unkey/db"; import { useRouter } from "next/navigation"; import { useForm } from "react-hook-form"; import { z } from "zod"; diff --git a/apps/dashboard/app/(app)/apis/client.tsx b/apps/dashboard/app/(app)/apis/client.tsx index 60f0ea5e15..5ddd90826d 100644 --- a/apps/dashboard/app/(app)/apis/client.tsx +++ b/apps/dashboard/app/(app)/apis/client.tsx @@ -1,6 +1,5 @@ "use client"; import { EmptyPlaceholder } from "@/components/dashboard/empty-placeholder"; -import { PageHeader } from "@/components/dashboard/page-header"; import { Button } from "@/components/ui/button"; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"; import { Separator } from "@/components/ui/separator"; diff --git a/apps/dashboard/app/(app)/authorization/layout.tsx b/apps/dashboard/app/(app)/authorization/layout.tsx index 01d2554797..70fcb4677b 100644 --- a/apps/dashboard/app/(app)/authorization/layout.tsx +++ b/apps/dashboard/app/(app)/authorization/layout.tsx @@ -1,12 +1,8 @@ import type * as React from "react"; -import { Banner } from "@/components/banner"; import { Navbar } from "@/components/dashboard/navbar"; -import { PageHeader } from "@/components/dashboard/page-header"; -import { OptIn } from "@/components/opt-in"; import { getTenantId } from "@/lib/auth"; import { db } from "@/lib/db"; -import Link from "next/link"; import { redirect } from "next/navigation"; export const dynamic = "force-dynamic"; diff --git a/apps/dashboard/app/(app)/identities/layout.tsx b/apps/dashboard/app/(app)/identities/layout.tsx index bde77c358d..165b1b041f 100644 --- a/apps/dashboard/app/(app)/identities/layout.tsx +++ b/apps/dashboard/app/(app)/identities/layout.tsx @@ -1,12 +1,8 @@ import type * as React from "react"; -import { Banner } from "@/components/banner"; -import { Navbar } from "@/components/dashboard/navbar"; -import { PageHeader } from "@/components/dashboard/page-header"; import { OptIn } from "@/components/opt-in"; import { getTenantId } from "@/lib/auth"; import { db } from "@/lib/db"; -import Link from "next/link"; import { redirect } from "next/navigation"; export const dynamic = "force-dynamic"; diff --git a/apps/dashboard/app/(app)/identities/page.tsx b/apps/dashboard/app/(app)/identities/page.tsx index 476154eabd..849f1cb592 100644 --- a/apps/dashboard/app/(app)/identities/page.tsx +++ b/apps/dashboard/app/(app)/identities/page.tsx @@ -1,18 +1,10 @@ import { redirect } from "next/navigation"; import { EmptyPlaceholder } from "@/components/dashboard/empty-placeholder"; -import { - Table, - TableBody, - TableCell, - TableFooter, - TableHead, - TableHeader, - TableRow, -} from "@/components/ui/table"; +import { Table, TableBody, TableHead, TableHeader, TableRow } from "@/components/ui/table"; import { getTenantId } from "@/lib/auth"; import { db } from "@/lib/db"; -import { Loader2, Scan } from "lucide-react"; +import { Loader2 } from "lucide-react"; import { unstable_cache as cache } from "next/cache"; import { parseAsInteger, parseAsString } from "nuqs/server"; import { Suspense } from "react"; diff --git a/apps/dashboard/app/(app)/ratelimits/[namespaceId]/overrides/[overrideId]/settings.tsx b/apps/dashboard/app/(app)/ratelimits/[namespaceId]/overrides/[overrideId]/settings.tsx index 4766a16653..f8e6bd8a2b 100644 --- a/apps/dashboard/app/(app)/ratelimits/[namespaceId]/overrides/[overrideId]/settings.tsx +++ b/apps/dashboard/app/(app)/ratelimits/[namespaceId]/overrides/[overrideId]/settings.tsx @@ -1,16 +1,7 @@ "use client"; import { Loading } from "@/components/dashboard/loading"; -import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert"; import { Button } from "@/components/ui/button"; import { Card, CardContent, CardFooter, CardHeader, CardTitle } from "@/components/ui/card"; -import { - Dialog, - DialogContent, - DialogDescription, - DialogFooter, - DialogHeader, - DialogTitle, -} from "@/components/ui/dialog"; import { Form, FormControl, @@ -33,7 +24,6 @@ import { trpc } from "@/lib/trpc/client"; import { zodResolver } from "@hookform/resolvers/zod"; import { useRouter } from "next/navigation"; import type React from "react"; -import { useState } from "react"; import { useForm } from "react-hook-form"; import { z } from "zod"; diff --git a/apps/dashboard/app/(app)/semantic-cache/[gatewayId]/logs/page.tsx b/apps/dashboard/app/(app)/semantic-cache/[gatewayId]/logs/page.tsx index 41fdea6e77..0bf1c69bdb 100644 --- a/apps/dashboard/app/(app)/semantic-cache/[gatewayId]/logs/page.tsx +++ b/apps/dashboard/app/(app)/semantic-cache/[gatewayId]/logs/page.tsx @@ -1,4 +1,3 @@ -import { Button } from "@/components/ui/button"; import { getTenantId } from "@/lib/auth"; import { db } from "@/lib/db"; import { getAllSemanticCacheLogs } from "@/lib/tinybird"; diff --git a/apps/dashboard/app/(app)/semantic-cache/page.tsx b/apps/dashboard/app/(app)/semantic-cache/page.tsx index 1fcfc298eb..3f180bd4eb 100644 --- a/apps/dashboard/app/(app)/semantic-cache/page.tsx +++ b/apps/dashboard/app/(app)/semantic-cache/page.tsx @@ -1,4 +1,3 @@ -import { PageHeader } from "@/components/dashboard/page-header"; import { getTenantId } from "@/lib/auth"; import { db } from "@/lib/db"; import { redirect } from "next/navigation"; diff --git a/apps/dashboard/app/(app)/settings/billing/plans/page.tsx b/apps/dashboard/app/(app)/settings/billing/plans/page.tsx index 445085c11d..3d79c9c6b6 100644 --- a/apps/dashboard/app/(app)/settings/billing/plans/page.tsx +++ b/apps/dashboard/app/(app)/settings/billing/plans/page.tsx @@ -4,7 +4,6 @@ import { db } from "@/lib/db"; import { ArrowLeft } from "lucide-react"; import Link from "next/link"; import { notFound } from "next/navigation"; -import React from "react"; import { ChangePlanButton } from "./button"; const tiers = { diff --git a/apps/dashboard/app/(app)/settings/root-keys/[keyId]/permissions/permission_toggle.tsx b/apps/dashboard/app/(app)/settings/root-keys/[keyId]/permissions/permission_toggle.tsx index c23c8322c0..d7e64585c5 100644 --- a/apps/dashboard/app/(app)/settings/root-keys/[keyId]/permissions/permission_toggle.tsx +++ b/apps/dashboard/app/(app)/settings/root-keys/[keyId]/permissions/permission_toggle.tsx @@ -1,10 +1,8 @@ "use client"; -import { CopyButton } from "@/components/dashboard/copy-button"; import { Checkbox } from "@/components/ui/checkbox"; import { Label } from "@/components/ui/label"; import { toast } from "@/components/ui/toaster"; -import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip"; import { trpc } from "@/lib/trpc/client"; import { Loader2 } from "lucide-react"; import { useRouter } from "next/navigation"; diff --git a/apps/dashboard/app/new/keys.tsx b/apps/dashboard/app/new/keys.tsx index 29758c324f..726e8b12c6 100644 --- a/apps/dashboard/app/new/keys.tsx +++ b/apps/dashboard/app/new/keys.tsx @@ -16,7 +16,6 @@ import { } from "@/components/ui/card"; import { Code } from "@/components/ui/code"; import { Separator } from "@/components/ui/separator"; -import { toast } from "@/components/ui/toaster"; import { trpc } from "@/lib/trpc/client"; import { AlertCircle, KeyRound, Lock } from "lucide-react"; import Link from "next/link"; diff --git a/apps/dashboard/app/theme-provider.tsx b/apps/dashboard/app/theme-provider.tsx index f670c8e306..c06a57bf36 100644 --- a/apps/dashboard/app/theme-provider.tsx +++ b/apps/dashboard/app/theme-provider.tsx @@ -2,7 +2,6 @@ import { ThemeProvider as NextThemesProvider } from "next-themes"; import type { ThemeProviderProps } from "next-themes/dist/types"; -import * as React from "react"; export function ThemeProvider({ children, ...props }: ThemeProviderProps) { return {children}; diff --git a/apps/dashboard/components/dashboard/create-key-button.tsx b/apps/dashboard/components/dashboard/create-key-button.tsx index 5d7cfcd349..9960ba0a77 100644 --- a/apps/dashboard/components/dashboard/create-key-button.tsx +++ b/apps/dashboard/components/dashboard/create-key-button.tsx @@ -1,7 +1,6 @@ "use client"; import Link from "next/link"; import { usePathname } from "next/navigation"; -import React from "react"; import { Button } from "../ui/button"; export const CreateKeyButton = (props: { apiId: string; keyAuthId: string }) => { diff --git a/apps/dashboard/components/dashboard/loading.tsx b/apps/dashboard/components/dashboard/loading.tsx index 0d87481b02..412e737b79 100644 --- a/apps/dashboard/components/dashboard/loading.tsx +++ b/apps/dashboard/components/dashboard/loading.tsx @@ -1,4 +1,4 @@ -import React, { type SVGProps } from "react"; +import type { SVGProps } from "react"; export function Loading({ width = 24, diff --git a/apps/dashboard/lib/trpc/routers/key/updateName.ts b/apps/dashboard/lib/trpc/routers/key/updateName.ts index 23ab0d1a9f..388acc4531 100644 --- a/apps/dashboard/lib/trpc/routers/key/updateName.ts +++ b/apps/dashboard/lib/trpc/routers/key/updateName.ts @@ -3,7 +3,7 @@ import { db, eq, schema } from "@/lib/db"; import { rateLimitedProcedure, ratelimit } from "@/lib/trpc/ratelimitProcedure"; import { TRPCError } from "@trpc/server"; import { z } from "zod"; -import { auth, t } from "../../trpc"; +import { auth } from "../../trpc"; export const updateKeyName = rateLimitedProcedure(ratelimit.update) .use(auth) diff --git a/apps/dashboard/lib/trpc/routers/key/updateOwnerId.ts b/apps/dashboard/lib/trpc/routers/key/updateOwnerId.ts index 7fb8a5b807..9168941756 100644 --- a/apps/dashboard/lib/trpc/routers/key/updateOwnerId.ts +++ b/apps/dashboard/lib/trpc/routers/key/updateOwnerId.ts @@ -3,7 +3,6 @@ import { db, eq, schema } from "@/lib/db"; import { rateLimitedProcedure, ratelimit } from "@/lib/trpc/ratelimitProcedure"; import { TRPCError } from "@trpc/server"; import { z } from "zod"; -import { auth, t } from "../../trpc"; export const updateKeyOwnerId = rateLimitedProcedure(ratelimit.update) .input( diff --git a/apps/dashboard/lib/trpc/routers/key/updateRootKeyName.ts b/apps/dashboard/lib/trpc/routers/key/updateRootKeyName.ts index 79c4978e01..dcb81e1c52 100644 --- a/apps/dashboard/lib/trpc/routers/key/updateRootKeyName.ts +++ b/apps/dashboard/lib/trpc/routers/key/updateRootKeyName.ts @@ -1,6 +1,5 @@ import { insertAuditLogs } from "@/lib/audit"; import { db, eq, schema } from "@/lib/db"; -import { env } from "@/lib/env"; import { TRPCError } from "@trpc/server"; import { z } from "zod"; import { auth, t } from "../../trpc"; diff --git a/apps/dashboard/lib/trpc/routers/rbac.ts b/apps/dashboard/lib/trpc/routers/rbac.ts index 0fef9a8a53..63d2abb6ff 100644 --- a/apps/dashboard/lib/trpc/routers/rbac.ts +++ b/apps/dashboard/lib/trpc/routers/rbac.ts @@ -6,7 +6,6 @@ import { rateLimitedProcedure, ratelimit } from "@/lib/trpc/ratelimitProcedure"; import { TRPCError } from "@trpc/server"; import { newId } from "@unkey/id"; import { unkeyPermissionValidation } from "@unkey/rbac"; -import { Text } from "@visx/text"; import { z } from "zod"; import type { Context } from "../context"; import { t } from "../trpc"; diff --git a/apps/logdrain/src/worker.ts b/apps/logdrain/src/worker.ts index ba865c32fd..37d7322d7b 100644 --- a/apps/logdrain/src/worker.ts +++ b/apps/logdrain/src/worker.ts @@ -1,5 +1,5 @@ import { Axiom } from "@axiomhq/js"; -import { type LogSchema, logSchema } from "@unkey/logs"; +import { logSchema } from "@unkey/logs"; import { decompressSync, strFromU8 } from "fflate"; import { z } from "zod"; diff --git a/apps/play/app/page-bk.tsx b/apps/play/app/page-bk.tsx index e4c3c865e7..5c510e33d3 100644 --- a/apps/play/app/page-bk.tsx +++ b/apps/play/app/page-bk.tsx @@ -1,7 +1,6 @@ "use client"; import TerminalInput from "@/components/ui/terminalInput"; -import TextAnimator from "@/components/ui/textAnimator"; import { type Message, getStepsData } from "@/lib/data"; import { handleCurlServer } from "@/lib/helper"; import { cn } from "@/lib/utils"; diff --git a/apps/play/app/page.tsx b/apps/play/app/page.tsx index fff657ed07..8989cb9c84 100644 --- a/apps/play/app/page.tsx +++ b/apps/play/app/page.tsx @@ -8,7 +8,6 @@ import { z } from "zod"; import { Button } from "@/components/ui/button"; import { NamedInput } from "@/components/ui/input"; -import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"; import { Textarea } from "@/components/ui/textarea"; import { protectedApiRequestSchema } from "@/lib/schemas"; import { cn } from "@/lib/utils"; diff --git a/apps/www/app/accelerate/components/audit-logs-ga.tsx b/apps/www/app/accelerate/components/audit-logs-ga.tsx index 1824e12c36..88e39eb624 100644 --- a/apps/www/app/accelerate/components/audit-logs-ga.tsx +++ b/apps/www/app/accelerate/components/audit-logs-ga.tsx @@ -1,5 +1,3 @@ -import React from "react"; - export function AccelerateAuditLogsIcon() { return ( diff --git a/apps/www/app/accelerate/components/recovering-keys.tsx b/apps/www/app/accelerate/components/recovering-keys.tsx index 2839964766..5ad495c8af 100644 --- a/apps/www/app/accelerate/components/recovering-keys.tsx +++ b/apps/www/app/accelerate/components/recovering-keys.tsx @@ -1,5 +1,3 @@ -import React from "react"; - export function AccelerateRecoveringKeysIcon() { return ( diff --git a/apps/www/app/accelerate/components/rive.tsx b/apps/www/app/accelerate/components/rive.tsx index 37ab492212..2c5ee7c7cf 100644 --- a/apps/www/app/accelerate/components/rive.tsx +++ b/apps/www/app/accelerate/components/rive.tsx @@ -1,7 +1,6 @@ "use client"; import { - Event, EventType, RiveEventType, useRive, diff --git a/apps/www/app/accelerate/components/semantic-cache.tsx b/apps/www/app/accelerate/components/semantic-cache.tsx index c9fb63f1fc..1ed9e3f347 100644 --- a/apps/www/app/accelerate/components/semantic-cache.tsx +++ b/apps/www/app/accelerate/components/semantic-cache.tsx @@ -1,5 +1,3 @@ -import React from "react"; - export function AccelerateSemanticCacheIcon() { return ( diff --git a/apps/www/app/accelerate/components/swagground.tsx b/apps/www/app/accelerate/components/swagground.tsx index 31bde8802f..9313f63e93 100644 --- a/apps/www/app/accelerate/components/swagground.tsx +++ b/apps/www/app/accelerate/components/swagground.tsx @@ -1,5 +1,3 @@ -import React from "react"; - export function AccelerateSwaggroundIcon() { return ( diff --git a/apps/www/app/accelerate/components/unkey-cache.tsx b/apps/www/app/accelerate/components/unkey-cache.tsx index 6e4d104bad..e38d4f006e 100644 --- a/apps/www/app/accelerate/components/unkey-cache.tsx +++ b/apps/www/app/accelerate/components/unkey-cache.tsx @@ -1,5 +1,3 @@ -import React from "react"; - export function AccelerateUnkeyCacheIcon() { return ( diff --git a/apps/www/app/feed.xml/route.ts b/apps/www/app/feed.xml/route.ts index 5054b485fc..56cd3e993f 100644 --- a/apps/www/app/feed.xml/route.ts +++ b/apps/www/app/feed.xml/route.ts @@ -1,6 +1,6 @@ -import RSS from "rss"; -import { type Post, allPosts } from "content-collections"; import { authors } from "@/content/blog/authors"; +import { type Post, allPosts } from "content-collections"; +import RSS from "rss"; const feed = new RSS({ title: "Unkey", description: "Open Source API Development platform", diff --git a/apps/www/app/hero/hero-main-section.tsx b/apps/www/app/hero/hero-main-section.tsx index d34c967414..746e610d1a 100644 --- a/apps/www/app/hero/hero-main-section.tsx +++ b/apps/www/app/hero/hero-main-section.tsx @@ -1,7 +1,7 @@ import Link from "next/link"; -import { PrimaryButton, RainbowDarkButton, SecondaryButton } from "@/components/button"; -import { ArrowRight, BookOpen, ChevronRight, LogIn } from "lucide-react"; +import { PrimaryButton, SecondaryButton } from "@/components/button"; +import { BookOpen, ChevronRight, LogIn } from "lucide-react"; export function HeroMainSection() { return ( diff --git a/apps/www/app/page.tsx b/apps/www/app/page.tsx index be88aa9826..4c7196c68f 100644 --- a/apps/www/app/page.tsx +++ b/apps/www/app/page.tsx @@ -11,7 +11,6 @@ import { LatencyBento } from "@/components/latency-bento"; import { OpenSource } from "@/components/open-source"; import { RateLimitsBento } from "@/components/rate-limits-bento"; import { Section, SectionTitle } from "@/components/section"; -import { Stats } from "@/components/stats"; import { FeatureGridChip } from "@/components/svg/feature-grid-chip"; import { TopLeftShiningLight, TopRightShiningLight } from "@/components/svg/hero"; import { OssLight } from "@/components/svg/oss-light"; diff --git a/apps/www/app/pricing/discover.tsx b/apps/www/app/pricing/discover.tsx index 78f43f46d3..b8c88f92d8 100644 --- a/apps/www/app/pricing/discover.tsx +++ b/apps/www/app/pricing/discover.tsx @@ -2,7 +2,7 @@ import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip"; import { cn } from "@/lib/utils"; import * as SliderPrimitive from "@radix-ui/react-slider"; -import { Gauge, HelpCircle, KeySquare, ListChecks } from "lucide-react"; +import { Gauge, HelpCircle, ListChecks } from "lucide-react"; import React, { useState } from "react"; import { SectionTitle } from "@/components/section"; diff --git a/apps/www/components/blog/darkTheme.ts b/apps/www/components/blog/darkTheme.ts index 8e6699060c..7cdd818612 100644 --- a/apps/www/components/blog/darkTheme.ts +++ b/apps/www/components/blog/darkTheme.ts @@ -1,4 +1,3 @@ -import { SyntaxHighlighterProps } from "react-syntax-highlighter"; export default { "hljs-type": { color: "#F8F8F2", //No effect in tests diff --git a/apps/www/components/blog/suggested-blogs.tsx b/apps/www/components/blog/suggested-blogs.tsx index 352eb2041a..4232e0b621 100644 --- a/apps/www/components/blog/suggested-blogs.tsx +++ b/apps/www/components/blog/suggested-blogs.tsx @@ -2,7 +2,6 @@ import { cn } from "@/lib/utils"; import { type Post, allPosts } from "content-collections"; import { format } from "date-fns"; import Link from "next/link"; -import React from "react"; import { Frame } from "../frame"; import { ImageWithBlur } from "../image-with-blur"; diff --git a/apps/www/components/hashed-keys.tsx b/apps/www/components/hashed-keys.tsx index 5437977e21..38266b1dbf 100644 --- a/apps/www/components/hashed-keys.tsx +++ b/apps/www/components/hashed-keys.tsx @@ -7,7 +7,7 @@ import { useTransform, useWillChange, } from "framer-motion"; -import { useEffect, useMemo, useRef, useState } from "react"; +import { useEffect, useRef, useState } from "react"; import { StarsSvg } from "@/components/svg/stars"; import { cn } from "@/lib/utils"; diff --git a/apps/www/components/mdx-content.tsx b/apps/www/components/mdx-content.tsx index 46982d4220..3558822923 100644 --- a/apps/www/components/mdx-content.tsx +++ b/apps/www/components/mdx-content.tsx @@ -5,7 +5,6 @@ import type { DetailedHTMLProps, ImgHTMLAttributes, JSX } from "react"; import { BlogCodeBlock, BlogCodeBlockSingle } from "./blog/blog-code-block"; import { BlogList, BlogListItem, BlogListNumbered, type BlogListProps } from "./blog/blog-list"; import { BlogQuote, type BlogQuoteProps } from "./blog/blog-quote"; -import { ImageWithBlur } from "./image-with-blur"; import { Alert } from "./ui/alert/alert"; export const MdxComponents = { diff --git a/apps/www/components/navbar/navigation.tsx b/apps/www/components/navbar/navigation.tsx index 15ec338392..e6dfef7306 100644 --- a/apps/www/components/navbar/navigation.tsx +++ b/apps/www/components/navbar/navigation.tsx @@ -1,14 +1,13 @@ "use client"; import { Drawer, - DrawerClose, DrawerContent, DrawerFooter, DrawerHeader, DrawerTrigger, } from "@/components/ui/drawer"; import { cn } from "@/lib/utils"; -import { motion, useAnimation } from "framer-motion"; +import { motion } from "framer-motion"; import { ChevronDown, ChevronRight } from "lucide-react"; import Link from "next/link"; import { useEffect, useState } from "react"; diff --git a/apps/www/components/template/codeblock.tsx b/apps/www/components/template/codeblock.tsx index 4b148e52b9..7b19e3d1e0 100644 --- a/apps/www/components/template/codeblock.tsx +++ b/apps/www/components/template/codeblock.tsx @@ -4,7 +4,7 @@ import { BlogCodeDownload } from "@/components/svg/blog-code-block"; import darkTheme from "@/components/template/darkTheme"; import { cn } from "@/lib/utils"; import { Highlight } from "prism-react-renderer"; -import React, { useState } from "react"; +import { useState } from "react"; export function CodeBlock(props: any) { let language = props.node.children[0].properties?.className; diff --git a/apps/www/components/template/mdx-components.tsx b/apps/www/components/template/mdx-components.tsx index ef48b9958f..2fef61d39a 100644 --- a/apps/www/components/template/mdx-components.tsx +++ b/apps/www/components/template/mdx-components.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { Alert } from "../ui/alert/alert"; import { Separator } from "../ui/separator"; import { CodeBlock } from "./codeblock"; diff --git a/biome.json b/biome.json index b25b0b65a0..9c7accf725 100644 --- a/biome.json +++ b/biome.json @@ -12,7 +12,8 @@ }, "correctness": { "noUnusedVariables": "error", - "useExhaustiveDependencies": "off" + "useExhaustiveDependencies": "warn", + "noUnusedImports": "warn" }, "security": { "noDangerouslySetInnerHtml": "off" diff --git a/internal/resend/emails/payment_issue.tsx b/internal/resend/emails/payment_issue.tsx index ed2d42fe67..ec475b4bca 100644 --- a/internal/resend/emails/payment_issue.tsx +++ b/internal/resend/emails/payment_issue.tsx @@ -5,9 +5,11 @@ import { Hr } from "@react-email/hr"; import { Link } from "@react-email/link"; import { Section } from "@react-email/section"; import { Text } from "@react-email/text"; +// biome-ignore lint/correctness/noUnusedImports: react-email needs this imported import React from "react"; import { Layout } from "../src/components/layout"; import { Signature } from "../src/components/signature"; + export type Props = { username: string; date: string; diff --git a/internal/resend/emails/secret_scanning_key_detected.tsx b/internal/resend/emails/secret_scanning_key_detected.tsx index f72d52d884..92f97ffd38 100644 --- a/internal/resend/emails/secret_scanning_key_detected.tsx +++ b/internal/resend/emails/secret_scanning_key_detected.tsx @@ -5,9 +5,11 @@ import { Hr } from "@react-email/hr"; import { Link } from "@react-email/link"; import { Section } from "@react-email/section"; import { Text } from "@react-email/text"; +// biome-ignore lint/correctness/noUnusedImports: react-email needs this imported import React from "react"; import { Layout } from "../src/components/layout"; import { Signature } from "../src/components/signature"; + export type Props = { date: string; source: string; diff --git a/internal/resend/emails/subscription_ended.tsx b/internal/resend/emails/subscription_ended.tsx index 1e86ab60c7..8f65267a58 100644 --- a/internal/resend/emails/subscription_ended.tsx +++ b/internal/resend/emails/subscription_ended.tsx @@ -4,9 +4,12 @@ import { Heading } from "@react-email/heading"; import { Hr } from "@react-email/hr"; import { Section } from "@react-email/section"; import { Text } from "@react-email/text"; -import React from "react"; import { Layout } from "../src/components/layout"; import { Signature } from "../src/components/signature"; + +// biome-ignore lint/correctness/noUnusedImports: react-email needs this imported +import React from "react"; + export type Props = { username: string; }; diff --git a/internal/resend/emails/trial_ended.tsx b/internal/resend/emails/trial_ended.tsx index dc385adf38..8540c89029 100644 --- a/internal/resend/emails/trial_ended.tsx +++ b/internal/resend/emails/trial_ended.tsx @@ -5,6 +5,7 @@ import { Hr } from "@react-email/hr"; import { Link } from "@react-email/link"; import { Section } from "@react-email/section"; import { Text } from "@react-email/text"; +// biome-ignore lint/correctness/noUnusedImports: react-email needs this imported import React from "react"; import { Layout } from "../src/components/layout"; import { Signature } from "../src/components/signature"; diff --git a/internal/resend/emails/welcome_email.tsx b/internal/resend/emails/welcome_email.tsx index cce05d7b7d..89374988a6 100644 --- a/internal/resend/emails/welcome_email.tsx +++ b/internal/resend/emails/welcome_email.tsx @@ -5,9 +5,11 @@ import { Hr } from "@react-email/hr"; import { Link } from "@react-email/link"; import { Section } from "@react-email/section"; import { Text } from "@react-email/text"; +// biome-ignore lint/correctness/noUnusedImports: react-email needs this imported import React from "react"; import { Layout } from "../src/components/layout"; import { Signature } from "../src/components/signature"; + export type Props = { username: string; date: string; diff --git a/internal/resend/src/client.tsx b/internal/resend/src/client.tsx index e6f2a7b2c5..513026f894 100644 --- a/internal/resend/src/client.tsx +++ b/internal/resend/src/client.tsx @@ -1,7 +1,6 @@ import { Resend as Client } from "resend"; import { render } from "@react-email/render"; -import React from "react"; import { PaymentIssue } from "../emails/payment_issue"; import { SecretScanningKeyDetected } from "../emails/secret_scanning_key_detected"; import { SubscriptionEnded } from "../emails/subscription_ended"; diff --git a/packages/api/src/openapi.d.ts b/packages/api/src/openapi.d.ts index ac451fca07..ce8cfafe72 100644 --- a/packages/api/src/openapi.d.ts +++ b/packages/api/src/openapi.d.ts @@ -19,6 +19,9 @@ export interface paths { "/v1/keys.getKey": { get: operations["getKey"]; }; + "/v1/keys.whoami": { + post: operations["whoami"]; + }; "/v1/keys.deleteKey": { post: operations["deleteKey"]; }; @@ -794,6 +797,123 @@ export interface operations { }; }; }; + whoami: { + requestBody: { + content: { + "application/json": { + /** + * @description The actual key to fetch + * @example sk_123 + */ + key: string; + }; + }; + }; + responses: { + /** @description The configuration for a single key */ + 200: { + content: { + "application/json": { + /** + * @description The ID of the key + * @example key_123 + */ + id: string; + /** + * @description The name of the key + * @example API Key 1 + */ + name?: string; + /** + * @description The remaining number of requests for the key + * @example 1000 + */ + remaining?: number; + /** @description The identity object associated with the key */ + identity?: { + /** + * @description The identity ID associated with the key + * @example id_123 + */ + id: string; + /** + * @description The external identity ID associated with the key + * @example ext123 + */ + externalId: string; + }; + /** + * @description Metadata associated with the key + * @example { + * "role": "admin", + * "plan": "premium" + * } + */ + meta?: { + [key: string]: unknown; + }; + /** + * @description The timestamp in milliseconds when the key was created + * @example 1620000000000 + */ + createdAt: number; + /** + * @description Whether the key is enabled + * @example true + */ + enabled: boolean; + /** + * @description The environment the key is associated with + * @example production + */ + environment?: string; + }; + }; + }; + /** @description The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing). */ + 400: { + content: { + "application/json": components["schemas"]["ErrBadRequest"]; + }; + }; + /** @description Although the HTTP standard specifies "unauthorized", semantically this response means "unauthenticated". That is, the client must authenticate itself to get the requested response. */ + 401: { + content: { + "application/json": components["schemas"]["ErrUnauthorized"]; + }; + }; + /** @description The client does not have access rights to the content; that is, it is unauthorized, so the server is refusing to give the requested resource. Unlike 401 Unauthorized, the client's identity is known to the server. */ + 403: { + content: { + "application/json": components["schemas"]["ErrForbidden"]; + }; + }; + /** @description The server cannot find the requested resource. In the browser, this means the URL is not recognized. In an API, this can also mean that the endpoint is valid but the resource itself does not exist. Servers may also send this response instead of 403 Forbidden to hide the existence of a resource from an unauthorized client. This response code is probably the most well known due to its frequent occurrence on the web. */ + 404: { + content: { + "application/json": components["schemas"]["ErrNotFound"]; + }; + }; + /** @description This response is sent when a request conflicts with the current state of the server. */ + 409: { + content: { + "application/json": components["schemas"]["ErrConflict"]; + }; + }; + /** @description The user has sent too many requests in a given amount of time ("rate limiting") */ + 429: { + content: { + "application/json": components["schemas"]["ErrTooManyRequests"]; + }; + }; + /** @description The server has encountered a situation it does not know how to handle. */ + 500: { + content: { + "application/json": components["schemas"]["ErrInternalServerError"]; + }; + }; + }; + }; deleteKey: { requestBody: { content: { diff --git a/packages/cache/src/middleware/encryption.test.ts b/packages/cache/src/middleware/encryption.test.ts index 5730d3bf4b..532a00b80c 100644 --- a/packages/cache/src/middleware/encryption.test.ts +++ b/packages/cache/src/middleware/encryption.test.ts @@ -1,4 +1,4 @@ -import { beforeEach, describe, test } from "vitest"; +import { describe, test } from "vitest"; import type { Store } from "../stores"; import { MemoryStore } from "../stores/memory"; import { EncryptedStore, withEncryption } from "./encryption"; diff --git a/packages/cache/src/middleware/encryption.ts b/packages/cache/src/middleware/encryption.ts index 01abe387c0..56ffa6da37 100644 --- a/packages/cache/src/middleware/encryption.ts +++ b/packages/cache/src/middleware/encryption.ts @@ -1,4 +1,4 @@ -import { Err, Ok, type Result } from "@unkey/error"; +import { Err, type Result } from "@unkey/error"; import SuperJSON from "superjson"; import { CacheError } from "../errors"; import type { Entry, Store } from "../stores"; diff --git a/tools/migrate/auditlog-import.ts b/tools/migrate/auditlog-import.ts index 2ec30ca9a6..384d981123 100644 --- a/tools/migrate/auditlog-import.ts +++ b/tools/migrate/auditlog-import.ts @@ -1,4 +1,4 @@ -import { and, asc, eq, gt, isNotNull, mysqlDrizzle, schema } from "@unkey/db"; +import { mysqlDrizzle, schema } from "@unkey/db"; import { newId } from "@unkey/id"; import mysql from "mysql2/promise"; diff --git a/tools/migrate/main.ts b/tools/migrate/main.ts index e0fa3ddec4..af2e6fba5a 100644 --- a/tools/migrate/main.ts +++ b/tools/migrate/main.ts @@ -1,4 +1,4 @@ -import { and, asc, eq, gt, isNotNull, mysqlDrizzle, schema } from "@unkey/db"; +import { eq, mysqlDrizzle, schema } from "@unkey/db"; import { newId } from "@unkey/id"; import mysql from "mysql2/promise";