Compare commits

..

15 Commits

Author SHA1 Message Date
Szilárd Dóró
69caa34c43 Merge pull request #1934 from nhost/changeset-release/main
chore: update versions
2023-05-16 08:34:38 +02:00
github-actions[bot]
1d898e2893 chore: update versions 2023-05-15 18:43:10 +00:00
Szilárd Dóró
e87621cbde Merge pull request #1936 from nhost/fix/security-key-url
fix(hasura-auth-js): make the call to the correct endpoint
2023-05-15 20:41:59 +02:00
Szilárd Dóró
0d6fc42158 fix: make the call to the correct endpoint 2023-05-15 19:46:26 +02:00
Szilárd Dóró
f6fbee6b13 Merge pull request #1933 from nhost/fix/project-rename-prevent-404
fix(dashboard): don't redirect to 404 on project rename
2023-05-15 16:59:00 +02:00
Szilárd Dóró
1230b72222 fix: don't redirect to 404 on project rename 2023-05-15 16:05:45 +02:00
Szilárd Dóró
6cc7704555 Merge pull request #1931 from nhost/changeset-release/main
chore: update versions
2023-05-15 15:47:22 +02:00
github-actions[bot]
c0954dec09 chore: update versions 2023-05-15 13:30:42 +00:00
Szilárd Dóró
6c25480a7a Merge pull request #1929 from nhost/fix/build-targets
chore: change build target to ES2019
2023-05-15 15:29:32 +02:00
Szilárd Dóró
da03bf390c chore: change build target to ES2019 2023-05-15 11:09:00 +02:00
Szilárd Dóró
3b513be9f2 Merge pull request #1926 from nhost/changeset-release/main
chore: update versions
2023-05-12 16:55:46 +02:00
github-actions[bot]
e450e9d636 chore: update versions 2023-05-12 14:27:16 +00:00
Szilárd Dóró
ed1ee10879 Merge pull request #1925 from nhost/fix/postgres-connection-string
fix(dashboard): show correct postgres connection string
2023-05-12 16:25:51 +02:00
Szilárd Dóró
349aac369e chore: add changeset 2023-05-12 14:23:54 +02:00
Szilárd Dóró
5a84362c80 fix: construct postgres connection string 2023-05-12 14:23:05 +02:00
36 changed files with 247 additions and 41 deletions

View File

