Openstatus www.openstatus.dev

chore: bump unkey (#1138)

authored by

Maximilian Kaske and committed by
GitHub
917979bb 21049b27

+52 -37
+1 -1
apps/server/package.json
··· 28 28 "@openstatus/utils": "workspace:*", 29 29 "@scalar/hono-api-reference": "0.5.131", 30 30 "@t3-oss/env-core": "0.7.1", 31 - "@unkey/api": "0.23.0", 31 + "@unkey/api": "0.26.1", 32 32 "@upstash/qstash": "2.6.2", 33 33 "hono": "4.5.3", 34 34 "nanoid": "5.0.7",
+1 -1
apps/web/package.json
··· 45 45 "@trpc/next": "11.0.0-rc.666", 46 46 "@trpc/react-query": "11.0.0-rc.666", 47 47 "@trpc/server": "11.0.0-rc.666", 48 - "@unkey/api": "0.23.0", 48 + "@unkey/api": "0.26.1", 49 49 "@upstash/qstash": "2.6.2", 50 50 "@upstash/redis": "1.22.1", 51 51 "@vercel/blob": "0.23.3",
+7
apps/web/src/app/app/[workspaceSlug]/(dashboard)/settings/api-token/_components/actions.ts
··· 7 7 8 8 import { env } from "@/env"; 9 9 import { auth } from "@/lib/auth"; 10 + import { revalidatePath } from "next/cache"; 10 11 11 12 const unkey = new Unkey({ token: env.UNKEY_TOKEN, cache: "no-cache" }); 12 13 ··· 34 35 ownerId: String(ownerId), 35 36 prefix: "os", 36 37 }); 38 + 39 + revalidatePath("/app/[workspaceSlug]/(dashboard)/settings/api-token"); 40 + 37 41 return key; 38 42 } 39 43 40 44 export async function revoke(keyId: string) { 41 45 const res = await unkey.keys.delete({ keyId }); 46 + 47 + revalidatePath("/app/[workspaceSlug]/(dashboard)/settings/api-token"); 48 + 42 49 return res; 43 50 }
+16 -26
apps/web/src/app/app/[workspaceSlug]/(dashboard)/settings/api-token/_components/card.tsx
··· 1 - "use server"; 2 - 3 - import { Unkey } from "@unkey/api"; 4 - 5 1 import { Container } from "@/components/dashboard/container"; 6 - import { env } from "@/env"; 7 2 import { formatDate } from "@/lib/utils"; 8 3 import { CreateForm } from "./create-form"; 9 4 import { RevokeButton } from "./revoke-button"; 10 5 11 - const unkey = new Unkey({ token: env.UNKEY_TOKEN }); 12 - 13 - export async function ApiKeys({ ownerId }: { ownerId: number }) { 14 - const data = await unkey.apis.listKeys({ 15 - apiId: env.UNKEY_API_ID, 16 - ownerId: String(ownerId), 17 - }); 18 - 19 - if (data.error) { 20 - return <div>Something went wrong. Please contact us.</div>; 21 - } 22 - 23 - const key = data.result.keys?.[0] || undefined; 24 - 6 + export async function ApiKeys({ 7 + ownerId, 8 + value, 9 + }: { 10 + ownerId: number; 11 + value?: { id: string; start: string; createdAt: number }; 12 + }) { 25 13 return ( 26 14 <> 27 15 <Container ··· 29 17 description="Use our API endpoints to create your monitors programmatically." 30 18 actions={ 31 19 <> 32 - {key ? ( 33 - <RevokeButton keyId={key.id} /> 20 + {value ? ( 21 + <RevokeButton keyId={value.id} /> 34 22 ) : ( 35 23 <CreateForm ownerId={ownerId} /> 36 24 )} 37 25 </> 38 26 } 39 27 > 40 - {key ? ( 28 + {value ? ( 41 29 <dl className="grid gap-2 [&>*]:text-sm [&_dt]:font-light [&_dt]:text-muted-foreground"> 42 30 <div className="flex min-w-0 items-center justify-between gap-3"> 43 31 <dt>Token</dt> 44 - <dd className="font-mono">{key.start}...</dd> 32 + <dd className="font-mono">{value.start}...</dd> 45 33 </div> 46 34 <div className="flex min-w-0 items-center justify-between gap-3"> 47 35 <dt>Created At</dt> 48 - <dd>{key.createdAt && formatDate(new Date(key.createdAt))}</dd> 36 + <dd> 37 + {value.createdAt && formatDate(new Date(value.createdAt))} 38 + </dd> 49 39 </div> 50 40 </dl> 51 41 ) : null} 52 42 </Container> 53 43 <p className="text-foreground text-sm"> 54 - Read more about APIs in our{" "} 44 + Read more about API in our{" "} 55 45 <a 56 46 className="text-foreground underline underline-offset-4 hover:no-underline" 57 - href="https://docs.openstatus.dev/api-reference/auth" 47 + href="https://api.openstatus.dev/v1" 58 48 target="_blank" 59 49 rel="noreferrer" 60 50 >
+20 -2
apps/web/src/app/app/[workspaceSlug]/(dashboard)/settings/api-token/page.tsx
··· 1 + import { Unkey } from "@unkey/api"; 2 + 3 + import { env } from "@/env"; 1 4 import { api } from "@/trpc/server"; 2 5 import { ApiKeys } from "./_components/card"; 3 6 7 + export const revalidate = 0; 8 + 9 + const unkey = new Unkey({ token: env.UNKEY_TOKEN, cache: "no-cache" }); 10 + 4 11 export default async function ApiTokenPage() { 5 - const data = await api.workspace.getWorkspace.query(); 12 + const workspace = await api.workspace.getWorkspace.query(); 6 13 7 - return <ApiKeys ownerId={data.id} />; 14 + const data = await unkey.apis.listKeys({ 15 + apiId: env.UNKEY_API_ID, 16 + ownerId: String(workspace.id), 17 + }); 18 + 19 + if (data.error) { 20 + return <div>Something went wrong. Please contact us.</div>; 21 + } 22 + 23 + const value = data.result.keys?.[0] || undefined; 24 + 25 + return <ApiKeys ownerId={workspace.id} value={value} />; 8 26 }
+7 -7
pnpm-lock.yaml
··· 167 167 specifier: 0.7.1 168 168 version: 0.7.1(typescript@5.7.2)(zod@3.23.8) 169 169 '@unkey/api': 170 - specifier: 0.23.0 171 - version: 0.23.0 170 + specifier: 0.26.1 171 + version: 0.26.1 172 172 '@upstash/qstash': 173 173 specifier: 2.6.2 174 174 version: 2.6.2 ··· 309 309 specifier: 11.0.0-rc.666 310 310 version: 11.0.0-rc.666(typescript@5.6.2) 311 311 '@unkey/api': 312 - specifier: 0.23.0 313 - version: 0.23.0 312 + specifier: 0.26.1 313 + version: 0.26.1 314 314 '@upstash/qstash': 315 315 specifier: 2.6.2 316 316 version: 2.6.2 ··· 5129 5129 peerDependencies: 5130 5130 vue: '>=2.7 || >=3' 5131 5131 5132 - '@unkey/api@0.23.0': 5133 - resolution: {integrity: sha512-N4mFiIQdzBaqDGtBZ70y8d7rNeRgi2iEWac7BgTsiflx12BfMHWd4oMglmUJ4uqHNmNqm3yNVSih7BY24H5K8g==} 5132 + '@unkey/api@0.26.1': 5133 + resolution: {integrity: sha512-WSYOeZjGbFkO9yA4UsNS6NjprUF9OAYIlBHN/7iRUaFBq+PL502Qe10xNwiwoppYhW6PnrCFobW92vrkjHTcjA==} 5134 5134 5135 5135 '@unkey/error@0.2.0': 5136 5136 resolution: {integrity: sha512-DFGb4A7SrusZPP0FYuRIF0CO+Gi4etLUAEJ6EKc+TKYmscL0nEJ2Pr38FyX9MvjI4Wx5l35Wc9KsBjMm9Ybh7w==} ··· 14987 14987 unhead: 1.9.15 14988 14988 vue: 3.4.31(typescript@5.7.2) 14989 14989 14990 - '@unkey/api@0.23.0': 14990 + '@unkey/api@0.26.1': 14991 14991 dependencies: 14992 14992 '@unkey/rbac': 0.3.1 14993 14993