Compare commits
8 Commits
@nhost/nex
...
@nhost/vue
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
543ea2a0e7 | ||
|
|
6764d476fd | ||
|
|
7bed0eadc9 | ||
|
|
c7644ace34 | ||
|
|
49cdb2843e | ||
|
|
6f45856c46 | ||
|
|
208bdbba2d | ||
|
|
cd62e1e833 |
@@ -20,9 +20,9 @@
|
||||
"@mantine/hooks": "^4.2.2",
|
||||
"@mantine/next": "^4.2.2",
|
||||
"@mantine/notifications": "^4.2.2",
|
||||
"@nhost/nextjs": "workspace:*",
|
||||
"@nhost/react": "workspace:*",
|
||||
"@nhost/react-apollo": "workspace:*",
|
||||
"@nhost/nextjs": "*",
|
||||
"@nhost/react": "*",
|
||||
"@nhost/react-apollo": "*",
|
||||
"graphql": "^16.3.0",
|
||||
"next": "12.1.6",
|
||||
"react": "18.1.0",
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
"@apollo/client": "^3.5.10",
|
||||
"@headlessui/react": "^1.5.0",
|
||||
"@heroicons/react": "^1.0.6",
|
||||
"@nhost/react": "workspace:*",
|
||||
"@nhost/react-apollo": "workspace:*",
|
||||
"@nhost/react": "*",
|
||||
"@nhost/react-apollo": "*",
|
||||
"@tailwindcss/forms": "^0.5.0",
|
||||
"classnames": "^2.3.1",
|
||||
"date-fns": "^2.28.0",
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@apollo/client": "^3.6.2",
|
||||
"@nhost/apollo": "^0.5.4",
|
||||
"@nhost/apollo": "*",
|
||||
"@nhost/vue": "*",
|
||||
"@vue/apollo-composable": "^4.0.0-alpha.17",
|
||||
"@vueuse/core": "^8.4.2",
|
||||
|
||||
@@ -1,5 +1,21 @@
|
||||
# @nhost/vue
|
||||
|
||||
## 0.2.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 6f45856c: Correct use of ref values in action options
|
||||
The `nestedUnref` helper was not correctly un-refing nested values. For instance, the values the properties of the following metadata were still `refs`:
|
||||
|
||||
```jsx
|
||||
const { signUpEmailPassword } = useSignUpEmailPassword()
|
||||
const firstName = ref('John')
|
||||
const lastName = ref('Doe')
|
||||
signUpEmailPassword((email: 'john@world.com'), (password: 'not-1234'), {
|
||||
metadata: { firstName, lastName }
|
||||
})
|
||||
```
|
||||
|
||||
## 0.2.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nhost/vue",
|
||||
"version": "0.2.0",
|
||||
"version": "0.2.1",
|
||||
"description": "Nhost Vue library",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
|
||||
@@ -14,9 +14,9 @@ export type NestedRefOfValue<T> = RefOrValue<{
|
||||
|
||||
export const nestedUnref = <T>(input: NestedRefOfValue<T>): T => {
|
||||
const result: NestedRefOfValue<T> = unref(input)
|
||||
if (result) {
|
||||
if (result && typeof result === 'object') {
|
||||
return Object.entries(result).reduce(
|
||||
(aggr, [key, value]) => ({ ...aggr, [key]: unref(value) }),
|
||||
(aggr, [key, value]) => ({ ...aggr, [key]: nestedUnref(value as NestedRefOfValue<unknown>) }),
|
||||
{} as T
|
||||
)
|
||||
} else {
|
||||
|
||||
@@ -1,5 +1,24 @@
|
||||
describe('main', () => {
|
||||
it('shoud work', async () => {
|
||||
expect(true).toBeTruthy()
|
||||
import { ref } from 'vue'
|
||||
import { nestedUnref } from '../src/helpers'
|
||||
describe('nestedUnref', () => {
|
||||
it('should unref ref values in a unref property', async () => {
|
||||
const a = ref('value of a')
|
||||
const b = ref('value of b')
|
||||
const input = { metadata: { a, b } }
|
||||
const result = nestedUnref(input)
|
||||
expect(result).toEqual({ metadata: { a: a.value, b: b.value } })
|
||||
})
|
||||
|
||||
it('should unref a property', () => {
|
||||
const metadataValue = { firstName: 'John', lastName: 'Doe' }
|
||||
const input = { metadata: ref(metadataValue) }
|
||||
const result = nestedUnref(input)
|
||||
expect(result).toEqual({ metadata: metadataValue })
|
||||
})
|
||||
|
||||
it('should return the same value when not a ref', () => {
|
||||
const input = { metadata: { firstName: 'John', lastName: 'Doe' } }
|
||||
const result = nestedUnref(input)
|
||||
expect(result).toEqual(input)
|
||||
})
|
||||
})
|
||||
|
||||
93
pnpm-lock.yaml
generated
93
pnpm-lock.yaml
generated
@@ -141,9 +141,9 @@ importers:
|
||||
'@mantine/next': ^4.2.2
|
||||
'@mantine/notifications': ^4.2.2
|
||||
'@next/bundle-analyzer': ^12.1.5
|
||||
'@nhost/nextjs': workspace:*
|
||||
'@nhost/react': workspace:*
|
||||
'@nhost/react-apollo': workspace:*
|
||||
'@nhost/nextjs': '*'
|
||||
'@nhost/react': '*'
|
||||
'@nhost/react-apollo': '*'
|
||||
'@types/node': 17.0.23
|
||||
'@types/react': 18.0.8
|
||||
'@xstate/inspect': ^0.6.2
|
||||
@@ -215,7 +215,7 @@ importers:
|
||||
'@mantine/notifications': 4.2.2_af46c71ecf518c86fb9b76e8a89b700a
|
||||
'@mantine/prism': 4.2.2_af46c71ecf518c86fb9b76e8a89b700a
|
||||
'@nhost/react': link:../../packages/react
|
||||
'@nhost/react-apollo': 4.2.16_58f3e90a6170f0045c5bb6e207aee083
|
||||
'@nhost/react-apollo': link:../../packages/react-apollo
|
||||
graphql: 15.7.2
|
||||
react: 18.1.0
|
||||
react-dom: 18.1.0_react@18.1.0
|
||||
@@ -247,8 +247,8 @@ importers:
|
||||
'@graphql-codegen/typescript-react-apollo': ^3.2.11
|
||||
'@headlessui/react': ^1.5.0
|
||||
'@heroicons/react': ^1.0.6
|
||||
'@nhost/react': workspace:*
|
||||
'@nhost/react-apollo': workspace:*
|
||||
'@nhost/react': '*'
|
||||
'@nhost/react-apollo': '*'
|
||||
'@tailwindcss/forms': ^0.5.0
|
||||
'@types/express': ^4.17.13
|
||||
'@types/jest': ^26.0.24
|
||||
@@ -330,7 +330,7 @@ importers:
|
||||
dependencies:
|
||||
'@apollo/client': 3.6.2_graphql@15.7.2
|
||||
'@mdi/font': 5.9.55
|
||||
'@nhost/apollo': 0.5.14_@apollo+client@3.6.2
|
||||
'@nhost/apollo': link:../../packages/apollo
|
||||
'@nhost/vue': link:../../packages/vue
|
||||
'@vue/apollo-composable': 4.0.0-alpha.17_b3df241743dde28b5526750c78bfbb4c
|
||||
graphql: 15.7.2
|
||||
@@ -356,7 +356,7 @@ importers:
|
||||
'@antfu/eslint-config': ^0.23.0
|
||||
'@apollo/client': ^3.6.2
|
||||
'@iconify-json/carbon': ^1.1.4
|
||||
'@nhost/apollo': ^0.5.4
|
||||
'@nhost/apollo': '*'
|
||||
'@nhost/vue': '*'
|
||||
'@types/node': ^17.0.32
|
||||
'@unocss/reset': ^0.33.2
|
||||
@@ -381,7 +381,7 @@ importers:
|
||||
vue-tsc: ^0.34.12
|
||||
dependencies:
|
||||
'@apollo/client': 3.6.2_graphql@15.7.2
|
||||
'@nhost/apollo': 0.5.14_@apollo+client@3.6.2
|
||||
'@nhost/apollo': link:../../packages/apollo
|
||||
'@nhost/vue': link:../../packages/vue
|
||||
'@vue/apollo-composable': 4.0.0-alpha.17_08af77e940f4f74547ae9718f2605a3f
|
||||
'@vueuse/core': 8.4.2_vue@3.2.33
|
||||
@@ -4904,29 +4904,6 @@ packages:
|
||||
dev: false
|
||||
optional: true
|
||||
|
||||
/@nhost/apollo/0.5.14_@apollo+client@3.6.2:
|
||||
resolution: {integrity: sha512-+nC3ohVZmxrUeYKfRldEu0EaSdCooy/K2Ky/N3SsUTVKYSH08zZuTKWO198+c3i0aEaJ4gz+mkvkkz13xwS9bg==}
|
||||
peerDependencies:
|
||||
'@apollo/client': ^3.6.2
|
||||
dependencies:
|
||||
'@apollo/client': 3.6.2_graphql@15.7.2
|
||||
'@nhost/nhost-js': 1.2.4_graphql@15.7.2
|
||||
graphql: 15.7.2
|
||||
graphql-ws: 5.7.0_graphql@15.7.2
|
||||
transitivePeerDependencies:
|
||||
- debug
|
||||
dev: false
|
||||
|
||||
/@nhost/core/0.6.5:
|
||||
resolution: {integrity: sha512-G0cEYZpipOaEtq1lpWFAb1m7M1Coks6KLSNqtCWOkVyUmcjXWnzwICcLo3TCBE3bqV0EVU4sfmjJH0IvzfjzLQ==}
|
||||
dependencies:
|
||||
axios: 0.27.2
|
||||
js-cookie: 3.0.1
|
||||
xstate: 4.31.0
|
||||
transitivePeerDependencies:
|
||||
- debug
|
||||
dev: false
|
||||
|
||||
/@nhost/hasura-auth-js/0.1.15:
|
||||
resolution: {integrity: sha512-KIZW0gqTsuZz0HKEA4UZPolmHOn6RVVVwy2WwUn/amFREJfDN4O4JrzZjUQUYSLn9Dx7wOCIf2ij2tkXKhcLaQ==}
|
||||
dependencies:
|
||||
@@ -4937,16 +4914,6 @@ packages:
|
||||
- debug
|
||||
dev: false
|
||||
|
||||
/@nhost/hasura-auth-js/1.1.14:
|
||||
resolution: {integrity: sha512-SrITpciqfLJbHbVnX+sCNAsk3NfpTj1BbjhLFWRR0yWNMUfR7zfZKv96id2jn5o+GvkeLS4KeRSFjqyusMiBAQ==}
|
||||
dependencies:
|
||||
'@nhost/core': 0.6.5
|
||||
jwt-decode: 3.1.2
|
||||
xstate: 4.31.0
|
||||
transitivePeerDependencies:
|
||||
- debug
|
||||
dev: false
|
||||
|
||||
/@nhost/hasura-storage-js/0.1.0:
|
||||
resolution: {integrity: sha512-XkmU8N3lvw9hm2o4NbXqjRc+X07TAicw3qlmoTQ+QFSLLzDUfr2L2u7j4UYsj5i8Nxxl+EaB/7hYOIH/+d+fzA==}
|
||||
dependencies:
|
||||
@@ -4955,14 +4922,6 @@ packages:
|
||||
- debug
|
||||
dev: false
|
||||
|
||||
/@nhost/hasura-storage-js/0.3.3:
|
||||
resolution: {integrity: sha512-QNXMOp3cPdyob6ADg+LGj/27nVdhnnqX/i3OuNj3KTbXWrFX/zkLpWV88Etk+MHA+rWPviQiN5Zjh5FNdaoCzw==}
|
||||
dependencies:
|
||||
axios: 0.27.2
|
||||
transitivePeerDependencies:
|
||||
- debug
|
||||
dev: false
|
||||
|
||||
/@nhost/nhost-js/0.3.13:
|
||||
resolution: {integrity: sha512-kg85sZjWmsvW3Se7MfJAEUkurN4dWb+b5f54EFMSIJ/62x8Rj3whoBzpjgN/CXtv1QTt3I+YqT9RNpEP/Z+jBQ==}
|
||||
dependencies:
|
||||
@@ -4975,40 +4934,6 @@ packages:
|
||||
- debug
|
||||
dev: false
|
||||
|
||||
/@nhost/nhost-js/1.2.4_graphql@15.7.2:
|
||||
resolution: {integrity: sha512-VrED8septNSEXC5yq/4uc6XOYGHb2CpdrP+q9q8iXXi+XaEfWdUMW39LaXhjP54zpiyDqn0H8yzS39QphDM+yQ==}
|
||||
peerDependencies:
|
||||
graphql: ^14.0.0 || ^15.0.0 || ^16.0.0
|
||||
dependencies:
|
||||
'@nhost/hasura-auth-js': 1.1.14
|
||||
'@nhost/hasura-storage-js': 0.3.3
|
||||
axios: 0.27.2
|
||||
graphql: 15.7.2
|
||||
jwt-decode: 3.1.2
|
||||
query-string: 7.1.1
|
||||
transitivePeerDependencies:
|
||||
- debug
|
||||
dev: false
|
||||
|
||||
/@nhost/react-apollo/4.2.16_58f3e90a6170f0045c5bb6e207aee083:
|
||||
resolution: {integrity: sha512-FJ7zgAXXBrblene2QEAG06XajCfWnteXwCGQBcrcd4vDK5wBubJCALs1xHvrucze2Nbow7EzWcvaEqzuU+HxkQ==}
|
||||
peerDependencies:
|
||||
'@apollo/client': ^3.6.2
|
||||
'@nhost/react': 0.7.13
|
||||
graphql: ^16.0.0
|
||||
react: ^17.0.0 || ^18.0.0
|
||||
react-dom: ^17.0.0 || ^18.0.0
|
||||
dependencies:
|
||||
'@apollo/client': 3.6.2_graphql@15.7.2+react@18.1.0
|
||||
'@nhost/apollo': 0.5.14_@apollo+client@3.6.2
|
||||
'@nhost/react': link:packages/react
|
||||
graphql: 15.7.2
|
||||
react: 18.1.0
|
||||
react-dom: 18.1.0_react@18.1.0
|
||||
transitivePeerDependencies:
|
||||
- debug
|
||||
dev: false
|
||||
|
||||
/@nodelib/fs.scandir/2.1.5:
|
||||
resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==}
|
||||
engines: {node: '>= 8'}
|
||||
|
||||
Reference in New Issue
Block a user