Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update Hono version for some packages #661

Open
wants to merge 8 commits into
base: bun-pm
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,4 @@
"typescript": "^5.2.2"
},
"packageManager": "[email protected]"
}
}
2 changes: 1 addition & 1 deletion packages/bun-transpiler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
},
"devDependencies": {
"@types/bun": "^1.0.0",
"hono": "^3.11.7",
"hono": "^4.5.1",
"tsup": "^8.0.1",
"vitest": "^1.0.4"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/clerk-auth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"devDependencies": {
"@clerk/backend": "^1.0.0",
"@types/react": "^18",
"hono": "^3.11.7",
"hono": "^4.5.1",
"jest": "^29.7.0",
"node-fetch-native": "^1.4.0",
"react": "^18.2.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/effect-validator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"devDependencies": {
"@effect/schema": "^0.68.21",
"effect": "^3.4.8",
"hono": "^4.4.13",
"hono": "^4.5.1",
"tsup": "^8.1.0",
"typescript": "^5.5.3",
"vitest": "^2.0.1"
Expand Down
2 changes: 1 addition & 1 deletion packages/esbuild-transpiler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"devDependencies": {
"esbuild": "^0.19.9",
"esbuild-wasm": "^0.19.5",
"hono": "^3.11.7",
"hono": "^4.5.1",
"tsup": "^8.0.1",
"vitest": "^0.34.6"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/event-emitter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"hono": "*"
},
"devDependencies": {
"hono": "^3.11.7",
"hono": "^4.5.1",
"tsup": "^8.0.1",
"vitest": "^1.0.4"
}
Expand Down
2 changes: 1 addition & 1 deletion packages/graphql-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"eslint-plugin-flowtype": "^8.0.3",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-node": "^11.1.0",
"hono": "^4.0.2",
"hono": "^4.5.1",
"jest": "^28.1.2",
"jest-environment-miniflare": "^2.6.0",
"np": "^7.6.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/medley-router/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"hono": ">=3.8.0"
},
"devDependencies": {
"hono": "^3.11.7",
"hono": "^4.5.1",
"jest": "^29.7.0",
"rimraf": "^5.0.5"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/node-ws/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"devDependencies": {
"@hono/node-server": "^1.11.1",
"@types/ws": "^8",
"hono": "^4.2.9",
"hono": "^4.5.1",
"tsup": "^8.0.1",
"vitest": "^1.0.4"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/prometheus/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"prom-client": "^15.0.0"
},
"devDependencies": {
"hono": "^4.2.7",
"hono": "^4.5.1",
"prom-client": "^15.0.0",
"tsup": "^8.0.1",
"vitest": "^1.0.4"
Expand Down
2 changes: 1 addition & 1 deletion packages/qwik-city/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"devDependencies": {
"@builder.io/qwik": "^1.2.0",
"@builder.io/qwik-city": "^1.2.0",
"hono": "^3.11.7",
"hono": "^4.5.1",
"rimraf": "^5.0.5"
},
"engines": {
Expand Down
2 changes: 1 addition & 1 deletion packages/react-compat/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"hono": ">=4.5.*"
},
"devDependencies": {
"hono": "^4.5.0",
"hono": "^4.5.1",
"tsup": "^8.0.1"
}
}
2 changes: 1 addition & 1 deletion packages/react-renderer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"@types/react": "^18",
"@types/react-dom": "^18.2.17",
"esbuild": "^0.20.2",
"hono": "^4.2.3",
"hono": "^4.5.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"tsup": "^8.0.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/sentry/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"eslint-plugin-flowtype": "^8.0.3",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-node": "^11.1.0",
"hono": "^3.11.7",
"hono": "^4.5.1",
"jest": "^28.1.2",
"jest-environment-miniflare": "^2.6.0",
"prettier": "^2.7.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/swagger-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
},
"devDependencies": {
"@types/swagger-ui-dist": "^3.30.5",
"hono": "^3.11.7",
"hono": "^4.5.1",
"publint": "^0.2.2",
"tsup": "^7.2.0",
"vite": "^4.4.9",
Expand Down
2 changes: 1 addition & 1 deletion packages/trpc-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
},
"devDependencies": {
"@trpc/server": "^10.10.0 || >11.0.0-rc",
"hono": "^4.3.6",
"hono": "^4.5.1",
"jest": "^29.7.0",
"rimraf": "^5.0.5",
"zod": "^3.20.2"
Expand Down
213 changes: 213 additions & 0 deletions packages/typia-validator/test-generated/index.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,213 @@
import { Hono } from 'hono';
import type { Equal, Expect } from 'hono/utils/types';
import type { tags } from 'typia';
import typia from 'typia';
import { typiaValidator } from "../src";
// eslint-disable-next-line @typescript-eslint/no-unused-vars
type ExtractSchema<T> = T extends Hono<infer _, infer S> ? S : never;
describe('Basic', () => {
const app = new Hono();
interface Author {
name: string;
age: number & tags.Type<'uint32'> & tags.Minimum<20> & tags.ExclusiveMaximum<100>;
}
const validate = (input: any): typia.IValidation<Author> => {
const errors = [] as any[];
const __is = (input: any): input is Author => {
return "object" === typeof input && null !== input && ("string" === typeof (input as any).name && ("number" === typeof (input as any).age && (Math.floor((input as any).age) === (input as any).age && 0 <= (input as any).age && (input as any).age <= 4294967295 && 20 <= (input as any).age && (input as any).age < 100)));
};
if (false === __is(input)) {
const $report = (typia.createValidate as any).report(errors);
((input: any, _path: string, _exceptionable: boolean = true): input is Author => {
const $vo0 = (input: any, _path: string, _exceptionable: boolean = true): boolean => ["string" === typeof input.name || $report(_exceptionable, {
path: _path + ".name",
expected: "string",
value: input.name
}), "number" === typeof input.age && (Math.floor(input.age) === input.age && 0 <= input.age && input.age <= 4294967295 || $report(_exceptionable, {
path: _path + ".age",
expected: "number & Type<\"uint32\">",
value: input.age
})) && (20 <= input.age || $report(_exceptionable, {
path: _path + ".age",
expected: "number & Minimum<20>",
value: input.age
})) && (input.age < 100 || $report(_exceptionable, {
path: _path + ".age",
expected: "number & ExclusiveMaximum<100>",
value: input.age
})) || $report(_exceptionable, {
path: _path + ".age",
expected: "(number & Type<\"uint32\"> & Minimum<20> & ExclusiveMaximum<100>)",
value: input.age
})].every((flag: boolean) => flag);
return ("object" === typeof input && null !== input || $report(true, {
path: _path + "",
expected: "Author",
value: input
})) && $vo0(input, _path + "", true) || $report(true, {
path: _path + "",
expected: "Author",
value: input
});
})(input, "$input", true);
}
const success = 0 === errors.length;
return {
success,
errors,
data: success ? input : undefined
} as any;
};
const route = app.post('/author', typiaValidator('json', validate), (c) => {
const data = c.req.valid('json');
return c.json({
success: true,
message: `${data.name} is ${data.age}`,
});
});
type Actual = ExtractSchema<typeof route>;
type Expected = {
'/author': {
$post: {
input: {
json: Author;
};
output: {
success: boolean;
message: string;
};
};
};
};
// eslint-disable-next-line @typescript-eslint/no-unused-vars
type verify = Expect<Equal<Expected, Actual>>;
it('Should return 200 response', async () => {
const req = new Request('http://localhost/author', {
body: JSON.stringify({
name: 'Superman',
age: 30,
}),
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
});
const res = await app.request(req);
expect(res).not.toBeNull();
expect(res.status).toBe(200);
expect(await res.json()).toEqual({
success: true,
message: 'Superman is 30',
});
});
it('Should return 400 response', async () => {
const req = new Request('http://localhost/author', {
body: JSON.stringify({
name: 'Superman',
age: 18,
}),
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
});
const res = await app.request(req);
expect(res).not.toBeNull();
expect(res.status).toBe(400);
const data = (await res.json()) as {
success: boolean;
};
expect(data['success']).toBe(false);
});
});
describe('With Hook', () => {
const app = new Hono();
interface Item {
id: number & tags.ExclusiveMaximum<9999>;
title: string;
}
const validate = (input: any): typia.IValidation<Item> => {
const errors = [] as any[];
const __is = (input: any): input is Item => {
return "object" === typeof input && null !== input && ("number" === typeof (input as any).id && (input as any).id < 9999 && "string" === typeof (input as any).title);
};
if (false === __is(input)) {
const $report = (typia.createValidate as any).report(errors);
((input: any, _path: string, _exceptionable: boolean = true): input is Item => {
const $vo0 = (input: any, _path: string, _exceptionable: boolean = true): boolean => ["number" === typeof input.id && (input.id < 9999 || $report(_exceptionable, {
path: _path + ".id",
expected: "number & ExclusiveMaximum<9999>",
value: input.id
})) || $report(_exceptionable, {
path: _path + ".id",
expected: "(number & ExclusiveMaximum<9999>)",
value: input.id
}), "string" === typeof input.title || $report(_exceptionable, {
path: _path + ".title",
expected: "string",
value: input.title
})].every((flag: boolean) => flag);
return ("object" === typeof input && null !== input || $report(true, {
path: _path + "",
expected: "Item",
value: input
})) && $vo0(input, _path + "", true) || $report(true, {
path: _path + "",
expected: "Item",
value: input
});
})(input, "$input", true);
}
const success = 0 === errors.length;
return {
success,
errors,
data: success ? input : undefined
} as any;
};
app.post('/post', typiaValidator('json', validate, (result, c) => {
if (!result.success) {
return c.text(`${result.data.id} is invalid!`, 400);
}
const data = result.data;
return Promise.resolve(c.text(`${data.id} is valid!`));
}), (c) => {
const data = c.req.valid('json');
return c.json({
success: true,
message: `${data.id} is ${data.title}`,
});
});
it('Should return 200 response', async () => {
const req = new Request('http://localhost/post', {
body: JSON.stringify({
id: 123,
title: 'Hello',
}),
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
});
const res = await app.request(req);
expect(res).not.toBeNull();
expect(res.status).toBe(200);
expect(await res.text()).toBe('123 is valid!');
});
it('Should return 400 response', async () => {
const req = new Request('http://localhost/post', {
body: JSON.stringify({
id: '123',
title: 'Hello',
}),
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
});
const res = await app.request(req);
expect(res).not.toBeNull();
expect(res.status).toBe(400);
expect(await res.text()).toBe('123 is invalid!');
});
});
Binary file modified packages/zod-openapi/.yarn/install-state.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion packages/zod-openapi/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
},
"devDependencies": {
"@cloudflare/workers-types": "^4.20240117.0",
"hono": "^4.3.6",
"hono": "^4.5.1",
"jest": "^29.7.0",
"tsup": "^8.0.1",
"typescript": "^5.4.4",
Expand Down
10 changes: 5 additions & 5 deletions packages/zod-openapi/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ __metadata:
"@asteasolutions/zod-to-openapi": "npm:^7.1.0"
"@cloudflare/workers-types": "npm:^4.20240117.0"
"@hono/zod-validator": "npm:0.2.2"
hono: "npm:^4.3.6"
hono: "npm:^4.5.1"
jest: "npm:^29.7.0"
tsup: "npm:^8.0.1"
typescript: "npm:^5.4.4"
Expand Down Expand Up @@ -2379,10 +2379,10 @@ __metadata:
languageName: node
linkType: hard

"hono@npm:^4.3.6":
version: 4.4.6
resolution: "hono@npm:4.4.6"
checksum: 065318f3fe021320b59f3daddacf7d74bfc3303de55f415a999b6967a9f09714e136528bc86cc880a45633cd85dec5428e41e902b5e3a3809f3cd17204302668
"hono@npm:^4.5.1":
version: 4.5.1
resolution: "hono@npm:4.5.1"
checksum: 71228cefd3808b4bb42c10de23d67f135678eb0ab7fdfd1728d934ec2ee1241be9b1260f279b81acd2a6a57346d06d047a2650ff9bddd48fda6581751a690d80
languageName: node
linkType: hard

Expand Down
2 changes: 1 addition & 1 deletion packages/zod-validator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"zod": "^3.19.1"
},
"devDependencies": {
"hono": "^4.0.10",
"hono": "^4.5.1",
"jest": "^29.7.0",
"rimraf": "^5.0.5",
"typescript": "^5.3.3",
Expand Down
Loading