Compare commits

..

9 Commits

Author SHA1 Message Date
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
33 changed files with 158 additions and 19 deletions

View File

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

View File

@@ -1,5 +1,19 @@
# @nhost/dashboard
## 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.10",
"private": true,
"scripts": {
"preinstall": "npx only-allow pnpm",

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

@@ -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,13 @@
# @nhost/apollo
## 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.5",
"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,14 @@
# @nhost/react-apollo
## 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.21",
"description": "Nhost React Apollo client",
"license": "MIT",
"keywords": [

View File

@@ -1,5 +1,13 @@
# @nhost/react-urql
## 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.18",
"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,11 @@
# @nhost/hasura-auth-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-auth-js",
"version": "2.1.1",
"version": "2.1.2",
"description": "Hasura-auth client",
"license": "MIT",
"keywords": [

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,13 @@
# @nhost/nextjs
## 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.23",
"description": "Nhost NextJS library",
"license": "MIT",
"keywords": [

View File

@@ -1,5 +1,15 @@
# @nhost/nhost-js
## 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.3",
"description": "Nhost JavaScript SDK",
"license": "MIT",
"keywords": [

View File

@@ -1,5 +1,13 @@
# @nhost/react
## 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.17",
"description": "Nhost React library",
"license": "MIT",
"keywords": [

View File

@@ -1,5 +1,13 @@
# @nhost/vue
## 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.23",
"description": "Nhost Vue library",
"license": "MIT",
"keywords": [