@@ -36,6 +36,7 @@ export default defineConfig({
}
},
build: {
target: 'es2019',
sourcemap: true,
lib: {
entry,

View File

@@ -1,5 +1,27 @@
# @nhost/dashboard
## 0.16.11
### Patch Changes
- 1230b722: fix(projects): don't redirect to 404 on when the project is renamed
- @nhost/react-apollo@5.0.22
- @nhost/nextjs@1.13.24
## 0.16.10
### Patch Changes
- Updated dependencies [da03bf39]
- @nhost/react-apollo@5.0.21
- @nhost/nextjs@1.13.23
## 0.16.9
### Patch Changes
- 349aac36: fix(settings): use region domain when constructing the postgres connection string
## 0.16.8
### Patch Changes

View File

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

View File

@@ -4,6 +4,7 @@ import { ApplicationStatus } from '@/types/application';
import { GetWorkspaceAndProjectDocument } from '@/utils/__generated__/graphql';
import { getHasuraAdminSecret } from '@/utils/env';
import { useNhostClient, useUserData } from '@nhost/nextjs';
import type { RefetchOptions } from '@tanstack/react-query';
import { useQuery } from '@tanstack/react-query';
import { useRouter } from 'next/router';
import { useMemo } from 'react';
@@ -28,7 +29,7 @@ export interface UseCurrentWorkspaceAndProjectReturnType {
/**
* Refetch the query.
*/
refetch: (options?: any) => Promise<any>;
refetch: (options?: RefetchOptions) => Promise<any>;
}
export default function useCurrentWorkspaceAndProject(): UseCurrentWorkspaceAndProjectReturnType {

View File

@@ -3,7 +3,6 @@ import SettingsLayout from '@/components/settings/SettingsLayout';
import { useGetDatabaseConnectionInfoQuery } from '@/generated/graphql';
import ActivityIndicator from '@/ui/v2/ActivityIndicator';
import { isDevOrStaging } from '@/utils/helpers';
import type { ReactElement } from 'react';
import SettingsContainer from '@/components/settings/SettingsContainer';
@@ -15,14 +14,17 @@ import type { InputProps } from '@/ui/v2/Input';
import Input from '@/ui/v2/Input';
import InputAdornment from '@/ui/v2/InputAdornment';
import CopyIcon from '@/ui/v2/icons/CopyIcon';
import generateAppServiceUrl from '@/utils/common/generateAppServiceUrl/generateAppServiceUrl';
import { copy } from '@/utils/copy';
export default function DatabaseSettingsPage() {
const { currentProject } = useCurrentWorkspaceAndProject();
const postgresHost = `${currentProject.subdomain}.db.${
currentProject.region.awsName
}.${isDevOrStaging() ? 'staging.nhost' : 'nhost'}.run`;
const postgresHost = generateAppServiceUrl(
currentProject.subdomain,
currentProject.region,
'db',
).replace('https://', '');
const { data, loading, error } = useGetDatabaseConnectionInfoQuery({
variables: {

View File

@@ -13,12 +13,12 @@ import {
usePauseApplicationMutation,
useUpdateApplicationMutation,
} from '@/generated/graphql';
import ActivityIndicator from '@/ui/v2/ActivityIndicator';
import Input from '@/ui/v2/Input';
import { discordAnnounce } from '@/utils/discordAnnounce';
import { slugifyString } from '@/utils/helpers';
import getServerError from '@/utils/settings/getServerError';
import { getToastStyleProps } from '@/utils/settings/settingsConstants';
import { useApolloClient } from '@apollo/client';
import { yupResolver } from '@hookform/resolvers/yup';
import { useRouter } from 'next/router';
import type { ReactElement } from 'react';
@@ -38,11 +38,15 @@ export type ProjectNameValidationSchema = Yup.InferType<
>;
export default function SettingsGeneralPage() {
const { currentWorkspace, currentProject } = useCurrentWorkspaceAndProject();
const {
currentWorkspace,
currentProject,
loading,
refetch: refetchWorkspaceAndProject,
} = useCurrentWorkspaceAndProject();
const isOwner = useIsCurrentUserOwner();
const { openDialog, openAlertDialog, closeDialog } = useDialog();
const [updateApp] = useUpdateApplicationMutation();
const client = useApolloClient();
const [pauseApplication] = usePauseApplicationMutation({
variables: { appId: currentProject?.id },
refetchQueries: [GetAllWorkspacesAndProjectsDocument],
@@ -98,7 +102,7 @@ export default function SettingsGeneralPage() {
});
try {
await toast.promise(
const { data: updateAppData } = await toast.promise(
updateAppMutation,
{
loading: `Project name is being updated...`,
@@ -109,24 +113,24 @@ export default function SettingsGeneralPage() {
},
getToastStyleProps(),
);
const updateAppResult = updateAppData?.updateApp;
if (!updateAppResult) {
await discordAnnounce('Failed to update project name.');
return;
}
form.reset(undefined, { keepValues: true, keepDirty: false });
await refetchWorkspaceAndProject();
await router.replace(
`/${currentWorkspace.slug}/${updateAppResult.slug}/settings/general`,
);
} catch {
// Note: The toast will handle the error.
}
try {
form.reset(undefined, { keepValues: true, keepDirty: false });
await router.push(
`/${currentWorkspace.slug}/${newProjectSlug}/settings/general`,
);
await client.refetchQueries({
include: [GetAllWorkspacesAndProjectsDocument],
});
} catch (error) {
await discordAnnounce(
error.message ||
'An error occurred while trying to update application cache.',
);
}
}
async function handleDeleteApplication() {
@@ -161,6 +165,10 @@ export default function SettingsGeneralPage() {
await router.push('/');
}
if (loading) {
return <ActivityIndicator label="Loading project..." />;
}
return (
<Container
className="grid max-w-5xl grid-flow-row gap-8 bg-transparent"
@@ -195,7 +203,7 @@ export default function SettingsGeneralPage() {
</Form>
</FormProvider>
{currentProject.plan.isFree && (
{currentProject?.plan.isFree && (
<SettingsContainer
title="Pause Project"
description="While your project is paused, it will not be accessible. You can wake it up anytime after."

View File

@@ -48,6 +48,10 @@ test('should generate a per service subdomain in remote mode', () => {
'https://test.auth.eu-west-1.nhost.run/v1',
);
expect(generateAppServiceUrl('test', region, 'db')).toBe(
'https://test.db.eu-west-1.nhost.run',
);
expect(generateAppServiceUrl('test', region, 'functions')).toBe(
'https://test.functions.eu-west-1.nhost.run/v1',
);
@@ -77,6 +81,10 @@ test('should generate staging subdomains in staging environment', () => {
'https://test.auth.eu-west-1.staging.nhost.run/v1',
);
expect(generateAppServiceUrl('test', stagingRegion, 'db')).toBe(
'https://test.db.eu-west-1.staging.nhost.run',
);
expect(generateAppServiceUrl('test', stagingRegion, 'functions')).toBe(
'https://test.functions.eu-west-1.staging.nhost.run/v1',
);
@@ -151,6 +159,13 @@ test('should construct service URLs based on environment variables', () => {
`https://localdev1.nhost.run/v1/auth`,
);
process.env.NEXT_PUBLIC_NHOST_DATABASE_URL =
'https://localdev2.nhost.run/v1/db';
expect(generateAppServiceUrl('test', region, 'db')).toBe(
`https://localdev2.nhost.run/v1/db`,
);
process.env.NEXT_PUBLIC_NHOST_STORAGE_URL =
'https://localdev2.nhost.run/v1/storage';

View File

@@ -1,6 +1,7 @@
import type { ProjectFragment } from '@/utils/__generated__/graphql';
import {
getAuthServiceUrl,
getDatabaseServiceUrl,
getFunctionsServiceUrl,
getGraphqlServiceUrl,
getHasuraApiUrl,
@@ -10,6 +11,7 @@ import {
export type NhostService =
| 'auth'
| 'db'
| 'graphql'
| 'functions'
| 'storage'
@@ -23,6 +25,7 @@ export type NhostService =
*/
export const defaultLocalBackendSlugs: Record<NhostService, string> = {
auth: '/v1/auth',
db: '',
graphql: '/v1/graphql',
functions: '/v1/functions',
storage: '/v1/files',
@@ -36,6 +39,7 @@ export const defaultLocalBackendSlugs: Record<NhostService, string> = {
*/
export const defaultRemoteBackendSlugs: Record<NhostService, string> = {
auth: '/v1',
db: '',
graphql: '/v1',
functions: '/v1',
storage: '/v1',
@@ -57,7 +61,7 @@ export const defaultRemoteBackendSlugs: Record<NhostService, string> = {
export default function generateAppServiceUrl(
subdomain: string,
region: ProjectFragment['region'],
service: 'auth' | 'graphql' | 'functions' | 'storage' | 'hasura' | 'grafana',
service: NhostService,
localBackendSlugs = defaultLocalBackendSlugs,
remoteBackendSlugs = defaultRemoteBackendSlugs,
) {
@@ -66,6 +70,7 @@ export default function generateAppServiceUrl(
if (!IS_PLATFORM) {
const serviceUrls: Record<typeof service, string> = {
auth: getAuthServiceUrl(),
db: getDatabaseServiceUrl(),
graphql: getGraphqlServiceUrl(),
storage: getStorageServiceUrl(),
functions: getFunctionsServiceUrl(),

View File

@@ -31,6 +31,13 @@ export function getAuthServiceUrl() {
);
}
/**
* Custom URL of the Database service.
*/
export function getDatabaseServiceUrl() {
return process.env.NEXT_PUBLIC_NHOST_DATABASE_URL || 'local.db.nhost.run';
}
/**
* Custom URL of the GraphQL service.
*/

View File

@@ -1,5 +1,19 @@
# @nhost/apollo
## 5.2.6
### Patch Changes
- @nhost/nhost-js@2.2.4
## 5.2.5
### Patch Changes
- da03bf39: chore(build): change build target to ES2019
- Updated dependencies [da03bf39]
- @nhost/nhost-js@2.2.3
## 5.2.4
### Patch Changes

View File

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

View File

@@ -1,5 +1,11 @@
# @nhost/google-translation
## 0.0.5
### Patch Changes
- da03bf39: chore(build): change build target to ES2019
## 0.0.4
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@nhost/google-translation",
"version": "0.0.4",
"version": "0.0.5",
"description": "Google Translation GraphQL API",
"license": "MIT",
"keywords": [

View File

@@ -1,5 +1,21 @@
# @nhost/react-apollo
## 5.0.22
### Patch Changes
- @nhost/apollo@5.2.6
- @nhost/react@2.0.18
## 5.0.21
### Patch Changes
- da03bf39: chore(build): change build target to ES2019
- Updated dependencies [da03bf39]
- @nhost/apollo@5.2.5
- @nhost/react@2.0.17
## 5.0.20
### Patch Changes

View File

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

View File

@@ -1,5 +1,19 @@
# @nhost/react-urql
## 2.0.19
### Patch Changes
- @nhost/react@2.0.18
## 2.0.18
### Patch Changes
- da03bf39: chore(build): change build target to ES2019
- Updated dependencies [da03bf39]
- @nhost/react@2.0.17
## 2.0.17
### Patch Changes

View File

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

View File

@@ -1,5 +1,11 @@
# @nhost/stripe-graphql-js
## 1.0.3
### Patch Changes
- da03bf39: chore(build): change build target to ES2019
## 1.0.2
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@nhost/stripe-graphql-js",
"version": "1.0.2",
"version": "1.0.3",
"description": "Stripe GraphQL API",
"license": "MIT",
"keywords": [

View File

@@ -1,5 +1,11 @@
# @nhost/docgen
## 0.1.10
### Patch Changes
- da03bf39: chore(build): change build target to ES2019
## 0.1.9
### Patch Changes

View File

@@ -2,7 +2,7 @@
"name": "@nhost/docgen",
"description": "Documentation generator for classes and functions",
"private": true,
"version": "0.1.9",
"version": "0.1.10",
"license": "MIT",
"main": "dist/index.cjs.js",
"types": "dist/index.d.ts",

View File

@@ -1,5 +1,11 @@
# @nhost/graphql-js
## 0.1.2
### Patch Changes
- da03bf39: chore(build): change build target to ES2019
## 0.1.1
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@nhost/graphql-js",
"version": "0.1.1",
"version": "0.1.2",
"description": "Nhost GraphQL client",
"license": "MIT",
"keywords": [

View File

@@ -1,5 +1,17 @@
# @nhost/hasura-auth-js
## 2.1.3
### Patch Changes
- 0d6fc421: fix(webauthn): make the call to the correct Hasura Auth endpoint
## 2.1.2
### Patch Changes
- da03bf39: chore(build): change build target to ES2019
## 2.1.1
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@nhost/hasura-auth-js",
"version": "2.1.1",
"version": "2.1.3",
"description": "Hasura-auth client",
"license": "MIT",
"keywords": [

View File

@@ -21,7 +21,7 @@ export const addSecurityKeyPromise = async (
): Promise<AddSecurityKeyHandlerResult> => {
try {
const { data: options } = await postFetch<PublicKeyCredentialCreationOptionsJSON>(
'/user/webauthn/add',
`${backendUrl}/user/webauthn/add`,
{},
interpreter?.getSnapshot().context.accessToken.value
)

View File

@@ -1,5 +1,11 @@
# @nhost/hasura-storage-js
## 2.1.2
### Patch Changes
- da03bf39: chore(build): change build target to ES2019
## 2.1.1
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@nhost/hasura-storage-js",
"version": "2.1.1",
"version": "2.1.2",
"description": "Hasura-storage client",
"license": "MIT",
"keywords": [

View File

@@ -1,5 +1,19 @@
# @nhost/nextjs
## 1.13.24
### Patch Changes
- @nhost/react@2.0.18
## 1.13.23
### Patch Changes
- da03bf39: chore(build): change build target to ES2019
- Updated dependencies [da03bf39]
- @nhost/react@2.0.17
## 1.13.22
### Patch Changes

View File

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

View File

@@ -1,5 +1,22 @@
# @nhost/nhost-js
## 2.2.4
### Patch Changes
- Updated dependencies [0d6fc421]
- @nhost/hasura-auth-js@2.1.3
## 2.2.3
### Patch Changes
- da03bf39: chore(build): change build target to ES2019
- Updated dependencies [da03bf39]
- @nhost/graphql-js@0.1.2
- @nhost/hasura-auth-js@2.1.2
- @nhost/hasura-storage-js@2.1.2
## 2.2.2
### Patch Changes

View File

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

View File

@@ -1,5 +1,19 @@
# @nhost/react
## 2.0.18
### Patch Changes
- @nhost/nhost-js@2.2.4
## 2.0.17
### Patch Changes
- da03bf39: chore(build): change build target to ES2019
- Updated dependencies [da03bf39]
- @nhost/nhost-js@2.2.3
## 2.0.16
### Patch Changes

View File

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

View File

@@ -1,5 +1,19 @@
# @nhost/vue
## 1.13.24
### Patch Changes
- @nhost/nhost-js@2.2.4
## 1.13.23
### Patch Changes
- da03bf39: chore(build): change build target to ES2019
- Updated dependencies [da03bf39]
- @nhost/nhost-js@2.2.3
## 1.13.22
### Patch Changes

View File

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