Skip to content

Commit faf124d

Browse files
committed
chore(deps): Upgrade @aklinker1/zeta
1 parent 05e5845 commit faf124d

6 files changed

Lines changed: 35 additions & 24 deletions

File tree

bun.lock

Lines changed: 8 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@
1616
},
1717
"dependencies": {
1818
"@aklinker1/zero-ioc": "^1.3.2",
19-
"@aklinker1/zeta": "npm:@jsr/aklinker1__zeta@0.2.8",
19+
"@aklinker1/zeta": "^2.2.0",
2020
"consola": "^3.2.3",
2121
"dataloader": "^2.2.2",
22+
"dedent": "^1.7.2",
2223
"graphql": "^16.8.0",
2324
"linkedom": "^0.15.3",
2425
"picocolors": "^1.0.0",

src/plugins/cors-plugin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { createApp } from "@aklinker1/zeta";
22

33
export const corsPlugin = createApp()
4-
.onRequest(async ({ method, set }) => {
4+
.onGlobalRequest(async ({ method, set }) => {
55
set.headers["Access-Control-Allow-Origin"] = "*";
66
set.headers["Access-Control-Allow-Methods"] = "GET, POST, OPTIONS";
77
set.headers["Access-Control-Allow-Headers"] = "*";

src/routes/grpahql-routes.ts

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import PLAYGROUND_HTML_TEMPLATE from "../assets/playground.html.tmpl" with { typ
33
import { version } from "../../package.json";
44
import { createGraphql } from "../graphql";
55
import { z } from "zod/v4";
6+
import dedent from "dedent";
67

78
const PLAYGROUND_HTML = PLAYGROUND_HTML_TEMPLATE.replace(
89
"{{VERSION}}",
@@ -27,19 +28,21 @@ export const graphqlRoutes = createApp()
2728
})
2829
.meta({
2930
example: {
30-
query: `query GetExtension($id: String!) {
31-
chromeExtension(id: $id) {
32-
id
33-
screenshots { rawUrl }
34-
}
35-
}`,
31+
query: dedent`
32+
query GetExtension($id: String!) {
33+
chromeExtension(id: $id) {
34+
id
35+
screenshots { rawUrl }
36+
}
37+
}
38+
`,
3639
variables: {
3740
id: "ocfdgncpifmegplaglcnglhioflaimkd",
3841
},
3942
operationName: "GetExtension",
4043
},
4144
}),
42-
response: z
45+
responses: z
4346
.object({
4447
data: z.any().optional(),
4548
errors: z.any().array().optional(),
@@ -69,11 +72,13 @@ export const graphqlRoutes = createApp()
6972
.get(
7073
"/playground",
7174
{
72-
summary: "Playground",
75+
operationId: "playground",
7376
tags: ["GraphQL"],
74-
description:
75-
"Open the GraphiQL playground. This is where you can interact and test out the GraphQL API. It also contains the GraphQL documentation explorer.",
76-
response: z.string().meta({ contentType: "text/html" }),
77+
description: dedent`
78+
Open the GraphiQL playground. This is where you can interact and test out
79+
the GraphQL API. It also contains the GraphQL documentation explorer.
80+
`,
81+
responses: z.string().meta({ contentType: "text/html" }),
7782
},
7883
({ set }) => {
7984
set.headers["Content-Type"] = "text/html; charset=utf-8";

src/routes/rest-routes.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { createApp } from "@aklinker1/zeta";
22
import { z } from "zod/v4";
33
import { contextPlugin } from "../plugins/context-plugin";
4-
import { NotFoundError } from "@aklinker1/zeta/errors";
5-
import { Status } from "@aklinker1/zeta/status";
4+
import { NotFoundHttpError } from "@aklinker1/zeta";
5+
import { HttpStatus } from "@aklinker1/zeta";
66

77
export const restRoutes = createApp()
88
.use(contextPlugin)
@@ -24,9 +24,9 @@ export const restRoutes = createApp()
2424
params.index,
2525
);
2626
if (!screenshotUrl)
27-
throw new NotFoundError("Extension or screenshot not found");
27+
throw new NotFoundHttpError("Extension or screenshot not found");
2828

29-
set.status = Status.Found;
29+
set.status = HttpStatus.Found;
3030
set.headers["Location"] = screenshotUrl;
3131
},
3232
)
@@ -48,9 +48,9 @@ export const restRoutes = createApp()
4848
params.index,
4949
);
5050
if (!screenshotUrl)
51-
throw new NotFoundError("Extension or screenshot not found");
51+
throw new NotFoundHttpError("Extension or screenshot not found");
5252

53-
set.status = Status.Found;
53+
set.status = HttpStatus.Found;
5454
set.headers["Location"] = screenshotUrl;
5555
},
5656
);

src/server.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const app = createApp({
2525
],
2626
},
2727
})
28-
.onError(({ error }) => void consola.error(error))
28+
.onGlobalError(({ error }) => void consola.error(error))
2929
.use(corsPlugin)
3030
.use(restRoutes)
3131
.use(graphqlRoutes)
@@ -47,7 +47,7 @@ const app = createApp({
4747
summary: "Health Check",
4848
tags: ["System"],
4949
description: "Used to make sure the API is up and running.",
50-
response: z.object({
50+
responses: z.object({
5151
status: z.literal("ok"),
5252
version: z.string(),
5353
}),

0 commit comments

Comments
 (0)