@startsimpli/hooks 0.4.33 → 0.4.34
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.
- package/package.json +3 -3
- package/src/index.ts +1 -0
- package/src/useVault.ts +11 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@startsimpli/hooks",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.34",
|
|
4
4
|
"description": "Shared React hooks for StartSimpli apps",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "./src/index.ts",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"@tanstack/react-query": ">=5.0.0",
|
|
24
24
|
"react": ">=18.0.0",
|
|
25
25
|
"react-native": ">=0.74.0",
|
|
26
|
-
"@startsimpli/api": "^0.5.
|
|
26
|
+
"@startsimpli/api": "^0.5.56"
|
|
27
27
|
},
|
|
28
28
|
"peerDependenciesMeta": {
|
|
29
29
|
"@tanstack/react-query": {
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"tsup": "^8.5.1",
|
|
47
47
|
"typescript": "^6.0.3",
|
|
48
48
|
"vitest": "^4.1.5",
|
|
49
|
-
"@startsimpli/api": "0.5.
|
|
49
|
+
"@startsimpli/api": "0.5.56"
|
|
50
50
|
},
|
|
51
51
|
"scripts": {
|
|
52
52
|
"build": "tsup",
|
package/src/index.ts
CHANGED
package/src/useVault.ts
CHANGED
|
@@ -205,6 +205,17 @@ export function useCreateAccessKey(api: VaultApi) {
|
|
|
205
205
|
})
|
|
206
206
|
}
|
|
207
207
|
|
|
208
|
+
/** Replace an access key's value in place — the old value stops working
|
|
209
|
+
* immediately. Raw values are hashed at rest, so there's no in-place "edit",
|
|
210
|
+
* only a swap; the new raw key comes back once in the mutation result. */
|
|
211
|
+
export function useRotateAccessKey(api: VaultApi) {
|
|
212
|
+
const qc = useQueryClient()
|
|
213
|
+
return useMutation({
|
|
214
|
+
mutationFn: ({ slug, id }: { slug: string; id: string }) => api.rotateAccessKey(slug, id),
|
|
215
|
+
onSuccess: (_, { slug }) => qc.invalidateQueries({ queryKey: accessKeysKey(slug) }),
|
|
216
|
+
})
|
|
217
|
+
}
|
|
218
|
+
|
|
208
219
|
export function useDeleteAccessKey(api: VaultApi) {
|
|
209
220
|
const qc = useQueryClient()
|
|
210
221
|
return useMutation({
|