Compare commits
6 Commits
@nhost/rea
...
@nhost/nho
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f1d9b472d1 | ||
|
|
c6dc7f44df | ||
|
|
3cea460c36 | ||
|
|
4c351714f5 | ||
|
|
3143d66a8e | ||
|
|
8512a7f181 |
@@ -1,5 +1,19 @@
|
||||
# @nhost/dashboard
|
||||
|
||||
## 1.15.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @nhost/react-apollo@11.0.4
|
||||
- @nhost/nextjs@2.1.13
|
||||
|
||||
## 1.15.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @nhost/react-apollo@11.0.3
|
||||
- @nhost/nextjs@2.1.12
|
||||
|
||||
## 1.15.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nhost/dashboard",
|
||||
"version": "1.15.0",
|
||||
"version": "1.15.2",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"preinstall": "npx only-allow pnpm",
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
# @nhost/docs
|
||||
|
||||
## 2.11.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- c6dc7f4: chore: docs: add Nhost client reference
|
||||
|
||||
## 2.10.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -298,6 +298,10 @@
|
||||
"group": "JavaScript",
|
||||
"icon": "js",
|
||||
"pages": [
|
||||
{
|
||||
"group": "nhost-js",
|
||||
"pages": ["reference/javascript/nhost-js/nhost-client", "reference/javascript/nhost-js/set-role", "reference/javascript/nhost-js/unset-role"]
|
||||
},
|
||||
{
|
||||
"group": "Auth",
|
||||
"pages": [
|
||||
@@ -338,7 +342,10 @@
|
||||
"reference/javascript/storage/get-public-url",
|
||||
"reference/javascript/storage/delete",
|
||||
"reference/javascript/storage/set-access-token",
|
||||
"reference/javascript/storage/set-admin-secret"
|
||||
"reference/javascript/storage/set-admin-secret",
|
||||
"reference/javascript/storage/set-headers",
|
||||
"reference/javascript/storage/unset-headers",
|
||||
"reference/javascript/storage/get-headers"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -347,7 +354,10 @@
|
||||
"reference/javascript/graphql/nhost-graphql-client",
|
||||
"reference/javascript/graphql/get-url",
|
||||
"reference/javascript/graphql/set-access-token",
|
||||
"reference/javascript/graphql/request"
|
||||
"reference/javascript/graphql/request",
|
||||
"reference/javascript/graphql/set-headers",
|
||||
"reference/javascript/graphql/unset-headers",
|
||||
"reference/javascript/graphql/get-headers"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nhost/docs",
|
||||
"version": "2.10.3",
|
||||
"version": "2.11.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"start": "mintlify dev"
|
||||
|
||||
10
docs/reference/javascript/graphql/get-headers.mdx
Normal file
10
docs/reference/javascript/graphql/get-headers.mdx
Normal file
@@ -0,0 +1,10 @@
|
||||
---
|
||||
title: getHeaders()
|
||||
sidebarTitle: getHeaders()
|
||||
---
|
||||
|
||||
Use `nhost.graphql.getHeaders` to get the global headers sent with all graphql requests
|
||||
|
||||
```ts
|
||||
nhost.graphql.getHeaders()
|
||||
```
|
||||
20
docs/reference/javascript/graphql/set-headers.mdx
Normal file
20
docs/reference/javascript/graphql/set-headers.mdx
Normal file
@@ -0,0 +1,20 @@
|
||||
---
|
||||
title: setHeaders()
|
||||
sidebarTitle: setHeaders()
|
||||
---
|
||||
|
||||
Use `nhost.graphql.setHeaders` to set global headers to be sent in all subsequent graphql requests
|
||||
|
||||
```ts
|
||||
nhost.graphql.setHeaders({
|
||||
'x-hasura-role': 'admin'
|
||||
})
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">headers</span>** <span className="optional-status">optional</span> <code>Record<string, string></code>
|
||||
|
||||
---
|
||||
11
docs/reference/javascript/graphql/unset-headers.mdx
Normal file
11
docs/reference/javascript/graphql/unset-headers.mdx
Normal file
@@ -0,0 +1,11 @@
|
||||
---
|
||||
title: unsetHeaders()
|
||||
sidebarTitle: unsetHeaders()
|
||||
---
|
||||
|
||||
Use `nhost.graphql.unsetHeaders` to remove global headers sent with all requests, except for the role header to preserve
|
||||
the role set by 'setRole' method.
|
||||
|
||||
```ts
|
||||
nhost.graphql.unsetHeaders()
|
||||
```
|
||||
51
docs/reference/javascript/nhost-js/nhost-client.mdx
Normal file
51
docs/reference/javascript/nhost-js/nhost-client.mdx
Normal file
@@ -0,0 +1,51 @@
|
||||
---
|
||||
title: NhostClient
|
||||
description: The Nhost client is the entry point to Nhost services.
|
||||
---
|
||||
|
||||
# `NhostClient`
|
||||
|
||||
```ts
|
||||
// Create a new Nhost client from subdomain and region.
|
||||
const nhost = new NhostClient({ subdomain, region })
|
||||
```
|
||||
|
||||
```ts
|
||||
// Create a new Nhost client from individual service URLs (custom domains, self-hosting, etc).
|
||||
const nhost = new NhostClient({
|
||||
authUrl: 'my-auth-service-url',
|
||||
storageUrl: 'my-storage-service-url',
|
||||
graphqlUrl: 'my-graphql-service-url',
|
||||
functionsUrl: 'my-functions-service-url'
|
||||
})
|
||||
```
|
||||
|
||||
```ts
|
||||
// Create a new Nhost client for local development.
|
||||
const nhost = new NhostClient({ subdomain: 'local' })
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">\_\_namedParameters</span>** <span className="optional-status">required</span> [`NhostClientConstructorParams`](/reference/javascript/nhost-js/types/nhost-client-constructor-params)
|
||||
|
||||
| Property | Type | Required | Notes |
|
||||
| :------------------------------------------------------------------------------------------------------------------ | :------------------------------------------------------------------------------ | :------: | :--------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| <span className="parameter-name"><span className="light-grey">\_\_namedParameters.</span>adminSecret</span> | <code>string</code> | | When set, the admin secret is sent as a header, `x-hasura-admin-secret`, for all requests to GraphQL, Storage, and Serverless Functions. |
|
||||
| <span className="parameter-name"><span className="light-grey">\_\_namedParameters.</span>functionsUrl</span> | <code>string</code> | | |
|
||||
| <span className="parameter-name"><span className="light-grey">\_\_namedParameters.</span>storageUrl</span> | <code>string</code> | | |
|
||||
| <span className="parameter-name"><span className="light-grey">\_\_namedParameters.</span>graphqlUrl</span> | <code>string</code> | | |
|
||||
| <span className="parameter-name"><span className="light-grey">\_\_namedParameters.</span>authUrl</span> | <code>string</code> | | |
|
||||
| <span className="parameter-name"><span className="light-grey">\_\_namedParameters.</span>region</span> | <code>string</code> | | Project region (e.g. `eu-central-1`) Project region is not required during local development (when `subdomain` is `localhost`) |
|
||||
| <span className="parameter-name"><span className="light-grey">\_\_namedParameters.</span>subdomain</span> | <code>string</code> | | Project subdomain (e.g. `ieingiwnginwnfnegqwvdqwdwq`) Use `localhost` during local development |
|
||||
| <span className="parameter-name"><span className="light-grey">\_\_namedParameters.</span>devTools</span> | <code>boolean</code> | | Activate devTools e.g. the ability to connect to the xstate inspector |
|
||||
| <span className="parameter-name"><span className="light-grey">\_\_namedParameters.</span>autoSignIn</span> | <code>boolean</code> | | When set to true, will parse the url on startup to check if it contains a refresh token to start the session with |
|
||||
| <span className="parameter-name"><span className="light-grey">\_\_namedParameters.</span>autoRefreshToken</span> | <code>boolean</code> | | When set to true, will automatically refresh token before it expires |
|
||||
| <span className="parameter-name"><span className="light-grey">\_\_namedParameters.</span>clientStorage</span> | [`ClientStorage`](/reference/javascript/nhost-js/types/client-storage) | | Object where the refresh token will be persisted and read locally. |
|
||||
| <span className="parameter-name"><span className="light-grey">\_\_namedParameters.</span>clientStorageType</span> | [`ClientStorageType`](/reference/javascript/nhost-js/types/client-storage-type) | | Define a way to get information about the refresh token and its exipration date. |
|
||||
| <span className="parameter-name"><span className="light-grey">\_\_namedParameters.</span>refreshIntervalTime</span> | <code>number</code> | | Time interval until token refreshes, in seconds |
|
||||
| <span className="parameter-name"><span className="light-grey">\_\_namedParameters.</span>start</span> | <code>boolean</code> | | |
|
||||
|
||||
---
|
||||
29
docs/reference/javascript/nhost-js/set-role.mdx
Normal file
29
docs/reference/javascript/nhost-js/set-role.mdx
Normal file
@@ -0,0 +1,29 @@
|
||||
---
|
||||
title: setRole()
|
||||
sidebarTitle: setRole()
|
||||
---
|
||||
|
||||
Use `nhost.setRole` to set the user role for all subsequent GraphQL, storage, and functions calls.
|
||||
Underneath, this method sets the `x-hasura-role` header on the graphql, storage,
|
||||
and functions clients.
|
||||
|
||||
```ts
|
||||
nhost.graphql.setHeaders({ 'x-hasura-role': role })
|
||||
nhost.storage.setHeaders({ 'x-hasura-role': role })
|
||||
nhost.functions.setHeaders({ 'x-hasura-role': role })
|
||||
```
|
||||
|
||||
Note: Exercise caution when mixing the use of `setRole` along with `setHeaders` when setting the
|
||||
`x-hasura-role` header, as the last call will override any previous ones.
|
||||
|
||||
```ts
|
||||
nhost.setRole('admin')
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">role</span>** <span className="optional-status">required</span> <code>string</code>
|
||||
|
||||
---
|
||||
@@ -0,0 +1,18 @@
|
||||
---
|
||||
title: ClientStorageType
|
||||
sidebarTitle: ClientStorageType
|
||||
description: No description provided.
|
||||
---
|
||||
|
||||
# `ClientStorageType`
|
||||
|
||||
```ts
|
||||
type ClientStorageType =
|
||||
| 'capacitor'
|
||||
| 'custom'
|
||||
| 'expo-secure-storage'
|
||||
| 'localStorage'
|
||||
| 'react-native'
|
||||
| 'web'
|
||||
| 'cookie'
|
||||
```
|
||||
55
docs/reference/javascript/nhost-js/types/client-storage.mdx
Normal file
55
docs/reference/javascript/nhost-js/types/client-storage.mdx
Normal file
@@ -0,0 +1,55 @@
|
||||
---
|
||||
title: ClientStorage
|
||||
sidebarTitle: ClientStorage
|
||||
description: No description provided.
|
||||
---
|
||||
|
||||
# `ClientStorage`
|
||||
|
||||
## Parameters
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">customSet</span>** <span className="optional-status">optional</span> <code>(key: string, value: null | string) => void | Promise<void></code>
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">customGet</span>** <span className="optional-status">optional</span> <code>(key: string) => null | string | Promise<null | string></code>
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">deleteItemAsync</span>** <span className="optional-status">optional</span> <code>(key: string) => void</code>
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">getItemAsync</span>** <span className="optional-status">optional</span> <code>(key: string) => any</code>
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">setItemAsync</span>** <span className="optional-status">optional</span> <code>(key: string, value: string) => void</code>
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">remove</span>** <span className="optional-status">optional</span> <code>(options: { key: string }) => void</code>
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">get</span>** <span className="optional-status">optional</span> <code>(options: { key: string }) => any</code>
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">set</span>** <span className="optional-status">optional</span> <code>(options: { key: string, value: string }) => void</code>
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">removeItem</span>** <span className="optional-status">optional</span> <code>(key: string) => void</code>
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">getItem</span>** <span className="optional-status">optional</span> <code>(key: string) => any</code>
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">setItem</span>** <span className="optional-status">optional</span> <code>(\_key: string, \_value: string) => void</code>
|
||||
|
||||
---
|
||||
@@ -0,0 +1,118 @@
|
||||
---
|
||||
title: NhostClientConstructorParams
|
||||
sidebarTitle: NhostClientConstructorParams
|
||||
description: No description provided.
|
||||
---
|
||||
|
||||
# `NhostClientConstructorParams`
|
||||
|
||||
## Parameters
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">start</span>** <span className="optional-status">optional</span> <code>boolean</code>
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">refreshIntervalTime</span>** <span className="optional-status">optional</span> <code>number</code>
|
||||
|
||||
Time interval until token refreshes, in seconds
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">clientStorageType</span>** <span className="optional-status">optional</span> [`ClientStorageType`](/reference/javascript/nhost-js/types/client-storage-type)
|
||||
|
||||
Define a way to get information about the refresh token and its exipration date.
|
||||
|
||||
**`@default`**
|
||||
|
||||
`web`
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">clientStorage</span>** <span className="optional-status">optional</span> [`ClientStorage`](/reference/javascript/nhost-js/types/client-storage)
|
||||
|
||||
Object where the refresh token will be persisted and read locally.
|
||||
|
||||
Recommended values:
|
||||
|
||||
- `'web'` and `'cookies'`: no value is required
|
||||
- `'react-native'`: `import Storage from @react-native-async-storage/async-storage`
|
||||
- `'cookies'`: `localStorage`
|
||||
- `'custom'`: an object that defines the following methods:
|
||||
- `setItem` or `setItemAsync`
|
||||
- `getItem` or `getItemAsync`
|
||||
- `removeItem`
|
||||
- `'capacitor'`: `import { Storage } from @capacitor/storage`
|
||||
- `'expo-secure-store'`: `import * as SecureStore from 'expo-secure-store'`
|
||||
|
||||
| Property | Type | Required | Notes |
|
||||
| :-------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------- | :------: | :---- |
|
||||
| <span className="parameter-name"><span className="light-grey">clientStorage.</span>setItem</span> | <code>(\_key: string, \_value: string) => void</code> | | |
|
||||
| <span className="parameter-name"><span className="light-grey">clientStorage.</span>getItem</span> | <code>(key: string) => any</code> | | |
|
||||
| <span className="parameter-name"><span className="light-grey">clientStorage.</span>removeItem</span> | <code>(key: string) => void</code> | | |
|
||||
| <span className="parameter-name"><span className="light-grey">clientStorage.</span>set</span> | <code>(options: { key: string, value: string }) => void</code> | | |
|
||||
| <span className="parameter-name"><span className="light-grey">clientStorage.</span>get</span> | <code>(options: { key: string }) => any</code> | | |
|
||||
| <span className="parameter-name"><span className="light-grey">clientStorage.</span>remove</span> | <code>(options: { key: string }) => void</code> | | |
|
||||
| <span className="parameter-name"><span className="light-grey">clientStorage.</span>setItemAsync</span> | <code>(key: string, value: string) => void</code> | | |
|
||||
| <span className="parameter-name"><span className="light-grey">clientStorage.</span>getItemAsync</span> | <code>(key: string) => any</code> | | |
|
||||
| <span className="parameter-name"><span className="light-grey">clientStorage.</span>deleteItemAsync</span> | <code>(key: string) => void</code> | | |
|
||||
| <span className="parameter-name"><span className="light-grey">clientStorage.</span>customGet</span> | <code>(key: string) => null | string | Promise<null | string></code> | | |
|
||||
| <span className="parameter-name"><span className="light-grey">clientStorage.</span>customSet</span> | <code>(key: string, value: null | string) => void | Promise<void></code> | | |
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">autoRefreshToken</span>** <span className="optional-status">optional</span> <code>boolean</code>
|
||||
|
||||
When set to true, will automatically refresh token before it expires
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">autoSignIn</span>** <span className="optional-status">optional</span> <code>boolean</code>
|
||||
|
||||
When set to true, will parse the url on startup to check if it contains a refresh token to start the session with
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">devTools</span>** <span className="optional-status">optional</span> <code>boolean</code>
|
||||
|
||||
Activate devTools e.g. the ability to connect to the xstate inspector
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">subdomain</span>** <span className="optional-status">optional</span> <code>string</code>
|
||||
|
||||
Project subdomain (e.g. `ieingiwnginwnfnegqwvdqwdwq`)
|
||||
Use `localhost` during local development
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">region</span>** <span className="optional-status">optional</span> <code>string</code>
|
||||
|
||||
Project region (e.g. `eu-central-1`)
|
||||
Project region is not required during local development (when `subdomain` is `localhost`)
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">authUrl</span>** <span className="optional-status">optional</span> <code>string</code>
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">graphqlUrl</span>** <span className="optional-status">optional</span> <code>string</code>
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">storageUrl</span>** <span className="optional-status">optional</span> <code>string</code>
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">functionsUrl</span>** <span className="optional-status">optional</span> <code>string</code>
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">adminSecret</span>** <span className="optional-status">optional</span> <code>string</code>
|
||||
|
||||
When set, the admin secret is sent as a header, `x-hasura-admin-secret`,
|
||||
for all requests to GraphQL, Storage, and Serverless Functions.
|
||||
|
||||
---
|
||||
14
docs/reference/javascript/nhost-js/unset-role.mdx
Normal file
14
docs/reference/javascript/nhost-js/unset-role.mdx
Normal file
@@ -0,0 +1,14 @@
|
||||
---
|
||||
title: unsetRole()
|
||||
sidebarTitle: unsetRole()
|
||||
---
|
||||
|
||||
Use `nhost.unsetRole` to unset the user role for all subsequent graphql, storage and functions calls.
|
||||
Underneath, this method removes the `x-hasura-role` header from the graphql, storage and functions clients.
|
||||
|
||||
Note: Exercise caution when mixing the use of `unsetRole` along with `setHeaders` when setting the
|
||||
`x-hasura-role` header, as the last call will override any previous ones.
|
||||
|
||||
```ts
|
||||
nhost.unsetRole()
|
||||
```
|
||||
@@ -22,6 +22,6 @@ const { file, error } = await nhost.storage.download({ fileId: '<File-ID>' })
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>quality</span> | <code>number</code> | | Image quality, between 1 and 100, 100 being the best quality |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>height</span> | <code>number</code> | | Image height, in pixels |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>width</span> | <code>number</code> | | Image width, in pixels |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>headers</span> | <code>Record<string, string></code> | | Optional headers to be sent with the request |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>headers</span> | <code>Record<string, string></code> | | |
|
||||
|
||||
---
|
||||
|
||||
10
docs/reference/javascript/storage/get-headers.mdx
Normal file
10
docs/reference/javascript/storage/get-headers.mdx
Normal file
@@ -0,0 +1,10 @@
|
||||
---
|
||||
title: getHeaders()
|
||||
sidebarTitle: getHeaders()
|
||||
---
|
||||
|
||||
Use `nhost.storage.getHeaders` to get global headers sent with all storage requests.
|
||||
|
||||
```ts
|
||||
nhost.storage.getHeaders()
|
||||
```
|
||||
@@ -24,12 +24,13 @@ console.log('expiration: ', presignedUrl.expiration)
|
||||
|
||||
**<span className="parameter-name">params</span>** <span className="optional-status">required</span> [`StorageGetPresignedUrlParams`](/reference/javascript/storage/types/storage-get-presigned-url-params)
|
||||
|
||||
| Property | Type | Required | Notes |
|
||||
| :----------------------------------------------------------------------------------------- | :------------------ | :------: | :----------------------------------------------------------- |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>fileId</span> | <code>string</code> | ✔️ | |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>blur</span> | <code>number</code> | | Image blur, between 0 and 100 |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>quality</span> | <code>number</code> | | Image quality, between 1 and 100, 100 being the best quality |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>height</span> | <code>number</code> | | Image height, in pixels |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>width</span> | <code>number</code> | | Image width, in pixels |
|
||||
| Property | Type | Required | Notes |
|
||||
| :----------------------------------------------------------------------------------------- | :---------------------------------------- | :------: | :----------------------------------------------------------- |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>fileId</span> | <code>string</code> | ✔️ | |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>blur</span> | <code>number</code> | | Image blur, between 0 and 100 |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>quality</span> | <code>number</code> | | Image quality, between 1 and 100, 100 being the best quality |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>height</span> | <code>number</code> | | Image height, in pixels |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>width</span> | <code>number</code> | | Image width, in pixels |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>headers</span> | <code>Record<string, string></code> | | |
|
||||
|
||||
---
|
||||
|
||||
22
docs/reference/javascript/storage/set-headers.mdx
Normal file
22
docs/reference/javascript/storage/set-headers.mdx
Normal file
@@ -0,0 +1,22 @@
|
||||
---
|
||||
title: setHeaders()
|
||||
sidebarTitle: setHeaders()
|
||||
---
|
||||
|
||||
Use `nhost.storage.setHeaders` to set global headers to be sent for all subsequent storage requests.
|
||||
|
||||
```ts
|
||||
nhost.storage.setHeaders({
|
||||
'x-hasura-role': 'admin'
|
||||
})
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">headers</span>** <span className="optional-status">optional</span> <code>Record<string, string></code>
|
||||
|
||||
key value headers object
|
||||
|
||||
---
|
||||
@@ -10,6 +10,10 @@ description: No description provided.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">headers</span>** <span className="optional-status">optional</span> <code>Record<string, string></code>
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">fileId</span>** <span className="optional-status">required</span> <code>string</code>
|
||||
|
||||
---
|
||||
|
||||
@@ -10,6 +10,10 @@ description: No description provided.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">headers</span>** <span className="optional-status">optional</span> <code>Record<string, string></code>
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">fileId</span>** <span className="optional-status">required</span> <code>string</code>
|
||||
|
||||
---
|
||||
|
||||
@@ -40,6 +40,4 @@ Image width, in pixels
|
||||
|
||||
**<span className="parameter-name">headers</span>** <span className="optional-status">optional</span> <code>Record<string, string></code>
|
||||
|
||||
Optional headers to be sent with the request
|
||||
|
||||
---
|
||||
|
||||
@@ -37,3 +37,7 @@ Image height, in pixels
|
||||
Image width, in pixels
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">headers</span>** <span className="optional-status">optional</span> <code>Record<string, string></code>
|
||||
|
||||
---
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
---
|
||||
title: StorageHeadersParam
|
||||
sidebarTitle: StorageHeadersParam
|
||||
description: No description provided.
|
||||
---
|
||||
|
||||
# `StorageHeadersParam`
|
||||
|
||||
## Parameters
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">headers</span>** <span className="optional-status">optional</span> <code>Record<string, string></code>
|
||||
|
||||
---
|
||||
@@ -25,3 +25,7 @@ description: No description provided.
|
||||
**<span className="parameter-name">id</span>** <span className="optional-status">optional</span> <code>string</code>
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">headers</span>** <span className="optional-status">optional</span> <code>Record<string, string></code>
|
||||
|
||||
---
|
||||
|
||||
@@ -14,10 +14,10 @@ description: No description provided.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">headers</span>** <span className="optional-status">optional</span> <code>Record<string, string></code>
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">bucketId</span>** <span className="optional-status">optional</span> <code>string</code>
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">headers</span>** <span className="optional-status">optional</span> <code>Record<string, string></code>
|
||||
|
||||
---
|
||||
|
||||
10
docs/reference/javascript/storage/unset-headers.mdx
Normal file
10
docs/reference/javascript/storage/unset-headers.mdx
Normal file
@@ -0,0 +1,10 @@
|
||||
---
|
||||
title: unsetHeaders()
|
||||
sidebarTitle: unsetHeaders()
|
||||
---
|
||||
|
||||
Use `nhost.storage.unsetHeaders` to remove the global headers sent for all subsequent storage requests.
|
||||
|
||||
```ts
|
||||
nhost.storage.unsetHeaders()
|
||||
```
|
||||
@@ -19,12 +19,13 @@ If no `bucketId` is specified the bucket `default` is used.
|
||||
|
||||
**<span className="parameter-name">params</span>** <span className="optional-status">required</span> [`StorageUploadFileParams`](/reference/javascript/storage/types/storage-upload-file-params)
|
||||
|
||||
| Property | Type | Required | Notes |
|
||||
| :------------------------------------------------------------------------------------------ | :------------------ | :------: | :---- |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>file</span> | <code>File</code> | ✔️ | |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>bucketId</span> | <code>string</code> | | |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>name</span> | <code>string</code> | | |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>id</span> | <code>string</code> | | |
|
||||
| Property | Type | Required | Notes |
|
||||
| :------------------------------------------------------------------------------------------ | :---------------------------------------- | :------: | :---- |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>file</span> | <code>File</code> | ✔️ | |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>bucketId</span> | <code>string</code> | | |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>name</span> | <code>string</code> | | |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>id</span> | <code>string</code> | | |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>headers</span> | <code>Record<string, string></code> | | |
|
||||
|
||||
---
|
||||
|
||||
@@ -64,7 +65,7 @@ await storage.upload({
|
||||
| Property | Type | Required | Notes |
|
||||
| :------------------------------------------------------------------------------------------ | :---------------------------------------- | :------: | :---- |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>formData</span> | <code>FormData | FormData</code> | ✔️ | |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>headers</span> | <code>Record<string, string></code> | | |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>bucketId</span> | <code>string</code> | | |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>headers</span> | <code>Record<string, string></code> | | |
|
||||
|
||||
---
|
||||
|
||||
@@ -1,5 +1,19 @@
|
||||
# @nhost-examples/cli
|
||||
|
||||
## 0.3.4
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [4c35171]
|
||||
- Updated dependencies [3cea460]
|
||||
- @nhost/nhost-js@3.1.2
|
||||
|
||||
## 0.3.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @nhost/nhost-js@3.1.1
|
||||
|
||||
## 0.3.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nhost-examples/cli",
|
||||
"version": "0.3.2",
|
||||
"version": "0.3.4",
|
||||
"main": "src/index.mjs",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
|
||||
@@ -1,5 +1,19 @@
|
||||
# @nhost-examples/codegen-react-apollo
|
||||
|
||||
## 0.4.4
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @nhost/react@3.4.4
|
||||
- @nhost/react-apollo@11.0.4
|
||||
|
||||
## 0.4.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @nhost/react@3.4.3
|
||||
- @nhost/react-apollo@11.0.3
|
||||
|
||||
## 0.4.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nhost-examples/codegen-react-apollo",
|
||||
"version": "0.4.2",
|
||||
"version": "0.4.4",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"codegen": "graphql-codegen",
|
||||
|
||||
@@ -1,5 +1,17 @@
|
||||
# @nhost-examples/codegen-react-query
|
||||
|
||||
## 0.4.4
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @nhost/react@3.4.4
|
||||
|
||||
## 0.4.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @nhost/react@3.4.3
|
||||
|
||||
## 0.4.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nhost-examples/codegen-react-query",
|
||||
"version": "0.4.2",
|
||||
"version": "0.4.4",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"codegen": "graphql-codegen",
|
||||
|
||||
@@ -1,5 +1,19 @@
|
||||
# @nhost-examples/react-urql
|
||||
|
||||
## 0.3.4
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @nhost/react@3.4.4
|
||||
- @nhost/react-urql@8.0.4
|
||||
|
||||
## 0.3.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @nhost/react@3.4.3
|
||||
- @nhost/react-urql@8.0.3
|
||||
|
||||
## 0.3.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@nhost-examples/codegen-react-urql",
|
||||
"private": true,
|
||||
"version": "0.3.2",
|
||||
"version": "0.3.4",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "tsc && vite build",
|
||||
|
||||
@@ -1,5 +1,19 @@
|
||||
# @nhost-examples/multi-tenant-one-to-many
|
||||
|
||||
## 2.2.4
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [4c35171]
|
||||
- Updated dependencies [3cea460]
|
||||
- @nhost/nhost-js@3.1.2
|
||||
|
||||
## 2.2.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @nhost/nhost-js@3.1.1
|
||||
|
||||
## 2.2.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@nhost-examples/multi-tenant-one-to-many",
|
||||
"private": true,
|
||||
"version": "2.2.2",
|
||||
"version": "2.2.4",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {},
|
||||
|
||||
@@ -1,5 +1,21 @@
|
||||
# @nhost-examples/nextjs
|
||||
|
||||
## 0.3.4
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @nhost/react@3.4.4
|
||||
- @nhost/react-apollo@11.0.4
|
||||
- @nhost/nextjs@2.1.13
|
||||
|
||||
## 0.3.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @nhost/react@3.4.3
|
||||
- @nhost/react-apollo@11.0.3
|
||||
- @nhost/nextjs@2.1.12
|
||||
|
||||
## 0.3.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nhost-examples/nextjs",
|
||||
"version": "0.3.2",
|
||||
"version": "0.3.4",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
|
||||
@@ -1,5 +1,19 @@
|
||||
# @nhost-examples/node-storage
|
||||
|
||||
## 0.2.4
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [4c35171]
|
||||
- Updated dependencies [3cea460]
|
||||
- @nhost/nhost-js@3.1.2
|
||||
|
||||
## 0.2.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @nhost/nhost-js@3.1.1
|
||||
|
||||
## 0.2.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nhost-examples/node-storage",
|
||||
"version": "0.2.2",
|
||||
"version": "0.2.4",
|
||||
"private": true,
|
||||
"description": "This is an example of how to use the Storage with Node.js",
|
||||
"main": "src/index.mjs",
|
||||
|
||||
@@ -1,5 +1,19 @@
|
||||
# @nhost-examples/nextjs-server-components
|
||||
|
||||
## 0.4.4
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [4c35171]
|
||||
- Updated dependencies [3cea460]
|
||||
- @nhost/nhost-js@3.1.2
|
||||
|
||||
## 0.4.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @nhost/nhost-js@3.1.1
|
||||
|
||||
## 0.4.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nhost-examples/nextjs-server-components",
|
||||
"version": "0.4.2",
|
||||
"version": "0.4.4",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
|
||||
@@ -1,5 +1,19 @@
|
||||
# @nhost-examples/react-apollo
|
||||
|
||||
## 0.8.4
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @nhost/react@3.4.4
|
||||
- @nhost/react-apollo@11.0.4
|
||||
|
||||
## 0.8.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @nhost/react@3.4.3
|
||||
- @nhost/react-apollo@11.0.3
|
||||
|
||||
## 0.8.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nhost-examples/react-apollo",
|
||||
"version": "0.8.2",
|
||||
"version": "0.8.4",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@apollo/client": "^3.9.9",
|
||||
|
||||
@@ -1,5 +1,17 @@
|
||||
# @nhost-examples/react-gqty
|
||||
|
||||
## 1.2.4
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @nhost/react@3.4.4
|
||||
|
||||
## 1.2.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @nhost/react@3.4.3
|
||||
|
||||
## 1.2.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@nhost-examples/react-gqty",
|
||||
"private": true,
|
||||
"version": "1.2.2",
|
||||
"version": "1.2.4",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -1,5 +1,23 @@
|
||||
# @nhost-examples/vue-apollo
|
||||
|
||||
## 0.6.4
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [4c35171]
|
||||
- Updated dependencies [3cea460]
|
||||
- @nhost/nhost-js@3.1.2
|
||||
- @nhost/apollo@7.0.2
|
||||
- @nhost/vue@2.5.4
|
||||
|
||||
## 0.6.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @nhost/nhost-js@3.1.1
|
||||
- @nhost/apollo@7.0.1
|
||||
- @nhost/vue@2.5.3
|
||||
|
||||
## 0.6.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@nhost-examples/vue-apollo",
|
||||
"private": true,
|
||||
"version": "0.6.2",
|
||||
"version": "0.6.4",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "vite build",
|
||||
|
||||
@@ -1,5 +1,19 @@
|
||||
# @nhost-examples/vue-quickstart
|
||||
|
||||
## 0.2.4
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @nhost/apollo@7.0.2
|
||||
- @nhost/vue@2.5.4
|
||||
|
||||
## 0.2.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @nhost/apollo@7.0.1
|
||||
- @nhost/vue@2.5.3
|
||||
|
||||
## 0.2.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nhost-examples/vue-quickstart",
|
||||
"version": "0.2.2",
|
||||
"version": "0.2.4",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"build": "vite build",
|
||||
|
||||
@@ -1,5 +1,19 @@
|
||||
# @nhost/apollo
|
||||
|
||||
## 7.0.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [4c35171]
|
||||
- Updated dependencies [3cea460]
|
||||
- @nhost/nhost-js@3.1.2
|
||||
|
||||
## 7.0.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @nhost/nhost-js@3.1.1
|
||||
|
||||
## 7.0.0
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nhost/apollo",
|
||||
"version": "7.0.0",
|
||||
"version": "7.0.2",
|
||||
"description": "Nhost Apollo Client library",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
|
||||
@@ -1,5 +1,19 @@
|
||||
# @nhost/react-apollo
|
||||
|
||||
## 11.0.4
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @nhost/apollo@7.0.2
|
||||
- @nhost/react@3.4.4
|
||||
|
||||
## 11.0.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @nhost/apollo@7.0.1
|
||||
- @nhost/react@3.4.3
|
||||
|
||||
## 11.0.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nhost/react-apollo",
|
||||
"version": "11.0.2",
|
||||
"version": "11.0.4",
|
||||
"description": "Nhost React Apollo client",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
|
||||
@@ -1,5 +1,17 @@
|
||||
# @nhost/react-urql
|
||||
|
||||
## 8.0.4
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @nhost/react@3.4.4
|
||||
|
||||
## 8.0.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @nhost/react@3.4.3
|
||||
|
||||
## 8.0.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nhost/react-urql",
|
||||
"version": "8.0.2",
|
||||
"version": "8.0.4",
|
||||
"description": "Nhost React URQL client",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
# @nhost/hasura-storage-js
|
||||
|
||||
## 2.5.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 8512a7f: fix: fix types StorageGetUrlParams and StorageGetPresignedUrlParams to include missing StorageHeadersParam
|
||||
|
||||
## 2.5.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nhost/hasura-storage-js",
|
||||
"version": "2.5.0",
|
||||
"version": "2.5.1",
|
||||
"description": "Hasura-storage client",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
|
||||
@@ -124,8 +124,9 @@ export class HasuraStorageClient {
|
||||
async getPresignedUrl(
|
||||
params: StorageGetPresignedUrlParams
|
||||
): Promise<StorageGetPresignedUrlResponse> {
|
||||
const { fileId, ...imageTransformationParams } = params
|
||||
const { fileId, headers, ...imageTransformationParams } = params
|
||||
const { presignedUrl, error } = await this.api.getPresignedUrl(params)
|
||||
|
||||
if (error) {
|
||||
return { presignedUrl: null, error }
|
||||
}
|
||||
|
||||
@@ -81,7 +81,9 @@ export interface StorageGetUrlParams extends StorageImageTransformationParams {
|
||||
fileId: string
|
||||
}
|
||||
|
||||
export interface StorageGetPresignedUrlParams extends StorageImageTransformationParams {
|
||||
export interface StorageGetPresignedUrlParams
|
||||
extends StorageImageTransformationParams,
|
||||
StorageHeadersParam {
|
||||
fileId: string
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,17 @@
|
||||
# @nhost/nextjs
|
||||
|
||||
## 2.1.13
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @nhost/react@3.4.4
|
||||
|
||||
## 2.1.12
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @nhost/react@3.4.3
|
||||
|
||||
## 2.1.11
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nhost/nextjs",
|
||||
"version": "2.1.11",
|
||||
"version": "2.1.13",
|
||||
"description": "Nhost NextJS library",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
|
||||
@@ -1,5 +1,19 @@
|
||||
# @nhost/nhost-js
|
||||
|
||||
## 3.1.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 4c35171: fix: update docstring to correctly reflect usage of nhost.unsetRole method
|
||||
- 3cea460: chore: update docs links for nhost-js setRole and unsetRole methods
|
||||
|
||||
## 3.1.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [8512a7f]
|
||||
- @nhost/hasura-storage-js@2.5.1
|
||||
|
||||
## 3.1.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nhost/nhost-js",
|
||||
"version": "3.1.0",
|
||||
"version": "3.1.2",
|
||||
"description": "Nhost JavaScript SDK",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
|
||||
@@ -18,13 +18,30 @@ export class NhostClient {
|
||||
readonly devTools?: boolean
|
||||
|
||||
/**
|
||||
* Nhost Client
|
||||
*
|
||||
* @example
|
||||
* ```ts
|
||||
* // Create a new Nhost client from subdomain and region.
|
||||
* const nhost = new NhostClient({ subdomain, region });
|
||||
* ```
|
||||
*
|
||||
*
|
||||
* ```ts
|
||||
* // Create a new Nhost client from individual service URLs (custom domains, self-hosting, etc).
|
||||
* const nhost = new NhostClient({
|
||||
* authUrl: "my-auth-service-url",
|
||||
* storageUrl: "my-storage-service-url",
|
||||
* graphqlUrl: "my-graphql-service-url",
|
||||
* functionsUrl: "my-functions-service-url",
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
*
|
||||
* ```ts
|
||||
* // Create a new Nhost client for local development.
|
||||
* const nhost = new NhostClient({ subdomain: "local" });
|
||||
* ```
|
||||
*
|
||||
* @docs https://docs.nhost.io/reference/javascript
|
||||
*/
|
||||
constructor({
|
||||
@@ -110,7 +127,7 @@ export class NhostClient {
|
||||
* nhost.setRole('admin')
|
||||
* ```
|
||||
*
|
||||
* @docs https://docs.nhost.io/reference/javascript/set-role
|
||||
* @docs https://docs.nhost.io/reference/javascript/nhost-js/set-role
|
||||
*/
|
||||
setRole(role: string) {
|
||||
this.graphql.setHeaders({ 'x-hasura-role': role })
|
||||
@@ -127,10 +144,10 @@ export class NhostClient {
|
||||
*
|
||||
* @example
|
||||
* ```ts
|
||||
* nhost.unsetRole('admin')
|
||||
* nhost.unsetRole()
|
||||
* ```
|
||||
*
|
||||
* @docs https://docs.nhost.io/reference/javascript/set-role
|
||||
* @docs https://docs.nhost.io/reference/javascript/nhost-js/unset-role
|
||||
*/
|
||||
unsetRole() {
|
||||
this.graphql.setHeaders((({ 'x-hasura-role': _, ...rest }) => rest)(this.graphql.getHeaders()))
|
||||
|
||||
@@ -1,5 +1,19 @@
|
||||
# @nhost/react
|
||||
|
||||
## 3.4.4
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [4c35171]
|
||||
- Updated dependencies [3cea460]
|
||||
- @nhost/nhost-js@3.1.2
|
||||
|
||||
## 3.4.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @nhost/nhost-js@3.1.1
|
||||
|
||||
## 3.4.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nhost/react",
|
||||
"version": "3.4.2",
|
||||
"version": "3.4.4",
|
||||
"description": "Nhost React library",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
|
||||
@@ -1,5 +1,19 @@
|
||||
# @nhost/vue
|
||||
|
||||
## 2.5.4
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [4c35171]
|
||||
- Updated dependencies [3cea460]
|
||||
- @nhost/nhost-js@3.1.2
|
||||
|
||||
## 2.5.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @nhost/nhost-js@3.1.1
|
||||
|
||||
## 2.5.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nhost/vue",
|
||||
"version": "2.5.2",
|
||||
"version": "2.5.4",
|
||||
"description": "Nhost Vue library",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
|
||||
Reference in New Issue
Block a user