Compare commits

..

83 Commits

Author SHA1 Message Date
Szilárd Dóró
11b4d12f12 Merge pull request #1794 from nhost/changeset-release/main
chore: update versions
2023-03-30 19:56:33 +02:00
Szilárd Dóró
12301e6551 fix: use correct @nhost/apollo version 2023-03-30 15:57:43 +02:00
github-actions[bot]
74e52cac2d chore: update versions 2023-03-30 09:07:41 +00:00
Szilárd Dóró
f17823760a Merge pull request #1795 from nhost/fix/presigned-urls
fix: don't alter URLs when no transformation parameters are available
2023-03-30 11:06:32 +02:00
Szilárd Dóró
bb8803a1e3 fix: don't alter URLs 2023-03-30 10:41:57 +02:00
Szilárd Dóró
b846291331 Merge pull request #1793 from nhost/fix/export-issue
fix: don't use conflicting names
2023-03-30 10:07:24 +02:00
Szilárd Dóró
2b2fb94f00 chore: add type checking step 2023-03-30 09:42:23 +02:00
Szilárd Dóró
551760c4f0 fix: don't break builds 2023-03-30 09:37:39 +02:00
Szilárd Dóró
5ae5a8e77d fix: don't break builds 2023-03-30 09:31:54 +02:00
Szilárd Dóró
56aae0c964 fix: don't break builds 2023-03-30 09:28:34 +02:00
Szilárd Dóró
a0e093d77b fix: don't use conflicting names 2023-03-30 09:16:30 +02:00
Szilárd Dóró
5e82e1b3da Merge pull request #1784 from nhost/changeset-release/main
chore: update versions
2023-03-29 09:20:48 +02:00
github-actions[bot]
e618b705e7 chore: update versions 2023-03-28 15:52:47 +00:00
Szilárd Dóró
a232c9f0f6 Merge pull request #1789 from nhost/fix/azuread-description
fix(dashboard): use correct description for Azure AD
2023-03-28 17:50:51 +02:00
Szilárd Dóró
bf4644ea10 fix: use correct description for Azure AD 2023-03-28 16:52:54 +02:00
Szilárd Dóró
0aca907ea4 Merge pull request #1788 from nhost/fix/azuread-provider-name
fix: correct typos in Azure AD
2023-03-28 16:25:59 +02:00
Szilárd Dóró
394f4c4174 fix: correct typos in Azure AD 2023-03-28 16:25:26 +02:00
Szilárd Dóró
8fef08a150 Merge pull request #1786 from nhost/renovate/turbo-1.x
chore(deps): update dependency turbo to v1.8.6
2023-03-28 16:16:57 +02:00
Szilárd Dóró
1bd2c37301 chore: bump turbo in the Dockerfile 2023-03-28 15:54:37 +02:00
renovate[bot]
5cdb70bd81 chore(deps): update dependency turbo to v1.8.6 2023-03-28 12:01:36 +00:00
Szilárd Dóró
1a5f80e1b6 Merge pull request #1785 from nhost/renovate/react-monorepo
chore(deps): update dependency @types/react to v18.0.30
2023-03-28 13:59:29 +02:00
Szilárd Dóró
59e0cb00c5 Merge pull request #1787 from nhost/feat/azuread-provider 2023-03-28 12:25:42 +02:00
Szilárd Dóró
406b0f2cb7 Merge pull request #1163 from dipakparmar/feat/dashboard-azuread-settings
feat(dashboard): add azure ad provider settings
2023-03-28 10:52:17 +02:00
Szilárd Dóró
d329b6218f chore: add changeset 2023-03-28 10:46:50 +02:00
Szilárd Dóró
335b58670e Merge branch 'renovate/react-monorepo' of https://github.com/nhost/nhost into renovate/react-monorepo 2023-03-28 10:43:08 +02:00
renovate[bot]
efa2d89067 chore(deps): update dependency @types/react to v18.0.30 2023-03-28 08:35:55 +00:00
Szilárd Dóró
77ce4bd738 Merge pull request #1783 from nhost/fix/random-words
fix(tests): avoid name collision in database tests
2023-03-28 10:33:33 +02:00
Szilárd Dóró
017adea700 chore: update comment 2023-03-28 10:04:38 +02:00
Dipak Parmar
378284faa8 chore(dashboard): remove docs and title for now from azuread component
Signed-off-by: Dipak Parmar <hi@dipak.tech>
2023-03-27 23:44:40 -07:00
renovate[bot]
e5e2d114b1 chore(deps): update dependency @types/react to v18.0.30 2023-03-27 19:03:37 +00:00
Szilárd Dóró
5e3dbdeb7d Merge pull request #1781 from nhost/renovate/react-monorepo
chore(deps): update dependency @types/react to v18.0.29
2023-03-27 20:55:47 +02:00
Szilárd Dóró
98b777491a fix: improve flaky tests 2023-03-27 18:13:10 +02:00
Szilárd Dóró
71de870cb0 fix: use admin secret as env var 2023-03-27 17:29:09 +02:00
Szilárd Dóró
74d4deba28 feat: cleanup public schema after tests 2023-03-27 17:00:07 +02:00
Szilárd Dóró
cb248f0d30 chore: add changeset 2023-03-27 15:44:08 +02:00
Szilárd Dóró
09e4f1eb34 fix: avoid duplicate table names in tests 2023-03-27 15:16:40 +02:00
Szilárd Dóró
19818e2b59 Merge pull request #1777 from nhost/changeset-release/main
chore: update versions
2023-03-27 12:03:16 +02:00
Szilárd Dóró
6e1f03eaee chore: accomodate changes to API 2023-03-27 11:57:24 +02:00
github-actions[bot]
b3eeec82ef chore: update versions 2023-03-27 09:38:55 +00:00
Szilárd Dóró
34ff254696 Merge pull request #1782 from nhost/renovate/sharp-0.x
fix(deps): update dependency sharp to ^0.32.0
2023-03-27 11:37:33 +02:00
Szilárd Dóró
867c807699 chore: add changeset 2023-03-27 11:21:42 +02:00
Szilárd Dóró
1c4806bf51 chore: add changeset 2023-03-27 11:17:41 +02:00
renovate[bot]
2fb82ec97d fix(deps): update dependency sharp to ^0.32.0 2023-03-27 07:50:45 +00:00
renovate[bot]
d0673d7825 chore(deps): update dependency @types/react to v18.0.29 2023-03-27 07:50:19 +00:00
Dipak Parmar
106f23dcfa fixdashboard-settings): remove extra whitespace azuread provider import in settings
Signed-off-by: Dipak Parmar <hi@dipak.tech>
2023-03-27 00:48:56 -07:00
Szilárd Dóró
0c994a9651 Merge pull request #1779 from nhost/renovate/pnpm-find-workspace-dir-6.x
fix(deps): update dependency @pnpm/find-workspace-dir to v6
2023-03-27 09:48:14 +02:00
Dipak Parmar
83ef755822 feat(dashboard-settings): update azuread provider settings component
Signed-off-by: Dipak Parmar <hi@dipak.tech>
2023-03-27 00:47:09 -07:00
Dipak Parmar
b7703ffd70 feat(graphql): add azuread to signinmethods query
Signed-off-by: Dipak Parmar <hi@dipak.tech>
2023-03-27 00:46:30 -07:00
Szilárd Dóró
4713cecfc2 chore: add changeset 2023-03-27 09:26:44 +02:00
Dipak Parmar
340ea5b115 chore: merge branch 'main' into feat/dashboard-azuread-settings
* main: (1322 commits)
  chore(ci): adjust preview fetcher
  chore: add changeset
  fix: fetch valid previews only
  fix: use correct Vercel token
  fix: use staging project ID
  chore: use dynamic test URL
  fix(deps): update docusaurus monorepo to v2.4.0
  chore(hasura-storage-js): improve presignedUrl test
  fix: remove test.only call
  chore: add tests for table deletion
  chore: update versions
  fix: potential subscription fix
  Fix import in docs
  fix: remove `test.only` call
  chore: add remaining table creation tests
  chore: add foreign key constraint test
  chore: add extra database UI tests
  chore: restructure tests, add basic table creation test
  chore: update versions
  chore: add changeset
  ...

Signed-off-by: Dipak Parmar <hi@dipak.tech>
2023-03-26 19:16:40 -07:00
renovate[bot]
f79eebadbf fix(deps): update dependency @pnpm/find-workspace-dir to v6 2023-03-24 21:30:22 +00:00
Szilárd Dóró
ac174b5e51 Merge pull request #1780 from nhost/chore/vercel-preview-fetcher 2023-03-24 17:07:43 +01:00
Szilárd Dóró
dc9ddfc9ae chore(ci): adjust preview fetcher 2023-03-24 16:30:29 +01:00
Szilárd Dóró
3bdd9f570c Merge pull request #1773 from nhost/chore/dashboard-delete-table-tests
chore(dashboard): tests for table deletion
2023-03-24 15:52:25 +01:00
Szilárd Dóró
94477be998 Merge pull request #1778 from nhost/chore/fetch-preview-url
chore: use dynamic test URL
2023-03-24 15:51:47 +01:00
Szilárd Dóró
568577e8ca Merge pull request #1774 from nhost/renovate/docusaurus-monorepo
fix(deps): update docusaurus monorepo to v2.4.0
2023-03-24 15:38:23 +01:00
Szilárd Dóró
e93b06ab8f chore: add changeset 2023-03-24 15:37:08 +01:00
Szilárd Dóró
c75bf46ba1 fix: fetch valid previews only 2023-03-24 15:24:36 +01:00
Szilárd Dóró
63a1fd09b5 fix: use correct Vercel token 2023-03-24 15:09:42 +01:00
Szilárd Dóró
630d44ad6e fix: use staging project ID 2023-03-24 14:55:26 +01:00
Szilárd Dóró
d7db521974 chore: use dynamic test URL 2023-03-24 14:16:05 +01:00
renovate[bot]
90e4053f0a fix(deps): update docusaurus monorepo to v2.4.0 2023-03-24 09:57:19 +00:00
Szilárd Dóró
8e9d5d1b38 Merge pull request #1775 from nhost/fix/storage-sdk-tests
chore(hasura-storage-js): improve presignedUrl test
2023-03-24 10:54:51 +01:00
Szilárd Dóró
43c86fef14 chore(hasura-storage-js): improve presignedUrl test 2023-03-24 10:25:18 +01:00
Szilárd Dóró
6b97340cf4 fix: remove test.only call 2023-03-23 16:14:49 +01:00
Szilárd Dóró
1605756362 chore: add tests for table deletion 2023-03-23 16:05:21 +01:00
Szilárd Dóró
6437544384 Merge pull request #1771 from nhost/changeset-release/main
chore: update versions
2023-03-23 14:20:16 +01:00
github-actions[bot]
b4dcd1996d chore: update versions 2023-03-23 13:01:48 +00:00
Szilárd Dóró
7fb73dbb1b Merge pull request #1770 from nhost/fix/subscription-errors
fix(apollo): retry subscriptions on error
2023-03-23 14:00:11 +01:00
Szilárd Dóró
a66b11d245 Merge pull request #1769 from st3phan/patch-1
Fix import in docs for SignedIn component
2023-03-23 13:23:35 +01:00
Szilárd Dóró
912ed76c64 fix: potential subscription fix 2023-03-23 12:30:14 +01:00
Szilárd Dóró
b47c0d1af7 Merge pull request #1765 from nhost/chore/dashboard-db-tests
chore(dashboard): tests for table creation
2023-03-23 09:36:27 +01:00
Stephan van Opstal
b97ab2be2f Fix import in docs 2023-03-22 21:46:58 +01:00
Szilárd Dóró
f12cb666ff fix: remove test.only call 2023-03-22 15:42:05 +01:00
Szilárd Dóró
c3b2b1cd02 chore: add remaining table creation tests 2023-03-22 15:40:39 +01:00
Szilárd Dóró
c0b71102d4 chore: add foreign key constraint test 2023-03-22 15:32:18 +01:00
Szilárd Dóró
5f68ae95c4 chore: add extra database UI tests 2023-03-22 15:22:49 +01:00
Szilárd Dóró
2d1b7bb292 chore: restructure tests, add basic table creation test 2023-03-22 14:57:33 +01:00
Dipak Parmar
ce4b655c55 fix: correct typos 2022-11-22 19:47:21 -08:00
Dipak Parmar
dc57d31ec9 fix: correct extra space in azureadprovidersettings dir 2022-11-22 19:45:38 -08:00
Dipak Parmar
ea29fd6b73 feat(dashboard-settings): add azuread provider to settings 2022-11-21 20:30:53 -08:00
Dipak Parmar
d8e4073957 feat(dashboard-settings): add azuread provider settings component 2022-11-21 20:29:34 -08:00
Dipak Parmar
3f399a54a3 feat(graphql): add azuread to signinmethods query 2022-11-21 20:28:50 -08:00
101 changed files with 2068 additions and 770 deletions

View File

@@ -24,6 +24,7 @@ env:
NHOST_TEST_PROJECT_NAME: ${{ vars.NHOST_TEST_PROJECT_NAME }}
NHOST_TEST_USER_EMAIL: ${{ secrets.NHOST_TEST_USER_EMAIL }}
NHOST_TEST_USER_PASSWORD: ${{ secrets.NHOST_TEST_USER_PASSWORD }}
NHOST_TEST_PROJECT_ADMIN_SECRET: ${{ secrets.NHOST_TEST_PROJECT_ADMIN_SECRET }}
jobs:
build:
@@ -128,12 +129,27 @@ jobs:
- name: Install Nhost CLI
if: hashFiles(format('{0}/nhost/config.yaml', matrix.package.path)) != ''
uses: ./.github/actions/nhost-cli
- name: Fetch Dashboard Preview URL
id: fetch-dashboard-preview-url
uses: zentered/vercel-preview-url@v1.1.9
if: github.ref_name != 'main'
env:
VERCEL_TOKEN: ${{ secrets.DASHBOARD_VERCEL_DEPLOY_TOKEN }}
GITHUB_REF: ${{ github.ref_name }}
GITHUB_REPOSITORY: ${{ github.repository }}
with:
vercel_team_id: ${{ secrets.DASHBOARD_VERCEL_TEAM_ID }}
vercel_project_id: ${{ secrets.DASHBOARD_STAGING_VERCEL_PROJECT_ID }}
vercel_state: BUILDING,READY,INITIALIZING
- name: Set Dashboard Preview URL
if: steps.fetch-dashboard-preview-url.outputs.preview_url != ''
run: echo "NHOST_TEST_DASHBOARD_URL=https://${{ steps.fetch-dashboard-preview-url.outputs.preview_url }}" >> $GITHUB_ENV
# * Run the `ci` script of the current package of the matrix. Dependencies build is cached by Turborepo
- name: Run e2e test
- name: Run e2e tests
run: pnpm --filter="${{ matrix.package.name }}" run e2e
- id: file-name
if: ${{ failure() }}
name: Tranform package name into a valid file name
name: Transform package name into a valid file name
run: |
PACKAGE_FILE_NAME=$(echo "${{ matrix.package.name }}" | sed 's/@//g; s/\//-/g')
echo "fileName=$PACKAGE_FILE_NAME" >> $GITHUB_OUTPUT

View File

