Compare commits

..

8 Commits

Author SHA1 Message Date
github-actions[bot]
b2cc1411d7 chore: update versions (#2571)
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## @nhost/apollo@6.0.8

### Patch Changes

-   @nhost/nhost-js@3.0.8

## @nhost/react-apollo@9.0.3

### Patch Changes

-   @nhost/apollo@6.0.8
-   @nhost/react@3.2.3

## @nhost/react-urql@6.0.3

### Patch Changes

-   @nhost/react@3.2.3

## @nhost/graphql-js@0.1.8

### Patch Changes

- 407feea: fix: replace `jwt-decode` with `jose` to decode access tokens
in a non browser environment

## @nhost/nextjs@2.1.5

### Patch Changes

-   @nhost/react@3.2.3

## @nhost/nhost-js@3.0.8

### Patch Changes

-   Updated dependencies [407feea]
    -   @nhost/graphql-js@0.1.8

## @nhost/react@3.2.3

### Patch Changes

-   @nhost/nhost-js@3.0.8

## @nhost/vue@2.2.3

### Patch Changes

-   @nhost/nhost-js@3.0.8

## @nhost/dashboard@1.8.3

### Patch Changes

-   @nhost/react-apollo@9.0.3
-   @nhost/nextjs@2.1.5

## @nhost-examples/cli@0.1.9

### Patch Changes

-   @nhost/nhost-js@3.0.8

## @nhost-examples/codegen-react-apollo@0.1.17

### Patch Changes

-   @nhost/react@3.2.3
-   @nhost/react-apollo@9.0.3

## @nhost-examples/codegen-react-query@0.1.18

### Patch Changes

-   @nhost/react@3.2.3

## @nhost-examples/codegen-react-urql@0.0.14

### Patch Changes

-   @nhost/react@3.2.3
-   @nhost/react-urql@6.0.3

## @nhost-examples/multi-tenant-one-to-many@2.0.7

### Patch Changes

-   @nhost/nhost-js@3.0.8

## @nhost-examples/nextjs@0.1.19

### Patch Changes

-   @nhost/react@3.2.3
-   @nhost/react-apollo@9.0.3
-   @nhost/nextjs@2.1.5

## @nhost-examples/node-storage@0.0.11

### Patch Changes

-   @nhost/nhost-js@3.0.8

## @nhost-examples/nextjs-server-components@0.2.5

### Patch Changes

-   @nhost/nhost-js@3.0.8

## @nhost-examples/react-apollo@0.3.3

### Patch Changes

-   @nhost/react@3.2.3
-   @nhost/react-apollo@9.0.3

## @nhost-examples/react-gqty@1.0.7

### Patch Changes

-   @nhost/react@3.2.3

## @nhost-examples/vue-apollo@0.2.4

### Patch Changes

-   @nhost/nhost-js@3.0.8
-   @nhost/apollo@6.0.8
-   @nhost/vue@2.2.3

## @nhost-examples/vue-quickstart@0.0.16

### Patch Changes

-   @nhost/apollo@6.0.8
-   @nhost/vue@2.2.3

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-02-29 15:43:48 +01:00
Hassan Ben Jobrane
407feeac37 fix: sdk: graphql-js: replace jwt-decode with jose to decode access tokens in both node and the browser (#2570) 2024-02-29 14:51:33 +01:00
github-actions[bot]
7b25c37c26 chore: update versions (#2569)
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## @nhost/dashboard@1.8.2

### Patch Changes

- 6df4f02: fix: use custom error toast and show correct message when
sending an invite

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-02-29 13:10:09 +01:00
Hassan Ben Jobrane
6df4f02e95 fix(dashboard): show correct message when sending invite fails (#2567) 2024-02-29 12:52:25 +01:00
github-actions[bot]
aaae98f019 chore: update versions (#2559)
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## @nhost/docs@2.6.0

### Minor Changes

-   dc23dc0: fix: docs run references

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-02-25 23:02:36 -01:00
Nuno Pato
dc23dc0f49 fix: docs run references (#2558) 2024-02-25 22:47:38 -01:00
github-actions[bot]
82728da100 chore: update versions (#2556)
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## @nhost/apollo@6.0.7

### Patch Changes

-   @nhost/nhost-js@3.0.7

## @nhost/react-apollo@9.0.2

### Patch Changes

-   @nhost/apollo@6.0.7
-   @nhost/react@3.2.2

## @nhost/react-urql@6.0.2

### Patch Changes

-   @nhost/react@3.2.2

## @nhost/graphql-js@0.1.7

### Patch Changes

- 2d68fee: fix: resolve an issue where unauthenticated graphql requests
are not sent

## @nhost/nextjs@2.1.4

### Patch Changes

-   @nhost/react@3.2.2

## @nhost/nhost-js@3.0.7

### Patch Changes

-   Updated dependencies [2d68fee]
    -   @nhost/graphql-js@0.1.7

## @nhost/react@3.2.2

### Patch Changes

-   @nhost/nhost-js@3.0.7

## @nhost/vue@2.2.2

### Patch Changes

-   @nhost/nhost-js@3.0.7

## @nhost/dashboard@1.8.1

### Patch Changes

-   @nhost/react-apollo@9.0.2
-   @nhost/nextjs@2.1.4

## @nhost-examples/cli@0.1.8

### Patch Changes

-   @nhost/nhost-js@3.0.7

## @nhost-examples/codegen-react-apollo@0.1.16

### Patch Changes

-   @nhost/react@3.2.2
-   @nhost/react-apollo@9.0.2

## @nhost-examples/codegen-react-query@0.1.17

### Patch Changes

-   @nhost/react@3.2.2

## @nhost-examples/codegen-react-urql@0.0.13

### Patch Changes

-   @nhost/react@3.2.2
-   @nhost/react-urql@6.0.2

## @nhost-examples/multi-tenant-one-to-many@2.0.6

### Patch Changes

-   @nhost/nhost-js@3.0.7

## @nhost-examples/nextjs@0.1.18

### Patch Changes

-   @nhost/react@3.2.2
-   @nhost/react-apollo@9.0.2
-   @nhost/nextjs@2.1.4

## @nhost-examples/node-storage@0.0.10

### Patch Changes

-   @nhost/nhost-js@3.0.7

## @nhost-examples/nextjs-server-components@0.2.4

### Patch Changes

-   @nhost/nhost-js@3.0.7

## @nhost-examples/react-apollo@0.3.2

### Patch Changes

-   @nhost/react@3.2.2
-   @nhost/react-apollo@9.0.2

## @nhost-examples/react-gqty@1.0.6

### Patch Changes

-   @nhost/react@3.2.2

## @nhost-examples/vue-apollo@0.2.3

### Patch Changes

-   @nhost/nhost-js@3.0.7
-   @nhost/apollo@6.0.7
-   @nhost/vue@2.2.2

## @nhost-examples/vue-quickstart@0.0.15

### Patch Changes

-   @nhost/apollo@6.0.7
-   @nhost/vue@2.2.2

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-02-23 21:14:11 +01:00
Hassan Ben Jobrane
2d68fee54c fix(graphql-js): allow graphql requests with no access token (#2555) 2024-02-23 21:09:45 +01:00
53 changed files with 387 additions and 84 deletions

View File

@@ -1,5 +1,25 @@
# @nhost/dashboard
## 1.8.3
### Patch Changes
- @nhost/react-apollo@9.0.3
- @nhost/nextjs@2.1.5
## 1.8.2
### Patch Changes
- 6df4f02: fix: use custom error toast and show correct message when sending an invite
## 1.8.1
### Patch Changes
- @nhost/react-apollo@9.0.2
- @nhost/nextjs@2.1.4
## 1.8.0
### Minor Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@nhost/dashboard",
"version": "1.8.0",
"version": "1.8.3",
"private": true,
"scripts": {
"preinstall": "npx only-allow pnpm",

View File

@@ -5,7 +5,7 @@ import { XIcon } from '@/components/ui/v2/icons/XIcon';
import { useCurrentWorkspaceAndProject } from '@/features/projects/common/hooks/useCurrentWorkspaceAndProject';
import { getToastBackgroundColor } from '@/utils/constants/settings';
import { copy } from '@/utils/copy';
import { ApolloError } from '@apollo/client';
import type { ApolloError } from '@apollo/client';
import { useUserData } from '@nhost/nextjs';
import { AnimatePresence, motion } from 'framer-motion';
import { useRouter } from 'next/router';
@@ -27,10 +27,11 @@ const getInternalErrorMessage = (
return null;
}
if (error instanceof ApolloError) {
const internalError = error.graphQLErrors?.[0]?.extensions?.internal as
| { error: { message: string } }
| undefined;
if (error.name === 'ApolloError') {
// @ts-ignore
const internalError = error.graphQLErrors?.[0]?.extensions?.internal as {
error: { message: string };
};
return internalError?.error?.message || null;
}
@@ -42,7 +43,7 @@ const getInternalErrorMessage = (
};
const errorToObject = (error: ApolloError | Error) => {
if (error instanceof ApolloError) {
if (error.name === 'ApolloError') {
return error;
}

View File

@@ -7,7 +7,7 @@ import { useIsCurrentUserOwner } from '@/features/projects/common/hooks/useIsCur
import { PendingWorkspaceMemberInvitation } from '@/features/projects/workspaces/components/PendingWorkspaceMemberInvitation';
import { WorkspaceMember } from '@/features/projects/workspaces/components/WorkspaceMember';
import { discordAnnounce } from '@/utils/discordAnnounce';
import { getErrorMessage } from '@/utils/getErrorMessage';
import { execPromiseWithErrorToast } from '@/utils/execPromiseWithErrorToast';
import { triggerToast } from '@/utils/toast';
import {
refetchGetWorkspaceMembersQuery,
@@ -52,38 +52,42 @@ function WorkspaceMemberInviteForm({
return;
}
try {
await insertWorkspaceMemberInvite({
variables: {
workspaceMemberInvite: {
workspaceId: currentWorkspace.id,
email,
memberType: 'member',
await execPromiseWithErrorToast(
async () => {
await insertWorkspaceMemberInvite({
variables: {
workspaceMemberInvite: {
workspaceId: currentWorkspace.id,
email,
memberType: 'member',
},
},
},
});
triggerToast(
`Invite to join workspace ${currentWorkspace.name} sent to ${email}.`,
);
} catch (error) {
await discordAnnounce(
`Error trying to invite to ${email} to ${currentWorkspace.name} ${error.message}`,
);
if (
error.message ===
'Foreign key violation. insert or update on table "workspace_member_invites" violates foreign key constraint "workspace_member_invites_email_fkey"'
) {
setWorkspaceInviteError(
'You can only invite users that are already registered at Nhost. Ask the person to register an account, then invite them again.',
});
triggerToast(
`Invite to join workspace ${currentWorkspace.name} sent to ${email}.`,
);
},
{
loadingMessage: 'Sending invite...',
successMessage: 'The invite has been sent successfully.',
errorMessage: `Error trying to invite to ${email} to ${currentWorkspace.name}`,
onError: async (error) => {
await discordAnnounce(
`Error trying to invite to ${email} to ${currentWorkspace.name} ${error.message}`,
);
return;
}
setWorkspaceInviteError(getErrorMessage(error, 'invite'));
return;
}
if (
error.message ===
'Foreign key violation. insert or update on table "workspace_member_invites" violates foreign key constraint "workspace_member_invites_email_fkey"'
) {
setWorkspaceInviteError(
'You can only invite users that are already registered at Nhost. Ask the person to register an account, then invite them again.',
);
}
},
},
);
setEmail('');
};
@@ -130,8 +134,8 @@ export default function WorkspaceMembers() {
});
return (
<div className="mx-auto mt-18 max-w-3xl font-display">
<div className="mb-2 grid grid-flow-row gap-1">
<div className="max-w-3xl mx-auto mt-18 font-display">
<div className="grid grid-flow-row gap-1 mb-2">
<Text variant="h3">Members</Text>
<Text color="secondary" className="text-sm">
People in this workspace can manage all projects listed above.

View File

@@ -29,6 +29,7 @@ export default async function execPromiseWithErrorToast(
const result = await call();
toast.dismiss(loadingToastId);
toast.success(successMessage, {
style: toastStyle.style,
...toastStyle.success,

View File

@@ -1,5 +1,11 @@
# @nhost/docs
## 2.6.0
### Minor Changes
- dc23dc0: fix: docs run references
## 2.5.0
### Minor Changes

View File

@@ -9,7 +9,7 @@ If you are using the Nhost CLI for local development, as of [v0.12.0](https://gi
<Steps>
<Step title="Configuring the Service">
Follow the steps highlighed in the ["Enabling Service"](enabling-service) guide and don't forget to add the relevant secrets to your `.secrets` file.
Follow the steps highlighed in the [Enabling Service](enabling-service) guide and don't forget to add the relevant secrets to your `.secrets` file.
</Step>
<Step title="Start nhost">
Run `nhost up`:

View File

@@ -46,11 +46,11 @@ capacity=1
</Tab>
</Tabs>
<Info>Head to [CLI & CI deployments](/run/ci) for more details on how to deploy using a configuration file.</Info>
<Info>Head to [CLI & CI deployments](/guides/run/cli-deployments) for more details on how to deploy using a configuration file.</Info>
The `name` of the service is used as an identifier and to generate URLs when exposing the service to the Internet. You can use any container image publicly available or you can push your own to the [Nhost registry](/run/registry).
The `name` of the service is used as an identifier and to generate URLs when exposing the service to the Internet. You can use any container image publicly available or you can push your own to the [Nhost registry](/guides/run/registry).
All environment variables set here are exclusive to this service and will not be shared with other services or with the Nhost stack. If you are using a configuration file secrets are supported.
For more details about the `Ports` section head to [networking](/run/networking). You can also head to [resources](/run/resources) for more information about replicas, compute, and storage.
For more details about the `Ports` section head to [networking](/guides/run/networking). You can also head to [resources](/guides/run/resources) for more information about replicas, compute, and storage.

View File

@@ -12,11 +12,11 @@ Then on `New Service`:
![click on New Service](/images/guides/run/getting_started_2.png)
Now you can fill your [service configuration](/run/configuration):
Now you can fill your [service configuration](/guides/run/configuration):
![click on New Service](/images/guides/run/getting_started_3.png)
As you configure the `Ports` section you can take note of the generated URL. You can find more information about this section under [Networking](/run/networking).
As you configure the `Ports` section you can take note of the generated URL. You can find more information about this section under [Networking](/guides/run/networking).
![copy the URL](/images/guides/run/getting_started_4.png)

View File

@@ -76,7 +76,7 @@ To pause a service, simply set its number of replicas to `0`:
<Tab title="dashboard">
![pausing a service](/img/run/resources_3.png)
![pausing a service](/images/guides/run/resources_3.png)
</Tab>
<Tab title="toml">

View File

@@ -1,6 +1,6 @@
{
"name": "@nhost/docs",
"version": "2.5.0",
"version": "2.6.0",
"private": true,
"scripts": {
"start": "mintlify dev"

View File

@@ -1,5 +1,17 @@
# @nhost-examples/cli
## 0.1.9
### Patch Changes
- @nhost/nhost-js@3.0.8
## 0.1.8
### Patch Changes
- @nhost/nhost-js@3.0.7
## 0.1.7
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@nhost-examples/cli",
"version": "0.1.7",
"version": "0.1.9",
"main": "src/index.mjs",
"private": true,
"scripts": {

View File

@@ -1,5 +1,19 @@
# @nhost-examples/codegen-react-apollo
## 0.1.17
### Patch Changes
- @nhost/react@3.2.3
- @nhost/react-apollo@9.0.3
## 0.1.16
### Patch Changes
- @nhost/react@3.2.2
- @nhost/react-apollo@9.0.2
## 0.1.15
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@nhost-examples/codegen-react-apollo",
"version": "0.1.15",
"version": "0.1.17",
"private": true,
"scripts": {
"codegen": "graphql-codegen",

View File

@@ -1,5 +1,17 @@
# @nhost-examples/codegen-react-query
## 0.1.18
### Patch Changes
- @nhost/react@3.2.3
## 0.1.17
### Patch Changes
- @nhost/react@3.2.2
## 0.1.16
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@nhost-examples/codegen-react-query",
"version": "0.1.16",
"version": "0.1.18",
"private": true,
"scripts": {
"codegen": "graphql-codegen",

View File

@@ -1,5 +1,19 @@
# @nhost-examples/react-urql
## 0.0.14
### Patch Changes
- @nhost/react@3.2.3
- @nhost/react-urql@6.0.3
## 0.0.13
### Patch Changes
- @nhost/react@3.2.2
- @nhost/react-urql@6.0.2
## 0.0.12
### Patch Changes

View File

@@ -1,7 +1,7 @@
{
"name": "@nhost-examples/codegen-react-urql",
"private": true,
"version": "0.0.12",
"version": "0.0.14",
"scripts": {
"dev": "vite",
"build": "tsc && vite build",

View File

@@ -1,5 +1,17 @@
# @nhost-examples/multi-tenant-one-to-many
## 2.0.7
### Patch Changes
- @nhost/nhost-js@3.0.8
## 2.0.6
### Patch Changes
- @nhost/nhost-js@3.0.7
## 2.0.5
### Patch Changes

View File

@@ -1,7 +1,7 @@
{
"name": "@nhost-examples/multi-tenant-one-to-many",
"private": true,
"version": "2.0.5",
"version": "2.0.7",
"description": "",
"main": "index.js",
"scripts": {},

View File

@@ -1,5 +1,21 @@
# @nhost-examples/nextjs
## 0.1.19
### Patch Changes
- @nhost/react@3.2.3
- @nhost/react-apollo@9.0.3
- @nhost/nextjs@2.1.5
## 0.1.18
### Patch Changes
- @nhost/react@3.2.2
- @nhost/react-apollo@9.0.2
- @nhost/nextjs@2.1.4
## 0.1.17
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@nhost-examples/nextjs",
"version": "0.1.17",
"version": "0.1.19",
"private": true,
"scripts": {
"dev": "next dev",

View File

@@ -1,5 +1,17 @@
# @nhost-examples/node-storage
## 0.0.11
### Patch Changes
- @nhost/nhost-js@3.0.8
## 0.0.10
### Patch Changes
- @nhost/nhost-js@3.0.7
## 0.0.9
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@nhost-examples/node-storage",
"version": "0.0.9",
"version": "0.0.11",
"private": true,
"description": "This is an example of how to use the Storage with Node.js",
"main": "src/index.mjs",

View File

@@ -1,5 +1,17 @@
# @nhost-examples/nextjs-server-components
## 0.2.5
### Patch Changes
- @nhost/nhost-js@3.0.8
## 0.2.4
### Patch Changes
- @nhost/nhost-js@3.0.7
## 0.2.3
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@nhost-examples/nextjs-server-components",
"version": "0.2.3",
"version": "0.2.5",
"private": true,
"scripts": {
"dev": "next dev",

View File

@@ -1,5 +1,19 @@
# @nhost-examples/react-apollo
## 0.3.3
### Patch Changes
- @nhost/react@3.2.3
- @nhost/react-apollo@9.0.3
## 0.3.2
### Patch Changes
- @nhost/react@3.2.2
- @nhost/react-apollo@9.0.2
## 0.3.1
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@nhost-examples/react-apollo",
"version": "0.3.1",
"version": "0.3.3",
"private": true,
"dependencies": {
"@apollo/client": "^3.9.4",

View File

@@ -1,5 +1,17 @@
# @nhost-examples/react-gqty
## 1.0.7
### Patch Changes
- @nhost/react@3.2.3
## 1.0.6
### Patch Changes
- @nhost/react@3.2.2
## 1.0.5
### Patch Changes

View File

@@ -1,7 +1,7 @@
{
"name": "@nhost-examples/react-gqty",
"private": true,
"version": "1.0.5",
"version": "1.0.7",
"type": "module",
"scripts": {
"dev": "vite",

View File

@@ -1,5 +1,21 @@
# @nhost-examples/vue-apollo
## 0.2.4
### Patch Changes
- @nhost/nhost-js@3.0.8
- @nhost/apollo@6.0.8
- @nhost/vue@2.2.3
## 0.2.3
### Patch Changes
- @nhost/nhost-js@3.0.7
- @nhost/apollo@6.0.7
- @nhost/vue@2.2.2
## 0.2.2
### Patch Changes

View File

@@ -1,7 +1,7 @@
{
"name": "@nhost-examples/vue-apollo",
"private": true,
"version": "0.2.2",
"version": "0.2.4",
"scripts": {
"dev": "vite",
"build": "vite build",

View File

@@ -1,5 +1,19 @@
# @nhost-examples/vue-quickstart
## 0.0.16
### Patch Changes
- @nhost/apollo@6.0.8
- @nhost/vue@2.2.3
## 0.0.15
### Patch Changes
- @nhost/apollo@6.0.7
- @nhost/vue@2.2.2
## 0.0.14
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@nhost-examples/vue-quickstart",
"version": "0.0.14",
"version": "0.0.16",
"private": true,
"scripts": {
"build": "vite build",

View File

@@ -1,5 +1,17 @@
# @nhost/apollo
## 6.0.8
### Patch Changes
- @nhost/nhost-js@3.0.8
## 6.0.7
### Patch Changes
- @nhost/nhost-js@3.0.7
## 6.0.6
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@nhost/apollo",
"version": "6.0.6",
"version": "6.0.8",
"description": "Nhost Apollo Client library",
"license": "MIT",
"keywords": [

View File

@@ -1,5 +1,19 @@
# @nhost/react-apollo
## 9.0.3
### Patch Changes
- @nhost/apollo@6.0.8
- @nhost/react@3.2.3
## 9.0.2
### Patch Changes
- @nhost/apollo@6.0.7
- @nhost/react@3.2.2
## 9.0.1
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@nhost/react-apollo",
"version": "9.0.1",
"version": "9.0.3",
"description": "Nhost React Apollo client",
"license": "MIT",
"keywords": [

View File

@@ -1,5 +1,17 @@
# @nhost/react-urql
## 6.0.3
### Patch Changes
- @nhost/react@3.2.3
## 6.0.2
### Patch Changes
- @nhost/react@3.2.2
## 6.0.1
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@nhost/react-urql",
"version": "6.0.1",
"version": "6.0.3",
"description": "Nhost React URQL client",
"license": "MIT",
"keywords": [

View File

@@ -1,5 +1,17 @@
# @nhost/graphql-js
## 0.1.8
### Patch Changes
- 407feea: fix: replace `jwt-decode` with `jose` to decode access tokens in a non browser environment
## 0.1.7
### Patch Changes
- 2d68fee: fix: resolve an issue where unauthenticated graphql requests are not sent
## 0.1.6
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@nhost/graphql-js",
"version": "0.1.6",
"version": "0.1.8",
"description": "Nhost GraphQL client",
"license": "MIT",
"keywords": [
@@ -55,7 +55,7 @@
"dependencies": {
"@graphql-typed-document-node/core": "^3.2.0",
"isomorphic-unfetch": "^3.1.0",
"jwt-decode": "^3.1.2"
"jose": "^5.2.2"
},
"peerDependencies": {
"graphql": "^14.0.0 || ^15.0.0 || ^16.0.0"

View File

@@ -12,7 +12,7 @@ import {
Variables
} from './types'
import jwtDecode, { JwtPayload } from 'jwt-decode'
import * as jose from 'jose'
/**
* @alias GraphQL
@@ -30,13 +30,13 @@ export class NhostGraphqlClient {
this.adminSecret = adminSecret
}
private isAccessTokenValid = () => {
private isAccessTokenValidOrNull = () => {
if (!this.accessToken) {
return false
return true
}
try {
const decodedToken: JwtPayload = jwtDecode(this.accessToken)
const decodedToken = jose.decodeJwt<jose.JWTPayload>(this.accessToken)
return decodedToken.exp != null && decodedToken.exp * 1000 > Date.now()
} catch (error) {
console.error('Error decoding token:', error)
@@ -44,21 +44,21 @@ export class NhostGraphqlClient {
}
}
private awaitForValidAccessToken = async () => {
if (this.isAccessTokenValid()) {
private awaitForValidAccessTokenOrNull = async () => {
if (this.isAccessTokenValidOrNull()) {
return true
}
const waitForValidToken = () => {
if (this.isAccessTokenValid()) {
const waitForValidTokenOrNull = () => {
if (this.isAccessTokenValidOrNull()) {
return Promise.resolve(true)
}
return new Promise((resolve) => {
setTimeout(() => waitForValidToken().then(resolve), 100)
setTimeout(() => waitForValidTokenOrNull().then(resolve), 100)
})
}
return waitForValidToken()
return waitForValidTokenOrNull()
}
/**
@@ -106,7 +106,7 @@ export class NhostGraphqlClient {
if (!process.env.TEST_MODE) {
// We skip this while running unit tests because the accessToken is generated using faker
await this.awaitForValidAccessToken()
await this.awaitForValidAccessTokenOrNull()
}
try {

View File

@@ -1,5 +1,17 @@
# @nhost/nextjs
## 2.1.5
### Patch Changes
- @nhost/react@3.2.3
## 2.1.4
### Patch Changes
- @nhost/react@3.2.2
## 2.1.3
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@nhost/nextjs",
"version": "2.1.3",
"version": "2.1.5",
"description": "Nhost NextJS library",
"license": "MIT",
"keywords": [

View File

@@ -1,5 +1,19 @@
# @nhost/nhost-js
## 3.0.8
### Patch Changes
- Updated dependencies [407feea]
- @nhost/graphql-js@0.1.8
## 3.0.7
### Patch Changes
- Updated dependencies [2d68fee]
- @nhost/graphql-js@0.1.7
## 3.0.6
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@nhost/nhost-js",
"version": "3.0.6",
"version": "3.0.8",
"description": "Nhost JavaScript SDK",
"license": "MIT",
"keywords": [

View File

@@ -1,5 +1,17 @@
# @nhost/react
## 3.2.3
### Patch Changes
- @nhost/nhost-js@3.0.8
## 3.2.2
### Patch Changes
- @nhost/nhost-js@3.0.7
## 3.2.1
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@nhost/react",
"version": "3.2.1",
"version": "3.2.3",
"description": "Nhost React library",
"license": "MIT",
"keywords": [

View File

@@ -1,5 +1,17 @@
# @nhost/vue
## 2.2.3
### Patch Changes
- @nhost/nhost-js@3.0.8
## 2.2.2
### Patch Changes
- @nhost/nhost-js@3.0.7
## 2.2.1
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@nhost/vue",
"version": "2.2.1",
"version": "2.2.3",
"description": "Nhost Vue library",
"license": "MIT",
"keywords": [

21
pnpm-lock.yaml generated
View File

@@ -1578,9 +1578,9 @@ importers:
isomorphic-unfetch:
specifier: ^3.1.0
version: 3.1.0
jwt-decode:
specifier: ^3.1.2
version: 3.1.2
jose:
specifier: ^5.2.2
version: 5.2.2
devDependencies:
'@nhost/docgen':
specifier: workspace:*
@@ -5982,7 +5982,7 @@ packages:
/@graphql-typed-document-node/core@3.2.0(graphql@16.8.1):
resolution: {integrity: sha512-mB9oAsNCm9aM3/SOv4YtBMqZbYj10R7dkq8byBqxGY/ncFwhf2oQzMV+LCRlWoDSEBJ3COiR1yeDvMtsoOsuFQ==}
peerDependencies:
graphql: 16.8.1
graphql: '>=16.8.1'
dependencies:
graphql: 16.8.1
@@ -19205,7 +19205,7 @@ packages:
/isomorphic-unfetch@3.1.0:
resolution: {integrity: sha512-geDJjpoZ8N0kWexiwkX8F9NkTsXhetLPVbZFQ+JTW239QNOwvB0gniuR1Wc6f0AMTn7/mFGyXvHTifrCp/GH8Q==}
dependencies:
node-fetch: 2.7.0(encoding@0.1.13)
node-fetch: 2.7.0
unfetch: 4.2.0
transitivePeerDependencies:
- encoding
@@ -22003,6 +22003,17 @@ packages:
dependencies:
whatwg-url: 5.0.0
/node-fetch@2.7.0:
resolution: {integrity: sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==}
engines: {node: 4.x || >=6.0.0}
peerDependencies:
encoding: ^0.1.0
peerDependenciesMeta:
encoding:
optional: true
dependencies:
whatwg-url: 5.0.0
/node-fetch@2.7.0(encoding@0.1.13):
resolution: {integrity: sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==}
engines: {node: 4.x || >=6.0.0}