Compare commits
8 Commits
@nhost/rea
...
@nhost/rea
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dee93bb873 | ||
|
|
173b587802 | ||
|
|
30ef1660b4 | ||
|
|
a613aa9f0c | ||
|
|
3c03b9b46f | ||
|
|
65a3061146 | ||
|
|
55864eac30 | ||
|
|
28494d6c1f |
@@ -43,7 +43,7 @@ In your serverless function, you need to make sure the request actually comes fr
|
|||||||
- Check the header in the serverless function. It should match the environment variable `NHOST_WEBHOOK_SECRET`.
|
- Check the header in the serverless function. It should match the environment variable `NHOST_WEBHOOK_SECRET`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
export default function async handler(req, res) {
|
export default async function handler(req, res) {
|
||||||
|
|
||||||
// Check webhook secret to make sure the request is valid
|
// Check webhook secret to make sure the request is valid
|
||||||
if (
|
if (
|
||||||
|
|||||||
@@ -1,5 +1,12 @@
|
|||||||
# @nhost/apollo
|
# @nhost/apollo
|
||||||
|
|
||||||
|
## 0.5.2
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [65a3061]
|
||||||
|
- @nhost/core@0.5.2
|
||||||
|
|
||||||
## 0.5.1
|
## 0.5.1
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@nhost/apollo",
|
"name": "@nhost/apollo",
|
||||||
"version": "0.5.1",
|
"version": "0.5.2",
|
||||||
"description": "Nhost Apollo Client library",
|
"description": "Nhost Apollo Client library",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
|
|||||||
@@ -1,5 +1,11 @@
|
|||||||
# @nhost/core
|
# @nhost/core
|
||||||
|
|
||||||
|
## 0.5.2
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- 65a3061: correct cookie storage type
|
||||||
|
|
||||||
## 0.5.1
|
## 0.5.1
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@nhost/core",
|
"name": "@nhost/core",
|
||||||
"version": "0.5.1",
|
"version": "0.5.2",
|
||||||
"description": "Nhost core client library",
|
"description": "Nhost core client library",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
|
|||||||
@@ -29,39 +29,13 @@ const defaultClientStorageSetter: StorageSetter = (key, value) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO see https://github.com/nhost/nhost/pull/507#discussion_r865873389
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
||||||
const checkStorageAccessors = (
|
|
||||||
clientStorage: ClientStorage,
|
|
||||||
accessors: Array<keyof ClientStorage>
|
|
||||||
) => {
|
|
||||||
accessors.forEach((key) => {
|
|
||||||
if (typeof clientStorage[key] !== 'function') {
|
|
||||||
console.error(`clientStorage.${key} is not a function`)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
export const localStorageGetter = (
|
export const localStorageGetter = (
|
||||||
clientStorageType: ClientStorageType,
|
clientStorageType: ClientStorageType,
|
||||||
clientStorage?: ClientStorage
|
clientStorage?: ClientStorage
|
||||||
): StorageGetter => {
|
): StorageGetter => {
|
||||||
if (!clientStorage || clientStorageType === 'localStorage' || clientStorageType === 'web') {
|
if (clientStorageType === 'localStorage' || clientStorageType === 'web') {
|
||||||
return defaultClientStorageGetter
|
return defaultClientStorageGetter
|
||||||
}
|
}
|
||||||
|
|
||||||
if (clientStorageType === 'react-native') {
|
|
||||||
// checkStorageAccessors(clientStorage, ['getItem'])
|
|
||||||
return (key) => clientStorage.getItem?.(key)
|
|
||||||
}
|
|
||||||
if (clientStorageType === 'capacitor') {
|
|
||||||
// checkStorageAccessors(clientStorage, ['get'])
|
|
||||||
return (key) => clientStorage.get?.({ key })
|
|
||||||
}
|
|
||||||
if (clientStorageType === 'expo-secure-storage') {
|
|
||||||
// checkStorageAccessors(clientStorage, ['getItemAsync'])
|
|
||||||
return (key) => clientStorage.getItemAsync?.(key)
|
|
||||||
}
|
|
||||||
if (clientStorageType === 'cookie') {
|
if (clientStorageType === 'cookie') {
|
||||||
return (key) => {
|
return (key) => {
|
||||||
if (isBrowser) {
|
if (isBrowser) {
|
||||||
@@ -71,6 +45,20 @@ export const localStorageGetter = (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!clientStorage) {
|
||||||
|
throw Error(
|
||||||
|
`clientStorageType is set to '${clientStorageType}' but no clienStorage has been given`
|
||||||
|
)
|
||||||
|
}
|
||||||
|
if (clientStorageType === 'react-native') {
|
||||||
|
return (key) => clientStorage.getItem?.(key)
|
||||||
|
}
|
||||||
|
if (clientStorageType === 'capacitor') {
|
||||||
|
return (key) => clientStorage.get?.({ key })
|
||||||
|
}
|
||||||
|
if (clientStorageType === 'expo-secure-storage') {
|
||||||
|
return (key) => clientStorage.getItemAsync?.(key)
|
||||||
|
}
|
||||||
if (clientStorageType === 'custom') {
|
if (clientStorageType === 'custom') {
|
||||||
if (clientStorage.getItem && clientStorage.removeItem) {
|
if (clientStorage.getItem && clientStorage.removeItem) {
|
||||||
return clientStorage.getItem
|
return clientStorage.getItem
|
||||||
@@ -89,25 +77,9 @@ export const localStorageSetter = (
|
|||||||
clientStorageType: ClientStorageType,
|
clientStorageType: ClientStorageType,
|
||||||
clientStorage?: ClientStorage
|
clientStorage?: ClientStorage
|
||||||
): StorageSetter => {
|
): StorageSetter => {
|
||||||
if (!clientStorage || clientStorageType === 'localStorage' || clientStorageType === 'web') {
|
if (clientStorageType === 'localStorage' || clientStorageType === 'web') {
|
||||||
return defaultClientStorageSetter
|
return defaultClientStorageSetter
|
||||||
}
|
}
|
||||||
|
|
||||||
if (clientStorageType === 'react-native') {
|
|
||||||
// checkStorageAccessors(clientStorage, ['setItem', 'removeItem'])
|
|
||||||
return (key, value) =>
|
|
||||||
value ? clientStorage.setItem?.(key, value) : clientStorage.removeItem?.(key)
|
|
||||||
}
|
|
||||||
if (clientStorageType === 'capacitor') {
|
|
||||||
// checkStorageAccessors(clientStorage, ['set', 'remove'])
|
|
||||||
return (key, value) =>
|
|
||||||
value ? clientStorage.set?.({ key, value }) : clientStorage.remove?.({ key })
|
|
||||||
}
|
|
||||||
if (clientStorageType === 'expo-secure-storage') {
|
|
||||||
// checkStorageAccessors(clientStorage, ['setItemAsync', 'deleteItemAsync'])
|
|
||||||
return async (key, value) =>
|
|
||||||
value ? clientStorage.setItemAsync?.(key, value) : clientStorage.deleteItemAsync?.(key)
|
|
||||||
}
|
|
||||||
if (clientStorageType === 'cookie') {
|
if (clientStorageType === 'cookie') {
|
||||||
return (key, value) => {
|
return (key, value) => {
|
||||||
if (isBrowser) {
|
if (isBrowser) {
|
||||||
@@ -119,6 +91,23 @@ export const localStorageSetter = (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!clientStorage) {
|
||||||
|
throw Error(
|
||||||
|
`clientStorageType is set to '${clientStorageType}' but no clienStorage has been given`
|
||||||
|
)
|
||||||
|
}
|
||||||
|
if (clientStorageType === 'react-native') {
|
||||||
|
return (key, value) =>
|
||||||
|
value ? clientStorage.setItem?.(key, value) : clientStorage.removeItem?.(key)
|
||||||
|
}
|
||||||
|
if (clientStorageType === 'capacitor') {
|
||||||
|
return (key, value) =>
|
||||||
|
value ? clientStorage.set?.({ key, value }) : clientStorage.remove?.({ key })
|
||||||
|
}
|
||||||
|
if (clientStorageType === 'expo-secure-storage') {
|
||||||
|
return async (key, value) =>
|
||||||
|
value ? clientStorage.setItemAsync?.(key, value) : clientStorage.deleteItemAsync?.(key)
|
||||||
|
}
|
||||||
if (clientStorageType === 'custom') {
|
if (clientStorageType === 'custom') {
|
||||||
if (!clientStorage.removeItem) {
|
if (!clientStorage.removeItem) {
|
||||||
throw Error(
|
throw Error(
|
||||||
|
|||||||
@@ -1,5 +1,12 @@
|
|||||||
# @nhost/hasura-auth-js
|
# @nhost/hasura-auth-js
|
||||||
|
|
||||||
|
## 1.1.4
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [65a3061]
|
||||||
|
- @nhost/core@0.5.2
|
||||||
|
|
||||||
## 1.1.3
|
## 1.1.3
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@nhost/hasura-auth-js",
|
"name": "@nhost/hasura-auth-js",
|
||||||
"version": "1.1.3",
|
"version": "1.1.4",
|
||||||
"description": "Hasura-auth client",
|
"description": "Hasura-auth client",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
|
|||||||
@@ -1,5 +1,12 @@
|
|||||||
# @nhost/nextjs
|
# @nhost/nextjs
|
||||||
|
|
||||||
|
## 1.2.2
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- @nhost/nhost-js@1.1.9
|
||||||
|
- @nhost/react@0.7.2
|
||||||
|
|
||||||
## 1.2.1
|
## 1.2.1
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@nhost/nextjs",
|
"name": "@nhost/nextjs",
|
||||||
"version": "1.2.1",
|
"version": "1.2.2",
|
||||||
"description": "Nhost NextJS library",
|
"description": "Nhost NextJS library",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ export const getNhostSession = async (
|
|||||||
backendUrl: string,
|
backendUrl: string,
|
||||||
context: GetServerSidePropsContext
|
context: GetServerSidePropsContext
|
||||||
): Promise<NhostSession | null> => {
|
): Promise<NhostSession | null> => {
|
||||||
const nhost = await createServerSideClient(backendUrl, context as any)
|
const nhost = await createServerSideClient(backendUrl, context)
|
||||||
const { accessToken, refreshToken, user } = nhost.auth.client.interpreter!.state.context
|
const { accessToken, refreshToken, user } = nhost.auth.client.interpreter!.state.context
|
||||||
return nhost.auth.isAuthenticated()
|
return nhost.auth.isAuthenticated()
|
||||||
? {
|
? {
|
||||||
|
|||||||
@@ -1,5 +1,11 @@
|
|||||||
# @nhost/nhost-js
|
# @nhost/nhost-js
|
||||||
|
|
||||||
|
## 1.1.9
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- @nhost/hasura-auth-js@1.1.4
|
||||||
|
|
||||||
## 1.1.8
|
## 1.1.8
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@nhost/nhost-js",
|
"name": "@nhost/nhost-js",
|
||||||
"version": "1.1.8",
|
"version": "1.1.9",
|
||||||
"description": "Nhost JavaScript SDK",
|
"description": "Nhost JavaScript SDK",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
|
|||||||
@@ -1,5 +1,12 @@
|
|||||||
# @nhost/react-apollo
|
# @nhost/react-apollo
|
||||||
|
|
||||||
|
## 4.2.2
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- @nhost/apollo@0.5.2
|
||||||
|
- @nhost/react@0.7.2
|
||||||
|
|
||||||
## 4.2.1
|
## 4.2.1
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@nhost/react-apollo",
|
"name": "@nhost/react-apollo",
|
||||||
"version": "4.2.1",
|
"version": "4.2.2",
|
||||||
"description": "Nhost React Apollo client",
|
"description": "Nhost React Apollo client",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
|
|||||||
@@ -1,5 +1,11 @@
|
|||||||
# @nhost/react
|
# @nhost/react
|
||||||
|
|
||||||
|
## 0.7.2
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- @nhost/nhost-js@1.1.9
|
||||||
|
|
||||||
## 0.7.1
|
## 0.7.1
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@nhost/react",
|
"name": "@nhost/react",
|
||||||
"version": "0.7.1",
|
"version": "0.7.2",
|
||||||
"description": "Nhost React library",
|
"description": "Nhost React library",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
|
|||||||
Reference in New Issue
Block a user