@lyeve-labs/client-vue 0.1.6 → 0.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +13 -9
  2. package/package.json +12 -3
package/README.md CHANGED
@@ -33,12 +33,13 @@ One plugin at the root, reactive refs everywhere else. No ceremony.
33
33
  component tree via `inject`/`provide`.
34
34
  - **useQuery:** reactive data fetching composable. Returns `data`, `error`,
35
35
  `loading` as Vue `Ref`s, plus a `refetch` function.
36
- - **useMutation:** mutation composable returning `[trigger, loading]`. The
37
- trigger returns a Promise of the result; `loading` is a `Ref<boolean>`.
36
+ - **useMutation:** mutation composable returning `[trigger, state]`. The
37
+ trigger returns a Promise of the result. `state` holds `data`, `error` and
38
+ `loading` as Vue `Ref`s.
38
39
 
39
40
  ## Requirements
40
41
 
41
- - **Node 20** or newer
42
+ - **Node 24** or newer
42
43
  - **Vue 3.0** or newer
43
44
  - **[@lyeve-labs/client](https://www.npmjs.com/package/@lyeve-labs/client)** `>=0.2.1`
44
45
 
@@ -84,7 +85,7 @@ const { data, error, loading, refetch } = useQuery((client) =>
84
85
  <div v-if="loading">Loading...</div>
85
86
  <div v-else-if="error">{{ error.message }}</div>
86
87
  <ul v-else>
87
- <li v-for="schema in data" :key="schema.id">{{ schema.name }}</li>
88
+ <li v-for="schema in data" :key="schema.name">{{ schema.display_name }}</li>
88
89
  </ul>
89
90
  </template>
90
91
  ```
@@ -96,8 +97,8 @@ const { data, error, loading, refetch } = useQuery((client) =>
96
97
  import { useMutation } from "@lyeve-labs/client-vue";
97
98
  import { deleteContent } from "@lyeve-labs/client-rest";
98
99
 
99
- const [remove, removing] = useMutation((client, id: string) =>
100
- deleteContent(id, client),
100
+ const [remove, { loading: removing }] = useMutation((client, id: string) =>
101
+ deleteContent("articles", id, client),
101
102
  );
102
103
 
103
104
  async function handleDelete(id: string) {
@@ -139,10 +140,13 @@ function useQuery<T>(fetcher: (client: HttpClient) => Promise<T>): {
139
140
  ```ts
140
141
  function useMutation<T, V>(
141
142
  mutator: (client: HttpClient, vars: V) => Promise<T>,
142
- ): [(vars: V) => Promise<T>, Ref<boolean>];
143
+ ): [
144
+ (vars: V) => Promise<T>,
145
+ { data: Ref<T | null>; error: Ref<Error | null>; loading: Ref<boolean> },
146
+ ];
143
147
  ```
144
148
 
145
- Returns a tuple: `[trigger, loading]`.
149
+ Returns a tuple: `[trigger, state]`.
146
150
 
147
151
  ## Local development
148
152
 
@@ -164,7 +168,7 @@ tests/ # vitest test suite
164
168
  ## Versioning
165
169
 
166
170
  `@lyeve-labs/client-vue` follows [SemVer](https://semver.org). While under `1.0`,
167
- breaking changes bump the **minor** version; additive changes bump the **patch**.
171
+ breaking changes bump the **minor** version. Additive changes bump the **patch**.
168
172
  Every release is logged in [`CHANGELOG.md`](CHANGELOG.md).
169
173
 
170
174
  ## Contributing
package/package.json CHANGED
@@ -1,12 +1,20 @@
1
1
  {
2
2
  "name": "@lyeve-labs/client-vue",
3
- "version": "0.1.6",
3
+ "version": "0.1.8",
4
4
  "description": "Vue 3 composables for the LyEve Core client - useQuery, useMutation, and the CmsPlugin provider",
5
5
  "license": "MIT",
6
6
  "author": "LyEve <info@lyeve.com>",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/lyeve-labs/client-vue.git"
10
+ },
11
+ "homepage": "https://github.com/lyeve-labs/client-vue#readme",
12
+ "bugs": {
13
+ "url": "https://github.com/lyeve-labs/client-vue/issues"
14
+ },
7
15
  "type": "module",
8
16
  "engines": {
9
- "node": ">=20"
17
+ "node": ">=24"
10
18
  },
11
19
  "main": "./dist/index.cjs",
12
20
  "module": "./dist/index.js",
@@ -49,7 +57,8 @@
49
57
  },
50
58
  "scripts": {
51
59
  "dev": "tsup --watch",
52
- "build": "tsup && publint && node scripts/check-dist.mjs",
60
+ "build": "pnpm version:check && tsup && publint && node scripts/check-dist.mjs",
61
+ "version:check": "node scripts/check-version.mjs",
53
62
  "check": "tsc --noEmit",
54
63
  "test": "vitest run",
55
64
  "test:watch": "vitest",