diff --git a/.changeset/thirty-coats-beg.md b/.changeset/thirty-coats-beg.md
deleted file mode 100644
index 0b11e48..0000000
--- a/.changeset/thirty-coats-beg.md
+++ /dev/null
@@ -1,24 +0,0 @@
----
-'@tuyau/core': minor
----
-
-See https://github.com/Julien-Sponsors/tuyau/issues/4
-
-Basically we allow the use of a validator directly in the controller file. For example:
-
-```ts
-export const myValidator = vine.compile(
- vine.object({
- id: vine.number()
- }),
-)
-
-export default class MyController {
- public async handle({ request }: HttpContext) {
- const payload = await request.validateUsing(myValidator)
- // ...
- }
-}
-```
-
-It didn't work before. Now it's possible
diff --git a/packages/core/CHANGELOG.md b/packages/core/CHANGELOG.md
index 028d1ca..8ba8b15 100644
--- a/packages/core/CHANGELOG.md
+++ b/packages/core/CHANGELOG.md
@@ -1,5 +1,30 @@
# @tuyau/core
+## 0.2.0
+
+### Minor Changes
+
+- df82585: See https://github.com/Julien-Sponsors/tuyau/issues/4
+
+ Basically we allow the use of a validator directly in the controller file. For example:
+
+ ```ts
+ export const myValidator = vine.compile(
+ vine.object({
+ id: vine.number(),
+ }),
+ )
+
+ export default class MyController {
+ public async handle({ request }: HttpContext) {
+ const payload = await request.validateUsing(myValidator)
+ // ...
+ }
+ }
+ ```
+
+ It didn't work before. Now it's possible
+
## 0.1.4
### Patch Changes
@@ -26,13 +51,13 @@
```ts
///
- import { createTuyau } from "@tuyau/client";
- import type { api } from "@your-monorepo/server/.adonisjs/api";
+ import { createTuyau } from '@tuyau/client'
+ import type { api } from '@your-monorepo/server/.adonisjs/api'
export const tuyau = createTuyau({
api,
- baseUrl: "http://localhost:3333",
- });
+ baseUrl: 'http://localhost:3333',
+ })
```
As you can see, you first need to change the import path and the imported value. Next, you need to pass this `api` object as an argument to the `createTuyau` function.
@@ -47,14 +72,12 @@
```ts
// Backend
- router
- .get("/posts/:id/generate-invitation", "...")
- .as("posts.generateInvitation");
+ router.get('/posts/:id/generate-invitation', '...').as('posts.generateInvitation')
// Client
- await tuyau.$route("posts.generateInvitation", { id: 1 }).$get({
+ await tuyau.$route('posts.generateInvitation', { id: 1 }).$get({
query: { limit: 10, page: 1 },
- });
+ })
```
### Generating URL from route name
@@ -62,9 +85,9 @@
If you need to generate the URL of a route using the route name, you can use the `$url` method. This method is pretty similar to [Ziggy](https://github.com/tighten/ziggy) behavior :
```ts
- tuyau.$url("users.posts", { id: 1, postId: 2 }); // http://localhost:3333/users/1/posts/2
- tuyau.$url("venues.events.show", [1, 2]); // http://localhost:3333/venues/1/events/2
- tuyau.$url("users", { query: { page: 1, limit: 10 } }); // http://localhost:3333/users?page=1&limit=10
+ tuyau.$url('users.posts', { id: 1, postId: 2 }) // http://localhost:3333/users/1/posts/2
+ tuyau.$url('venues.events.show', [1, 2]) // http://localhost:3333/venues/1/events/2
+ tuyau.$url('users', { query: { page: 1, limit: 10 } }) // http://localhost:3333/users?page=1&limit=10
```
If you are used to Ziggy and prefer to have a `route` method instead of `$url`, you can define a custom method in your client file pretty easily :
@@ -72,10 +95,10 @@
```ts
export const tuyau = createTuyau({
api,
- baseUrl: "http://localhost:3333",
- });
+ baseUrl: 'http://localhost:3333',
+ })
- window.route = tuyau.$url.bind(tuyau);
+ window.route = tuyau.$url.bind(tuyau)
```
Then you can use the `route` method in your frontend code :
@@ -84,9 +107,9 @@
export function MyComponent() {
return (
- );
+ )
}
```
@@ -95,9 +118,9 @@
If you need to check if a route name exists, you can use the `$has` method. You can also use wildcards in the route name :
```ts
- tuyau.$has("users"); // true
- tuyau.$has("users.posts"); // true
- tuyau.$has("users.*.comments"); // true
- tuyau.$has("users.*"); // true
- tuyau.$has("non-existent"); // false
+ tuyau.$has('users') // true
+ tuyau.$has('users.posts') // true
+ tuyau.$has('users.*.comments') // true
+ tuyau.$has('users.*') // true
+ tuyau.$has('non-existent') // false
```
diff --git a/packages/core/package.json b/packages/core/package.json
index f548a42..bbeff89 100644
--- a/packages/core/package.json
+++ b/packages/core/package.json
@@ -1,7 +1,7 @@
{
"name": "@tuyau/core",
"type": "module",
- "version": "0.1.4",
+ "version": "0.2.0",
"description": "",
"author": "",
"license": "MIT",
diff --git a/packages/openapi/CHANGELOG.md b/packages/openapi/CHANGELOG.md
index 92fc554..be9db83 100644
--- a/packages/openapi/CHANGELOG.md
+++ b/packages/openapi/CHANGELOG.md
@@ -1,5 +1,12 @@
# @tuyau/openapi
+## 1.0.0
+
+### Patch Changes
+
+- Updated dependencies [df82585]
+ - @tuyau/core@0.2.0
+
## 0.1.2
### Patch Changes
@@ -16,15 +23,13 @@
```ts
router
.group(() => {
+ router.get('/random', [MiscController, 'index']).detail({ description: 'Get a random thing' })
router
- .get("/random", [MiscController, "index"])
- .detail({ description: "Get a random thing" });
- router
- .get("/random/:id", [MiscController, "show"])
- .detail({ description: "Get a random thing by id" });
+ .get('/random/:id', [MiscController, 'show'])
+ .detail({ description: 'Get a random thing by id' })
})
- .prefix("/misc")
- .detail({ tags: ["misc"] });
+ .prefix('/misc')
+ .detail({ tags: ['misc'] })
```
These `details` will be merged and added to the auto-generated OpenAPI spec.
diff --git a/packages/openapi/package.json b/packages/openapi/package.json
index 534d059..c84243f 100644
--- a/packages/openapi/package.json
+++ b/packages/openapi/package.json
@@ -1,7 +1,7 @@
{
"name": "@tuyau/openapi",
"type": "module",
- "version": "0.2.0",
+ "version": "1.0.0",
"description": "",
"author": "",
"license": "MIT",
@@ -33,7 +33,7 @@
"prepublishOnly": "npm run build"
},
"peerDependencies": {
- "@tuyau/core": "^0.1.4"
+ "@tuyau/core": "^0.2.0"
},
"dependencies": {
"defu": "^6.1.4",
diff --git a/playgrounds/inertia-react/CHANGELOG.md b/playgrounds/inertia-react/CHANGELOG.md
new file mode 100644
index 0000000..8840812
--- /dev/null
+++ b/playgrounds/inertia-react/CHANGELOG.md
@@ -0,0 +1,8 @@
+# @tuyau/playground-inertia-react
+
+## 0.0.1
+
+### Patch Changes
+
+- Updated dependencies [df82585]
+ - @tuyau/core@0.2.0
diff --git a/playgrounds/inertia-react/package.json b/playgrounds/inertia-react/package.json
index 5b299a3..a8e3802 100644
--- a/playgrounds/inertia-react/package.json
+++ b/playgrounds/inertia-react/package.json
@@ -1,7 +1,7 @@
{
"name": "@tuyau/playground-inertia-react",
"type": "module",
- "version": "0.0.0",
+ "version": "0.0.1",
"private": true,
"license": "UNLICENSED",
"scripts": {
diff --git a/playgrounds/inertia-solid/CHANGELOG.md b/playgrounds/inertia-solid/CHANGELOG.md
new file mode 100644
index 0000000..3472a1d
--- /dev/null
+++ b/playgrounds/inertia-solid/CHANGELOG.md
@@ -0,0 +1,8 @@
+# @tuyau/playground-inertia-solid
+
+## 0.0.1
+
+### Patch Changes
+
+- Updated dependencies [df82585]
+ - @tuyau/core@0.2.0
diff --git a/playgrounds/inertia-solid/package.json b/playgrounds/inertia-solid/package.json
index cd8aecc..ecc84e3 100644
--- a/playgrounds/inertia-solid/package.json
+++ b/playgrounds/inertia-solid/package.json
@@ -1,7 +1,7 @@
{
"name": "@tuyau/playground-inertia-solid",
"type": "module",
- "version": "0.0.0",
+ "version": "0.0.1",
"private": true,
"license": "UNLICENSED",
"scripts": {
diff --git a/playgrounds/inertia-vue/CHANGELOG.md b/playgrounds/inertia-vue/CHANGELOG.md
new file mode 100644
index 0000000..9ea9c75
--- /dev/null
+++ b/playgrounds/inertia-vue/CHANGELOG.md
@@ -0,0 +1,8 @@
+# @tuyau/playground-inertia-vue
+
+## 0.0.1
+
+### Patch Changes
+
+- Updated dependencies [df82585]
+ - @tuyau/core@0.2.0
diff --git a/playgrounds/inertia-vue/package.json b/playgrounds/inertia-vue/package.json
index af144da..bb2a8cb 100644
--- a/playgrounds/inertia-vue/package.json
+++ b/playgrounds/inertia-vue/package.json
@@ -1,7 +1,7 @@
{
"name": "@tuyau/playground-inertia-vue",
"type": "module",
- "version": "0.0.0",
+ "version": "0.0.1",
"private": true,
"license": "UNLICENSED",
"scripts": {
diff --git a/playgrounds/openapi/CHANGELOG.md b/playgrounds/openapi/CHANGELOG.md
new file mode 100644
index 0000000..5b2b796
--- /dev/null
+++ b/playgrounds/openapi/CHANGELOG.md
@@ -0,0 +1,9 @@
+# @tuyau/playground-openapi
+
+## 0.0.1
+
+### Patch Changes
+
+- Updated dependencies [df82585]
+ - @tuyau/core@0.2.0
+ - @tuyau/openapi@1.0.0
diff --git a/playgrounds/openapi/package.json b/playgrounds/openapi/package.json
index 2330a3d..935e25a 100644
--- a/playgrounds/openapi/package.json
+++ b/playgrounds/openapi/package.json
@@ -1,7 +1,7 @@
{
"name": "@tuyau/playground-openapi",
"type": "module",
- "version": "0.0.0",
+ "version": "0.0.1",
"private": true,
"license": "UNLICENSED",
"scripts": {