@@ -51,7 +51,7 @@ export const decorators = [
(Story) => (
<NhostApolloProvider
fetchPolicy="cache-first"
graphqlUrl="http://localhost:1337/v1/graphql"
graphqlUrl="https://local.graphql.nhost.run/v1"
>
<Story />
</NhostApolloProvider>

View File

@@ -1,5 +1,42 @@
# @nhost/dashboard
## 0.14.1
### Patch Changes
- @nhost/react-apollo@5.0.15
- @nhost/nextjs@1.13.19
## 0.14.0
### Minor Changes
- 6e1f03ea: feat(dashboard): add support for the Azure AD provider
### Patch Changes
- 1bd2c373: chore(deps): bump `turbo` to 1.8.6
- d329b621: chore(deps): bump `@types/react` to 18.0.30
- cb248f0d: fix(tests): avoid name collision in database tests
- 867c8076: chore(deps): bump `@types/react` to 18.0.29
## 0.13.10
### Patch Changes
- e93b06ab: fix(dashboard): remove left margin from workspace list on mobile
- 1c4806bf: chore(deps): bump `sharp` to 0.32.0
- @nhost/react-apollo@5.0.14
- @nhost/nextjs@1.13.18
## 0.13.9
### Patch Changes
- 912ed76c: chore(dashboard): bump `@apollo/client` to 3.7.10
- Updated dependencies [912ed76c]
- @nhost/react-apollo@5.0.13
## 0.13.8
### Patch Changes

View File

@@ -3,7 +3,7 @@ RUN apk add --no-cache libc6-compat
RUN apk update
WORKDIR /app
RUN yarn global add turbo@1.8.3
RUN yarn global add turbo@1.8.6
COPY . .
RUN turbo prune --scope="@nhost/dashboard" --docker

View File

@@ -128,4 +128,5 @@ NHOST_TEST_USER_EMAIL=<test_user_email>
NHOST_TEST_USER_PASSWORD=<test_user_password>
NHOST_TEST_WORKSPACE_NAME=<test_workspace_name>
NHOST_TEST_PROJECT_NAME=<test_project_name>
NHOST_TEST_PROJECT_ADMIN_SECRET=<test_project_admin_secret>
```

View File

@@ -1,11 +1,11 @@
import type { Page } from '@playwright/test';
import { expect, test } from '@playwright/test';
import {
TEST_DASHBOARD_URL,
TEST_PROJECT_NAME,
TEST_PROJECT_SLUG,
TEST_WORKSPACE_SLUG,
} from './env';
} from '@/e2e/env';
import { openProject } from '@/e2e/utils';
import type { Page } from '@playwright/test';
import { expect, test } from '@playwright/test';
let page: Page;
@@ -14,20 +14,21 @@ test.describe.configure({ mode: 'serial' });
test.beforeAll(async ({ browser }) => {
page = await browser.newPage();
await page.goto(TEST_DASHBOARD_URL);
await page.getByRole('link', { name: TEST_PROJECT_NAME }).click();
await page.waitForURL(
`${TEST_DASHBOARD_URL}/${TEST_WORKSPACE_SLUG}/${TEST_PROJECT_SLUG}`,
);
await page.goto('/');
await openProject({
page,
projectName: TEST_PROJECT_NAME,
workspaceSlug: TEST_WORKSPACE_SLUG,
projectSlug: TEST_PROJECT_SLUG,
});
await page
.getByRole('navigation', { name: /main navigation/i })
.getByRole('link', { name: /auth/i })
.click();
await page.waitForURL(
`${TEST_DASHBOARD_URL}/${TEST_WORKSPACE_SLUG}/${TEST_PROJECT_SLUG}/users`,
);
await page.waitForURL(`/${TEST_WORKSPACE_SLUG}/${TEST_PROJECT_SLUG}/users`);
});
test.afterAll(async () => {

View File

@@ -0,0 +1,280 @@
import {
TEST_PROJECT_NAME,
TEST_PROJECT_SLUG,
TEST_WORKSPACE_SLUG,
} from '@/e2e/env';
import { openProject, prepareTable } from '@/e2e/utils';
import { faker } from '@faker-js/faker';
import type { Page } from '@playwright/test';
import { expect, test } from '@playwright/test';
import { snakeCase } from 'snake-case';
let page: Page;
test.beforeAll(async ({ browser }) => {
page = await browser.newPage();
});
test.beforeEach(async () => {
await page.goto('/');
await openProject({
page,
projectName: TEST_PROJECT_NAME,
workspaceSlug: TEST_WORKSPACE_SLUG,
projectSlug: TEST_PROJECT_SLUG,
});
await page
.getByRole('navigation', { name: /main navigation/i })
.getByRole('link', { name: /database/i })
.click();
});
test.afterAll(async () => {
await page.close();
});
test('should create a simple table', async () => {
await page.getByRole('button', { name: /new table/i }).click();
await expect(page.getByText(/create a new table/i)).toBeVisible();
const tableName = snakeCase(faker.lorem.words(3));
await prepareTable({
page,
name: tableName,
primaryKey: 'id',
columns: [
{ name: 'id', type: 'uuid', defaultValue: 'gen_random_uuid()' },
{ name: 'title', type: 'text' },
],
});
// create table
await page.getByRole('button', { name: /create/i }).click();
await page.waitForURL(
`/${TEST_WORKSPACE_SLUG}/${TEST_PROJECT_SLUG}/database/browser/default/public/${tableName}`,
);
await expect(
page.getByRole('link', { name: tableName, exact: true }),
).toBeVisible();
});
test('should create a table with unique constraints', async () => {
await page.getByRole('button', { name: /new table/i }).click();
await expect(page.getByText(/create a new table/i)).toBeVisible();
const tableName = snakeCase(faker.lorem.words(3));
await prepareTable({
page,
name: tableName,
primaryKey: 'id',
columns: [
{ name: 'id', type: 'uuid', defaultValue: 'gen_random_uuid()' },
{ name: 'title', type: 'text', unique: true },
{ name: 'isbn', type: 'text', unique: true },
],
});
// create table
await page.getByRole('button', { name: /create/i }).click();
await page.waitForURL(
`/${TEST_WORKSPACE_SLUG}/${TEST_PROJECT_SLUG}/database/browser/default/public/${tableName}`,
);
await expect(
page.getByRole('link', { name: tableName, exact: true }),
).toBeVisible();
});
test('should create a table with nullable columns', async () => {
await page.getByRole('button', { name: /new table/i }).click();
await expect(page.getByText(/create a new table/i)).toBeVisible();
const tableName = snakeCase(faker.lorem.words(3));
await prepareTable({
page,
name: tableName,
primaryKey: 'id',
columns: [
{ name: 'id', type: 'uuid', defaultValue: 'gen_random_uuid()' },
{ name: 'title', type: 'text', nullable: true },
{ name: 'description', type: 'text', nullable: true },
],
});
// create table
await page.getByRole('button', { name: /create/i }).click();
await page.waitForURL(
`/${TEST_WORKSPACE_SLUG}/${TEST_PROJECT_SLUG}/database/browser/default/public/${tableName}`,
);
await expect(
page.getByRole('link', { name: tableName, exact: true }),
).toBeVisible();
});
test('should create a table with an identity column', async () => {
await page.getByRole('button', { name: /new table/i }).click();
await expect(page.getByText(/create a new table/i)).toBeVisible();
const tableName = snakeCase(faker.lorem.words(3));
await prepareTable({
page,
name: tableName,
primaryKey: 'id',
columns: [
{ name: 'id', type: 'int4' },
{ name: 'title', type: 'text', nullable: true },
{ name: 'description', type: 'text', nullable: true },
],
});
await page.getByRole('button', { name: /identity/i }).click();
await page.getByRole('option', { name: /id/i }).click();
// create table
await page.getByRole('button', { name: /create/i }).click();
await page.waitForURL(
`/${TEST_WORKSPACE_SLUG}/${TEST_PROJECT_SLUG}/database/browser/default/public/${tableName}`,
);
await expect(
page.getByRole('link', { name: tableName, exact: true }),
).toBeVisible();
});
test('should create table with foreign key constraint', async () => {
await page.getByRole('button', { name: /new table/i }).click();
await expect(page.getByText(/create a new table/i)).toBeVisible();
const firstTableName = snakeCase(faker.lorem.words(3));
await prepareTable({
page,
name: firstTableName,
primaryKey: 'id',
columns: [
{ name: 'id', type: 'uuid', defaultValue: 'gen_random_uuid()' },
{ name: 'name', type: 'text' },
],
});
// create table
await page.getByRole('button', { name: /create/i }).click();
await page.waitForURL(
`/${TEST_WORKSPACE_SLUG}/${TEST_PROJECT_SLUG}/database/browser/default/public/${firstTableName}`,
);
await page.getByRole('button', { name: /new table/i }).click();
await expect(page.getByText(/create a new table/i)).toBeVisible();
const secondTableName = snakeCase(faker.lorem.words(3));
await prepareTable({
page,
name: secondTableName,
primaryKey: 'id',
columns: [
{ name: 'id', type: 'uuid', defaultValue: 'gen_random_uuid()' },
{ name: 'title', type: 'text' },
{ name: 'author_id', type: 'uuid' },
],
});
await page.getByRole('button', { name: /add foreign key/i }).click();
// select column in current table
await page
.getByRole('button', { name: /column/i })
.first()
.click();
await page.getByRole('option', { name: /author_id/i }).click();
// select reference schema
await page.getByRole('button', { name: /schema/i }).click();
await page.getByRole('option', { name: /public/i }).click();
// select reference table
await page.getByRole('button', { name: /table/i }).click();
await page.getByRole('option', { name: firstTableName, exact: true }).click();
// select reference column
await page
.getByRole('button', { name: /column/i })
.nth(1)
.click();
await page.getByRole('option', { name: /id/i }).click();
await page.getByRole('button', { name: /add/i }).click();
await expect(
page.getByText(`public.${firstTableName}.id`, { exact: true }),
).toBeVisible();
// create table
await page.getByRole('button', { name: /create/i }).click();
await page.waitForURL(
`/${TEST_WORKSPACE_SLUG}/${TEST_PROJECT_SLUG}/database/browser/default/public/${secondTableName}`,
);
await expect(
page.getByRole('link', { name: secondTableName, exact: true }),
).toBeVisible();
});
test('should not be able to create a table with a name that already exists', async () => {
await page.getByRole('button', { name: /new table/i }).click();
await expect(page.getByText(/create a new table/i)).toBeVisible();
const tableName = snakeCase(faker.lorem.words(3));
await prepareTable({
page,
name: tableName,
primaryKey: 'id',
columns: [
{ name: 'id', type: 'uuid', defaultValue: 'gen_random_uuid()' },
{ name: 'name', type: 'text' },
],
});
// create table
await page.getByRole('button', { name: /create/i }).click();
await page.waitForURL(
`/${TEST_WORKSPACE_SLUG}/${TEST_PROJECT_SLUG}/database/browser/default/public/${tableName}`,
);
await page.getByRole('button', { name: /new table/i }).click();
await expect(page.getByText(/create a new table/i)).toBeVisible();
await prepareTable({
page,
name: tableName,
primaryKey: 'id',
columns: [
{ name: 'id', type: 'uuid', defaultValue: 'gen_random_uuid()' },
{ name: 'title', type: 'text' },
{ name: 'author_id', type: 'uuid' },
],
});
// create table
await page.getByRole('button', { name: /create/i }).click();
await expect(
page.getByText(/error: a table with this name already exists/i),
).toBeVisible();
});

View File

@@ -0,0 +1,165 @@
import {
TEST_PROJECT_NAME,
TEST_PROJECT_SLUG,
TEST_WORKSPACE_SLUG,
} from '@/e2e/env';
import { deleteTable, openProject, prepareTable } from '@/e2e/utils';
import { faker } from '@faker-js/faker';
import type { Page } from '@playwright/test';
import { expect, test } from '@playwright/test';
import { snakeCase } from 'snake-case';
let page: Page;
test.beforeAll(async ({ browser }) => {
page = await browser.newPage();
});
test.beforeEach(async () => {
await page.goto('/');
await openProject({
page,
projectName: TEST_PROJECT_NAME,
workspaceSlug: TEST_WORKSPACE_SLUG,
projectSlug: TEST_PROJECT_SLUG,
});
await page
.getByRole('navigation', { name: /main navigation/i })
.getByRole('link', { name: /database/i })
.click();
});
test.afterAll(async () => {
await page.close();
});
test('should delete a table', async () => {
const tableName = snakeCase(faker.lorem.words(3));
await page.getByRole('button', { name: /new table/i }).click();
await prepareTable({
page,
name: tableName,
primaryKey: 'id',
columns: [
{ name: 'id', type: 'uuid', defaultValue: 'gen_random_uuid()' },
{ name: 'title', type: 'text' },
],
});
await page.getByRole('button', { name: /create/i }).click();
await page.waitForURL(
`/${TEST_WORKSPACE_SLUG}/${TEST_PROJECT_SLUG}/database/browser/default/public/${tableName}`,
);
await deleteTable({
page,
name: tableName,
});
// navigate to next URL
await page.waitForURL(
`/${TEST_WORKSPACE_SLUG}/${TEST_PROJECT_SLUG}/database/browser/default/public/**`,
);
await expect(
page.getByRole('link', { name: tableName, exact: true }),
).not.toBeVisible();
});
test('should not be able to delete a table if other tables have foreign keys referencing it', async () => {
await page.getByRole('button', { name: /new table/i }).click();
await expect(page.getByText(/create a new table/i)).toBeVisible();
const firstTableName = snakeCase(faker.lorem.words(3));
await prepareTable({
page,
name: firstTableName,
primaryKey: 'id',
columns: [
{ name: 'id', type: 'uuid', defaultValue: 'gen_random_uuid()' },
{ name: 'name', type: 'text' },
],
});
// create table
await page.getByRole('button', { name: /create/i }).click();
await page.waitForURL(
`/${TEST_WORKSPACE_SLUG}/${TEST_PROJECT_SLUG}/database/browser/default/public/${firstTableName}`,
);
await page.getByRole('button', { name: /new table/i }).click();
await expect(page.getByText(/create a new table/i)).toBeVisible();
const secondTableName = snakeCase(faker.lorem.words(3));
await prepareTable({
page,
name: secondTableName,
primaryKey: 'id',
columns: [
{ name: 'id', type: 'uuid', defaultValue: 'gen_random_uuid()' },
{ name: 'title', type: 'text' },
{ name: 'author_id', type: 'uuid' },
],
});
await page.getByRole('button', { name: /add foreign key/i }).click();
// select column in current table
await page
.getByRole('button', { name: /column/i })
.first()
.click();
await page.getByRole('option', { name: /author_id/i }).click();
// select reference schema
await page.getByRole('button', { name: /schema/i }).click();
await page.getByRole('option', { name: /public/i }).click();
// select reference table
await page.getByRole('button', { name: /table/i }).click();
await page.getByRole('option', { name: firstTableName, exact: true }).click();
// select reference column
await page
.getByRole('button', { name: /column/i })
.nth(1)
.click();
await page.getByRole('option', { name: /id/i }).click();
await page.getByRole('button', { name: /add/i }).click();
await expect(
page.getByText(`public.${firstTableName}.id`, { exact: true }),
).toBeVisible();
// create table
await page.getByRole('button', { name: /create/i }).click();
await page.waitForURL(
`/${TEST_WORKSPACE_SLUG}/${TEST_PROJECT_SLUG}/database/browser/default/public/${secondTableName}`,
);
await expect(
page.getByRole('link', { name: secondTableName, exact: true }),
).toBeVisible();
// try to delete the first table that is referenced by the second table
await deleteTable({
page,
name: firstTableName,
});
await expect(
page.getByText(
/constraint [a-zA-Z_]+ on table [a-zA-Z_]+ depends on table [a-zA-Z_]+/i,
),
).toBeVisible();
});

View File

@@ -31,6 +31,12 @@ export const TEST_PROJECT_SLUG = slugify(TEST_PROJECT_NAME, {
strict: true,
});
/**
* Hasura admin secret of the test project to use.
*/
export const TEST_PROJECT_ADMIN_SECRET =
process.env.NHOST_TEST_PROJECT_ADMIN_SECRET;
/**
* Email of the test account to use.
*/

View File

@@ -1,23 +1,25 @@
import type { Page } from '@playwright/test';
import { expect, test } from '@playwright/test';
import {
TEST_DASHBOARD_URL,
TEST_PROJECT_NAME,
TEST_PROJECT_SLUG,
TEST_WORKSPACE_NAME,
TEST_WORKSPACE_SLUG,
} from './env';
} from '@/e2e/env';
import { openProject } from '@/e2e/utils';
import type { Page } from '@playwright/test';
import { expect, test } from '@playwright/test';
let page: Page;
test.beforeAll(async ({ browser }) => {
page = await browser.newPage();
await page.goto(TEST_DASHBOARD_URL);
await page.getByRole('link', { name: TEST_PROJECT_NAME }).click();
await page.waitForURL(
`${TEST_DASHBOARD_URL}/${TEST_WORKSPACE_SLUG}/${TEST_PROJECT_SLUG}`,
);
await page.goto('/');
await openProject({
page,
projectName: TEST_PROJECT_NAME,
workspaceSlug: TEST_WORKSPACE_SLUG,
projectSlug: TEST_PROJECT_SLUG,
});
});
test.afterAll(async () => {

150
dashboard/e2e/utils.ts Normal file
View File

@@ -0,0 +1,150 @@
import type { Page } from '@playwright/test';
/**
* Open a project by navigating to the project's overview page.
*
* @param page - The Playwright page object.
* @param workspaceSlug - The slug of the workspace that contains the project.
* @param projectSlug - The slug of the project to open.
* @param projectName - The name of the project to open.
* @returns A promise that resolves when the project is opened.
*/
export async function openProject({
page,
projectName,
workspaceSlug,
projectSlug,
}: {
page: Page;
workspaceSlug: string;
projectSlug: string;
projectName: string;
}) {
await page.getByRole('link', { name: projectName }).click();
await page.waitForURL(`/${workspaceSlug}/${projectSlug}`);
}
/**
* Prepares a table by filling out the form.
*
* @param page - The Playwright page object.
* @param name - The name of the table to create.
* @param columns - The columns to create in the table.
* @returns A promise that resolves when the table is prepared.
*/
export async function prepareTable({
page,
name: tableName,
primaryKey,
columns,
}: {
page: Page;
name: string;
primaryKey: string;
columns: Array<{
name: string;
type: string;
nullable?: boolean;
unique?: boolean;
defaultValue?: string;
}>;
}) {
if (!columns.some(({ name }) => name === primaryKey)) {
throw new Error('Primary key must be one of the columns.');
}
await page.getByRole('textbox', { name: /name/i }).first().fill(tableName);
await Promise.all(
columns.map(
async (
{ name: columnName, type, nullable, unique, defaultValue },
index,
) => {
// set name
await page.getByPlaceholder(/name/i).nth(index).fill(columnName);
// set type
await page
.getByRole('table')
.getByRole('combobox', { name: /type/i })
.nth(index)
.type(type);
await page
.getByRole('table')
.getByRole('option', { name: type })
.first()
.click();
// optionally set default value
if (defaultValue) {
await page
.getByRole('table')
.getByRole('combobox', { name: /default value/i })
.nth(index)
.type(defaultValue);
await page
.getByRole('table')
.getByRole('option', { name: defaultValue })
.first()
.click();
}
// optionally check unique
if (unique) {
await page
.getByRole('checkbox', { name: /unique/i })
.nth(index)
.check();
}
// optionally check nullable
if (nullable) {
await page
.getByRole('checkbox', { name: /nullable/i })
.nth(index)
.check();
}
// add new column if not last
if (index < columns.length - 1) {
await page.getByRole('button', { name: /add column/i }).click();
}
},
),
);
// select the first column as primary key
await page.getByRole('button', { name: /primary key/i }).click();
await page.getByRole('option', { name: primaryKey, exact: true }).click();
}
/**
* Deletes a table with the given name.
*
* @param page - The Playwright page object.
* @param name - The name of the table to delete.
* @returns A promise that resolves when the table is deleted.
*/
export async function deleteTable({
page,
name,
}: {
page: Page;
name: string;
}) {
const tableLink = page.getByRole('link', {
name,
exact: true,
});
await tableLink.hover();
await page
.getByRole('listitem')
.filter({ hasText: name })
.getByRole('button')
.click();
await page.getByRole('menuitem', { name: /delete table/i }).click();
await page.getByRole('button', { name: /delete/i }).click();
}

View File

@@ -1,19 +1,19 @@
import { chromium } from '@playwright/test';
import {
TEST_DASHBOARD_URL,
TEST_USER_EMAIL,
TEST_USER_PASSWORD,
} from './e2e/env';
} from '@/e2e/env';
import { chromium } from '@playwright/test';
async function globalSetup() {
const browser = await chromium.launch();
const page = await browser.newPage();
const page = await browser.newPage({ baseURL: TEST_DASHBOARD_URL });
await page.goto(TEST_DASHBOARD_URL);
await page.waitForURL(`${TEST_DASHBOARD_URL}/signin`);
await page.goto('/');
await page.waitForURL('/signin');
await page.getByRole('link', { name: /continue with email/i }).click();
await page.waitForURL(`${TEST_DASHBOARD_URL}/signin/email`);
await page.waitForURL('/signin/email');
await page.getByLabel('Email').fill(TEST_USER_EMAIL);
await page.getByLabel('Password').fill(TEST_USER_PASSWORD);
await page.getByRole('button', { name: /sign in/i }).click();

View File

@@ -0,0 +1,66 @@
import {
TEST_DASHBOARD_URL,
TEST_PROJECT_ADMIN_SECRET,
TEST_PROJECT_NAME,
TEST_PROJECT_SLUG,
TEST_WORKSPACE_SLUG,
} from '@/e2e/env';
import { openProject } from '@/e2e/utils';
import { chromium } from '@playwright/test';
async function globalTeardown() {
const browser = await chromium.launch();
const context = await browser.newContext({
baseURL: TEST_DASHBOARD_URL,
storageState: 'storageState.json',
});
const page = await context.newPage();
await page.goto('/');
await openProject({
page,
projectName: TEST_PROJECT_NAME,
workspaceSlug: TEST_WORKSPACE_SLUG,
projectSlug: TEST_PROJECT_SLUG,
});
const pagePromise = context.waitForEvent('page');
await page.getByRole('link', { name: /hasura/i }).click();
await page.getByRole('link', { name: /open hasura/i }).click();
const hasuraPage = await pagePromise;
await hasuraPage.waitForLoadState();
const adminSecretInput = hasuraPage.getByPlaceholder(/enter admin-secret/i);
// note: a more ideal way would be to paste from clipboard, but Playwright
// doesn't support that yet
await adminSecretInput.fill(TEST_PROJECT_ADMIN_SECRET);
await adminSecretInput.press('Enter');
// note: getByRole doesn't work here
await hasuraPage.locator('a', { hasText: /data/i }).click();
await hasuraPage.getByRole('link', { name: /sql/i }).click();
await hasuraPage.getByRole('textbox').fill(`
DO $$ DECLARE
tablename text;
BEGIN
FOR tablename IN
SELECT table_name FROM information_schema.tables
WHERE table_schema = 'public'
LOOP
EXECUTE 'DROP TABLE IF EXISTS public.' || quote_ident(tablename) || ' CASCADE';
END LOOP;
END $$;
`);
await hasuraPage.getByRole('button', { name: /run!/i }).click();
await hasuraPage.getByText(/sql executed!/i).waitFor();
}
export default globalTeardown;

View File

@@ -1,5 +1,5 @@
schema:
- http://localhost:1337/v1/graphql:
- https://local.graphql.nhost.run/v1:
headers:
x-hasura-admin-secret: nhost-admin-secret
generates:

View File

@@ -1,6 +1,6 @@
{
"name": "@nhost/dashboard",
"version": "0.13.8",
"version": "0.14.1",
"private": true,
"scripts": {
"preinstall": "npx only-allow pnpm",
@@ -18,7 +18,7 @@
"e2e": "npx playwright@1.31.2 install --with-deps && playwright test"
},
"dependencies": {
"@apollo/client": "^3.7.3",
"@apollo/client": "^3.7.10",
"@codemirror/language": "^6.3.0",
"@emotion/cache": "^11.10.5",
"@emotion/react": "^11.10.5",
@@ -71,7 +71,7 @@
"react-merge-refs": "^1.1.0",
"react-syntax-highlighter": "^15.4.5",
"react-table": "^7.8.0",
"sharp": "^0.31.2",
"sharp": "^0.32.0",
"slugify": "^1.6.5",
"stripe": "^10.17.0",
"tailwind-merge": "^1.8.0",
@@ -82,6 +82,7 @@
},
"devDependencies": {
"@babel/core": "^7.20.2",
"@faker-js/faker": "^7.6.0",
"@graphql-codegen/cli": "^3.0.0",
"@graphql-codegen/typescript": "^3.0.0",
"@graphql-codegen/typescript-graphql-request": "^4.5.1",
@@ -105,7 +106,7 @@
"@types/lodash.debounce": "^4.0.7",
"@types/node": "^16.11.7",
"@types/pluralize": "^0.0.29",
"@types/react": "18.0.28",
"@types/react": "18.0.30",
"@types/react-dom": "18.0.11",
"@types/react-table": "^7.7.12",
"@types/testing-library__jest-dom": "^5.14.5",
@@ -140,6 +141,7 @@
"prettier-plugin-tailwindcss": "^0.2.0",
"react-date-fns-hooks": "^0.9.4",
"require-from-string": "^2.0.2",
"snake-case": "^3.0.4",
"storybook-addon-next-router": "^4.0.1",
"tailwindcss": "^3.1.2",
"ts-node": "^10.9.1",

View File

@@ -12,53 +12,22 @@ export default defineConfig({
timeout: 5000,
},
fullyParallel: true,
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: !!process.env.CI,
/* Retry on CI only */
retries: process.env.CI ? 2 : 0,
/* Opt out of parallel tests on CI. */
workers: process.env.CI ? 1 : undefined,
reporter: 'html',
globalSetup: require.resolve('./global-setup'),
globalTeardown: require.resolve('./global-teardown'),
use: {
actionTimeout: 0,
trace: 'on-first-retry',
storageState: 'storageState.json',
baseURL: process.env.NHOST_TEST_DASHBOARD_URL,
},
projects: [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
},
// {
// name: 'firefox',
// use: { ...devices['Desktop Firefox'] },
// },
// {
// name: 'webkit',
// use: { ...devices['Desktop Safari'] },
// },
/* Test against mobile viewports. */
// {
// name: 'Mobile Chrome',
// use: { ...devices['Pixel 5'] },
// },
// {
// name: 'Mobile Safari',
// use: { ...devices['iPhone 12'] },
// },
/* Test against branded browsers. */
// {
// name: 'Microsoft Edge',
// use: { channel: 'msedge' },
// },
// {
// name: 'Google Chrome',
// use: { channel: 'chrome' },
// },
],
});

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 16 KiB

View File

@@ -7,7 +7,7 @@ import Link from 'next/link';
export default function Sidebar() {
return (
<div className="grid grid-flow-row gap-8 mt-2 ml-10 w-full md:grid md:w-workspaceSidebar content-start">
<div className="mt-2 grid w-full grid-flow-row content-start gap-8 md:ml-10 md:grid md:w-workspaceSidebar">
<WorkspaceSection />
<Resources />

View File

@@ -2,8 +2,9 @@ import { UserDataProvider } from '@/context/workspace1-context';
import type { Project } from '@/types/application';
import { ApplicationStatus } from '@/types/application';
import type { Workspace } from '@/types/workspace';
import nhostGraphQLLink from '@/utils/msw/mocks/graphql/nhostGraphQLLink';
import { render, screen, waitForElementToBeRemoved } from '@/utils/testUtils';
import { graphql, rest } from 'msw';
import { rest } from 'msw';
import { setupServer } from 'msw/node';
import { afterAll, beforeAll, vi } from 'vitest';
import OverviewDeployments from '.';
@@ -73,13 +74,11 @@ const mockWorkspace: Workspace = {
applications: [mockApplication],
};
const mockGraphqlLink = graphql.link('http://localhost:1337/v1/graphql');
const server = setupServer(
rest.get('http://localhost:1337/v1/graphql', (req, res, ctx) =>
rest.get('https://local.graphql.nhost.run/v1', (_req, res, ctx) =>
res(ctx.status(200)),
),
mockGraphqlLink.operation(async (req, res, ctx) =>
nhostGraphQLLink.operation(async (_req, res, ctx) =>
res(
ctx.data({
deployments: [],
@@ -143,7 +142,7 @@ test('should render an empty state when GitHub is connected, but there are no de
test('should render a list of deployments', async () => {
server.use(
mockGraphqlLink.operation(async (req, res, ctx) => {
nhostGraphQLLink.operation(async (req, res, ctx) => {
const requestPayload = await req.json();
if (requestPayload.operationName === 'ScheduledOrPendingDeploymentsSub') {
@@ -193,7 +192,7 @@ test('should render a list of deployments', async () => {
test('should disable redeployments if a deployment is already in progress', async () => {
server.use(
mockGraphqlLink.operation(async (req, res, ctx) => {
nhostGraphQLLink.operation(async (req, res, ctx) => {
const requestPayload = await req.json();
if (requestPayload.operationName === 'ScheduledOrPendingDeploymentsSub') {

View File

@@ -0,0 +1,201 @@
import Form from '@/components/common/Form';
import SettingsContainer from '@/components/settings/SettingsContainer';
import BaseProviderSettings from '@/components/settings/signInMethods/BaseProviderSettings';
import { useUI } from '@/context/UIContext';
import {
GetSignInMethodsDocument,
useGetSignInMethodsQuery,
useUpdateConfigMutation,
} from '@/generated/graphql';
import { useCurrentWorkspaceAndApplication } from '@/hooks/useCurrentWorkspaceAndApplication';
import ActivityIndicator from '@/ui/v2/ActivityIndicator';
import IconButton from '@/ui/v2/IconButton';
import CopyIcon from '@/ui/v2/icons/CopyIcon';
import Input from '@/ui/v2/Input';
import InputAdornment from '@/ui/v2/InputAdornment';
import generateAppServiceUrl from '@/utils/common/generateAppServiceUrl';
import { copy } from '@/utils/copy';
import getServerError from '@/utils/settings/getServerError';
import { getToastStyleProps } from '@/utils/settings/settingsConstants';
import { yupResolver } from '@hookform/resolvers/yup';
import { FormProvider, useForm } from 'react-hook-form';
import { toast } from 'react-hot-toast';
import { twMerge } from 'tailwind-merge';
import * as Yup from 'yup';
const validationSchema = Yup.object({
clientId: Yup.string()
.label('Client ID')
.when('enabled', {
is: true,
then: (schema) => schema.required(),
}),
clientSecret: Yup.string()
.label('Client Secret')
.when('enabled', {
is: true,
then: (schema) => schema.required(),
}),
tenant: Yup.string()
.label('Tenant')
.when('enabled', {
is: true,
then: (schema) => schema.required(),
}),
enabled: Yup.boolean(),
});
export type AzureADProviderFormValues = Yup.InferType<typeof validationSchema>;
export default function AzureADProviderSettings() {
const { maintenanceActive } = useUI();
const { currentApplication } = useCurrentWorkspaceAndApplication();
const [updateConfig] = useUpdateConfigMutation({
refetchQueries: [GetSignInMethodsDocument],
});
const { data, loading, error } = useGetSignInMethodsQuery({
variables: { appId: currentApplication?.id },
fetchPolicy: 'cache-only',
});
const { clientId, clientSecret, tenant, enabled } =
data?.config?.auth?.method?.oauth?.azuread || {};
const form = useForm<AzureADProviderFormValues>({
reValidateMode: 'onSubmit',
defaultValues: {
clientId: clientId || '',
clientSecret: clientSecret || '',
tenant: tenant || '',
enabled: enabled || false,
},
resolver: yupResolver(validationSchema),
});
if (loading) {
return (
<ActivityIndicator
delay={1000}
label="Loading settings for Azure AD..."
className="justify-center"
/>
);
}
if (error) {
throw error;
}
const { register, formState, watch } = form;
const authEnabled = watch('enabled');
const handleProviderUpdate = async (values: AzureADProviderFormValues) => {
const updateConfigPromise = updateConfig({
variables: {
appId: currentApplication.id,
config: {
auth: {
method: {
oauth: {
azuread: values,
},
},
},
},
},
});
try {
await toast.promise(
updateConfigPromise,
{
loading: `Azure AD settings are being updated...`,
success: `Azure AD settings have been updated successfully.`,
error: getServerError(
`An error occurred while trying to update the project's Azure AD settings.`,
),
},
getToastStyleProps(),
);
form.reset(values);
} catch {
// Note: The toast will handle the error.
}
};
return (
<FormProvider {...form}>
<Form onSubmit={handleProviderUpdate}>
<SettingsContainer
title="Azure AD"
description="Allow users to sign in with Azure AD."
slotProps={{
submitButton: {
disabled: !formState.isDirty || maintenanceActive,
loading: formState.isSubmitting,
},
}}
icon="/assets/brands/azuread.svg"
switchId="enabled"
showSwitch
className={twMerge(
'grid grid-flow-row grid-cols-2 gap-y-4 gap-x-3 px-4 py-2',
!authEnabled && 'hidden',
)}
>
<BaseProviderSettings providerName="azuread" />
<Input
{...register('tenant')}
name="tenant"
id="tenant"
label="Tenant ID"
placeholder="Tenant ID"
className="col-span-2"
fullWidth
hideEmptyHelperText
error={!!formState.errors?.tenant}
helperText={formState.errors?.tenant?.message}
/>
<Input
name="redirectUrl"
id="redirectUrl"
defaultValue={`${generateAppServiceUrl(
currentApplication.subdomain,
currentApplication.region.awsName,
'auth',
)}/signin/provider/azuread/callback`}
className="col-span-2"
fullWidth
hideEmptyHelperText
label="Redirect URL"
disabled
endAdornment={
<InputAdornment position="end" className="absolute right-2">
<IconButton
sx={{ minWidth: 0, padding: 0 }}
color="secondary"
variant="borderless"
onClick={(e) => {
e.stopPropagation();
copy(
`${generateAppServiceUrl(
currentApplication.subdomain,
currentApplication.region.awsName,
'auth',
)}/signin/provider/azuread/callback`,
'Redirect URL',
);
}}
>
<CopyIcon className="h-4 w-4" />
</IconButton>
</InputAdornment>
}
/>
</SettingsContainer>
</Form>
</FormProvider>
);
}

View File

@@ -0,0 +1 @@
export { default } from './AzureADProviderSettings';

View File

@@ -100,6 +100,12 @@ query GetSignInMethods($appId: uuid!) {
connection
organization
}
azuread {
enabled
clientId
clientSecret
tenant
}
}
}
}

View File

@@ -2,6 +2,7 @@ import Container from '@/components/layout/Container';
import SettingsLayout from '@/components/settings/SettingsLayout';
import AnonymousSignInSettings from '@/components/settings/signInMethods/AnonymousSignInSettings';
import AppleProviderSettings from '@/components/settings/signInMethods/AppleProviderSettings';
import AzureADProviderSettings from '@/components/settings/signInMethods/AzureADProviderSettings';
import DiscordProviderSettings from '@/components/settings/signInMethods/DiscordProviderSettings';
import EmailAndPasswordSettings from '@/components/settings/signInMethods/EmailAndPasswordSettings';
import FacebookProviderSettings from '@/components/settings/signInMethods/FacebookProviderSettings';
@@ -56,6 +57,7 @@ export default function SettingsSignInMethodsPage() {
<SMSSettings />
{!currentApplication.providersUpdated && <ProvidersUpdatedAlert />}
<AppleProviderSettings />
<AzureADProviderSettings />
<DiscordProviderSettings />
<FacebookProviderSettings />
<GitHubProviderSettings />

View File

@@ -25,7 +25,9 @@ export type Scalars = {
bpchar: any;
bytea: any;
citext: any;
float64: any;
jsonb: any;
labels: any;
smallint: any;
timestamp: any;
timestamptz: any;
@@ -1035,7 +1037,9 @@ export type ConfigGlobalUpdateInput = {
export type ConfigHasura = {
__typename?: 'ConfigHasura';
adminSecret: Scalars['String'];
events?: Maybe<ConfigHasuraEvents>;
jwtSecrets?: Maybe<Array<ConfigJwtSecret>>;
logs?: Maybe<ConfigHasuraLogs>;
resources?: Maybe<ConfigResources>;
settings?: Maybe<ConfigHasuraSettings>;
version?: Maybe<Scalars['String']>;
@@ -1047,22 +1051,66 @@ export type ConfigHasuraComparisonExp = {
_not?: InputMaybe<ConfigHasuraComparisonExp>;
_or?: InputMaybe<Array<ConfigHasuraComparisonExp>>;
adminSecret?: InputMaybe<ConfigStringComparisonExp>;
events?: InputMaybe<ConfigHasuraEventsComparisonExp>;
jwtSecrets?: InputMaybe<ConfigJwtSecretComparisonExp>;
logs?: InputMaybe<ConfigHasuraLogsComparisonExp>;
resources?: InputMaybe<ConfigResourcesComparisonExp>;
settings?: InputMaybe<ConfigHasuraSettingsComparisonExp>;
version?: InputMaybe<ConfigStringComparisonExp>;
webhookSecret?: InputMaybe<ConfigStringComparisonExp>;
};
export type ConfigHasuraEvents = {
__typename?: 'ConfigHasuraEvents';
httpPoolSize?: Maybe<Scalars['ConfigUint32']>;
};
export type ConfigHasuraEventsComparisonExp = {
_and?: InputMaybe<Array<ConfigHasuraEventsComparisonExp>>;
_not?: InputMaybe<ConfigHasuraEventsComparisonExp>;
_or?: InputMaybe<Array<ConfigHasuraEventsComparisonExp>>;
httpPoolSize?: InputMaybe<ConfigUint32ComparisonExp>;
};
export type ConfigHasuraEventsInsertInput = {
httpPoolSize?: InputMaybe<Scalars['ConfigUint32']>;
};
export type ConfigHasuraEventsUpdateInput = {
httpPoolSize?: InputMaybe<Scalars['ConfigUint32']>;
};
export type ConfigHasuraInsertInput = {
adminSecret: Scalars['String'];
events?: InputMaybe<ConfigHasuraEventsInsertInput>;
jwtSecrets?: InputMaybe<Array<ConfigJwtSecretInsertInput>>;
logs?: InputMaybe<ConfigHasuraLogsInsertInput>;
resources?: InputMaybe<ConfigResourcesInsertInput>;
settings?: InputMaybe<ConfigHasuraSettingsInsertInput>;
version?: InputMaybe<Scalars['String']>;
webhookSecret: Scalars['String'];
};
export type ConfigHasuraLogs = {
__typename?: 'ConfigHasuraLogs';
level?: Maybe<Scalars['String']>;
};
export type ConfigHasuraLogsComparisonExp = {
_and?: InputMaybe<Array<ConfigHasuraLogsComparisonExp>>;
_not?: InputMaybe<ConfigHasuraLogsComparisonExp>;
_or?: InputMaybe<Array<ConfigHasuraLogsComparisonExp>>;
level?: InputMaybe<ConfigStringComparisonExp>;
};
export type ConfigHasuraLogsInsertInput = {
level?: InputMaybe<Scalars['String']>;
};
export type ConfigHasuraLogsUpdateInput = {
level?: InputMaybe<Scalars['String']>;
};
export type ConfigHasuraSettings = {
__typename?: 'ConfigHasuraSettings';
enableRemoteSchemaPermissions?: Maybe<Scalars['Boolean']>;
@@ -1085,7 +1133,9 @@ export type ConfigHasuraSettingsUpdateInput = {
export type ConfigHasuraUpdateInput = {
adminSecret?: InputMaybe<Scalars['String']>;
events?: InputMaybe<ConfigHasuraEventsUpdateInput>;
jwtSecrets?: InputMaybe<Array<ConfigJwtSecretUpdateInput>>;
logs?: InputMaybe<ConfigHasuraLogsUpdateInput>;
resources?: InputMaybe<ConfigResourcesUpdateInput>;
settings?: InputMaybe<ConfigHasuraSettingsUpdateInput>;
version?: InputMaybe<Scalars['String']>;
@@ -1639,6 +1689,24 @@ export type Log = {
timestamp: Scalars['Timestamp'];
};
export type Metrics = {
__typename?: 'Metrics';
rows: Array<RowMetric>;
};
export type RowMetric = {
__typename?: 'RowMetric';
labels?: Maybe<Scalars['labels']>;
time: Scalars['Timestamp'];
value?: Maybe<Scalars['float64']>;
};
export type StatsLiveApps = {
__typename?: 'StatsLiveApps';
appID: Array<Scalars['uuid']>;
count: Scalars['Int'];
};
/** Boolean expression to compare columns of type "String". All fields are combined with logical 'AND'. */
export type String_Comparison_Exp = {
_eq?: InputMaybe<Scalars['String']>;
@@ -4878,6 +4946,7 @@ export type Backups = {
appId: Scalars['uuid'];
completedAt?: Maybe<Scalars['timestamptz']>;
createdAt: Scalars['timestamptz'];
expiresAt?: Maybe<Scalars['timestamptz']>;
id: Scalars['uuid'];
size: Scalars['bigint'];
};
@@ -4965,6 +5034,7 @@ export type Backups_Bool_Exp = {
appId?: InputMaybe<Uuid_Comparison_Exp>;
completedAt?: InputMaybe<Timestamptz_Comparison_Exp>;
createdAt?: InputMaybe<Timestamptz_Comparison_Exp>;
expiresAt?: InputMaybe<Timestamptz_Comparison_Exp>;
id?: InputMaybe<Uuid_Comparison_Exp>;
size?: InputMaybe<Bigint_Comparison_Exp>;
};
@@ -4986,6 +5056,7 @@ export type Backups_Insert_Input = {
appId?: InputMaybe<Scalars['uuid']>;
completedAt?: InputMaybe<Scalars['timestamptz']>;
createdAt?: InputMaybe<Scalars['timestamptz']>;
expiresAt?: InputMaybe<Scalars['timestamptz']>;
id?: InputMaybe<Scalars['uuid']>;
size?: InputMaybe<Scalars['bigint']>;
};
@@ -4996,6 +5067,7 @@ export type Backups_Max_Fields = {
appId?: Maybe<Scalars['uuid']>;
completedAt?: Maybe<Scalars['timestamptz']>;
createdAt?: Maybe<Scalars['timestamptz']>;
expiresAt?: Maybe<Scalars['timestamptz']>;
id?: Maybe<Scalars['uuid']>;
size?: Maybe<Scalars['bigint']>;
};
@@ -5005,6 +5077,7 @@ export type Backups_Max_Order_By = {
appId?: InputMaybe<Order_By>;
completedAt?: InputMaybe<Order_By>;
createdAt?: InputMaybe<Order_By>;
expiresAt?: InputMaybe<Order_By>;
id?: InputMaybe<Order_By>;
size?: InputMaybe<Order_By>;
};
@@ -5015,6 +5088,7 @@ export type Backups_Min_Fields = {
appId?: Maybe<Scalars['uuid']>;
completedAt?: Maybe<Scalars['timestamptz']>;
createdAt?: Maybe<Scalars['timestamptz']>;
expiresAt?: Maybe<Scalars['timestamptz']>;
id?: Maybe<Scalars['uuid']>;
size?: Maybe<Scalars['bigint']>;
};
@@ -5024,6 +5098,7 @@ export type Backups_Min_Order_By = {
appId?: InputMaybe<Order_By>;
completedAt?: InputMaybe<Order_By>;
createdAt?: InputMaybe<Order_By>;
expiresAt?: InputMaybe<Order_By>;
id?: InputMaybe<Order_By>;
size?: InputMaybe<Order_By>;
};
@@ -5050,6 +5125,7 @@ export type Backups_Order_By = {
appId?: InputMaybe<Order_By>;
completedAt?: InputMaybe<Order_By>;
createdAt?: InputMaybe<Order_By>;
expiresAt?: InputMaybe<Order_By>;
id?: InputMaybe<Order_By>;
size?: InputMaybe<Order_By>;
};
@@ -5068,6 +5144,8 @@ export enum Backups_Select_Column {
/** column name */
CreatedAt = 'createdAt',
/** column name */
ExpiresAt = 'expiresAt',
/** column name */
Id = 'id',
/** column name */
Size = 'size'
@@ -5078,6 +5156,7 @@ export type Backups_Set_Input = {
appId?: InputMaybe<Scalars['uuid']>;
completedAt?: InputMaybe<Scalars['timestamptz']>;
createdAt?: InputMaybe<Scalars['timestamptz']>;
expiresAt?: InputMaybe<Scalars['timestamptz']>;
id?: InputMaybe<Scalars['uuid']>;
size?: InputMaybe<Scalars['bigint']>;
};
@@ -5128,6 +5207,7 @@ export type Backups_Stream_Cursor_Value_Input = {
appId?: InputMaybe<Scalars['uuid']>;
completedAt?: InputMaybe<Scalars['timestamptz']>;
createdAt?: InputMaybe<Scalars['timestamptz']>;
expiresAt?: InputMaybe<Scalars['timestamptz']>;
id?: InputMaybe<Scalars['uuid']>;
size?: InputMaybe<Scalars['bigint']>;
};
@@ -5152,6 +5232,8 @@ export enum Backups_Update_Column {
/** column name */
CreatedAt = 'createdAt',
/** column name */
ExpiresAt = 'expiresAt',
/** column name */
Id = 'id',
/** column name */
Size = 'size'
@@ -9150,6 +9232,7 @@ export type Mutation_Root = {
/** insert a single row into the table: "regions" */
insert_regions_one?: Maybe<Regions>;
migrateRDSToPostgres: Scalars['Boolean'];
pauseInactiveApps: Array<Scalars['String']>;
resetPostgresPassword: Scalars['Boolean'];
restoreApplicationDatabase: Scalars['Boolean'];
/** update single row of the table: "apps" */
@@ -9338,9 +9421,16 @@ export type Mutation_Root = {
};
/** mutation root */
export type Mutation_RootBackupAllApplicationsDatabaseArgs = {
expireInDays?: InputMaybe<Scalars['Int']>;
};
/** mutation root */
export type Mutation_RootBackupApplicationDatabaseArgs = {
appID: Scalars['String'];
expireInDays?: InputMaybe<Scalars['Int']>;
};
@@ -11947,6 +12037,41 @@ export type Query_Root = {
files: Array<Files>;
/** fetch aggregated fields from the table: "storage.files" */
filesAggregate: Files_Aggregate;
/**
* Returns CPU metrics for a given application.
* If `from` and `to` are not provided, they default to an hour ago and now, respectively.
*
* CPU usage is calculated as the average CPU usage over the period of 1m.
*
* Unit returned is millicores.
*/
getCPUMetrics: Metrics;
/**
* Returns memory metrics for a given application.
* If `from` and `to` are not provided, they default to an hour ago and now, respectively.
*
* Memory usage is returned in MiB.
*/
getMemoryMetrics: Metrics;
/**
* Returns disk capacity for the volume used by postgres to store the database.
* If `from` and `to` are not provided, they default to an hour ago and now, respectively.
*
* Disk usage is returned in MiB.
*/
getPostgresVolumeCapacity: Metrics;
/**
* Returns disk usage for the volume used by postgres to store the database.
* If `from` and `to` are not provided, they default to an hour ago and now, respectively.
*
* Disk usage is returned in MiB.
*/
getPostgresVolumeUsage: Metrics;
/**
* Return requests per second for a given application by service.
* If `from` and `to` are not provided, they default to an hour ago and now, respectively.
*/
getRequestsPerSecond: Metrics;
/** fetch data from the table: "github_app_installations" using primary key columns */
githubAppInstallation?: Maybe<GithubAppInstallations>;
/** fetch data from the table: "github_app_installations" */
@@ -11982,6 +12107,13 @@ export type Query_Root = {
regions_aggregate: Regions_Aggregate;
/** fetch data from the table: "regions" using primary key columns */
regions_by_pk?: Maybe<Regions>;
/**
* Returns lists of apps that have some live traffic in the give time range.
* From defaults to 24 hours ago and to defaults to now.
*
* Requests that returned a 4xx or 5xx status code are not counted as live traffic.
*/
statsLiveApps: StatsLiveApps;
systemConfig?: Maybe<ConfigSystemConfig>;
systemConfigs: Array<ConfigAppSystemConfig>;
/** fetch data from the table: "auth.users" using primary key columns */
@@ -12511,6 +12643,41 @@ export type Query_RootFilesAggregateArgs = {
};
export type Query_RootGetCpuMetricsArgs = {
appID: Scalars['String'];
from?: InputMaybe<Scalars['Timestamp']>;
to?: InputMaybe<Scalars['Timestamp']>;
};
export type Query_RootGetMemoryMetricsArgs = {
appID: Scalars['String'];
from?: InputMaybe<Scalars['Timestamp']>;
to?: InputMaybe<Scalars['Timestamp']>;
};
export type Query_RootGetPostgresVolumeCapacityArgs = {
appID: Scalars['String'];
from?: InputMaybe<Scalars['Timestamp']>;
to?: InputMaybe<Scalars['Timestamp']>;
};
export type Query_RootGetPostgresVolumeUsageArgs = {
appID: Scalars['String'];
from?: InputMaybe<Scalars['Timestamp']>;
to?: InputMaybe<Scalars['Timestamp']>;
};
export type Query_RootGetRequestsPerSecondArgs = {
appID: Scalars['String'];
from?: InputMaybe<Scalars['Timestamp']>;
to?: InputMaybe<Scalars['Timestamp']>;
};
export type Query_RootGithubAppInstallationArgs = {
id: Scalars['uuid'];
};
@@ -12634,6 +12801,12 @@ export type Query_RootRegions_By_PkArgs = {
};
export type Query_RootStatsLiveAppsArgs = {
from?: InputMaybe<Scalars['Timestamp']>;
to?: InputMaybe<Scalars['Timestamp']>;
};
export type Query_RootSystemConfigArgs = {
appID: Scalars['uuid'];
};
@@ -16480,7 +16653,7 @@ export type GetSignInMethodsQueryVariables = Exact<{
}>;
export type GetSignInMethodsQuery = { __typename?: 'query_root', config?: { __typename: 'ConfigConfig', id: 'ConfigConfig', provider?: { __typename: 'ConfigProvider', id: 'ConfigProvider', sms?: { __typename?: 'ConfigSms', accountSid: string, authToken: string, messagingServiceId: string, provider?: string | null } | null } | null, auth?: { __typename: 'ConfigAuth', id: 'ConfigAuth', method?: { __typename?: 'ConfigAuthMethod', emailPassword?: { __typename?: 'ConfigAuthMethodEmailPassword', emailVerificationRequired?: boolean | null, hibpEnabled?: boolean | null } | null, emailPasswordless?: { __typename?: 'ConfigAuthMethodEmailPasswordless', enabled?: boolean | null } | null, smsPasswordless?: { __typename?: 'ConfigAuthMethodSmsPasswordless', enabled?: boolean | null } | null, anonymous?: { __typename?: 'ConfigAuthMethodAnonymous', enabled?: boolean | null } | null, webauthn?: { __typename?: 'ConfigAuthMethodWebauthn', enabled?: boolean | null } | null, oauth?: { __typename?: 'ConfigAuthMethodOauth', apple?: { __typename?: 'ConfigAuthMethodOauthApple', enabled?: boolean | null, clientId?: string | null, keyId?: string | null, teamId?: string | null, privateKey?: string | null } | null, discord?: { __typename?: 'ConfigStandardOauthProviderWithScope', enabled?: boolean | null, clientId?: string | null, clientSecret?: string | null, scope?: Array<string> | null } | null, facebook?: { __typename?: 'ConfigStandardOauthProviderWithScope', enabled?: boolean | null, clientId?: string | null, clientSecret?: string | null, scope?: Array<string> | null } | null, github?: { __typename?: 'ConfigStandardOauthProviderWithScope', enabled?: boolean | null, clientId?: string | null, clientSecret?: string | null, scope?: Array<string> | null } | null, google?: { __typename?: 'ConfigStandardOauthProviderWithScope', enabled?: boolean | null, clientId?: string | null, clientSecret?: string | null, scope?: Array<string> | null } | null, linkedin?: { __typename?: 'ConfigStandardOauthProviderWithScope', enabled?: boolean | null, clientId?: string | null, clientSecret?: string | null, scope?: Array<string> | null } | null, spotify?: { __typename?: 'ConfigStandardOauthProviderWithScope', enabled?: boolean | null, clientId?: string | null, clientSecret?: string | null, scope?: Array<string> | null } | null, twitch?: { __typename?: 'ConfigStandardOauthProviderWithScope', enabled?: boolean | null, clientId?: string | null, clientSecret?: string | null, scope?: Array<string> | null } | null, twitter?: { __typename?: 'ConfigAuthMethodOauthTwitter', enabled?: boolean | null, consumerKey?: string | null, consumerSecret?: string | null } | null, windowslive?: { __typename?: 'ConfigStandardOauthProviderWithScope', enabled?: boolean | null, clientId?: string | null, clientSecret?: string | null, scope?: Array<string> | null } | null, workos?: { __typename?: 'ConfigAuthMethodOauthWorkos', enabled?: boolean | null, clientId?: string | null, clientSecret?: string | null, connection?: string | null, organization?: string | null } | null } | null } | null } | null } | null };
export type GetSignInMethodsQuery = { __typename?: 'query_root', config?: { __typename: 'ConfigConfig', id: 'ConfigConfig', provider?: { __typename: 'ConfigProvider', id: 'ConfigProvider', sms?: { __typename?: 'ConfigSms', accountSid: string, authToken: string, messagingServiceId: string, provider?: string | null } | null } | null, auth?: { __typename: 'ConfigAuth', id: 'ConfigAuth', method?: { __typename?: 'ConfigAuthMethod', emailPassword?: { __typename?: 'ConfigAuthMethodEmailPassword', emailVerificationRequired?: boolean | null, hibpEnabled?: boolean | null } | null, emailPasswordless?: { __typename?: 'ConfigAuthMethodEmailPasswordless', enabled?: boolean | null } | null, smsPasswordless?: { __typename?: 'ConfigAuthMethodSmsPasswordless', enabled?: boolean | null } | null, anonymous?: { __typename?: 'ConfigAuthMethodAnonymous', enabled?: boolean | null } | null, webauthn?: { __typename?: 'ConfigAuthMethodWebauthn', enabled?: boolean | null } | null, oauth?: { __typename?: 'ConfigAuthMethodOauth', apple?: { __typename?: 'ConfigAuthMethodOauthApple', enabled?: boolean | null, clientId?: string | null, keyId?: string | null, teamId?: string | null, privateKey?: string | null } | null, discord?: { __typename?: 'ConfigStandardOauthProviderWithScope', enabled?: boolean | null, clientId?: string | null, clientSecret?: string | null, scope?: Array<string> | null } | null, facebook?: { __typename?: 'ConfigStandardOauthProviderWithScope', enabled?: boolean | null, clientId?: string | null, clientSecret?: string | null, scope?: Array<string> | null } | null, github?: { __typename?: 'ConfigStandardOauthProviderWithScope', enabled?: boolean | null, clientId?: string | null, clientSecret?: string | null, scope?: Array<string> | null } | null, google?: { __typename?: 'ConfigStandardOauthProviderWithScope', enabled?: boolean | null, clientId?: string | null, clientSecret?: string | null, scope?: Array<string> | null } | null, linkedin?: { __typename?: 'ConfigStandardOauthProviderWithScope', enabled?: boolean | null, clientId?: string | null, clientSecret?: string | null, scope?: Array<string> | null } | null, spotify?: { __typename?: 'ConfigStandardOauthProviderWithScope', enabled?: boolean | null, clientId?: string | null, clientSecret?: string | null, scope?: Array<string> | null } | null, twitch?: { __typename?: 'ConfigStandardOauthProviderWithScope', enabled?: boolean | null, clientId?: string | null, clientSecret?: string | null, scope?: Array<string> | null } | null, twitter?: { __typename?: 'ConfigAuthMethodOauthTwitter', enabled?: boolean | null, consumerKey?: string | null, consumerSecret?: string | null } | null, windowslive?: { __typename?: 'ConfigStandardOauthProviderWithScope', enabled?: boolean | null, clientId?: string | null, clientSecret?: string | null, scope?: Array<string> | null } | null, workos?: { __typename?: 'ConfigAuthMethodOauthWorkos', enabled?: boolean | null, clientId?: string | null, clientSecret?: string | null, connection?: string | null, organization?: string | null } | null, azuread?: { __typename?: 'ConfigAuthMethodOauthAzuread', enabled?: boolean | null, clientId?: string | null, clientSecret?: string | null, tenant?: string | null } | null } | null } | null } | null } | null };
export type GetSmtpSettingsQueryVariables = Exact<{
appId: Scalars['uuid'];
@@ -18282,6 +18455,12 @@ export const GetSignInMethodsDocument = gql`
connection
organization
}
azuread {
enabled
clientId
clientSecret
tenant
}
}
}
}

View File

@@ -1,5 +1,5 @@
import { graphql } from 'msw';
const nhostGraphQLLink = graphql.link('http://localhost:1337/v1/graphql');
const nhostGraphQLLink = graphql.link('https://local.graphql.nhost.run/v1');
export default nhostGraphQLLink;

View File

@@ -79,7 +79,7 @@ function Providers({ children }: PropsWithChildren<{}>) {
<NhostApolloProvider
nhost={nhost}
link={createHttpLink({
uri: 'http://localhost:1337/v1/graphql',
uri: 'https://local.graphql.nhost.run/v1',
})}
>
<WorkspaceProvider>

View File

@@ -19,6 +19,7 @@
"baseUrl": "./src",
"useUnknownInCatchVariables": false,
"paths": {
"@/e2e/*": ["../e2e/*"],
"@/components/*": ["components/*"],
"@/hooks/*": ["hooks/*"],
"@/utils/*": ["utils/*"],

View File

@@ -4,6 +4,7 @@
"jsx": "react-jsx",
"types": ["vitest/globals"],
"paths": {
"@/e2e/*": ["../e2e/*"],
"@/components/*": ["components/*"],
"@/hooks/*": ["hooks/*"],
"@/utils/*": ["utils/*"],

View File

@@ -16,9 +16,9 @@
},
"dependencies": {
"@algolia/client-search": "^4.9.1",
"@docusaurus/core": "2.3.1",
"@docusaurus/plugin-sitemap": "2.3.1",
"@docusaurus/preset-classic": "2.3.1",
"@docusaurus/core": "2.4.0",
"@docusaurus/plugin-sitemap": "2.4.0",
"@docusaurus/preset-classic": "2.4.0",
"@mdx-js/react": "^1.6.22",
"clsx": "^1.2.1",
"docusaurus-plugin-image-zoom": "^0.1.1",
@@ -30,7 +30,7 @@
"unist-util-visit": "^2.0.0"
},
"devDependencies": {
"@docusaurus/module-type-aliases": "2.3.1",
"@docusaurus/module-type-aliases": "2.4.0",
"@tsconfig/docusaurus": "^1.0.6",
"typescript": "^4.8.4"
},

View File

@@ -13,7 +13,7 @@ services:
postgres_password: postgres
postgres_user: postgres
auth:
image: nhost/hasura-auth:0.16.1
image: nhost/hasura-auth:0.16.2
storage:
image: nhost/hasura-storage:0.3.0
auth:

View File

@@ -13,7 +13,7 @@ services:
postgres_password: postgres
postgres_user: postgres
auth:
image: nhost/hasura-auth:0.16.1
image: nhost/hasura-auth:0.16.2
storage:
image: nhost/hasura-storage:0.3.0
auth:

View File

@@ -13,7 +13,7 @@ services:
postgres_password: postgres
postgres_user: postgres
auth:
image: nhost/hasura-auth:0.16.1
image: nhost/hasura-auth:0.16.2
storage:
image: nhost/hasura-storage:0.3.0
auth:

View File

@@ -1,5 +1,24 @@
# @nhost/apollo
## 5.2.0
### Patch Changes
- Updated dependencies [a0e093d7]
- @nhost/nhost-js@2.2.0
## 5.1.3
### Patch Changes
- @nhost/nhost-js@2.1.2
## 5.1.2
### Patch Changes
- 912ed76c: fix(apollo): retry subscriptions on error
## 5.1.1
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@nhost/apollo",
"version": "5.1.1",
"version": "5.2.0",
"description": "Nhost Apollo Client library",
"license": "MIT",
"keywords": [
@@ -59,15 +59,15 @@
"verify:fix": "run-p prettier:fix lint:fix"
},
"peerDependencies": {
"@nhost/nhost-js": "workspace:*",
"@apollo/client": "^3.6.2"
"@apollo/client": "^3.7.10",
"@nhost/nhost-js": "workspace:*"
},
"dependencies": {
"graphql": "16.6.0",
"graphql-ws": "^5.10.1"
},
"devDependencies": {
"@nhost/nhost-js": "workspace:*",
"@apollo/client": "^3.7.3"
"@apollo/client": "^3.7.10",
"@nhost/nhost-js": "workspace:*"
}
}

View File

@@ -1,6 +1,5 @@
import {
ApolloClient,
ApolloClientOptions,
createHttpLink,
from,
InMemoryCache,
@@ -38,16 +37,19 @@ export const createApolloClient = ({
connectToDevTools = isBrowser && process.env.NODE_ENV === 'development',
onError,
link: customLink
}: NhostApolloClientOptions): ApolloClient<any> => {
let backendUrl = graphqlUrl || nhost?.graphql.getUrl()
}: NhostApolloClientOptions) => {
const backendUrl = graphqlUrl || nhost?.graphql.httpUrl
if (!backendUrl) {
throw Error("Can't initialize the Apollo Client: no backend Url has been provided")
}
const uri = backendUrl
const interpreter = nhost?.auth.client.interpreter
let token: string | null = null
const getAuthHeaders = () => {
function getAuthHeaders() {
// add headers
const resHeaders = {
...headers,
@@ -66,33 +68,28 @@ export const createApolloClient = ({
return resHeaders
}
const uri = backendUrl
const wsClient =
isBrowser &&
createRestartableClient({
url: uri.startsWith('https') ? uri.replace(/^https/, 'wss') : uri.replace(/^http/, 'ws'),
connectionParams: () => ({
headers: {
...headers,
...getAuthHeaders()
}
const wsClient = isBrowser
? createRestartableClient({
url: uri.startsWith('https') ? uri.replace(/^https/, 'wss') : uri.replace(/^http/, 'ws'),
shouldRetry: () => true,
retryAttempts: 10,
connectionParams: () => ({
headers: {
...headers,
...getAuthHeaders()
}
})
})
})
const wsLink = wsClient && new GraphQLWsLink(wsClient)
: null
const httpLink = setContext((_, { headers }) => {
return {
headers: {
...headers,
...getAuthHeaders()
}
const wsLink = wsClient ? new GraphQLWsLink(wsClient) : null
const httpLink = setContext((_, { headers }) => ({
headers: {
...headers,
...getAuthHeaders()
}
}).concat(
createHttpLink({
uri
})
)
})).concat(createHttpLink({ uri }))
const link = wsLink
? split(
@@ -112,7 +109,7 @@ export const createApolloClient = ({
)
: httpLink
const apolloClientOptions: ApolloClientOptions<any> = {
const client = new ApolloClient({
cache: cache || new InMemoryCache(),
ssrMode: !isBrowser,
defaultOptions: {
@@ -120,34 +117,35 @@ export const createApolloClient = ({
fetchPolicy
}
},
connectToDevTools
}
// add link
if (customLink) {
apolloClientOptions.link = from([customLink])
} else {
apolloClientOptions.link = typeof onError === 'function' ? from([onError, link]) : from([link])
}
const client = new ApolloClient(apolloClientOptions)
connectToDevTools,
link: customLink
? from([customLink])
: from(typeof onError === 'function' ? [onError, link] : [link])
})
interpreter?.onTransition(async (state, event) => {
if (['SIGNOUT', 'SIGNED_IN', 'TOKEN_CHANGED'].includes(event.type)) {
const newToken = state.context.accessToken.value
token = newToken
if (event.type === 'SIGNOUT') {
token = null
try {
await client.resetStore()
} catch (error) {
console.error('Error resetting Apollo client cache')
console.error(error)
}
} else {
if (isBrowser && wsClient && wsClient.started()) {
wsClient.restart()
}
return
}
// update token
token = state.context.accessToken.value
if (!isBrowser) {
return
}
wsClient?.restart()
}
})

View File

@@ -3,7 +3,6 @@ import { Client, ClientOptions, createClient } from 'graphql-ws'
export interface RestartableClient extends Client {
restart(): void
started(): boolean
}
export function createRestartableClient(options: ClientOptions): RestartableClient {
@@ -11,18 +10,41 @@ export function createRestartableClient(options: ClientOptions): RestartableClie
let restart = () => {
restartRequested = true
}
let _started = false
const started = () => _started
let socket: WebSocket
let timedOut: NodeJS.Timeout
const client = createClient({
...options,
on: {
...options.on,
connected: () => {
_started = true
error: (error) => {
console.error(error)
options.on?.error?.(error)
restart()
},
ping: (received) => {
if (!received /* sent */) {
timedOut = setTimeout(() => {
// a close event `4499: Terminated` is issued to the current WebSocket and an
// artificial `{ code: 4499, reason: 'Terminated', wasClean: false }` close-event-like
// object is immediately emitted without waiting for the one coming from `WebSocket.onclose`
//
// calling terminate is not considered fatal and a connection retry will occur as expected
//
// see: https://github.com/enisdenjo/graphql-ws/discussions/290
client.terminate()
restart()
}, 5_000)
}
},
pong: (received) => {
if (received) {
clearTimeout(timedOut)
}
},
opened: (originalSocket) => {
const socket = originalSocket as WebSocket
socket = originalSocket as WebSocket
options.on?.opened?.(socket)
restart = () => {
@@ -47,7 +69,6 @@ export function createRestartableClient(options: ClientOptions): RestartableClie
return {
...client,
restart: () => restart(),
started
restart: () => restart()
}
}

View File

@@ -1,5 +1,27 @@
# @nhost/react-apollo
## 5.0.15
### Patch Changes
- @nhost/apollo@5.2.0
- @nhost/react@2.0.13
## 5.0.14
### Patch Changes
- @nhost/apollo@5.1.3
- @nhost/react@2.0.12
## 5.0.13
### Patch Changes
- 912ed76c: fix(apollo): retry subscriptions on error
- Updated dependencies [912ed76c]
- @nhost/apollo@5.1.2
## 5.0.12
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@nhost/react-apollo",
"version": "5.0.12",
"version": "5.0.15",
"description": "Nhost React Apollo client",
"license": "MIT",
"keywords": [
@@ -63,14 +63,14 @@
"@nhost/apollo": "workspace:*"
},
"peerDependencies": {
"@apollo/client": "^3.6.2",
"@apollo/client": "^3.7.10",
"@nhost/react": "workspace:*",
"graphql": "^16.0.0",
"react": "^17.0.0 || ^18.0.0",
"react-dom": "^17.0.0 || ^18.0.0"
},
"devDependencies": {
"@apollo/client": "^3.7.1",
"@apollo/client": "^3.7.10",
"@nhost/react": "workspace:*",
"@types/react": "^18.0.25",
"graphql": "16.6.0",

View File

@@ -9,7 +9,10 @@ import {
} from '@apollo/client'
import { useAuthenticated } from '@nhost/react'
export function useAuthQuery<TData = any, TVariables = OperationVariables>(
export function useAuthQuery<
TData = any,
TVariables extends OperationVariables = OperationVariables
>(
query: DocumentNode | TypedDocumentNode<TData, TVariables>,
options?: QueryHookOptions<TData, TVariables>
) {
@@ -18,7 +21,10 @@ export function useAuthQuery<TData = any, TVariables = OperationVariables>(
return useQuery(query, newOptions)
}
export function useAuthSubscription<TData = any, TVariables = OperationVariables>(
export function useAuthSubscription<
TData = any,
TVariables extends OperationVariables = OperationVariables
>(
subscription: DocumentNode | TypedDocumentNode<TData, TVariables>,
options?: SubscriptionHookOptions<TData, TVariables>
) {

View File

@@ -22,9 +22,7 @@ export const NhostApolloProvider: React.FC<PropsWithChildren<NhostApolloClientOp
if (!client) {
setClient(createApolloClient(options))
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [])
}, [client, options])
return <ApolloProvider client={client || mockApolloClient}>{children}</ApolloProvider>
}

View File

@@ -1,5 +1,17 @@
# @nhost/react-urql
## 2.0.13
### Patch Changes
- @nhost/react@2.0.13
## 2.0.12
### Patch Changes
- @nhost/react@2.0.12
## 2.0.11
### Patch Changes

View File

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

View File

@@ -76,7 +76,7 @@
"husky": "^8.0.1",
"npm-run-all": "^4.1.5",
"prettier": "^2.7.1",
"turbo": "1.8.5",
"turbo": "1.8.6",
"typedoc": "^0.22.18",
"typescript": "4.9.5",
"vite": "^4.0.2",

View File

@@ -1,5 +1,11 @@
# @nhost/hasura-auth-js
## 2.1.0
### Minor Changes
- a0e093d7: fix(exports): don't use conflicting names in exports
## 2.0.2
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@nhost/hasura-auth-js",
"version": "2.0.2",
"version": "2.1.0",
"description": "Hasura-auth client",
"license": "MIT",
"keywords": [
@@ -43,7 +43,8 @@
},
"scripts": {
"dev": "vite build --config ./vite.dev.config.js",
"build": "run-p build:lib build:umd",
"build": "run-p typecheck build:lib build:umd",
"typecheck": "tsc --noEmit",
"build:lib": "vite build",
"build:umd": "vite build --config ../../config/vite.lib.umd.config.js",
"test": "vitest run",

View File

@@ -1,4 +1,4 @@
import { ErrorPayload } from './types'
import { AuthErrorPayload } from './types'
export const NETWORK_ERROR_CODE = 0
export const OTHER_ERROR_CODE = 1
@@ -12,8 +12,8 @@ export const STATE_ERROR_CODE = 20
* See https://github.com/statelyai/xstate/issues/3037
*/
export class CodifiedError extends Error {
error: ErrorPayload
constructor(original: Error | ErrorPayload) {
error: AuthErrorPayload
constructor(original: Error | AuthErrorPayload) {
super(original.message)
Error.captureStackTrace(this, this.constructor)
if (original instanceof Error) {
@@ -30,95 +30,95 @@ export class CodifiedError extends Error {
}
}
export type ValidationErrorPayload = ErrorPayload & { status: typeof VALIDATION_ERROR_CODE }
export type ValidationAuthErrorPayload = AuthErrorPayload & { status: typeof VALIDATION_ERROR_CODE }
// TODO share with hasura-auth
export const INVALID_EMAIL_ERROR: ValidationErrorPayload = {
export const INVALID_EMAIL_ERROR: ValidationAuthErrorPayload = {
status: VALIDATION_ERROR_CODE,
error: 'invalid-email',
message: 'Email is incorrectly formatted'
}
export const INVALID_MFA_TYPE_ERROR: ValidationErrorPayload = {
export const INVALID_MFA_TYPE_ERROR: ValidationAuthErrorPayload = {
status: VALIDATION_ERROR_CODE,
error: 'invalid-mfa-type',
message: 'MFA type is invalid'
}
export const INVALID_MFA_CODE_ERROR: ValidationErrorPayload = {
export const INVALID_MFA_CODE_ERROR: ValidationAuthErrorPayload = {
status: VALIDATION_ERROR_CODE,
error: 'invalid-mfa-code',
message: 'MFA code is invalid'
}
export const INVALID_PASSWORD_ERROR: ValidationErrorPayload = {
export const INVALID_PASSWORD_ERROR: ValidationAuthErrorPayload = {
status: VALIDATION_ERROR_CODE,
error: 'invalid-password',
message: 'Password is incorrectly formatted'
}
export const INVALID_PHONE_NUMBER_ERROR: ValidationErrorPayload = {
export const INVALID_PHONE_NUMBER_ERROR: ValidationAuthErrorPayload = {
status: VALIDATION_ERROR_CODE,
error: 'invalid-phone-number',
message: 'Phone number is incorrectly formatted'
}
export const INVALID_MFA_TICKET_ERROR: ValidationErrorPayload = {
export const INVALID_MFA_TICKET_ERROR: ValidationAuthErrorPayload = {
status: VALIDATION_ERROR_CODE,
error: 'invalid-mfa-ticket',
message: 'MFA ticket is invalid'
}
export const NO_MFA_TICKET_ERROR: ValidationErrorPayload = {
export const NO_MFA_TICKET_ERROR: ValidationAuthErrorPayload = {
status: VALIDATION_ERROR_CODE,
error: 'no-mfa-ticket',
message: 'No MFA ticket has been provided'
}
export const NO_REFRESH_TOKEN: ValidationErrorPayload = {
export const NO_REFRESH_TOKEN: ValidationAuthErrorPayload = {
status: VALIDATION_ERROR_CODE,
error: 'no-refresh-token',
message: 'No refresh token has been provided'
}
export const TOKEN_REFRESHER_RUNNING_ERROR: ErrorPayload = {
export const TOKEN_REFRESHER_RUNNING_ERROR: AuthErrorPayload = {
status: STATE_ERROR_CODE,
error: 'refresher-already-running',
message:
'The token refresher is already running. You must wait until is has finished before submitting a new token.'
}
export const USER_ALREADY_SIGNED_IN: ErrorPayload = {
export const USER_ALREADY_SIGNED_IN: AuthErrorPayload = {
status: STATE_ERROR_CODE,
error: 'already-signed-in',
message: 'User is already signed in'
}
export const USER_UNAUTHENTICATED: ErrorPayload = {
export const USER_UNAUTHENTICATED: AuthErrorPayload = {
status: STATE_ERROR_CODE,
error: 'unauthenticated-user',
message: 'User is not authenticated'
}
export const USER_NOT_ANONYMOUS: ErrorPayload = {
export const USER_NOT_ANONYMOUS: AuthErrorPayload = {
status: STATE_ERROR_CODE,
error: 'user-not-anonymous',
message: 'User is not anonymous'
}
export const EMAIL_NEEDS_VERIFICATION: ErrorPayload = {
export const EMAIL_NEEDS_VERIFICATION: AuthErrorPayload = {
status: STATE_ERROR_CODE,
error: 'unverified-user',
message: 'Email needs verification'
}
export const INVALID_REFRESH_TOKEN = {
export const INVALID_REFRESH_TOKEN: AuthErrorPayload = {
status: VALIDATION_ERROR_CODE,
error: 'invalid-refresh-token',
message: 'Invalid or expired refresh token'
}
export const INVALID_SIGN_IN_METHOD = {
export const INVALID_SIGN_IN_METHOD: AuthErrorPayload = {
status: OTHER_ERROR_CODE,
error: 'invalid-sign-in-method',
message: 'Invalid sign-in method'

View File

@@ -34,13 +34,13 @@ import {
} from './promises'
import {
AuthChangedFunction,
AuthErrorPayload,
ChangeEmailParams,
ChangeEmailResponse,
ChangePasswordParams,
ChangePasswordResponse,
DeanonymizeParams,
DeanonymizeResponse,
ErrorPayload,
JWTClaims,
JWTHasuraClaims,
NhostAuthConstructorParams,
@@ -411,7 +411,7 @@ export class HasuraAuthClient {
*/
async addSecurityKey(
nickname?: string
): Promise<{ error: ErrorPayload | null; key?: SecurityKey }> {
): Promise<{ error: AuthErrorPayload | null; key?: SecurityKey }> {
const { error, key } = await addSecurityKeyPromise(this._client, nickname)
return { error, key }
}

View File

@@ -1,4 +1,4 @@
import { ErrorPayload, User } from '../../types'
import { AuthErrorPayload, User } from '../../types'
export type StateErrorTypes = 'registration' | 'authentication' | 'signout'
@@ -21,7 +21,7 @@ export type AuthContext = {
}
/** Number of times the user tried to get an access token from a refresh token but got a network error */
importTokenAttempts: number
errors: Partial<Record<StateErrorTypes, ErrorPayload>>
errors: Partial<Record<StateErrorTypes, AuthErrorPayload>>
}
export const INITIAL_MACHINE_CONTEXT: AuthContext = {

View File

@@ -24,9 +24,9 @@ import {
} from '../../errors'
import { localStorageGetter, localStorageSetter } from '../../local-storage'
import {
AuthErrorPayload,
AuthOptions,
DeanonymizeResponse,
ErrorPayload,
NhostSession,
NhostSessionResponse,
PasswordlessEmailResponse,
@@ -856,7 +856,7 @@ export const createAuthMachine = ({
error: null
}
}
let error: ErrorPayload | null = null
let error: AuthErrorPayload | null = null
if (autoSignIn) {
const urlToken = getParameterByName('refreshToken') || null
if (urlToken) {
@@ -866,7 +866,7 @@ export const createAuthMachine = ({
})
return { session, error: null }
} catch (exception) {
error = (exception as { error: ErrorPayload }).error
error = (exception as { error: AuthErrorPayload }).error
}
} else {
const error = getParameterByName('error')
@@ -890,7 +890,7 @@ export const createAuthMachine = ({
})
return { session, error: null }
} catch (exception) {
error = (exception as { error: ErrorPayload }).error
error = (exception as { error: AuthErrorPayload }).error
}
}
if (error) {

View File

@@ -1,12 +1,12 @@
import { assign, createMachine, send } from 'xstate'
import { INVALID_EMAIL_ERROR } from '../errors'
import { AuthClient } from '../internal-client'
import { ChangeEmailOptions, ChangeEmailResponse, ErrorPayload } from '../types'
import { AuthErrorPayload, ChangeEmailOptions, ChangeEmailResponse } from '../types'
import { postFetch, rewriteRedirectTo } from '../utils'
import { isValidEmail } from '../utils/validators'
export type ChangeEmailContext = {
error: ErrorPayload | null
error: AuthErrorPayload | null
}
export type ChangeEmailEvents =
@@ -16,7 +16,7 @@ export type ChangeEmailEvents =
options?: ChangeEmailOptions
}
| { type: 'SUCCESS' }
| { type: 'ERROR'; error: ErrorPayload | null }
| { type: 'ERROR'; error: AuthErrorPayload | null }
export type ChangeEmailServices = {
request: { data: ChangeEmailResponse }

View File

@@ -16,9 +16,9 @@ export interface Typegen0 {
}
missingImplementations: {
actions: never
services: never
guards: never
delays: never
guards: never
services: never
}
eventsCausingActions: {
reportError: 'error.platform.requestChange'
@@ -26,13 +26,13 @@ export interface Typegen0 {
saveInvalidEmailError: 'REQUEST'
saveRequestError: 'error.platform.requestChange'
}
eventsCausingServices: {
requestChange: 'REQUEST'
}
eventsCausingDelays: {}
eventsCausingGuards: {
invalidEmail: 'REQUEST'
}
eventsCausingDelays: {}
eventsCausingServices: {
requestChange: 'REQUEST'
}
matchesStates:
| 'idle'
| 'idle.error'

View File

@@ -1,12 +1,12 @@
import { assign, createMachine, send } from 'xstate'
import { INVALID_PASSWORD_ERROR } from '../errors'
import { AuthClient } from '../internal-client'
import { ChangePasswordResponse, ErrorPayload } from '../types'
import { AuthErrorPayload, ChangePasswordResponse } from '../types'
import { postFetch } from '../utils'
import { isValidPassword } from '../utils/validators'
export type ChangePasswordContext = {
error: ErrorPayload | null
error: AuthErrorPayload | null
}
export type ChangePasswordEvents =
| {
@@ -15,7 +15,7 @@ export type ChangePasswordEvents =
ticket?: string
}
| { type: 'SUCCESS' }
| { type: 'ERROR'; error: ErrorPayload | null }
| { type: 'ERROR'; error: AuthErrorPayload | null }
export type ChangePasswordServices = {
requestChange: { data: ChangePasswordResponse }

View File

@@ -16,9 +16,9 @@ export interface Typegen0 {
}
missingImplementations: {
actions: never
services: never
guards: never
delays: never
guards: never
services: never
}
eventsCausingActions: {
reportError: 'error.platform.requestChange'
@@ -26,13 +26,13 @@ export interface Typegen0 {
saveInvalidPasswordError: 'REQUEST'
saveRequestError: 'error.platform.requestChange'
}
eventsCausingServices: {
requestChange: 'REQUEST'
}
eventsCausingDelays: {}
eventsCausingGuards: {
invalidPassword: 'REQUEST'
}
eventsCausingDelays: {}
eventsCausingServices: {
requestChange: 'REQUEST'
}
matchesStates:
| 'idle'
| 'idle.error'

View File

@@ -1,11 +1,11 @@
import { assign, createMachine, send } from 'xstate'
import { INVALID_MFA_CODE_ERROR, INVALID_MFA_TYPE_ERROR } from '../errors'
import { AuthClient } from '../internal-client'
import { ErrorPayload } from '../types'
import { AuthErrorPayload } from '../types'
import { getFetch, postFetch } from '../utils'
export type EnableMfaContext = {
error: ErrorPayload | null
error: AuthErrorPayload | null
imageUrl: string | null
secret: string | null
}
@@ -20,9 +20,9 @@ export type EnableMfaEvents =
activeMfaType: 'totp'
}
| { type: 'GENERATED' }
| { type: 'GENERATED_ERROR'; error: ErrorPayload | null }
| { type: 'GENERATED_ERROR'; error: AuthErrorPayload | null }
| { type: 'SUCCESS' }
| { type: 'ERROR'; error: ErrorPayload | null }
| { type: 'ERROR'; error: AuthErrorPayload | null }
export type EnableMfadMachine = ReturnType<typeof createEnableMfaMachine>

View File

@@ -23,9 +23,9 @@ export interface Typegen0 {
}
missingImplementations: {
actions: never
services: never
guards: never
delays: never
guards: never
services: never
}
eventsCausingActions: {
reportError: 'error.platform.activate'
@@ -37,15 +37,15 @@ export interface Typegen0 {
saveInvalidMfaCodeError: 'ACTIVATE'
saveInvalidMfaTypeError: 'ACTIVATE'
}
eventsCausingServices: {
activate: 'ACTIVATE'
generate: 'GENERATE'
}
eventsCausingDelays: {}
eventsCausingGuards: {
invalidMfaCode: 'ACTIVATE'
invalidMfaType: 'ACTIVATE'
}
eventsCausingDelays: {}
eventsCausingServices: {
activate: 'ACTIVATE'
generate: 'GENERATE'
}
matchesStates:
| 'generated'
| 'generated.activated'

View File

@@ -1,12 +1,12 @@
import { assign, createMachine, send } from 'xstate'
import { INVALID_EMAIL_ERROR } from '../errors'
import { AuthClient } from '../internal-client'
import { ErrorPayload, ResetPasswordOptions, ResetPasswordResponse } from '../types'
import { AuthErrorPayload, ResetPasswordOptions, ResetPasswordResponse } from '../types'
import { postFetch, rewriteRedirectTo } from '../utils'
import { isValidEmail } from '../utils/validators'
export type ResetPasswordContext = {
error: ErrorPayload | null
error: AuthErrorPayload | null
}
export type ResetPasswordEvents =
| {
@@ -15,7 +15,7 @@ export type ResetPasswordEvents =
options?: ResetPasswordOptions
}
| { type: 'SUCCESS' }
| { type: 'ERROR'; error: ErrorPayload | null }
| { type: 'ERROR'; error: AuthErrorPayload | null }
export type ResetPasswordServices = {
requestChange: { data: ResetPasswordResponse }

View File

@@ -16,9 +16,9 @@ export interface Typegen0 {
}
missingImplementations: {
actions: never
services: never
guards: never
delays: never
guards: never
services: never
}
eventsCausingActions: {
reportError: 'error.platform.requestChange'
@@ -26,13 +26,13 @@ export interface Typegen0 {
saveInvalidEmailError: 'REQUEST'
saveRequestError: 'error.platform.requestChange'
}
eventsCausingServices: {
requestChange: 'REQUEST'
}
eventsCausingDelays: {}
eventsCausingGuards: {
invalidEmail: 'REQUEST'
}
eventsCausingDelays: {}
eventsCausingServices: {
requestChange: 'REQUEST'
}
matchesStates:
| 'idle'
| 'idle.error'

View File

@@ -1,12 +1,16 @@
import { assign, createMachine, send } from 'xstate'
import { INVALID_EMAIL_ERROR } from '../errors'
import { AuthClient } from '../internal-client'
import { ErrorPayload, SendVerificationEmailOptions, SendVerificationEmailResponse } from '../types'
import {
AuthErrorPayload,
SendVerificationEmailOptions,
SendVerificationEmailResponse
} from '../types'
import { postFetch, rewriteRedirectTo } from '../utils'
import { isValidEmail } from '../utils/validators'
export type SendVerificationEmailContext = {
error: ErrorPayload | null
error: AuthErrorPayload | null
}
export type SendVerificationEmailEvents =
@@ -16,7 +20,7 @@ export type SendVerificationEmailEvents =
options?: SendVerificationEmailOptions
}
| { type: 'SUCCESS' }
| { type: 'ERROR'; error: ErrorPayload | null }
| { type: 'ERROR'; error: AuthErrorPayload | null }
export type SendVerificationEmailServices = {
request: { data: SendVerificationEmailResponse }

View File

@@ -16,9 +16,9 @@ export interface Typegen0 {
}
missingImplementations: {
actions: never
services: never
guards: never
delays: never
guards: never
services: never
}
eventsCausingActions: {
reportError: 'error.platform.request'
@@ -26,13 +26,13 @@ export interface Typegen0 {
saveInvalidEmailError: 'REQUEST'
saveRequestError: 'error.platform.request'
}
eventsCausingServices: {
request: 'REQUEST'
}
eventsCausingDelays: {}
eventsCausingGuards: {
invalidEmail: 'REQUEST'
}
eventsCausingDelays: {}
eventsCausingServices: {
request: 'REQUEST'
}
matchesStates:
| 'idle'
| 'idle.error'

View File

@@ -6,14 +6,14 @@ import {
import { postFetch } from '..'
import { CodifiedError } from '../errors'
import { AuthClient } from '../internal-client'
import { ErrorPayload, SecurityKey } from '../types'
import { ActionErrorState, ActionLoadingState, ActionSuccessState } from './types'
import { AuthErrorPayload, SecurityKey } from '../types'
import { AuthActionErrorState, AuthActionLoadingState, AuthActionSuccessState } from './types'
export interface AddSecurityKeyHandlerResult extends ActionErrorState, ActionSuccessState {
export interface AddSecurityKeyHandlerResult extends AuthActionErrorState, AuthActionSuccessState {
key?: SecurityKey
}
export interface AddSecurityKeyState extends AddSecurityKeyHandlerResult, ActionLoadingState {}
export interface AddSecurityKeyState extends AddSecurityKeyHandlerResult, AuthActionLoadingState {}
export const addSecurityKeyPromise = async (
{ backendUrl, interpreter }: AuthClient,
@@ -38,7 +38,7 @@ export const addSecurityKeyPromise = async (
)
return { key, isError: false, error: null, isSuccess: true }
} catch (e) {
const { error } = e as { error: ErrorPayload }
const { error } = e as { error: AuthErrorPayload }
return { isError: true, error, isSuccess: false }
}
}

View File

@@ -3,10 +3,12 @@ import { InterpreterFrom } from 'xstate'
import { ChangeEmailMachine } from '../machines'
import { ChangeEmailOptions } from '../types'
import { ActionErrorState, ActionLoadingState, NeedsEmailVerificationState } from './types'
export interface ChangeEmailHandlerResult extends ActionErrorState, NeedsEmailVerificationState {}
import { AuthActionErrorState, AuthActionLoadingState, NeedsEmailVerificationState } from './types'
export interface ChangeEmailHandlerResult
extends AuthActionErrorState,
NeedsEmailVerificationState {}
export interface ChangeEmailState extends ChangeEmailHandlerResult, ActionLoadingState {}
export interface ChangeEmailState extends ChangeEmailHandlerResult, AuthActionLoadingState {}
export const changeEmailPromise = async (
interpreter: InterpreterFrom<ChangeEmailMachine>,

View File

@@ -2,11 +2,11 @@ import { InterpreterFrom } from 'xstate'
import { ChangePasswordMachine } from '../machines'
import { ActionErrorState, ActionLoadingState, ActionSuccessState } from './types'
import { AuthActionErrorState, AuthActionLoadingState, AuthActionSuccessState } from './types'
export interface ChangePasswordState extends ChangePasswordHandlerResult, ActionLoadingState {}
export interface ChangePasswordState extends ChangePasswordHandlerResult, AuthActionLoadingState {}
export interface ChangePasswordHandlerResult extends ActionErrorState, ActionSuccessState {}
export interface ChangePasswordHandlerResult extends AuthActionErrorState, AuthActionSuccessState {}
export const changePasswordPromise = async (
interpreter: InterpreterFrom<ChangePasswordMachine>,

View File

@@ -2,9 +2,9 @@ import { InterpreterFrom } from 'xstate'
import { EnableMfadMachine } from '../machines'
import { ActionErrorState } from './types'
import { AuthActionErrorState } from './types'
export interface GenerateQrCodeHandlerResult extends ActionErrorState {
export interface GenerateQrCodeHandlerResult extends AuthActionErrorState {
qrCodeDataUrl: string
isGenerated: boolean
}
@@ -12,7 +12,7 @@ export interface GenerateQrCodeHandlerResult extends ActionErrorState {
export interface GenerateQrCodeState extends GenerateQrCodeHandlerResult {
isGenerating: boolean
}
export interface ActivateMfaHandlerResult extends ActionErrorState {
export interface ActivateMfaHandlerResult extends AuthActionErrorState {
isActivated: boolean
}

View File

@@ -3,14 +3,14 @@ import { InterpreterFrom } from 'xstate'
import { ResetPasswordMachine } from '../machines'
import { ResetPasswordOptions } from '../types'
import { ActionErrorState, ActionLoadingState } from './types'
import { AuthActionErrorState, AuthActionLoadingState } from './types'
export interface ResetPasswordHandlerResult extends ActionErrorState {
export interface ResetPasswordHandlerResult extends AuthActionErrorState {
/** Returns `true` when an email to reset the password has been sent */
isSent: boolean
}
export interface ResetPasswordState extends ResetPasswordHandlerResult, ActionLoadingState {}
export interface ResetPasswordState extends ResetPasswordHandlerResult, AuthActionLoadingState {}
export const resetPasswordPromise = async (
interpreter: InterpreterFrom<ResetPasswordMachine>,

View File

@@ -3,15 +3,15 @@ import { InterpreterFrom } from 'xstate'
import { SendVerificationEmailMachine } from '../machines'
import { SendVerificationEmailOptions } from '../types'
import { ActionErrorState, ActionLoadingState } from './types'
import { AuthActionErrorState, AuthActionLoadingState } from './types'
export interface SendVerificationEmailHandlerResult extends ActionErrorState {
export interface SendVerificationEmailHandlerResult extends AuthActionErrorState {
/** Returns `true` when a new verification email has been sent */
isSent: boolean
}
export interface SendVerificationEmailState
extends ActionLoadingState,
extends AuthActionLoadingState,
SendVerificationEmailHandlerResult {}
export const sendVerificationEmailPromise = (

View File

@@ -1,10 +1,12 @@
import { USER_ALREADY_SIGNED_IN } from '../errors'
import { AuthInterpreter } from '../machines'
import { ActionLoadingState, SessionActionHandlerResult } from './types'
import { AuthActionLoadingState, SessionActionHandlerResult } from './types'
export interface SignInAnonymousHandlerResult extends SessionActionHandlerResult {}
export interface SignInAnonymousState extends SignInAnonymousHandlerResult, ActionLoadingState {}
export interface SignInAnonymousState
extends SignInAnonymousHandlerResult,
AuthActionLoadingState {}
export const signInAnonymousPromise = (
interpreter: AuthInterpreter

View File

@@ -2,7 +2,7 @@ import { USER_ALREADY_SIGNED_IN } from '../errors'
import { AuthInterpreter } from '../machines'
import {
ActionLoadingState,
AuthActionLoadingState,
NeedsEmailVerificationState,
SessionActionHandlerResult
} from './types'
@@ -18,7 +18,7 @@ export interface SignInEmailPasswordHandlerResult
export interface SignInEmailPasswordState
extends SignInEmailPasswordHandlerResult,
ActionLoadingState {}
AuthActionLoadingState {}
export const signInEmailPasswordPromise = (
interpreter: AuthInterpreter,

View File

@@ -2,13 +2,13 @@ import { USER_ALREADY_SIGNED_IN } from '../errors'
import { AuthInterpreter } from '../machines'
import { PasswordlessOptions } from '../types'
import { ActionErrorState, ActionLoadingState, ActionSuccessState } from './types'
import { AuthActionErrorState, AuthActionLoadingState, AuthActionSuccessState } from './types'
export interface SignInEmailPasswordlessHandlerResult
extends ActionErrorState,
ActionSuccessState {}
extends AuthActionErrorState,
AuthActionSuccessState {}
export interface SignInEmailPasswordlessState
extends SignInEmailPasswordlessHandlerResult,
ActionLoadingState {}
AuthActionLoadingState {}
export const signInEmailPasswordlessPromise = (
interpreter: AuthInterpreter,

View File

@@ -2,7 +2,7 @@ import { USER_ALREADY_SIGNED_IN } from '../errors'
import { AuthInterpreter } from '../machines'
import {
ActionLoadingState,
AuthActionLoadingState,
NeedsEmailVerificationState,
SessionActionHandlerResult
} from './types'
@@ -13,7 +13,7 @@ export interface SignInSecurityKeyPasswordlessHandlerResult
export interface SignInSecurityKeyPasswordlessState
extends SignInSecurityKeyPasswordlessHandlerResult,
ActionLoadingState {}
AuthActionLoadingState {}
export const signInEmailSecurityKeyPromise = (interpreter: AuthInterpreter, email: string) =>
new Promise<SignInSecurityKeyPasswordlessHandlerResult>((resolve) => {

View File

@@ -1,11 +1,11 @@
import { USER_ALREADY_SIGNED_IN } from '../errors'
import { AuthInterpreter } from '../machines'
import { ActionLoadingState, SessionActionHandlerResult } from './types'
import { AuthActionLoadingState, SessionActionHandlerResult } from './types'
export interface SignInMfaTotpHandlerResult extends SessionActionHandlerResult {}
export interface SignInMfaTotpState extends SignInMfaTotpHandlerResult, ActionLoadingState {}
export interface SignInMfaTotpState extends SignInMfaTotpHandlerResult, AuthActionLoadingState {}
export const signInMfaTotpPromise = (interpreter: AuthInterpreter, otp: string, ticket?: string) =>
new Promise<SignInMfaTotpHandlerResult>((resolve) => {

View File

@@ -2,13 +2,15 @@ import { USER_ALREADY_SIGNED_IN } from '../errors'
import { AuthInterpreter } from '../machines'
import { PasswordlessOptions } from '../types'
import { ActionErrorState, ActionLoadingState, ActionSuccessState } from './types'
import { AuthActionErrorState, AuthActionLoadingState, AuthActionSuccessState } from './types'
export interface SignInSmsPasswordlessState
extends SignInSmsPasswordlessHandlerResult,
ActionLoadingState {}
AuthActionLoadingState {}
export interface SignInSmsPasswordlessHandlerResult extends ActionErrorState, ActionSuccessState {
export interface SignInSmsPasswordlessHandlerResult
extends AuthActionErrorState,
AuthActionSuccessState {
/**
* Returns true when the one-time password has been sent over by SMS, and the user needs to send it back to complete sign-in.
*/

View File

@@ -1,12 +1,12 @@
import { USER_ALREADY_SIGNED_IN } from '../errors'
import { AuthInterpreter } from '../machines'
import { ActionLoadingState, SessionActionHandlerResult } from './types'
import { AuthActionLoadingState, SessionActionHandlerResult } from './types'
export interface SignInSmsPasswordlessOtpHandlerResult extends SessionActionHandlerResult {}
export interface SignInSmsPasswordlessOtpState
extends SignInSmsPasswordlessOtpHandlerResult,
ActionLoadingState {}
AuthActionLoadingState {}
export const signInSmsPasswordlessOtpPromise = (
interpreter: AuthInterpreter,

View File

@@ -1,10 +1,10 @@
import { USER_UNAUTHENTICATED } from '../errors'
import { AuthInterpreter } from '../machines'
import { ActionErrorState, ActionLoadingState, ActionSuccessState } from './types'
import { AuthActionErrorState, AuthActionLoadingState, AuthActionSuccessState } from './types'
export interface SignOutlessHandlerResult extends ActionErrorState, ActionSuccessState {}
export interface SignOutlessState extends SignOutlessHandlerResult, ActionLoadingState {}
export interface SignOutlessHandlerResult extends AuthActionErrorState, AuthActionSuccessState {}
export interface SignOutlessState extends SignOutlessHandlerResult, AuthActionLoadingState {}
export const signOutPromise = async (
interpreter: AuthInterpreter,

View File

@@ -3,7 +3,7 @@ import { AuthInterpreter } from '../machines'
import { SignUpOptions } from '../types'
import {
ActionLoadingState,
AuthActionLoadingState,
NeedsEmailVerificationState,
SessionActionHandlerResult
} from './types'
@@ -14,7 +14,7 @@ export interface SignUpEmailPasswordHandlerResult
export interface SignUpEmailPasswordState
extends SignUpEmailPasswordHandlerResult,
ActionLoadingState {}
AuthActionLoadingState {}
export const signUpEmailPasswordPromise = (
interpreter: AuthInterpreter,

View File

@@ -3,7 +3,7 @@ import { AuthInterpreter } from '../machines'
import { SignUpSecurityKeyOptions } from '../types'
import {
ActionLoadingState,
AuthActionLoadingState,
NeedsEmailVerificationState,
SessionActionHandlerResult
} from './types'
@@ -14,7 +14,7 @@ export interface SignUpSecurityKeyHandlerResult
export interface SignUpSecurityKeyState
extends SignUpSecurityKeyHandlerResult,
ActionLoadingState {}
AuthActionLoadingState {}
export const signUpEmailSecurityKeyPromise = (
interpreter: AuthInterpreter,

View File

@@ -1,28 +1,28 @@
import { ErrorPayload, User } from '../types'
import { AuthErrorPayload, User } from '../types'
export interface ActionErrorState {
export interface AuthActionErrorState {
/**
* @return `true` if an error occurred
* @depreacted use `!isSuccess` or `!!error` instead
* */
isError: boolean
/** Provides details about the error */
error: ErrorPayload | null
error: AuthErrorPayload | null
}
export interface ActionLoadingState {
export interface AuthActionLoadingState {
/**
* @return `true` when the action is executing, `false` when it finished its execution.
*/
isLoading: boolean
}
export interface ActionSuccessState {
export interface AuthActionSuccessState {
/** Returns `true` if the action is successful. */
isSuccess: boolean
}
export interface SessionActionHandlerResult extends ActionSuccessState, ActionErrorState {
export interface SessionActionHandlerResult extends AuthActionSuccessState, AuthActionErrorState {
/** User information */
user: User | null
/** Access token (JWT) */

View File

@@ -1,5 +1,5 @@
// TODO shared with other packages
export type ErrorPayload = {
export type AuthErrorPayload = {
error: string
status: number
message: string

View File

@@ -1,13 +1,13 @@
import { ErrorPayload, NhostSession } from './common'
import { AuthErrorPayload, NhostSession } from './common'
// Hasura-auth API response types
export interface NullableErrorResponse {
error: ErrorPayload | null
error: AuthErrorPayload | null
}
/** session payload from common hasura-auth responses */
export type NhostSessionResponse =
| { session: null; error: ErrorPayload }
| { session: null; error: AuthErrorPayload }
| { session: NhostSession | null; error: null }
/** payload from hasura-auth endpoint /signin/email-password */
@@ -16,7 +16,7 @@ export interface SignInResponse {
mfa: {
ticket: string
} | null
error: ErrorPayload | null
error: AuthErrorPayload | null
}
/** payload from hasura-auth endpoint /signup/email-password */

View File

@@ -1,5 +1,21 @@
# @nhost/hasura-storage-js
## 2.1.0
### Minor Changes
- a0e093d7: fix(exports): don't use conflicting names in exports
### Patch Changes
- bb8803a1: fix(presigned-url): don't alter URL when no transformation params were provided
## 2.0.5
### Patch Changes
- 43c86fef: chore: improve presignedUrl test
## 2.0.4
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@nhost/hasura-storage-js",
"version": "2.0.4",
"version": "2.1.0",
"description": "Hasura-storage client",
"license": "MIT",
"keywords": [
@@ -41,7 +41,8 @@
},
"scripts": {
"dev": "vite build --config ../../config/vite.lib.dev.config.js",
"build": "run-p build:lib build:umd",
"build": "run-p typecheck build:lib build:umd",
"typecheck": "tsc --noEmit",
"build:lib": "vite build",
"build:umd": "vite build --config ../../config/vite.lib.umd.config.js",
"e2e": "start-test e2e:backend http-get://localhost:9695 ci:test",
@@ -66,6 +67,7 @@
},
"devDependencies": {
"@nhost/docgen": "workspace:*",
"@types/uuid": "^9.0.1",
"jpeg-js": "^0.4.4",
"pixelmatch": "^5.3.0",
"start-server-and-test": "^1.15.2",

View File

@@ -1,12 +1,12 @@
import FormData from 'form-data'
import { assign, createMachine } from 'xstate'
import { ErrorPayload, FileUploadConfig } from '../utils'
import { FileUploadConfig, StorageErrorPayload } from '../utils'
import { fetchUpload } from '../utils/upload'
export type FileUploadContext = {
progress: number | null
loaded: number
error: ErrorPayload | null
error: StorageErrorPayload | null
id?: string
bucketId?: string
file?: File
@@ -24,7 +24,7 @@ export type FileUploadEvents =
} & FileUploadConfig)
| { type: 'UPLOAD_PROGRESS'; progress: number; loaded: number; additions: number }
| { type: 'UPLOAD_DONE'; id: string; bucketId: string }
| { type: 'UPLOAD_ERROR'; error: ErrorPayload }
| { type: 'UPLOAD_ERROR'; error: StorageErrorPayload }
| { type: 'CANCEL' }
| { type: 'DESTROY' }

View File

@@ -1,7 +1,7 @@
import { InterpreterFrom } from 'xstate'
import { FileItemRef, FileUploadMachine } from '../machines'
import { ActionErrorState, FileUploadConfig, StorageUploadFileParams } from '../utils'
import { FileUploadConfig, StorageActionErrorState, StorageUploadFileParams } from '../utils'
export interface UploadProgressState {
/**
@@ -14,7 +14,7 @@ export interface UploadProgressState {
progress: number | null
}
export interface UploadFileHandlerResult extends ActionErrorState {
export interface UploadFileHandlerResult extends StorageActionErrorState {
/**
* Returns `true` when the file has been successfully uploaded.
*/

View File

@@ -3,7 +3,7 @@ import appendImageTransformationParameters from './appendImageTransformationPara
test('should append image transformation parameters to a simple URL', () => {
expect(
appendImageTransformationParameters('https://example.com/', {
appendImageTransformationParameters('https://example.com', {
width: 100,
height: 100,
blur: 50,
@@ -25,7 +25,7 @@ test('should append image transformation parameters to a URL with existing query
test('should not append falsy values', () => {
expect(
appendImageTransformationParameters('https://example.com/', {
appendImageTransformationParameters('https://example.com', {
width: undefined,
height: 100,
blur: undefined,
@@ -35,7 +35,9 @@ test('should not append falsy values', () => {
})
test('should keep the original URL if no transformation parameters are provided', () => {
expect(appendImageTransformationParameters('https://example.com/', {})).toBe(
'https://example.com/'
)
expect(appendImageTransformationParameters('https://example.com')).toBe('https://example.com')
expect(
appendImageTransformationParameters('https://example.com/?param1=test_data&param2=test_data')
).toBe('https://example.com/?param1=test_data&param2=test_data')
expect(appendImageTransformationParameters('https://example.com/')).toBe('https://example.com/')
})

View File

@@ -12,8 +12,12 @@ import { StorageImageTransformationParams } from '../types'
*/
export default function appendImageTransformationParameters(
url: string,
params: StorageImageTransformationParams
params?: StorageImageTransformationParams
): string {
if (!params || Object.keys(params).length === 0) {
return url
}
const urlObject = new URL(url)
// create an object with the transformation parameters by using the first

View File

@@ -1,21 +1,21 @@
import FormData from 'form-data'
// TODO shared with other packages
export type ErrorPayload = {
export type StorageErrorPayload = {
error: string
status: number
message: string
}
// TODO shared with other packages
export interface ActionErrorState {
export interface StorageActionErrorState {
/**
* @return `true` if an error occurred
* @depreacted use `!isSuccess` or `!!error` instead
* */
isError: boolean
/** Provides details about the error */
error: ErrorPayload | null
error: StorageErrorPayload | null
}
// * Avoid circular references and broken links in docusaurus generated docs
@@ -46,7 +46,7 @@ export type StorageUploadParams = StorageUploadFileParams | StorageUploadFormDat
export type StorageUploadResponse =
| { fileMetadata: FileResponse; error: null }
| { fileMetadata: null; error: ErrorPayload }
| { fileMetadata: null; error: StorageErrorPayload }
export interface StorageImageTransformationParams {
/** Image width, in pixels */

View File

@@ -1,6 +1,6 @@
import FormData from 'form-data'
import fetch from 'isomorphic-unfetch'
import { ErrorPayload, StorageUploadResponse } from './types'
import { StorageErrorPayload, StorageUploadResponse } from './types'
/** Convert any string into ISO-8859-1 */
export const toIso88591 = (fileName: string) => {
@@ -59,7 +59,7 @@ export const fetchUpload = async (
})
if (!response.ok) {
const error: ErrorPayload = {
const error: StorageErrorPayload = {
status: response.status,
message: await response.text(),
// * errors from hasura-storage are not codified
@@ -70,7 +70,7 @@ export const fetchUpload = async (
const fileMetadata = await response.json()
return { fileMetadata, error: null }
} catch (e) {
const error: ErrorPayload = {
const error: StorageErrorPayload = {
status: 0,
message: (e as Error).message,
error: (e as Error).message

View File

@@ -1,24 +1,27 @@
import fs from 'fs'
import { describe, expect, it } from 'vitest'
import { v4 as uuidv4 } from 'uuid'
import { storage } from './utils/helpers'
import FormData from 'form-data'
import fs from 'fs'
import fetch from 'isomorphic-unfetch'
import { v4 as uuidv4 } from 'uuid'
import { describe, expect, it } from 'vitest'
import { storage } from './utils/helpers'
describe('test get presigned url of file', () => {
it('should be able to get presigned url of file', async () => {
const fd = new FormData()
fd.append('file', fs.createReadStream('./tests/assets/sample.pdf'))
const formData = new FormData()
formData.append('file', fs.createReadStream('./tests/assets/sample.pdf'))
const { fileMetadata } = await storage.upload({
formData: fd
})
const { fileMetadata } = await storage.upload({ formData })
const { error } = await storage.getPresignedUrl({
const { presignedUrl, error } = await storage.getPresignedUrl({
fileId: fileMetadata?.id as string
})
expect(presignedUrl).not.toBeNull()
expect(error).toBeNull()
const imageResponse = await fetch(presignedUrl!.url)
expect(imageResponse.ok).toBeTruthy()
})
it('should fail to get presigned url of file that does not exist', async () => {

View File

@@ -1,5 +1,17 @@
# @nhost/nextjs
## 1.13.19
### Patch Changes
- @nhost/react@2.0.13
## 1.13.18
### Patch Changes
- @nhost/react@2.0.12
## 1.13.17
### Patch Changes

View File

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

View File

@@ -1,5 +1,25 @@
# @nhost/nhost-js
## 2.2.0
### Minor Changes
- a0e093d7: fix(exports): don't use conflicting names in exports
### Patch Changes
- Updated dependencies [bb8803a1]
- Updated dependencies [a0e093d7]
- @nhost/hasura-storage-js@2.1.0
- @nhost/hasura-auth-js@2.1.0
## 2.1.2
### Patch Changes
- Updated dependencies [43c86fef]
- @nhost/hasura-storage-js@2.0.5
## 2.1.1
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@nhost/nhost-js",
"version": "2.1.1",
"version": "2.2.0",
"description": "Nhost JavaScript SDK",
"license": "MIT",
"keywords": [
@@ -44,7 +44,8 @@
},
"scripts": {
"dev": "vite build --config ../../config/vite.lib.dev.config.js",
"build": "run-p build:lib build:umd",
"build": "run-p typecheck build:lib build:umd",
"typecheck": "tsc --noEmit",
"build:lib": "vite build",
"build:umd": "vite build --config ../../config/vite.lib.umd.config.js",
"test": "vitest run",

View File

@@ -1,10 +1,4 @@
export * from '@nhost/hasura-auth-js'
// ErrorPayload and ActionErrorState are two conflicting types, but these are
// the same in both packages, so this error is ignored for now.
// @ts-ignore
export * from '@nhost/hasura-storage-js'
export * from './clients'
// ErrorPayload is conflicting types, but it is the same in both packages,
// so this error is ignored for now.
// @ts-ignore
export * from './utils/types'

View File

@@ -1,11 +1,37 @@
import { NhostAuthConstructorParams } from '@nhost/hasura-auth-js'
// TODO shared with other packages
export type ErrorPayload = {
export interface ErrorPayload {
error: string
status: number
message: string
}
// TODO shared with other packages
export interface ActionErrorState {
/**
* @return `true` if an error occurred
* @depreacted use `!isSuccess` or `!!error` instead
* */
isError: boolean
/** Provides details about the error */
error: ErrorPayload | null
}
// TODO shared with other packages
export interface ActionLoadingState {
/**
* @return `true` when the action is executing, `false` when it finished its execution.
*/
isLoading: boolean
}
// TODO shared with other packages
export interface ActionSuccessState {
/** Returns `true` if the action is successful. */
isSuccess: boolean
}
export type BackendUrl = {
/**
* Nhost backend URL

View File

@@ -1,5 +1,18 @@
# @nhost/react
## 2.0.13
### Patch Changes
- Updated dependencies [a0e093d7]
- @nhost/nhost-js@2.2.0
## 2.0.12
### Patch Changes
- @nhost/nhost-js@2.1.2
## 2.0.11
### Patch Changes

View File

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

View File

@@ -7,7 +7,7 @@ import { useAuthenticationStatus } from '../useAuthenticationStatus'
*
* @example
* ```tsx
* import { NhostProvider, SignedOut } from "@nhost/react";
* import { NhostProvider, SignedIn } from "@nhost/react";
* import { nhost } from '@/utils/nhost';
*
* function Page() {

View File

@@ -1,5 +1,11 @@
# @nhost/sync-versions
## 0.0.7
### Patch Changes
- 4713cecf: chore(deps): bump `@pnpm/find-workspace-dir` to v6
## 0.0.6
### Patch Changes

View File

@@ -2,7 +2,7 @@
"name": "@nhost/sync-versions",
"description": "Sync the versions of Nhost services in each of the packages of a pnpm workspace",
"private": true,
"version": "0.0.6",
"version": "0.0.7",
"license": "MIT",
"main": "dist/index.cjs.js",
"types": "dist/index.d.ts",
@@ -33,7 +33,7 @@
"typescript": "^4.8.4"
},
"dependencies": {
"@pnpm/find-workspace-dir": "^5.0.0",
"@pnpm/find-workspace-dir": "^6.0.0",
"glob": "^9.0.0",
"object-path": "^0.11.8",
"yaml": "^2.1.1"

View File

@@ -1,5 +1,18 @@
# @nhost/vue
## 1.13.19
### Patch Changes
- Updated dependencies [a0e093d7]
- @nhost/nhost-js@2.2.0
## 1.13.18
### Patch Changes
- @nhost/nhost-js@2.1.2
## 1.13.17
### Patch Changes

View File

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

Some files were not shown because too many files have changed in this diff Show More