Compare commits
77 Commits
@nhost/rea
...
@nhost/das
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1ee0d332bf | ||
|
|
130ce49c76 | ||
|
|
6be6d6475a | ||
|
|
177b146b93 | ||
|
|
3cb673000a | ||
|
|
09cf5d4b39 | ||
|
|
48c0061a0b | ||
|
|
0795d1c6a1 | ||
|
|
45a23dd1bf | ||
|
|
bb8e3454df | ||
|
|
6a290bb297 | ||
|
|
80baec7356 | ||
|
|
8e43297564 | ||
|
|
bb8eb9e387 | ||
|
|
5b0dc6cb19 | ||
|
|
826112afd0 | ||
|
|
97105c390d | ||
|
|
8e3707ff2c | ||
|
|
7453bf3b6a | ||
|
|
bd739383d2 | ||
|
|
f75e2e41db | ||
|
|
7328491be0 | ||
|
|
11b4d12f12 | ||
|
|
6c24d56b1d | ||
|
|
0a523f4b45 | ||
|
|
12301e6551 | ||
|
|
8440d0389e | ||
|
|
c166dad0f8 | ||
|
|
e31d39b3d2 | ||
|
|
090f9cef86 | ||
|
|
74e52cac2d | ||
|
|
f17823760a | ||
|
|
bb8803a1e3 | ||
|
|
b846291331 | ||
|
|
2b2fb94f00 | ||
|
|
551760c4f0 | ||
|
|
5ae5a8e77d | ||
|
|
56aae0c964 | ||
|
|
a0e093d77b | ||
|
|
5e82e1b3da | ||
|
|
e618b705e7 | ||
|
|
a232c9f0f6 | ||
|
|
bf4644ea10 | ||
|
|
0aca907ea4 | ||
|
|
394f4c4174 | ||
|
|
8fef08a150 | ||
|
|
1bd2c37301 | ||
|
|
5cdb70bd81 | ||
|
|
1a5f80e1b6 | ||
|
|
59e0cb00c5 | ||
|
|
406b0f2cb7 | ||
|
|
d329b6218f | ||
|
|
335b58670e | ||
|
|
efa2d89067 | ||
|
|
77ce4bd738 | ||
|
|
017adea700 | ||
|
|
378284faa8 | ||
|
|
e5e2d114b1 | ||
|
|
5e3dbdeb7d | ||
|
|
98b777491a | ||
|
|
71de870cb0 | ||
|
|
74d4deba28 | ||
|
|
cb248f0d30 | ||
|
|
09e4f1eb34 | ||
|
|
6e1f03eaee | ||
|
|
867c807699 | ||
|
|
d0673d7825 | ||
|
|
106f23dcfa | ||
|
|
83ef755822 | ||
|
|
b7703ffd70 | ||
|
|
340ea5b115 | ||
|
|
776eca3fb5 | ||
|
|
ce4b655c55 | ||
|
|
dc57d31ec9 | ||
|
|
ea29fd6b73 | ||
|
|
d8e4073957 | ||
|
|
3f399a54a3 |
1
.github/workflows/ci.yaml
vendored
1
.github/workflows/ci.yaml
vendored
@@ -24,6 +24,7 @@ env:
|
|||||||
NHOST_TEST_PROJECT_NAME: ${{ vars.NHOST_TEST_PROJECT_NAME }}
|
NHOST_TEST_PROJECT_NAME: ${{ vars.NHOST_TEST_PROJECT_NAME }}
|
||||||
NHOST_TEST_USER_EMAIL: ${{ secrets.NHOST_TEST_USER_EMAIL }}
|
NHOST_TEST_USER_EMAIL: ${{ secrets.NHOST_TEST_USER_EMAIL }}
|
||||||
NHOST_TEST_USER_PASSWORD: ${{ secrets.NHOST_TEST_USER_PASSWORD }}
|
NHOST_TEST_USER_PASSWORD: ${{ secrets.NHOST_TEST_USER_PASSWORD }}
|
||||||
|
NHOST_TEST_PROJECT_ADMIN_SECRET: ${{ secrets.NHOST_TEST_PROJECT_ADMIN_SECRET }}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ module.exports = {
|
|||||||
'error',
|
'error',
|
||||||
{ allowArrowFunctions: true, allowFunctions: true },
|
{ allowArrowFunctions: true, allowFunctions: true },
|
||||||
],
|
],
|
||||||
|
'import/prefer-default-export': 'off',
|
||||||
'import/no-extraneous-dependencies': ['error', { devDependencies: true }],
|
'import/no-extraneous-dependencies': ['error', { devDependencies: true }],
|
||||||
curly: ['error', 'all'],
|
curly: ['error', 'all'],
|
||||||
'no-restricted-exports': 'off',
|
'no-restricted-exports': 'off',
|
||||||
|
|||||||
1
dashboard/.gitignore
vendored
1
dashboard/.gitignore
vendored
@@ -54,3 +54,4 @@ tailwind.json
|
|||||||
/playwright-report/
|
/playwright-report/
|
||||||
/playwright/.cache/
|
/playwright/.cache/
|
||||||
storageState.json
|
storageState.json
|
||||||
|
e2e/.auth/*
|
||||||
@@ -1,5 +1,34 @@
|
|||||||
# @nhost/dashboard
|
# @nhost/dashboard
|
||||||
|
|
||||||
|
## 0.14.2
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- 3cb67300: fix(logs): don't break UI when clearing time picker
|
||||||
|
- 7453bf3b: feat(projects): show project creator info
|
||||||
|
- c166dad0: chore(tests): improve auth page tests
|
||||||
|
- 6a290bb2: chore(deps): bump `@types/react` to 18.0.32
|
||||||
|
|
||||||
|
## 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
|
## 0.13.10
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ RUN apk add --no-cache libc6-compat
|
|||||||
RUN apk update
|
RUN apk update
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
RUN yarn global add turbo@1.8.3
|
RUN yarn global add turbo@1.8.6
|
||||||
COPY . .
|
COPY . .
|
||||||
RUN turbo prune --scope="@nhost/dashboard" --docker
|
RUN turbo prune --scope="@nhost/dashboard" --docker
|
||||||
|
|
||||||
|
|||||||
@@ -128,4 +128,5 @@ NHOST_TEST_USER_EMAIL=<test_user_email>
|
|||||||
NHOST_TEST_USER_PASSWORD=<test_user_password>
|
NHOST_TEST_USER_PASSWORD=<test_user_password>
|
||||||
NHOST_TEST_WORKSPACE_NAME=<test_workspace_name>
|
NHOST_TEST_WORKSPACE_NAME=<test_workspace_name>
|
||||||
NHOST_TEST_PROJECT_NAME=<test_project_name>
|
NHOST_TEST_PROJECT_NAME=<test_project_name>
|
||||||
|
NHOST_TEST_PROJECT_ADMIN_SECRET=<test_project_admin_secret>
|
||||||
```
|
```
|
||||||
|
|||||||
50
dashboard/e2e/auth/ban-user.test.ts
Normal file
50
dashboard/e2e/auth/ban-user.test.ts
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
import {
|
||||||
|
TEST_PROJECT_NAME,
|
||||||
|
TEST_PROJECT_SLUG,
|
||||||
|
TEST_WORKSPACE_SLUG,
|
||||||
|
} from '@/e2e/env';
|
||||||
|
import { createUser, generateTestEmail, openProject } from '@/e2e/utils';
|
||||||
|
import { faker } from '@faker-js/faker';
|
||||||
|
import test, { expect } from '@playwright/test';
|
||||||
|
|
||||||
|
test('should be able to ban and unban a user', async ({ page }) => {
|
||||||
|
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_WORKSPACE_SLUG}/${TEST_PROJECT_SLUG}/users`);
|
||||||
|
|
||||||
|
const email = generateTestEmail();
|
||||||
|
const password = faker.internet.password();
|
||||||
|
|
||||||
|
await createUser({ page, email, password });
|
||||||
|
|
||||||
|
await page
|
||||||
|
.getByRole('button', { name: `View ${email}`, exact: true })
|
||||||
|
.click();
|
||||||
|
await page.getByRole('button', { name: /actions/i }).click();
|
||||||
|
await page.getByRole('menuitem', { name: /ban user/i }).click();
|
||||||
|
|
||||||
|
await expect(
|
||||||
|
page.getByText(/user has been banned successfully./i),
|
||||||
|
).toBeVisible();
|
||||||
|
await expect(page.locator('form').getByText(/^banned$/i)).toBeVisible();
|
||||||
|
|
||||||
|
await page.getByRole('button', { name: /actions/i }).click();
|
||||||
|
await page.getByRole('menuitem', { name: /unban user/i }).click();
|
||||||
|
|
||||||
|
await expect(
|
||||||
|
page.getByText(/user has been unbanned successfully./i),
|
||||||
|
).toBeVisible();
|
||||||
|
await expect(page.locator('form').getByText(/^banned$/i)).not.toBeVisible();
|
||||||
|
});
|
||||||
65
dashboard/e2e/auth/create-user.test.ts
Normal file
65
dashboard/e2e/auth/create-user.test.ts
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
import {
|
||||||
|
TEST_PROJECT_NAME,
|
||||||
|
TEST_PROJECT_SLUG,
|
||||||
|
TEST_WORKSPACE_SLUG,
|
||||||
|
} from '@/e2e/env';
|
||||||
|
import { createUser, generateTestEmail, openProject } from '@/e2e/utils';
|
||||||
|
import { faker } from '@faker-js/faker';
|
||||||
|
import type { Page } from '@playwright/test';
|
||||||
|
import test, { expect } from '@playwright/test';
|
||||||
|
|
||||||
|
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: /auth/i })
|
||||||
|
.click();
|
||||||
|
|
||||||
|
await page.waitForURL(`/${TEST_WORKSPACE_SLUG}/${TEST_PROJECT_SLUG}/users`);
|
||||||
|
});
|
||||||
|
|
||||||
|
test.afterAll(async () => {
|
||||||
|
await page.close();
|
||||||
|
});
|
||||||
|
|
||||||
|
test('should create a user', async () => {
|
||||||
|
const email = generateTestEmail();
|
||||||
|
const password = faker.internet.password();
|
||||||
|
|
||||||
|
await createUser({ page, email, password });
|
||||||
|
|
||||||
|
await expect(
|
||||||
|
page.getByRole('button', { name: `View ${email}`, exact: true }),
|
||||||
|
).toBeVisible();
|
||||||
|
});
|
||||||
|
|
||||||
|
test('should not be able to create a user with an existing email', async () => {
|
||||||
|
const email = generateTestEmail();
|
||||||
|
const password = faker.internet.password();
|
||||||
|
|
||||||
|
await createUser({ page, email, password });
|
||||||
|
|
||||||
|
await expect(
|
||||||
|
page.getByRole('button', { name: `View ${email}`, exact: true }),
|
||||||
|
).toBeVisible();
|
||||||
|
|
||||||
|
await createUser({ page, email, password });
|
||||||
|
|
||||||
|
await expect(
|
||||||
|
page.getByRole('dialog').getByText(/email already in use/i),
|
||||||
|
).toBeVisible();
|
||||||
|
});
|
||||||
96
dashboard/e2e/auth/delete-user.test.ts
Normal file
96
dashboard/e2e/auth/delete-user.test.ts
Normal file
@@ -0,0 +1,96 @@
|
|||||||
|
import {
|
||||||
|
TEST_PROJECT_NAME,
|
||||||
|
TEST_PROJECT_SLUG,
|
||||||
|
TEST_WORKSPACE_SLUG,
|
||||||
|
} from '@/e2e/env';
|
||||||
|
import { createUser, generateTestEmail, openProject } from '@/e2e/utils';
|
||||||
|
import { faker } from '@faker-js/faker';
|
||||||
|
import type { Page } from '@playwright/test';
|
||||||
|
import test, { expect } from '@playwright/test';
|
||||||
|
|
||||||
|
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: /auth/i })
|
||||||
|
.click();
|
||||||
|
|
||||||
|
await page.waitForURL(`/${TEST_WORKSPACE_SLUG}/${TEST_PROJECT_SLUG}/users`);
|
||||||
|
});
|
||||||
|
|
||||||
|
test.afterAll(async () => {
|
||||||
|
await page.close();
|
||||||
|
});
|
||||||
|
|
||||||
|
test('should be able to delete a user', async () => {
|
||||||
|
const email = generateTestEmail();
|
||||||
|
const password = faker.internet.password();
|
||||||
|
|
||||||
|
await createUser({ page, email, password });
|
||||||
|
|
||||||
|
await expect(
|
||||||
|
page.getByRole('button', { name: `View ${email}`, exact: true }),
|
||||||
|
).toBeVisible();
|
||||||
|
|
||||||
|
await page
|
||||||
|
.getByRole('button', { name: `More options for ${email}`, exact: true })
|
||||||
|
.click();
|
||||||
|
await page.getByRole('menuitem', { name: /delete user/i }).click();
|
||||||
|
|
||||||
|
await expect(page.getByRole('dialog')).toBeVisible();
|
||||||
|
await expect(
|
||||||
|
page.getByRole('heading', { name: /delete user/i }),
|
||||||
|
).toBeVisible();
|
||||||
|
await expect(
|
||||||
|
page.getByText(`Are you sure you want to delete the "${email}" user?`),
|
||||||
|
).toBeVisible();
|
||||||
|
|
||||||
|
await page.getByRole('button', { name: /delete/i, exact: true }).click();
|
||||||
|
|
||||||
|
await expect(page.getByRole('dialog')).not.toBeVisible();
|
||||||
|
|
||||||
|
await expect(
|
||||||
|
page.getByRole('button', { name: `View ${email}`, exact: true }),
|
||||||
|
).not.toBeVisible();
|
||||||
|
});
|
||||||
|
|
||||||
|
test('should be able to delete a user from the details page', async () => {
|
||||||
|
const email = generateTestEmail();
|
||||||
|
const password = faker.internet.password();
|
||||||
|
|
||||||
|
await createUser({ page, email, password });
|
||||||
|
|
||||||
|
await page
|
||||||
|
.getByRole('button', { name: `View ${email}`, exact: true })
|
||||||
|
.click();
|
||||||
|
|
||||||
|
await page.getByRole('button', { name: /actions/i }).click();
|
||||||
|
await page.getByRole('menuitem', { name: /delete user/i }).click();
|
||||||
|
|
||||||
|
await expect(page.getByRole('dialog')).toBeVisible();
|
||||||
|
await expect(
|
||||||
|
page.getByRole('heading', { name: /delete user/i }),
|
||||||
|
).toBeVisible();
|
||||||
|
await expect(
|
||||||
|
page.getByText(`Are you sure you want to delete the "${email}" user?`),
|
||||||
|
).toBeVisible();
|
||||||
|
|
||||||
|
await page.getByRole('button', { name: /delete/i, exact: true }).click();
|
||||||
|
await expect(
|
||||||
|
page.getByRole('button', { name: `View ${email}`, exact: true }),
|
||||||
|
).not.toBeVisible();
|
||||||
|
});
|
||||||
@@ -1,93 +0,0 @@
|
|||||||
import {
|
|
||||||
TEST_PROJECT_NAME,
|
|
||||||
TEST_PROJECT_SLUG,
|
|
||||||
TEST_WORKSPACE_SLUG,
|
|
||||||
} from '@/e2e/env';
|
|
||||||
import { openProject } from '@/e2e/utils';
|
|
||||||
import type { Page } from '@playwright/test';
|
|
||||||
import { expect, test } from '@playwright/test';
|
|
||||||
|
|
||||||
let page: Page;
|
|
||||||
|
|
||||||
test.describe.configure({ mode: 'serial' });
|
|
||||||
|
|
||||||
test.beforeAll(async ({ browser }) => {
|
|
||||||
page = await browser.newPage();
|
|
||||||
|
|
||||||
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_WORKSPACE_SLUG}/${TEST_PROJECT_SLUG}/users`);
|
|
||||||
});
|
|
||||||
|
|
||||||
test.afterAll(async () => {
|
|
||||||
await page.close();
|
|
||||||
});
|
|
||||||
|
|
||||||
test('should create a user', async () => {
|
|
||||||
await expect(
|
|
||||||
page.getByRole('heading', { name: /there are no users yet/i }),
|
|
||||||
).toBeVisible();
|
|
||||||
|
|
||||||
await page
|
|
||||||
.getByRole('button', { name: /create user/i })
|
|
||||||
.first()
|
|
||||||
.click();
|
|
||||||
|
|
||||||
await expect(page.getByRole('dialog')).toBeVisible();
|
|
||||||
await expect(
|
|
||||||
page.getByRole('heading', { name: /create user/i }),
|
|
||||||
).toBeVisible();
|
|
||||||
|
|
||||||
await page
|
|
||||||
.getByRole('textbox', { name: /email/i })
|
|
||||||
.fill('testuser@example.com');
|
|
||||||
await page.getByRole('textbox', { name: /password/i }).fill('test.password');
|
|
||||||
await page.getByRole('button', { name: /create/i, exact: true }).click();
|
|
||||||
|
|
||||||
await expect(page.getByRole('dialog')).not.toBeVisible();
|
|
||||||
|
|
||||||
await expect(
|
|
||||||
page.getByRole('button', { name: /view testuser@example.com/i }),
|
|
||||||
).toBeVisible();
|
|
||||||
});
|
|
||||||
|
|
||||||
test('should delete a user', async () => {
|
|
||||||
await expect(
|
|
||||||
page.getByRole('button', { name: /view testuser@example.com/i }),
|
|
||||||
).toBeVisible();
|
|
||||||
|
|
||||||
await page
|
|
||||||
.getByRole('button', { name: /more options for testuser@example.com/i })
|
|
||||||
.click();
|
|
||||||
await page.getByRole('menuitem', { name: /delete user/i }).click();
|
|
||||||
|
|
||||||
await expect(page.getByRole('dialog')).toBeVisible();
|
|
||||||
await expect(
|
|
||||||
page.getByRole('heading', { name: /delete user/i }),
|
|
||||||
).toBeVisible();
|
|
||||||
await expect(
|
|
||||||
page.getByText(
|
|
||||||
/are you sure you want to delete the "testuser@example.com" user?/i,
|
|
||||||
),
|
|
||||||
).toBeVisible();
|
|
||||||
|
|
||||||
await page.getByRole('button', { name: /delete/i, exact: true }).click();
|
|
||||||
|
|
||||||
await expect(page.getByRole('dialog')).not.toBeVisible();
|
|
||||||
|
|
||||||
await expect(
|
|
||||||
page.getByRole('heading', { name: /there are no users yet/i }),
|
|
||||||
).toBeVisible();
|
|
||||||
});
|
|
||||||
103
dashboard/e2e/auth/verify-user.test.ts
Normal file
103
dashboard/e2e/auth/verify-user.test.ts
Normal file
@@ -0,0 +1,103 @@
|
|||||||
|
import {
|
||||||
|
TEST_PROJECT_NAME,
|
||||||
|
TEST_PROJECT_SLUG,
|
||||||
|
TEST_WORKSPACE_SLUG,
|
||||||
|
} from '@/e2e/env';
|
||||||
|
import { createUser, generateTestEmail, openProject } from '@/e2e/utils';
|
||||||
|
import { faker } from '@faker-js/faker';
|
||||||
|
import type { Page } from '@playwright/test';
|
||||||
|
import { expect, test } from '@playwright/test';
|
||||||
|
|
||||||
|
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: /auth/i })
|
||||||
|
.click();
|
||||||
|
|
||||||
|
await page.waitForURL(`/${TEST_WORKSPACE_SLUG}/${TEST_PROJECT_SLUG}/users`);
|
||||||
|
});
|
||||||
|
|
||||||
|
test.afterAll(async () => {
|
||||||
|
await page.close();
|
||||||
|
});
|
||||||
|
|
||||||
|
test('should be able to verify the email of a user', async () => {
|
||||||
|
const email = generateTestEmail();
|
||||||
|
const password = faker.internet.password();
|
||||||
|
|
||||||
|
await createUser({ page, email, password });
|
||||||
|
|
||||||
|
await page
|
||||||
|
.getByRole('button', { name: `View ${email}`, exact: true })
|
||||||
|
.click();
|
||||||
|
|
||||||
|
await expect(
|
||||||
|
page.getByRole('checkbox', { name: /email verified/i }),
|
||||||
|
).not.toBeChecked();
|
||||||
|
await page.getByRole('checkbox', { name: /email verified/i }).check();
|
||||||
|
|
||||||
|
await page.getByRole('button', { name: /save/i }).click();
|
||||||
|
|
||||||
|
await expect(
|
||||||
|
page.getByText(/user settings have been updated successfully./i),
|
||||||
|
).toBeVisible();
|
||||||
|
|
||||||
|
await page
|
||||||
|
.getByRole('button', { name: `View ${email}`, exact: true })
|
||||||
|
.click();
|
||||||
|
|
||||||
|
await expect(
|
||||||
|
page.getByRole('checkbox', { name: /email verified/i }),
|
||||||
|
).toBeChecked();
|
||||||
|
});
|
||||||
|
|
||||||
|
test('should be able to verify the phone number of a user', async () => {
|
||||||
|
const email = generateTestEmail();
|
||||||
|
const password = faker.internet.password();
|
||||||
|
const phoneNumber = faker.phone.number();
|
||||||
|
|
||||||
|
await createUser({ page, email, password });
|
||||||
|
|
||||||
|
await page
|
||||||
|
.getByRole('button', { name: `View ${email}`, exact: true })
|
||||||
|
.click();
|
||||||
|
|
||||||
|
await expect(
|
||||||
|
page.getByRole('checkbox', { name: /phone number verified/i }),
|
||||||
|
).toBeDisabled();
|
||||||
|
|
||||||
|
await page.getByRole('textbox', { name: /phone number/i }).fill(phoneNumber);
|
||||||
|
await page.getByRole('checkbox', { name: /phone number verified/i }).check();
|
||||||
|
await page.getByRole('button', { name: /save/i }).click();
|
||||||
|
|
||||||
|
await expect(
|
||||||
|
page.getByText(/user settings have been updated successfully./i),
|
||||||
|
).toBeVisible();
|
||||||
|
|
||||||
|
await page
|
||||||
|
.getByRole('button', { name: `View ${email}`, exact: true })
|
||||||
|
.click();
|
||||||
|
|
||||||
|
await expect(
|
||||||
|
page.getByRole('textbox', { name: /phone number/i }),
|
||||||
|
).toHaveValue(phoneNumber);
|
||||||
|
|
||||||
|
await expect(
|
||||||
|
page.getByRole('checkbox', { name: /phone number verified/i }),
|
||||||
|
).toBeChecked();
|
||||||
|
});
|
||||||
@@ -7,11 +7,15 @@ import { openProject, prepareTable } from '@/e2e/utils';
|
|||||||
import { faker } from '@faker-js/faker';
|
import { faker } from '@faker-js/faker';
|
||||||
import type { Page } from '@playwright/test';
|
import type { Page } from '@playwright/test';
|
||||||
import { expect, test } from '@playwright/test';
|
import { expect, test } from '@playwright/test';
|
||||||
|
import { snakeCase } from 'snake-case';
|
||||||
|
|
||||||
let page: Page;
|
let page: Page;
|
||||||
|
|
||||||
test.beforeAll(async ({ browser }) => {
|
test.beforeAll(async ({ browser }) => {
|
||||||
page = await browser.newPage();
|
page = await browser.newPage();
|
||||||
|
});
|
||||||
|
|
||||||
|
test.beforeEach(async () => {
|
||||||
await page.goto('/');
|
await page.goto('/');
|
||||||
|
|
||||||
await openProject({
|
await openProject({
|
||||||
@@ -35,7 +39,7 @@ test('should create a simple table', async () => {
|
|||||||
await page.getByRole('button', { name: /new table/i }).click();
|
await page.getByRole('button', { name: /new table/i }).click();
|
||||||
await expect(page.getByText(/create a new table/i)).toBeVisible();
|
await expect(page.getByText(/create a new table/i)).toBeVisible();
|
||||||
|
|
||||||
const tableName = faker.random.word().toLowerCase();
|
const tableName = snakeCase(faker.lorem.words(3));
|
||||||
|
|
||||||
await prepareTable({
|
await prepareTable({
|
||||||
page,
|
page,
|
||||||
@@ -63,7 +67,7 @@ test('should create a table with unique constraints', async () => {
|
|||||||
await page.getByRole('button', { name: /new table/i }).click();
|
await page.getByRole('button', { name: /new table/i }).click();
|
||||||
await expect(page.getByText(/create a new table/i)).toBeVisible();
|
await expect(page.getByText(/create a new table/i)).toBeVisible();
|
||||||
|
|
||||||
const tableName = faker.random.word().toLowerCase();
|
const tableName = snakeCase(faker.lorem.words(3));
|
||||||
|
|
||||||
await prepareTable({
|
await prepareTable({
|
||||||
page,
|
page,
|
||||||
@@ -92,7 +96,7 @@ test('should create a table with nullable columns', async () => {
|
|||||||
await page.getByRole('button', { name: /new table/i }).click();
|
await page.getByRole('button', { name: /new table/i }).click();
|
||||||
await expect(page.getByText(/create a new table/i)).toBeVisible();
|
await expect(page.getByText(/create a new table/i)).toBeVisible();
|
||||||
|
|
||||||
const tableName = faker.random.word().toLowerCase();
|
const tableName = snakeCase(faker.lorem.words(3));
|
||||||
|
|
||||||
await prepareTable({
|
await prepareTable({
|
||||||
page,
|
page,
|
||||||
@@ -121,7 +125,7 @@ test('should create a table with an identity column', async () => {
|
|||||||
await page.getByRole('button', { name: /new table/i }).click();
|
await page.getByRole('button', { name: /new table/i }).click();
|
||||||
await expect(page.getByText(/create a new table/i)).toBeVisible();
|
await expect(page.getByText(/create a new table/i)).toBeVisible();
|
||||||
|
|
||||||
const tableName = faker.random.word().toLowerCase();
|
const tableName = snakeCase(faker.lorem.words(3));
|
||||||
|
|
||||||
await prepareTable({
|
await prepareTable({
|
||||||
page,
|
page,
|
||||||
@@ -153,7 +157,7 @@ test('should create table with foreign key constraint', async () => {
|
|||||||
await page.getByRole('button', { name: /new table/i }).click();
|
await page.getByRole('button', { name: /new table/i }).click();
|
||||||
await expect(page.getByText(/create a new table/i)).toBeVisible();
|
await expect(page.getByText(/create a new table/i)).toBeVisible();
|
||||||
|
|
||||||
const firstTableName = faker.random.word().toLowerCase();
|
const firstTableName = snakeCase(faker.lorem.words(3));
|
||||||
|
|
||||||
await prepareTable({
|
await prepareTable({
|
||||||
page,
|
page,
|
||||||
@@ -175,7 +179,7 @@ test('should create table with foreign key constraint', async () => {
|
|||||||
await page.getByRole('button', { name: /new table/i }).click();
|
await page.getByRole('button', { name: /new table/i }).click();
|
||||||
await expect(page.getByText(/create a new table/i)).toBeVisible();
|
await expect(page.getByText(/create a new table/i)).toBeVisible();
|
||||||
|
|
||||||
const secondTableName = faker.random.word().toLowerCase();
|
const secondTableName = snakeCase(faker.lorem.words(3));
|
||||||
|
|
||||||
await prepareTable({
|
await prepareTable({
|
||||||
page,
|
page,
|
||||||
@@ -234,7 +238,7 @@ test('should not be able to create a table with a name that already exists', asy
|
|||||||
await page.getByRole('button', { name: /new table/i }).click();
|
await page.getByRole('button', { name: /new table/i }).click();
|
||||||
await expect(page.getByText(/create a new table/i)).toBeVisible();
|
await expect(page.getByText(/create a new table/i)).toBeVisible();
|
||||||
|
|
||||||
const tableName = faker.random.word().toLowerCase();
|
const tableName = snakeCase(faker.lorem.words(3));
|
||||||
|
|
||||||
await prepareTable({
|
await prepareTable({
|
||||||
page,
|
page,
|
||||||
|
|||||||
@@ -3,15 +3,19 @@ import {
|
|||||||
TEST_PROJECT_SLUG,
|
TEST_PROJECT_SLUG,
|
||||||
TEST_WORKSPACE_SLUG,
|
TEST_WORKSPACE_SLUG,
|
||||||
} from '@/e2e/env';
|
} from '@/e2e/env';
|
||||||
import { openProject, prepareTable } from '@/e2e/utils';
|
import { deleteTable, openProject, prepareTable } from '@/e2e/utils';
|
||||||
import { faker } from '@faker-js/faker';
|
import { faker } from '@faker-js/faker';
|
||||||
import type { Page } from '@playwright/test';
|
import type { Page } from '@playwright/test';
|
||||||
import { expect, test } from '@playwright/test';
|
import { expect, test } from '@playwright/test';
|
||||||
|
import { snakeCase } from 'snake-case';
|
||||||
|
|
||||||
let page: Page;
|
let page: Page;
|
||||||
|
|
||||||
test.beforeAll(async ({ browser }) => {
|
test.beforeAll(async ({ browser }) => {
|
||||||
page = await browser.newPage();
|
page = await browser.newPage();
|
||||||
|
});
|
||||||
|
|
||||||
|
test.beforeEach(async () => {
|
||||||
await page.goto('/');
|
await page.goto('/');
|
||||||
|
|
||||||
await openProject({
|
await openProject({
|
||||||
@@ -32,7 +36,7 @@ test.afterAll(async () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('should delete a table', async () => {
|
test('should delete a table', async () => {
|
||||||
const tableName = faker.random.word().toLowerCase();
|
const tableName = snakeCase(faker.lorem.words(3));
|
||||||
|
|
||||||
await page.getByRole('button', { name: /new table/i }).click();
|
await page.getByRole('button', { name: /new table/i }).click();
|
||||||
|
|
||||||
@@ -52,26 +56,11 @@ test('should delete a table', async () => {
|
|||||||
`/${TEST_WORKSPACE_SLUG}/${TEST_PROJECT_SLUG}/database/browser/default/public/${tableName}`,
|
`/${TEST_WORKSPACE_SLUG}/${TEST_PROJECT_SLUG}/database/browser/default/public/${tableName}`,
|
||||||
);
|
);
|
||||||
|
|
||||||
const tableLink = page.getByRole('link', {
|
await deleteTable({
|
||||||
|
page,
|
||||||
name: tableName,
|
name: tableName,
|
||||||
exact: true,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
await tableLink.hover();
|
|
||||||
await page
|
|
||||||
.getByRole('listitem')
|
|
||||||
.filter({ hasText: tableName })
|
|
||||||
.getByRole('button')
|
|
||||||
.click();
|
|
||||||
|
|
||||||
await page.getByRole('menuitem', { name: /delete table/i }).click();
|
|
||||||
|
|
||||||
await expect(
|
|
||||||
page.getByRole('heading', { name: /delete table/i }),
|
|
||||||
).toBeVisible();
|
|
||||||
|
|
||||||
await page.getByRole('button', { name: /delete/i }).click();
|
|
||||||
|
|
||||||
// navigate to next URL
|
// navigate to next URL
|
||||||
await page.waitForURL(
|
await page.waitForURL(
|
||||||
`/${TEST_WORKSPACE_SLUG}/${TEST_PROJECT_SLUG}/database/browser/default/public/**`,
|
`/${TEST_WORKSPACE_SLUG}/${TEST_PROJECT_SLUG}/database/browser/default/public/**`,
|
||||||
@@ -86,7 +75,7 @@ test('should not be able to delete a table if other tables have foreign keys ref
|
|||||||
await page.getByRole('button', { name: /new table/i }).click();
|
await page.getByRole('button', { name: /new table/i }).click();
|
||||||
await expect(page.getByText(/create a new table/i)).toBeVisible();
|
await expect(page.getByText(/create a new table/i)).toBeVisible();
|
||||||
|
|
||||||
const firstTableName = faker.random.word().toLowerCase();
|
const firstTableName = snakeCase(faker.lorem.words(3));
|
||||||
|
|
||||||
await prepareTable({
|
await prepareTable({
|
||||||
page,
|
page,
|
||||||
@@ -108,7 +97,7 @@ test('should not be able to delete a table if other tables have foreign keys ref
|
|||||||
await page.getByRole('button', { name: /new table/i }).click();
|
await page.getByRole('button', { name: /new table/i }).click();
|
||||||
await expect(page.getByText(/create a new table/i)).toBeVisible();
|
await expect(page.getByText(/create a new table/i)).toBeVisible();
|
||||||
|
|
||||||
const secondTableName = faker.random.word().toLowerCase();
|
const secondTableName = snakeCase(faker.lorem.words(3));
|
||||||
|
|
||||||
await prepareTable({
|
await prepareTable({
|
||||||
page,
|
page,
|
||||||
@@ -163,26 +152,11 @@ test('should not be able to delete a table if other tables have foreign keys ref
|
|||||||
).toBeVisible();
|
).toBeVisible();
|
||||||
|
|
||||||
// try to delete the first table that is referenced by the second table
|
// try to delete the first table that is referenced by the second table
|
||||||
const tableLink = page.getByRole('link', {
|
await deleteTable({
|
||||||
|
page,
|
||||||
name: firstTableName,
|
name: firstTableName,
|
||||||
exact: true,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
await tableLink.hover();
|
|
||||||
await page
|
|
||||||
.getByRole('listitem')
|
|
||||||
.filter({ hasText: firstTableName })
|
|
||||||
.getByRole('button')
|
|
||||||
.click();
|
|
||||||
|
|
||||||
await page.getByRole('menuitem', { name: /delete table/i }).click();
|
|
||||||
|
|
||||||
await expect(
|
|
||||||
page.getByRole('heading', { name: /delete table/i }),
|
|
||||||
).toBeVisible();
|
|
||||||
|
|
||||||
await page.getByRole('button', { name: /delete/i }).click();
|
|
||||||
|
|
||||||
await expect(
|
await expect(
|
||||||
page.getByText(
|
page.getByText(
|
||||||
/constraint [a-zA-Z_]+ on table [a-zA-Z_]+ depends on table [a-zA-Z_]+/i,
|
/constraint [a-zA-Z_]+ on table [a-zA-Z_]+ depends on table [a-zA-Z_]+/i,
|
||||||
|
|||||||
@@ -31,6 +31,12 @@ export const TEST_PROJECT_SLUG = slugify(TEST_PROJECT_NAME, {
|
|||||||
strict: true,
|
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.
|
* Email of the test account to use.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ test("should show the project's name, the Upgrade button and the Settings button
|
|||||||
await expect(
|
await expect(
|
||||||
page.getByRole('heading', { name: TEST_PROJECT_NAME }),
|
page.getByRole('heading', { name: TEST_PROJECT_NAME }),
|
||||||
).toBeVisible();
|
).toBeVisible();
|
||||||
await expect(page.getByText(/free plan/i)).toBeVisible();
|
await expect(page.getByText(/starter/i)).toBeVisible();
|
||||||
await expect(page.getByRole('button', { name: /upgrade/i })).toBeVisible();
|
await expect(page.getByRole('button', { name: /upgrade/i })).toBeVisible();
|
||||||
await expect(
|
await expect(
|
||||||
page.getByRole('main').getByRole('link', { name: /settings/i }),
|
page.getByRole('main').getByRole('link', { name: /settings/i }),
|
||||||
|
|||||||
20
dashboard/e2e/setup/auth.setup.ts
Normal file
20
dashboard/e2e/setup/auth.setup.ts
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
import {
|
||||||
|
TEST_DASHBOARD_URL,
|
||||||
|
TEST_USER_EMAIL,
|
||||||
|
TEST_USER_PASSWORD,
|
||||||
|
} from '@/e2e/env';
|
||||||
|
import { test as setup } from '@playwright/test';
|
||||||
|
|
||||||
|
setup('authenticate user', async ({ page }) => {
|
||||||
|
await page.goto('/');
|
||||||
|
await page.waitForURL('/signin');
|
||||||
|
await page.getByRole('link', { name: /continue with email/i }).click();
|
||||||
|
|
||||||
|
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();
|
||||||
|
|
||||||
|
await page.waitForURL(TEST_DASHBOARD_URL);
|
||||||
|
await page.context().storageState({ path: 'e2e/.auth/user.json' });
|
||||||
|
});
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { faker } from '@faker-js/faker';
|
||||||
import type { Page } from '@playwright/test';
|
import type { Page } from '@playwright/test';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -66,18 +67,25 @@ export async function prepareTable({
|
|||||||
|
|
||||||
// set type
|
// set type
|
||||||
await page
|
await page
|
||||||
|
.getByRole('table')
|
||||||
.getByRole('combobox', { name: /type/i })
|
.getByRole('combobox', { name: /type/i })
|
||||||
.nth(index)
|
.nth(index)
|
||||||
.fill(type);
|
.type(type);
|
||||||
await page.getByRole('option', { name: type }).first().click();
|
await page
|
||||||
|
.getByRole('table')
|
||||||
|
.getByRole('option', { name: type })
|
||||||
|
.first()
|
||||||
|
.click();
|
||||||
|
|
||||||
// optionally set default value
|
// optionally set default value
|
||||||
if (defaultValue) {
|
if (defaultValue) {
|
||||||
await page
|
await page
|
||||||
|
.getByRole('table')
|
||||||
.getByRole('combobox', { name: /default value/i })
|
.getByRole('combobox', { name: /default value/i })
|
||||||
.first()
|
.nth(index)
|
||||||
.fill(defaultValue);
|
.type(defaultValue);
|
||||||
await page
|
await page
|
||||||
|
.getByRole('table')
|
||||||
.getByRole('option', { name: defaultValue })
|
.getByRole('option', { name: defaultValue })
|
||||||
.first()
|
.first()
|
||||||
.click();
|
.click();
|
||||||
@@ -111,3 +119,71 @@ export async function prepareTable({
|
|||||||
await page.getByRole('button', { name: /primary key/i }).click();
|
await page.getByRole('button', { name: /primary key/i }).click();
|
||||||
await page.getByRole('option', { name: primaryKey, exact: true }).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();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new user.
|
||||||
|
*
|
||||||
|
* @param page - The Playwright page object.
|
||||||
|
* @param email - The email of the user to create.
|
||||||
|
* @param password - The password of the user to create.
|
||||||
|
* @returns A promise that resolves when the user is created.
|
||||||
|
*/
|
||||||
|
export async function createUser({
|
||||||
|
page,
|
||||||
|
email,
|
||||||
|
password,
|
||||||
|
}: {
|
||||||
|
page: Page;
|
||||||
|
email: string;
|
||||||
|
password: string;
|
||||||
|
}) {
|
||||||
|
await page
|
||||||
|
.getByRole('button', { name: /create user/i })
|
||||||
|
.first()
|
||||||
|
.click();
|
||||||
|
|
||||||
|
await page.getByRole('textbox', { name: /email/i }).fill(email);
|
||||||
|
await page.getByRole('textbox', { name: /password/i }).fill(password);
|
||||||
|
await page.getByRole('button', { name: /create/i, exact: true }).click();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generates a test email address with the given prefix (if provided).
|
||||||
|
*
|
||||||
|
* @param prefix - The prefix to use for the email address. (Default: `Nhost_Test_`)
|
||||||
|
*/
|
||||||
|
export function generateTestEmail(prefix: string = 'Nhost_Test_') {
|
||||||
|
const email = faker.internet.email();
|
||||||
|
|
||||||
|
return [prefix, email].join('');
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,27 +0,0 @@
|
|||||||
import { chromium } from '@playwright/test';
|
|
||||||
import {
|
|
||||||
TEST_DASHBOARD_URL,
|
|
||||||
TEST_USER_EMAIL,
|
|
||||||
TEST_USER_PASSWORD,
|
|
||||||
} from './e2e/env';
|
|
||||||
|
|
||||||
async function globalSetup() {
|
|
||||||
const browser = await chromium.launch();
|
|
||||||
const page = await browser.newPage();
|
|
||||||
|
|
||||||
await page.goto(TEST_DASHBOARD_URL);
|
|
||||||
await page.waitForURL(`${TEST_DASHBOARD_URL}/signin`);
|
|
||||||
await page.getByRole('link', { name: /continue with email/i }).click();
|
|
||||||
|
|
||||||
await page.waitForURL(`${TEST_DASHBOARD_URL}/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();
|
|
||||||
|
|
||||||
await page.waitForURL(TEST_DASHBOARD_URL);
|
|
||||||
await page.context().storageState({ path: 'storageState.json' });
|
|
||||||
|
|
||||||
await browser.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
export default globalSetup;
|
|
||||||
66
dashboard/global-teardown.ts
Normal file
66
dashboard/global-teardown.ts
Normal 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: 'e2e/.auth/user.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;
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@nhost/dashboard",
|
"name": "@nhost/dashboard",
|
||||||
"version": "0.13.10",
|
"version": "0.14.2",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"preinstall": "npx only-allow pnpm",
|
"preinstall": "npx only-allow pnpm",
|
||||||
@@ -106,7 +106,7 @@
|
|||||||
"@types/lodash.debounce": "^4.0.7",
|
"@types/lodash.debounce": "^4.0.7",
|
||||||
"@types/node": "^16.11.7",
|
"@types/node": "^16.11.7",
|
||||||
"@types/pluralize": "^0.0.29",
|
"@types/pluralize": "^0.0.29",
|
||||||
"@types/react": "18.0.28",
|
"@types/react": "18.0.32",
|
||||||
"@types/react-dom": "18.0.11",
|
"@types/react-dom": "18.0.11",
|
||||||
"@types/react-table": "^7.7.12",
|
"@types/react-table": "^7.7.12",
|
||||||
"@types/testing-library__jest-dom": "^5.14.5",
|
"@types/testing-library__jest-dom": "^5.14.5",
|
||||||
@@ -141,6 +141,7 @@
|
|||||||
"prettier-plugin-tailwindcss": "^0.2.0",
|
"prettier-plugin-tailwindcss": "^0.2.0",
|
||||||
"react-date-fns-hooks": "^0.9.4",
|
"react-date-fns-hooks": "^0.9.4",
|
||||||
"require-from-string": "^2.0.2",
|
"require-from-string": "^2.0.2",
|
||||||
|
"snake-case": "^3.0.4",
|
||||||
"storybook-addon-next-router": "^4.0.1",
|
"storybook-addon-next-router": "^4.0.1",
|
||||||
"tailwindcss": "^3.1.2",
|
"tailwindcss": "^3.1.2",
|
||||||
"ts-node": "^10.9.1",
|
"ts-node": "^10.9.1",
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import { defineConfig, devices } from '@playwright/test';
|
import { defineConfig, devices } from '@playwright/test';
|
||||||
|
|
||||||
import dotenv from 'dotenv';
|
import dotenv from 'dotenv';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
|
|
||||||
@@ -16,17 +15,24 @@ export default defineConfig({
|
|||||||
retries: process.env.CI ? 2 : 0,
|
retries: process.env.CI ? 2 : 0,
|
||||||
workers: process.env.CI ? 1 : undefined,
|
workers: process.env.CI ? 1 : undefined,
|
||||||
reporter: 'html',
|
reporter: 'html',
|
||||||
globalSetup: require.resolve('./global-setup'),
|
globalTeardown: require.resolve('./global-teardown'),
|
||||||
use: {
|
use: {
|
||||||
actionTimeout: 0,
|
actionTimeout: 0,
|
||||||
trace: 'on-first-retry',
|
trace: 'on-first-retry',
|
||||||
storageState: 'storageState.json',
|
|
||||||
baseURL: process.env.NHOST_TEST_DASHBOARD_URL,
|
baseURL: process.env.NHOST_TEST_DASHBOARD_URL,
|
||||||
},
|
},
|
||||||
projects: [
|
projects: [
|
||||||
|
{
|
||||||
|
name: 'setup',
|
||||||
|
testMatch: ['**/setup/*.setup.ts'],
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: 'chromium',
|
name: 'chromium',
|
||||||
use: { ...devices['Desktop Chrome'] },
|
use: {
|
||||||
|
...devices['Desktop Chrome'],
|
||||||
|
storageState: 'e2e/.auth/user.json',
|
||||||
|
},
|
||||||
|
dependencies: ['setup'],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|||||||
12
dashboard/public/assets/brands/azuread.svg
Normal file
12
dashboard/public/assets/brands/azuread.svg
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 16 KiB |
@@ -9,6 +9,7 @@ import { useGetAllUserWorkspacesAndApplications } from '@/hooks/useGetAllUserWor
|
|||||||
import { useNavigationVisible } from '@/hooks/useNavigationVisible';
|
import { useNavigationVisible } from '@/hooks/useNavigationVisible';
|
||||||
import useNotFoundRedirect from '@/hooks/useNotFoundRedirect';
|
import useNotFoundRedirect from '@/hooks/useNotFoundRedirect';
|
||||||
import { useSetAppWorkspaceContextFromUserContext } from '@/hooks/useSetAppWorkspaceContextFromUserContext';
|
import { useSetAppWorkspaceContextFromUserContext } from '@/hooks/useSetAppWorkspaceContextFromUserContext';
|
||||||
|
import { useCurrentWorkspaceAndProject } from '@/hooks/v2/useCurrentWorkspaceAndProject';
|
||||||
import type { BoxProps } from '@/ui/v2/Box';
|
import type { BoxProps } from '@/ui/v2/Box';
|
||||||
import Box from '@/ui/v2/Box';
|
import Box from '@/ui/v2/Box';
|
||||||
import { NextSeo } from 'next-seo';
|
import { NextSeo } from 'next-seo';
|
||||||
@@ -30,9 +31,15 @@ function ProjectLayoutContent({
|
|||||||
...mainContainerProps
|
...mainContainerProps
|
||||||
} = {},
|
} = {},
|
||||||
}: ProjectLayoutProps) {
|
}: ProjectLayoutProps) {
|
||||||
const { currentApplication, currentWorkspace } =
|
// TODO: This will be removed once we migrated every occurrence to
|
||||||
|
// useCurrentWorkspaceAndProject()
|
||||||
|
const { currentWorkspace, currentApplication } =
|
||||||
useCurrentWorkspaceAndApplication();
|
useCurrentWorkspaceAndApplication();
|
||||||
|
|
||||||
|
const { currentProject, loading, error } = useCurrentWorkspaceAndProject({
|
||||||
|
fetchPolicy: 'network-only',
|
||||||
|
});
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const shouldDisplayNav = useNavigationVisible();
|
const shouldDisplayNav = useNavigationVisible();
|
||||||
const isPlatform = useIsPlatform();
|
const isPlatform = useIsPlatform();
|
||||||
@@ -63,10 +70,14 @@ function ProjectLayoutContent({
|
|||||||
}
|
}
|
||||||
}, [isPlatform, isRestrictedPath, router]);
|
}, [isPlatform, isRestrictedPath, router]);
|
||||||
|
|
||||||
if (!currentWorkspace || !currentApplication || isRestrictedPath) {
|
if (!currentWorkspace || !currentApplication || isRestrictedPath || loading) {
|
||||||
return <LoadingScreen />;
|
return <LoadingScreen />;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (error) {
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
|
||||||
if (!isPlatform) {
|
if (!isPlatform) {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@@ -104,7 +115,7 @@ function ProjectLayoutContent({
|
|||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
|
|
||||||
<NextSeo title={currentApplication.name} />
|
<NextSeo title={currentProject.name} />
|
||||||
</Box>
|
</Box>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import { useDropdown } from '@/ui/v2/Dropdown';
|
|||||||
import type { InputProps } from '@/ui/v2/Input';
|
import type { InputProps } from '@/ui/v2/Input';
|
||||||
import Input from '@/ui/v2/Input';
|
import Input from '@/ui/v2/Input';
|
||||||
import { format, set } from 'date-fns';
|
import { format, set } from 'date-fns';
|
||||||
|
import type { ChangeEvent } from 'react';
|
||||||
|
|
||||||
export interface LogTimePickerProps extends InputProps {
|
export interface LogTimePickerProps extends InputProps {
|
||||||
/**
|
/**
|
||||||
@@ -22,21 +23,21 @@ function LogsTimePicker({
|
|||||||
}: any) {
|
}: any) {
|
||||||
const { handleClose } = useDropdown();
|
const { handleClose } = useDropdown();
|
||||||
|
|
||||||
const handleCancel = () => {
|
function handleCancel() {
|
||||||
handleClose();
|
handleClose();
|
||||||
};
|
}
|
||||||
|
|
||||||
const handleApply = () => {
|
function handleApply() {
|
||||||
onChange(selectedDate);
|
onChange(selectedDate);
|
||||||
handleClose();
|
handleClose();
|
||||||
};
|
}
|
||||||
|
|
||||||
const handleTimePicking = (event) => {
|
function handleChange(event: ChangeEvent<HTMLInputElement>) {
|
||||||
const [hours, minutes, seconds] = event.target.value.split(':');
|
const [hours, minutes, seconds] = event.target.value?.split(':') || [];
|
||||||
|
|
||||||
const hoursNumber = parseInt(hours, 10);
|
const hoursNumber = parseInt(hours || '0', 10);
|
||||||
const minutesNumber = parseInt(minutes, 10);
|
const minutesNumber = parseInt(minutes || '0', 10);
|
||||||
const secondsNumber = parseInt(seconds, 10);
|
const secondsNumber = parseInt(seconds || '0', 10);
|
||||||
|
|
||||||
const newDate = set(new Date(selectedDate), {
|
const newDate = set(new Date(selectedDate), {
|
||||||
hours: hoursNumber,
|
hours: hoursNumber,
|
||||||
@@ -51,7 +52,7 @@ function LogsTimePicker({
|
|||||||
}
|
}
|
||||||
|
|
||||||
setSelectedDate(newDate);
|
setSelectedDate(newDate);
|
||||||
};
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="mx-auto grid grid-flow-row items-center self-center">
|
<div className="mx-auto grid grid-flow-row items-center self-center">
|
||||||
@@ -64,7 +65,7 @@ function LogsTimePicker({
|
|||||||
formControl: { className: 'grid grid-flow-col gap-x-3' },
|
formControl: { className: 'grid grid-flow-col gap-x-3' },
|
||||||
label: { sx: { fontSize: '14px' } },
|
label: { sx: { fontSize: '14px' } },
|
||||||
}}
|
}}
|
||||||
onChange={handleTimePicking}
|
onChange={handleChange}
|
||||||
type="time"
|
type="time"
|
||||||
label="Select Time"
|
label="Select Time"
|
||||||
sx={{
|
sx={{
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import InfoCard from '@/components/overview/InfoCard';
|
import InfoCard from '@/components/overview/InfoCard';
|
||||||
import { useCurrentWorkspaceAndApplication } from '@/hooks/useCurrentWorkspaceAndApplication';
|
import { useCurrentWorkspaceAndProject } from '@/hooks/v2/useCurrentWorkspaceAndProject';
|
||||||
import Text from '@/ui/v2/Text';
|
import Text from '@/ui/v2/Text';
|
||||||
import Image from 'next/image';
|
import Image from 'next/image';
|
||||||
|
|
||||||
export default function OverviewProjectInfo() {
|
export default function OverviewProjectInfo() {
|
||||||
const { currentApplication } = useCurrentWorkspaceAndApplication();
|
const { currentProject } = useCurrentWorkspaceAndProject();
|
||||||
const { region, subdomain } = currentApplication || {};
|
const { region, subdomain } = currentProject || {};
|
||||||
const isRegionAvailable =
|
const isRegionAvailable =
|
||||||
region?.awsName && region?.countryCode && region?.city;
|
region?.awsName && region?.countryCode && region?.city;
|
||||||
|
|
||||||
@@ -13,14 +13,14 @@ export default function OverviewProjectInfo() {
|
|||||||
<div className="grid grid-flow-row content-start gap-6">
|
<div className="grid grid-flow-row content-start gap-6">
|
||||||
<Text variant="h3">Project Info</Text>
|
<Text variant="h3">Project Info</Text>
|
||||||
|
|
||||||
{currentApplication && (
|
{currentProject && (
|
||||||
<div className="grid grid-flow-row gap-3">
|
<div className="grid grid-flow-row gap-3">
|
||||||
<InfoCard
|
<InfoCard
|
||||||
title="Region"
|
title="Region"
|
||||||
value={region?.awsName}
|
value={region?.awsName}
|
||||||
customValue={
|
customValue={
|
||||||
region.countryCode &&
|
region?.countryCode &&
|
||||||
region.city && (
|
region?.city && (
|
||||||
<div className="grid grid-flow-col items-center gap-1 self-center">
|
<div className="grid grid-flow-col items-center gap-1 self-center">
|
||||||
<Image
|
<Image
|
||||||
src={`/assets/flags/${region.countryCode}.svg`}
|
src={`/assets/flags/${region.countryCode}.svg`}
|
||||||
@@ -29,7 +29,7 @@ export default function OverviewProjectInfo() {
|
|||||||
height={12}
|
height={12}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Text className="text-sm font-medium truncate">
|
<Text className="truncate text-sm font-medium">
|
||||||
{region.city} ({region.awsName})
|
{region.city} ({region.awsName})
|
||||||
</Text>
|
</Text>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -2,20 +2,19 @@ import { ChangePlanModal } from '@/components/applications/ChangePlanModal';
|
|||||||
import { useDialog } from '@/components/common/DialogProvider';
|
import { useDialog } from '@/components/common/DialogProvider';
|
||||||
import { useUI } from '@/context/UIContext';
|
import { useUI } from '@/context/UIContext';
|
||||||
import useIsPlatform from '@/hooks/common/useIsPlatform';
|
import useIsPlatform from '@/hooks/common/useIsPlatform';
|
||||||
import { useCurrentWorkspaceAndApplication } from '@/hooks/useCurrentWorkspaceAndApplication';
|
import { useCurrentWorkspaceAndProject } from '@/hooks/v2/useCurrentWorkspaceAndProject';
|
||||||
import Box from '@/ui/v2/Box';
|
|
||||||
import Button from '@/ui/v2/Button';
|
import Button from '@/ui/v2/Button';
|
||||||
import Chip from '@/ui/v2/Chip';
|
import Chip from '@/ui/v2/Chip';
|
||||||
import CogIcon from '@/ui/v2/icons/CogIcon';
|
import CogIcon from '@/ui/v2/icons/CogIcon';
|
||||||
import Text from '@/ui/v2/Text';
|
import Text from '@/ui/v2/Text';
|
||||||
|
import { formatDistanceToNowStrict, parseISO } from 'date-fns';
|
||||||
import Image from 'next/image';
|
import Image from 'next/image';
|
||||||
import Link from 'next/link';
|
import Link from 'next/link';
|
||||||
|
|
||||||
export default function OverviewTopBar() {
|
export default function OverviewTopBar() {
|
||||||
const isPlatform = useIsPlatform();
|
const isPlatform = useIsPlatform();
|
||||||
const { currentWorkspace, currentApplication } =
|
const { currentWorkspace, currentProject } = useCurrentWorkspaceAndProject();
|
||||||
useCurrentWorkspaceAndApplication();
|
const isPro = !currentProject?.plan?.isFree;
|
||||||
const isPro = !currentApplication?.plan?.isFree;
|
|
||||||
const { openAlertDialog } = useDialog();
|
const { openAlertDialog } = useDialog();
|
||||||
const { maintenanceActive } = useUI();
|
const { maintenanceActive } = useUI();
|
||||||
|
|
||||||
@@ -44,63 +43,92 @@ export default function OverviewTopBar() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="grid items-center gap-4 pb-5 md:grid-flow-col md:place-content-between md:py-5">
|
<div className="grid items-center gap-4 pb-5 md:grid-flow-col md:place-content-between md:py-5">
|
||||||
<div className="grid items-center gap-2 md:grid-flow-col">
|
<div className="grid items-center gap-4 md:grid-flow-col">
|
||||||
<div className="grid grid-flow-col items-center justify-start gap-2">
|
<div className="grid grid-flow-col items-center justify-start gap-2">
|
||||||
<div className="h-10 w-10 overflow-hidden rounded-lg">
|
<div className="h-10 w-10 overflow-hidden rounded-lg">
|
||||||
<Image
|
<Image
|
||||||
src="/logos/new.svg"
|
src="/logos/new.svg"
|
||||||
alt="Nhost Logo"
|
alt="Nhost Logo"
|
||||||
width={40}
|
width={56}
|
||||||
height={40}
|
height={56}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Text variant="h2" component="h1">
|
<div className="grid grid-flow-row">
|
||||||
{currentApplication.name}
|
<div className="grid grid-flow-row items-center justify-start md:grid-flow-col md:gap-3">
|
||||||
</Text>
|
<Text
|
||||||
</div>
|
variant="h2"
|
||||||
|
component="h1"
|
||||||
<Box className="grid grid-flow-col items-center justify-start gap-2">
|
className="grid grid-flow-col items-center gap-3"
|
||||||
{isPro ? (
|
|
||||||
<Chip
|
|
||||||
className="self-center font-medium"
|
|
||||||
size="small"
|
|
||||||
label="Pro Plan"
|
|
||||||
color="primary"
|
|
||||||
/>
|
|
||||||
) : (
|
|
||||||
<>
|
|
||||||
<Chip
|
|
||||||
className="self-center font-medium"
|
|
||||||
size="small"
|
|
||||||
label="Free Plan"
|
|
||||||
color="default"
|
|
||||||
variant="filled"
|
|
||||||
/>
|
|
||||||
<Button
|
|
||||||
variant="borderless"
|
|
||||||
className="mr-2"
|
|
||||||
onClick={() => {
|
|
||||||
openAlertDialog({
|
|
||||||
title: 'Upgrade your plan.',
|
|
||||||
payload: <ChangePlanModal />,
|
|
||||||
props: {
|
|
||||||
PaperProps: { className: 'p-0 max-w-xl w-full' },
|
|
||||||
hidePrimaryAction: true,
|
|
||||||
hideSecondaryAction: true,
|
|
||||||
hideTitle: true,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
Upgrade
|
{currentProject.name}
|
||||||
</Button>
|
</Text>
|
||||||
</>
|
|
||||||
)}
|
{currentProject.creator && (
|
||||||
</Box>
|
<Text
|
||||||
|
color="secondary"
|
||||||
|
variant="subtitle2"
|
||||||
|
className="md:hidden"
|
||||||
|
>
|
||||||
|
Created by{' '}
|
||||||
|
{currentProject.creator?.displayName ||
|
||||||
|
currentProject.creator?.email}{' '}
|
||||||
|
{formatDistanceToNowStrict(
|
||||||
|
parseISO(currentProject.createdAt),
|
||||||
|
)}{' '}
|
||||||
|
ago
|
||||||
|
</Text>
|
||||||
|
)}
|
||||||
|
|
||||||
|
<div className="mt-1 inline-grid grid-flow-col items-center justify-start gap-2 md:mt-0">
|
||||||
|
<Chip
|
||||||
|
size="small"
|
||||||
|
label={isPro ? 'Pro' : 'Starter'}
|
||||||
|
color={isPro ? 'primary' : 'default'}
|
||||||
|
/>
|
||||||
|
|
||||||
|
{!isPro && (
|
||||||
|
<Button
|
||||||
|
variant="borderless"
|
||||||
|
className="mr-2"
|
||||||
|
onClick={() => {
|
||||||
|
openAlertDialog({
|
||||||
|
title: 'Upgrade your plan.',
|
||||||
|
payload: <ChangePlanModal />,
|
||||||
|
props: {
|
||||||
|
PaperProps: { className: 'p-0 max-w-xl w-full' },
|
||||||
|
hidePrimaryAction: true,
|
||||||
|
hideSecondaryAction: true,
|
||||||
|
hideTitle: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Upgrade
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{currentProject.creator && (
|
||||||
|
<Text
|
||||||
|
color="secondary"
|
||||||
|
variant="subtitle2"
|
||||||
|
className="hidden md:block"
|
||||||
|
>
|
||||||
|
Created by{' '}
|
||||||
|
{currentProject.creator?.displayName ||
|
||||||
|
currentProject.creator?.email}{' '}
|
||||||
|
{formatDistanceToNowStrict(parseISO(currentProject.createdAt))}{' '}
|
||||||
|
ago
|
||||||
|
</Text>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Link
|
<Link
|
||||||
href={`/${currentWorkspace.slug}/${currentApplication.slug}/settings/general`}
|
href={`/${currentWorkspace.slug}/${currentProject.slug}/settings/general`}
|
||||||
passHref
|
passHref
|
||||||
>
|
>
|
||||||
<Button
|
<Button
|
||||||
|
|||||||
@@ -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>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
export { default } from './AzureADProviderSettings';
|
||||||
@@ -11,7 +11,7 @@ const StyledListItemText = styled(MaterialListItemText)(({ theme }) => ({
|
|||||||
display: 'grid',
|
display: 'grid',
|
||||||
justifyContent: 'start',
|
justifyContent: 'start',
|
||||||
gridAutoFlow: 'row',
|
gridAutoFlow: 'row',
|
||||||
gap: theme.spacing(0.5),
|
gap: theme.spacing(0.25),
|
||||||
fontSize: theme.typography.pxToRem(15),
|
fontSize: theme.typography.pxToRem(15),
|
||||||
[`&.${listItemTextClasses.root}`]: {
|
[`&.${listItemTextClasses.root}`]: {
|
||||||
margin: 0,
|
margin: 0,
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ export const validationSchema = Yup.object({
|
|||||||
.required('This field is required.'),
|
.required('This field is required.'),
|
||||||
password: Yup.string()
|
password: Yup.string()
|
||||||
.label('Users Password')
|
.label('Users Password')
|
||||||
.min(8, 'Password must be at least 8 characters long.')
|
|
||||||
.required('This field is required.'),
|
.required('This field is required.'),
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -99,7 +98,7 @@ export default function CreateUserForm({
|
|||||||
}),
|
}),
|
||||||
{
|
{
|
||||||
loading: 'Creating user...',
|
loading: 'Creating user...',
|
||||||
success: 'User created successfully.',
|
success: 'User has been created successfully.',
|
||||||
error: getServerError(
|
error: getServerError(
|
||||||
'An error occurred while trying to create the user.',
|
'An error occurred while trying to create the user.',
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import Option from '@/ui/v2/Option';
|
|||||||
import Text from '@/ui/v2/Text';
|
import Text from '@/ui/v2/Text';
|
||||||
import getReadableProviderName from '@/utils/common/getReadableProviderName';
|
import getReadableProviderName from '@/utils/common/getReadableProviderName';
|
||||||
import { copy } from '@/utils/copy';
|
import { copy } from '@/utils/copy';
|
||||||
|
import getServerError from '@/utils/settings/getServerError';
|
||||||
import getUserRoles from '@/utils/settings/getUserRoles';
|
import getUserRoles from '@/utils/settings/getUserRoles';
|
||||||
import { getToastStyleProps } from '@/utils/settings/settingsConstants';
|
import { getToastStyleProps } from '@/utils/settings/settingsConstants';
|
||||||
import {
|
import {
|
||||||
@@ -168,11 +169,13 @@ export default function EditUserForm({
|
|||||||
{
|
{
|
||||||
loading: shouldBan ? 'Banning user...' : 'Unbanning user...',
|
loading: shouldBan ? 'Banning user...' : 'Unbanning user...',
|
||||||
success: shouldBan
|
success: shouldBan
|
||||||
? 'User banned successfully'
|
? 'User has been banned successfully.'
|
||||||
: 'User unbanned successfully.',
|
: 'User has been unbanned successfully.',
|
||||||
error: shouldBan
|
error: getServerError(
|
||||||
? 'An error occurred while trying to ban the user.'
|
shouldBan
|
||||||
: 'An error occurred while trying to unban the user.',
|
? 'An error occurred while trying to ban the user.'
|
||||||
|
: 'An error occurred while trying to unban the user.',
|
||||||
|
),
|
||||||
},
|
},
|
||||||
getToastStyleProps(),
|
getToastStyleProps(),
|
||||||
);
|
);
|
||||||
@@ -213,7 +216,7 @@ export default function EditUserForm({
|
|||||||
Actions
|
Actions
|
||||||
</Button>
|
</Button>
|
||||||
</Dropdown.Trigger>
|
</Dropdown.Trigger>
|
||||||
<Dropdown.Content menu disablePortal className="h-full w-full">
|
<Dropdown.Content menu className="h-full w-full">
|
||||||
<Dropdown.Item
|
<Dropdown.Item
|
||||||
className="font-medium"
|
className="font-medium"
|
||||||
sx={{ color: 'error.main' }}
|
sx={{ color: 'error.main' }}
|
||||||
@@ -316,6 +319,7 @@ export default function EditUserForm({
|
|||||||
id="emailVerified"
|
id="emailVerified"
|
||||||
name="emailVerified"
|
name="emailVerified"
|
||||||
label="Verified"
|
label="Verified"
|
||||||
|
aria-label="Email Verified"
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -354,6 +358,7 @@ export default function EditUserForm({
|
|||||||
id="phoneNumberVerified"
|
id="phoneNumberVerified"
|
||||||
name="phoneNumberVerified"
|
name="phoneNumberVerified"
|
||||||
label="Verified"
|
label="Verified"
|
||||||
|
aria-label="Phone Number Verified"
|
||||||
disabled={!form.watch('phoneNumber')}
|
disabled={!form.watch('phoneNumber')}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -151,7 +151,7 @@ export default function UsersBody({ users, onSubmit }: UsersBodyProps) {
|
|||||||
updateUserMutationPromise,
|
updateUserMutationPromise,
|
||||||
{
|
{
|
||||||
loading: `Updating user's settings...`,
|
loading: `Updating user's settings...`,
|
||||||
success: 'User settings updated successfully.',
|
success: 'User settings have been updated successfully.',
|
||||||
error: getServerError(
|
error: getServerError(
|
||||||
`An error occurred while trying to update this user's settings.`,
|
`An error occurred while trying to update this user's settings.`,
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -1,21 +1,31 @@
|
|||||||
import { useCurrentWorkspaceAndApplication } from '@/hooks/useCurrentWorkspaceAndApplication';
|
import RetryableErrorBoundary from '@/components/common/RetryableErrorBoundary';
|
||||||
import Status, { StatusEnum } from '@/ui/Status';
|
import { useCurrentWorkspaceAndProject } from '@/hooks/v2/useCurrentWorkspaceAndProject';
|
||||||
|
import ActivityIndicator from '@/ui/v2/ActivityIndicator';
|
||||||
import Box from '@/ui/v2/Box';
|
import Box from '@/ui/v2/Box';
|
||||||
import Button from '@/ui/v2/Button';
|
import Button from '@/ui/v2/Button';
|
||||||
|
import Chip from '@/ui/v2/Chip';
|
||||||
import Divider from '@/ui/v2/Divider';
|
import Divider from '@/ui/v2/Divider';
|
||||||
import PlusCircleIcon from '@/ui/v2/icons/PlusCircleIcon';
|
import PlusCircleIcon from '@/ui/v2/icons/PlusCircleIcon';
|
||||||
import List from '@/ui/v2/List';
|
import List from '@/ui/v2/List';
|
||||||
import { ListItem } from '@/ui/v2/ListItem';
|
import { ListItem } from '@/ui/v2/ListItem';
|
||||||
import Text from '@/ui/v2/Text';
|
import Text from '@/ui/v2/Text';
|
||||||
|
import { formatDistanceToNowStrict, parseISO } from 'date-fns';
|
||||||
import Image from 'next/image';
|
import Image from 'next/image';
|
||||||
import NavLink from 'next/link';
|
import NavLink from 'next/link';
|
||||||
import { Fragment } from 'react';
|
import { Fragment } from 'react';
|
||||||
|
|
||||||
function AllWorkspaceApps() {
|
function AllWorkspaceApps() {
|
||||||
const { currentWorkspace } = useCurrentWorkspaceAndApplication();
|
const { currentWorkspace, loading, error } = useCurrentWorkspaceAndProject();
|
||||||
const noApplications = currentWorkspace?.applications.length === 0;
|
|
||||||
|
|
||||||
if (noApplications) {
|
if (loading) {
|
||||||
|
return <ActivityIndicator label="Loading projects..." delay={1000} />;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (error) {
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (currentWorkspace?.projects?.length === 0) {
|
||||||
return (
|
return (
|
||||||
<Box className="flex flex-row border-y py-4">
|
<Box className="flex flex-row border-y py-4">
|
||||||
<Text className="text-xs" color="secondary">
|
<Text className="text-xs" color="secondary">
|
||||||
@@ -29,25 +39,50 @@ function AllWorkspaceApps() {
|
|||||||
<List>
|
<List>
|
||||||
<Divider component="li" />
|
<Divider component="li" />
|
||||||
|
|
||||||
{currentWorkspace?.applications.map((app) => (
|
{currentWorkspace?.projects.map((project) => (
|
||||||
<Fragment key={app.id}>
|
<Fragment key={project.id}>
|
||||||
<ListItem.Root>
|
<ListItem.Root>
|
||||||
<NavLink href={`${currentWorkspace?.slug}/${app.slug}`} passHref>
|
<NavLink
|
||||||
<ListItem.Button className="grid grid-flow-col justify-between gap-2">
|
href={`${currentWorkspace?.slug}/${project.slug}`}
|
||||||
<div className="grid grid-flow-col items-center gap-2">
|
passHref
|
||||||
<div className="h-8 w-8 overflow-hidden rounded-lg">
|
>
|
||||||
<Image
|
<ListItem.Button className="grid grid-flow-col items-center justify-between gap-2">
|
||||||
src="/logos/new.svg"
|
<div className="grid grid-flow-col items-center justify-start gap-2">
|
||||||
alt="Nhost Logo"
|
<ListItem.Avatar>
|
||||||
width={32}
|
<div className="h-8 w-8 overflow-hidden rounded-lg">
|
||||||
height={32}
|
<Image
|
||||||
/>
|
src="/logos/new.svg"
|
||||||
</div>
|
alt="Nhost Logo"
|
||||||
|
width={32}
|
||||||
|
height={32}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</ListItem.Avatar>
|
||||||
|
|
||||||
<Text className="font-medium">{app.name}</Text>
|
<ListItem.Text
|
||||||
|
primary={project.name}
|
||||||
|
secondary={
|
||||||
|
project.creator ? (
|
||||||
|
<span>
|
||||||
|
{`Created by ${
|
||||||
|
project.creator.displayName || project.creator.email
|
||||||
|
} ${formatDistanceToNowStrict(
|
||||||
|
parseISO(project.createdAt),
|
||||||
|
)} ago`}
|
||||||
|
</span>
|
||||||
|
) : undefined
|
||||||
|
}
|
||||||
|
secondaryTypographyProps={{
|
||||||
|
className: 'text-xs',
|
||||||
|
}}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Status status={StatusEnum.Plan}>{app.plan.name}</Status>
|
<Chip
|
||||||
|
size="small"
|
||||||
|
label={project.plan.isFree ? 'Starter' : 'Pro'}
|
||||||
|
color={project.plan.isFree ? 'default' : 'primary'}
|
||||||
|
/>
|
||||||
</ListItem.Button>
|
</ListItem.Button>
|
||||||
</NavLink>
|
</NavLink>
|
||||||
</ListItem.Root>
|
</ListItem.Root>
|
||||||
@@ -59,30 +94,35 @@ function AllWorkspaceApps() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
export default function WorkspaceApps() {
|
export default function WorkspaceApps() {
|
||||||
const { currentWorkspace } = useCurrentWorkspaceAndApplication();
|
const { currentWorkspace, loading } = useCurrentWorkspaceAndProject();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="mt-9">
|
<div className="mt-9">
|
||||||
<div className="mx-auto max-w-3xl font-display">
|
<div className="mx-auto max-w-3xl font-display">
|
||||||
<div className="mb-4 flex flex-row place-content-between">
|
<div className="mb-4 grid grid-flow-col items-center justify-between gap-2">
|
||||||
<Text className="text-lg font-medium">Projects</Text>
|
<Text className="text-lg font-medium">Projects</Text>
|
||||||
<NavLink
|
|
||||||
href={{
|
{!loading && (
|
||||||
pathname: '/new',
|
<NavLink
|
||||||
query: { workspace: currentWorkspace.slug },
|
href={{
|
||||||
}}
|
pathname: '/new',
|
||||||
>
|
query: { workspace: currentWorkspace?.slug },
|
||||||
<Button
|
}}
|
||||||
variant="outlined"
|
|
||||||
color="secondary"
|
|
||||||
startIcon={<PlusCircleIcon />}
|
|
||||||
>
|
>
|
||||||
New Project
|
<Button
|
||||||
</Button>
|
variant="outlined"
|
||||||
</NavLink>
|
color="secondary"
|
||||||
|
startIcon={<PlusCircleIcon />}
|
||||||
|
>
|
||||||
|
New Project
|
||||||
|
</Button>
|
||||||
|
</NavLink>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<AllWorkspaceApps />
|
<RetryableErrorBoundary errorMessageProps={{ className: 'px-0' }}>
|
||||||
|
<AllWorkspaceApps />
|
||||||
|
</RetryableErrorBoundary>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
26
dashboard/src/gql/app/getWorkspaceAndProject.graphql
Normal file
26
dashboard/src/gql/app/getWorkspaceAndProject.graphql
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
fragment Workspace on workspaces {
|
||||||
|
id
|
||||||
|
name
|
||||||
|
slug
|
||||||
|
workspaceMembers {
|
||||||
|
id
|
||||||
|
user {
|
||||||
|
id
|
||||||
|
email
|
||||||
|
displayName
|
||||||
|
}
|
||||||
|
type
|
||||||
|
}
|
||||||
|
projects: apps {
|
||||||
|
...Project
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
query GetWorkspaceAndProject($workspaceSlug: String!, $projectSlug: String) {
|
||||||
|
workspaces(where: { slug: { _eq: $workspaceSlug } }) {
|
||||||
|
...Workspace
|
||||||
|
}
|
||||||
|
projects: apps(where: { slug: { _eq: $projectSlug } }) {
|
||||||
|
...Project
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -100,6 +100,12 @@ query GetSignInMethods($appId: uuid!) {
|
|||||||
connection
|
connection
|
||||||
organization
|
organization
|
||||||
}
|
}
|
||||||
|
azuread {
|
||||||
|
enabled
|
||||||
|
clientId
|
||||||
|
clientSecret
|
||||||
|
tenant
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
59
dashboard/src/gql/fragments/project.gql
Normal file
59
dashboard/src/gql/fragments/project.gql
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
fragment Project on apps {
|
||||||
|
id
|
||||||
|
slug
|
||||||
|
name
|
||||||
|
repositoryProductionBranch
|
||||||
|
subdomain
|
||||||
|
isProvisioned
|
||||||
|
createdAt
|
||||||
|
desiredState
|
||||||
|
nhostBaseFolder
|
||||||
|
providersUpdated
|
||||||
|
config(resolve: true) {
|
||||||
|
hasura {
|
||||||
|
adminSecret
|
||||||
|
}
|
||||||
|
}
|
||||||
|
featureFlags {
|
||||||
|
description
|
||||||
|
id
|
||||||
|
name
|
||||||
|
value
|
||||||
|
}
|
||||||
|
appStates(order_by: { createdAt: desc }, limit: 1) {
|
||||||
|
id
|
||||||
|
appId
|
||||||
|
message
|
||||||
|
stateId
|
||||||
|
createdAt
|
||||||
|
}
|
||||||
|
region {
|
||||||
|
id
|
||||||
|
countryCode
|
||||||
|
awsName
|
||||||
|
city
|
||||||
|
}
|
||||||
|
plan {
|
||||||
|
id
|
||||||
|
name
|
||||||
|
isFree
|
||||||
|
}
|
||||||
|
githubRepository {
|
||||||
|
fullName
|
||||||
|
}
|
||||||
|
deployments(limit: 4, order_by: { deploymentEndedAt: desc }) {
|
||||||
|
id
|
||||||
|
commitSHA
|
||||||
|
commitMessage
|
||||||
|
commitUserName
|
||||||
|
deploymentStartedAt
|
||||||
|
deploymentEndedAt
|
||||||
|
commitUserAvatarUrl
|
||||||
|
deploymentStatus
|
||||||
|
}
|
||||||
|
creator {
|
||||||
|
id
|
||||||
|
email
|
||||||
|
displayName
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,58 +1,3 @@
|
|||||||
fragment Project on apps {
|
|
||||||
id
|
|
||||||
slug
|
|
||||||
name
|
|
||||||
repositoryProductionBranch
|
|
||||||
subdomain
|
|
||||||
isProvisioned
|
|
||||||
createdAt
|
|
||||||
desiredState
|
|
||||||
nhostBaseFolder
|
|
||||||
providersUpdated
|
|
||||||
config(resolve: true) {
|
|
||||||
hasura {
|
|
||||||
adminSecret
|
|
||||||
}
|
|
||||||
}
|
|
||||||
featureFlags {
|
|
||||||
description
|
|
||||||
id
|
|
||||||
name
|
|
||||||
value
|
|
||||||
}
|
|
||||||
appStates(order_by: { createdAt: desc }, limit: 1) {
|
|
||||||
id
|
|
||||||
appId
|
|
||||||
message
|
|
||||||
stateId
|
|
||||||
createdAt
|
|
||||||
}
|
|
||||||
region {
|
|
||||||
id
|
|
||||||
countryCode
|
|
||||||
awsName
|
|
||||||
city
|
|
||||||
}
|
|
||||||
plan {
|
|
||||||
id
|
|
||||||
name
|
|
||||||
isFree
|
|
||||||
}
|
|
||||||
githubRepository {
|
|
||||||
fullName
|
|
||||||
}
|
|
||||||
deployments(limit: 4, order_by: { deploymentEndedAt: desc }) {
|
|
||||||
id
|
|
||||||
commitSHA
|
|
||||||
commitMessage
|
|
||||||
commitUserName
|
|
||||||
deploymentStartedAt
|
|
||||||
deploymentEndedAt
|
|
||||||
commitUserAvatarUrl
|
|
||||||
deploymentStatus
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
query getOneUser($userId: uuid!) {
|
query getOneUser($userId: uuid!) {
|
||||||
user(id: $userId) {
|
user(id: $userId) {
|
||||||
id
|
id
|
||||||
|
|||||||
@@ -39,6 +39,8 @@ export function useCheckProvisioning() {
|
|||||||
|
|
||||||
const memoizedUpdateCache = useCallback(updateOwnCache, [client]);
|
const memoizedUpdateCache = useCallback(updateOwnCache, [client]);
|
||||||
|
|
||||||
|
const currentApplicationId = currentApplication?.id;
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
startPolling(2000);
|
startPolling(2000);
|
||||||
}, [startPolling]);
|
}, [startPolling]);
|
||||||
@@ -84,7 +86,7 @@ export function useCheckProvisioning() {
|
|||||||
createdAt: data.app.appStates[0].createdAt,
|
createdAt: data.app.appStates[0].createdAt,
|
||||||
});
|
});
|
||||||
discordAnnounce(
|
discordAnnounce(
|
||||||
`Application ${currentApplication.id} errored after provisioning: ${data.app.appStates[0].message}`,
|
`Application ${currentApplicationId} errored after provisioning: ${data.app.appStates[0].message}`,
|
||||||
);
|
);
|
||||||
stopPolling();
|
stopPolling();
|
||||||
memoizedUpdateCache();
|
memoizedUpdateCache();
|
||||||
@@ -93,7 +95,7 @@ export function useCheckProvisioning() {
|
|||||||
data,
|
data,
|
||||||
stopPolling,
|
stopPolling,
|
||||||
memoizedUpdateCache,
|
memoizedUpdateCache,
|
||||||
currentApplication.id,
|
currentApplicationId,
|
||||||
currentApplicationState.state,
|
currentApplicationState.state,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
export { default as useCurrentWorkspaceAndProject } from './useCurrentWorkspaceAndProject';
|
||||||
@@ -0,0 +1,115 @@
|
|||||||
|
import useIsPlatform from '@/hooks/common/useIsPlatform';
|
||||||
|
import type { Project, Workspace } from '@/types/application';
|
||||||
|
import { ApplicationStatus } from '@/types/application';
|
||||||
|
import { getHasuraAdminSecret } from '@/utils/env';
|
||||||
|
import type { GetWorkspaceAndProjectQueryHookResult } from '@/utils/__generated__/graphql';
|
||||||
|
import { useGetWorkspaceAndProjectQuery } from '@/utils/__generated__/graphql';
|
||||||
|
import type { QueryHookOptions } from '@apollo/client';
|
||||||
|
import { useRouter } from 'next/router';
|
||||||
|
|
||||||
|
export interface UseCurrentWorkspaceAndProjectOptions {
|
||||||
|
/**
|
||||||
|
* The fetch policy to use.
|
||||||
|
*
|
||||||
|
* @default 'cache-first'
|
||||||
|
*/
|
||||||
|
fetchPolicy?: QueryHookOptions['fetchPolicy'];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface UseCurrentWorkspaceAndProjectReturnType {
|
||||||
|
/**
|
||||||
|
* The current workspace.
|
||||||
|
*/
|
||||||
|
currentWorkspace: Workspace;
|
||||||
|
/**
|
||||||
|
* The current project.
|
||||||
|
*/
|
||||||
|
currentProject: Project;
|
||||||
|
/**
|
||||||
|
* Whether the query is loading.
|
||||||
|
*/
|
||||||
|
loading?: GetWorkspaceAndProjectQueryHookResult['loading'];
|
||||||
|
/**
|
||||||
|
* The error if any.
|
||||||
|
*/
|
||||||
|
error?: GetWorkspaceAndProjectQueryHookResult['error'];
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function useCurrentWorkspaceAndProject(
|
||||||
|
options?: UseCurrentWorkspaceAndProjectOptions,
|
||||||
|
): UseCurrentWorkspaceAndProjectReturnType {
|
||||||
|
const isPlatform = useIsPlatform();
|
||||||
|
|
||||||
|
const {
|
||||||
|
query: { workspaceSlug, appSlug },
|
||||||
|
isReady,
|
||||||
|
} = useRouter();
|
||||||
|
|
||||||
|
const { data, loading, error } = useGetWorkspaceAndProjectQuery({
|
||||||
|
variables: {
|
||||||
|
workspaceSlug: (workspaceSlug as string) || '',
|
||||||
|
projectSlug: (appSlug as string) || '',
|
||||||
|
},
|
||||||
|
fetchPolicy: options?.fetchPolicy || 'cache-first',
|
||||||
|
skip: !isPlatform || !isReady || !workspaceSlug,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!isPlatform) {
|
||||||
|
const localProject: Project = {
|
||||||
|
id: 'local',
|
||||||
|
slug: 'local',
|
||||||
|
name: 'local',
|
||||||
|
appStates: [
|
||||||
|
{
|
||||||
|
id: 'local',
|
||||||
|
appId: 'local',
|
||||||
|
stateId: ApplicationStatus.Live,
|
||||||
|
createdAt: new Date().toISOString(),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
deployments: [],
|
||||||
|
subdomain: 'local',
|
||||||
|
region: {
|
||||||
|
id: null,
|
||||||
|
countryCode: null,
|
||||||
|
city: null,
|
||||||
|
awsName: null,
|
||||||
|
},
|
||||||
|
isProvisioned: true,
|
||||||
|
createdAt: new Date().toISOString(),
|
||||||
|
desiredState: ApplicationStatus.Live,
|
||||||
|
featureFlags: [],
|
||||||
|
providersUpdated: true,
|
||||||
|
repositoryProductionBranch: null,
|
||||||
|
nhostBaseFolder: null,
|
||||||
|
plan: null,
|
||||||
|
config: {
|
||||||
|
hasura: {
|
||||||
|
adminSecret: getHasuraAdminSecret(),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
return {
|
||||||
|
currentWorkspace: {
|
||||||
|
id: 'local',
|
||||||
|
slug: 'local',
|
||||||
|
name: 'local',
|
||||||
|
projects: [localProject],
|
||||||
|
workspaceMembers: [],
|
||||||
|
},
|
||||||
|
currentProject: localProject,
|
||||||
|
loading: false,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
const [currentWorkspace] = data?.workspaces || [];
|
||||||
|
const [currentProject] = data?.projects || [];
|
||||||
|
|
||||||
|
return {
|
||||||
|
currentWorkspace,
|
||||||
|
currentProject,
|
||||||
|
loading: data ? false : loading,
|
||||||
|
error,
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -16,9 +16,7 @@ export default function DataBrowserDatabaseDetailsPage() {
|
|||||||
description={
|
description={
|
||||||
<span>
|
<span>
|
||||||
Database{' '}
|
Database{' '}
|
||||||
<InlineCode className="bg-gray-200 bg-opacity-80 px-1.5 text-sm">
|
<InlineCode className="px-1.5 text-sm">{dataSourceSlug}</InlineCode>{' '}
|
||||||
{dataSourceSlug}
|
|
||||||
</InlineCode>{' '}
|
|
||||||
does not exist.
|
does not exist.
|
||||||
</span>
|
</span>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -134,9 +134,5 @@ export default function LogsPage() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
LogsPage.getLayout = function getLayout(page: ReactElement) {
|
LogsPage.getLayout = function getLayout(page: ReactElement) {
|
||||||
return (
|
return <ProjectLayout>{page}</ProjectLayout>;
|
||||||
<ProjectLayout mainContainerProps={{ className: 'bg-gray-50' }}>
|
|
||||||
{page}
|
|
||||||
</ProjectLayout>
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import Container from '@/components/layout/Container';
|
|||||||
import SettingsLayout from '@/components/settings/SettingsLayout';
|
import SettingsLayout from '@/components/settings/SettingsLayout';
|
||||||
import AnonymousSignInSettings from '@/components/settings/signInMethods/AnonymousSignInSettings';
|
import AnonymousSignInSettings from '@/components/settings/signInMethods/AnonymousSignInSettings';
|
||||||
import AppleProviderSettings from '@/components/settings/signInMethods/AppleProviderSettings';
|
import AppleProviderSettings from '@/components/settings/signInMethods/AppleProviderSettings';
|
||||||
|
import AzureADProviderSettings from '@/components/settings/signInMethods/AzureADProviderSettings';
|
||||||
import DiscordProviderSettings from '@/components/settings/signInMethods/DiscordProviderSettings';
|
import DiscordProviderSettings from '@/components/settings/signInMethods/DiscordProviderSettings';
|
||||||
import EmailAndPasswordSettings from '@/components/settings/signInMethods/EmailAndPasswordSettings';
|
import EmailAndPasswordSettings from '@/components/settings/signInMethods/EmailAndPasswordSettings';
|
||||||
import FacebookProviderSettings from '@/components/settings/signInMethods/FacebookProviderSettings';
|
import FacebookProviderSettings from '@/components/settings/signInMethods/FacebookProviderSettings';
|
||||||
@@ -56,6 +57,7 @@ export default function SettingsSignInMethodsPage() {
|
|||||||
<SMSSettings />
|
<SMSSettings />
|
||||||
{!currentApplication.providersUpdated && <ProvidersUpdatedAlert />}
|
{!currentApplication.providersUpdated && <ProvidersUpdatedAlert />}
|
||||||
<AppleProviderSettings />
|
<AppleProviderSettings />
|
||||||
|
<AzureADProviderSettings />
|
||||||
<DiscordProviderSettings />
|
<DiscordProviderSettings />
|
||||||
<FacebookProviderSettings />
|
<FacebookProviderSettings />
|
||||||
<GitHubProviderSettings />
|
<GitHubProviderSettings />
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import type {
|
|||||||
PermissionVariableFragment,
|
PermissionVariableFragment,
|
||||||
ProjectFragment,
|
ProjectFragment,
|
||||||
SecretFragment,
|
SecretFragment,
|
||||||
|
WorkspaceFragment,
|
||||||
} from '@/utils/__generated__/graphql';
|
} from '@/utils/__generated__/graphql';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -62,6 +63,7 @@ export type FeatureFlag = {
|
|||||||
value: string;
|
value: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type Workspace = WorkspaceFragment;
|
||||||
export type Project = ProjectFragment;
|
export type Project = ProjectFragment;
|
||||||
|
|
||||||
export interface PermissionVariable extends PermissionVariableFragment {
|
export interface PermissionVariable extends PermissionVariableFragment {
|
||||||
|
|||||||
376
dashboard/src/utils/__generated__/graphql.ts
generated
376
dashboard/src/utils/__generated__/graphql.ts
generated
@@ -25,7 +25,9 @@ export type Scalars = {
|
|||||||
bpchar: any;
|
bpchar: any;
|
||||||
bytea: any;
|
bytea: any;
|
||||||
citext: any;
|
citext: any;
|
||||||
|
float64: any;
|
||||||
jsonb: any;
|
jsonb: any;
|
||||||
|
labels: any;
|
||||||
smallint: any;
|
smallint: any;
|
||||||
timestamp: any;
|
timestamp: any;
|
||||||
timestamptz: any;
|
timestamptz: any;
|
||||||
@@ -1035,7 +1037,9 @@ export type ConfigGlobalUpdateInput = {
|
|||||||
export type ConfigHasura = {
|
export type ConfigHasura = {
|
||||||
__typename?: 'ConfigHasura';
|
__typename?: 'ConfigHasura';
|
||||||
adminSecret: Scalars['String'];
|
adminSecret: Scalars['String'];
|
||||||
|
events?: Maybe<ConfigHasuraEvents>;
|
||||||
jwtSecrets?: Maybe<Array<ConfigJwtSecret>>;
|
jwtSecrets?: Maybe<Array<ConfigJwtSecret>>;
|
||||||
|
logs?: Maybe<ConfigHasuraLogs>;
|
||||||
resources?: Maybe<ConfigResources>;
|
resources?: Maybe<ConfigResources>;
|
||||||
settings?: Maybe<ConfigHasuraSettings>;
|
settings?: Maybe<ConfigHasuraSettings>;
|
||||||
version?: Maybe<Scalars['String']>;
|
version?: Maybe<Scalars['String']>;
|
||||||
@@ -1047,22 +1051,66 @@ export type ConfigHasuraComparisonExp = {
|
|||||||
_not?: InputMaybe<ConfigHasuraComparisonExp>;
|
_not?: InputMaybe<ConfigHasuraComparisonExp>;
|
||||||
_or?: InputMaybe<Array<ConfigHasuraComparisonExp>>;
|
_or?: InputMaybe<Array<ConfigHasuraComparisonExp>>;
|
||||||
adminSecret?: InputMaybe<ConfigStringComparisonExp>;
|
adminSecret?: InputMaybe<ConfigStringComparisonExp>;
|
||||||
|
events?: InputMaybe<ConfigHasuraEventsComparisonExp>;
|
||||||
jwtSecrets?: InputMaybe<ConfigJwtSecretComparisonExp>;
|
jwtSecrets?: InputMaybe<ConfigJwtSecretComparisonExp>;
|
||||||
|
logs?: InputMaybe<ConfigHasuraLogsComparisonExp>;
|
||||||
resources?: InputMaybe<ConfigResourcesComparisonExp>;
|
resources?: InputMaybe<ConfigResourcesComparisonExp>;
|
||||||
settings?: InputMaybe<ConfigHasuraSettingsComparisonExp>;
|
settings?: InputMaybe<ConfigHasuraSettingsComparisonExp>;
|
||||||
version?: InputMaybe<ConfigStringComparisonExp>;
|
version?: InputMaybe<ConfigStringComparisonExp>;
|
||||||
webhookSecret?: 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 = {
|
export type ConfigHasuraInsertInput = {
|
||||||
adminSecret: Scalars['String'];
|
adminSecret: Scalars['String'];
|
||||||
|
events?: InputMaybe<ConfigHasuraEventsInsertInput>;
|
||||||
jwtSecrets?: InputMaybe<Array<ConfigJwtSecretInsertInput>>;
|
jwtSecrets?: InputMaybe<Array<ConfigJwtSecretInsertInput>>;
|
||||||
|
logs?: InputMaybe<ConfigHasuraLogsInsertInput>;
|
||||||
resources?: InputMaybe<ConfigResourcesInsertInput>;
|
resources?: InputMaybe<ConfigResourcesInsertInput>;
|
||||||
settings?: InputMaybe<ConfigHasuraSettingsInsertInput>;
|
settings?: InputMaybe<ConfigHasuraSettingsInsertInput>;
|
||||||
version?: InputMaybe<Scalars['String']>;
|
version?: InputMaybe<Scalars['String']>;
|
||||||
webhookSecret: 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 = {
|
export type ConfigHasuraSettings = {
|
||||||
__typename?: 'ConfigHasuraSettings';
|
__typename?: 'ConfigHasuraSettings';
|
||||||
enableRemoteSchemaPermissions?: Maybe<Scalars['Boolean']>;
|
enableRemoteSchemaPermissions?: Maybe<Scalars['Boolean']>;
|
||||||
@@ -1085,7 +1133,9 @@ export type ConfigHasuraSettingsUpdateInput = {
|
|||||||
|
|
||||||
export type ConfigHasuraUpdateInput = {
|
export type ConfigHasuraUpdateInput = {
|
||||||
adminSecret?: InputMaybe<Scalars['String']>;
|
adminSecret?: InputMaybe<Scalars['String']>;
|
||||||
|
events?: InputMaybe<ConfigHasuraEventsUpdateInput>;
|
||||||
jwtSecrets?: InputMaybe<Array<ConfigJwtSecretUpdateInput>>;
|
jwtSecrets?: InputMaybe<Array<ConfigJwtSecretUpdateInput>>;
|
||||||
|
logs?: InputMaybe<ConfigHasuraLogsUpdateInput>;
|
||||||
resources?: InputMaybe<ConfigResourcesUpdateInput>;
|
resources?: InputMaybe<ConfigResourcesUpdateInput>;
|
||||||
settings?: InputMaybe<ConfigHasuraSettingsUpdateInput>;
|
settings?: InputMaybe<ConfigHasuraSettingsUpdateInput>;
|
||||||
version?: InputMaybe<Scalars['String']>;
|
version?: InputMaybe<Scalars['String']>;
|
||||||
@@ -1639,6 +1689,24 @@ export type Log = {
|
|||||||
timestamp: Scalars['Timestamp'];
|
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'. */
|
/** Boolean expression to compare columns of type "String". All fields are combined with logical 'AND'. */
|
||||||
export type String_Comparison_Exp = {
|
export type String_Comparison_Exp = {
|
||||||
_eq?: InputMaybe<Scalars['String']>;
|
_eq?: InputMaybe<Scalars['String']>;
|
||||||
@@ -4878,6 +4946,7 @@ export type Backups = {
|
|||||||
appId: Scalars['uuid'];
|
appId: Scalars['uuid'];
|
||||||
completedAt?: Maybe<Scalars['timestamptz']>;
|
completedAt?: Maybe<Scalars['timestamptz']>;
|
||||||
createdAt: Scalars['timestamptz'];
|
createdAt: Scalars['timestamptz'];
|
||||||
|
expiresAt?: Maybe<Scalars['timestamptz']>;
|
||||||
id: Scalars['uuid'];
|
id: Scalars['uuid'];
|
||||||
size: Scalars['bigint'];
|
size: Scalars['bigint'];
|
||||||
};
|
};
|
||||||
@@ -4965,6 +5034,7 @@ export type Backups_Bool_Exp = {
|
|||||||
appId?: InputMaybe<Uuid_Comparison_Exp>;
|
appId?: InputMaybe<Uuid_Comparison_Exp>;
|
||||||
completedAt?: InputMaybe<Timestamptz_Comparison_Exp>;
|
completedAt?: InputMaybe<Timestamptz_Comparison_Exp>;
|
||||||
createdAt?: InputMaybe<Timestamptz_Comparison_Exp>;
|
createdAt?: InputMaybe<Timestamptz_Comparison_Exp>;
|
||||||
|
expiresAt?: InputMaybe<Timestamptz_Comparison_Exp>;
|
||||||
id?: InputMaybe<Uuid_Comparison_Exp>;
|
id?: InputMaybe<Uuid_Comparison_Exp>;
|
||||||
size?: InputMaybe<Bigint_Comparison_Exp>;
|
size?: InputMaybe<Bigint_Comparison_Exp>;
|
||||||
};
|
};
|
||||||
@@ -4986,6 +5056,7 @@ export type Backups_Insert_Input = {
|
|||||||
appId?: InputMaybe<Scalars['uuid']>;
|
appId?: InputMaybe<Scalars['uuid']>;
|
||||||
completedAt?: InputMaybe<Scalars['timestamptz']>;
|
completedAt?: InputMaybe<Scalars['timestamptz']>;
|
||||||
createdAt?: InputMaybe<Scalars['timestamptz']>;
|
createdAt?: InputMaybe<Scalars['timestamptz']>;
|
||||||
|
expiresAt?: InputMaybe<Scalars['timestamptz']>;
|
||||||
id?: InputMaybe<Scalars['uuid']>;
|
id?: InputMaybe<Scalars['uuid']>;
|
||||||
size?: InputMaybe<Scalars['bigint']>;
|
size?: InputMaybe<Scalars['bigint']>;
|
||||||
};
|
};
|
||||||
@@ -4996,6 +5067,7 @@ export type Backups_Max_Fields = {
|
|||||||
appId?: Maybe<Scalars['uuid']>;
|
appId?: Maybe<Scalars['uuid']>;
|
||||||
completedAt?: Maybe<Scalars['timestamptz']>;
|
completedAt?: Maybe<Scalars['timestamptz']>;
|
||||||
createdAt?: Maybe<Scalars['timestamptz']>;
|
createdAt?: Maybe<Scalars['timestamptz']>;
|
||||||
|
expiresAt?: Maybe<Scalars['timestamptz']>;
|
||||||
id?: Maybe<Scalars['uuid']>;
|
id?: Maybe<Scalars['uuid']>;
|
||||||
size?: Maybe<Scalars['bigint']>;
|
size?: Maybe<Scalars['bigint']>;
|
||||||
};
|
};
|
||||||
@@ -5005,6 +5077,7 @@ export type Backups_Max_Order_By = {
|
|||||||
appId?: InputMaybe<Order_By>;
|
appId?: InputMaybe<Order_By>;
|
||||||
completedAt?: InputMaybe<Order_By>;
|
completedAt?: InputMaybe<Order_By>;
|
||||||
createdAt?: InputMaybe<Order_By>;
|
createdAt?: InputMaybe<Order_By>;
|
||||||
|
expiresAt?: InputMaybe<Order_By>;
|
||||||
id?: InputMaybe<Order_By>;
|
id?: InputMaybe<Order_By>;
|
||||||
size?: InputMaybe<Order_By>;
|
size?: InputMaybe<Order_By>;
|
||||||
};
|
};
|
||||||
@@ -5015,6 +5088,7 @@ export type Backups_Min_Fields = {
|
|||||||
appId?: Maybe<Scalars['uuid']>;
|
appId?: Maybe<Scalars['uuid']>;
|
||||||
completedAt?: Maybe<Scalars['timestamptz']>;
|
completedAt?: Maybe<Scalars['timestamptz']>;
|
||||||
createdAt?: Maybe<Scalars['timestamptz']>;
|
createdAt?: Maybe<Scalars['timestamptz']>;
|
||||||
|
expiresAt?: Maybe<Scalars['timestamptz']>;
|
||||||
id?: Maybe<Scalars['uuid']>;
|
id?: Maybe<Scalars['uuid']>;
|
||||||
size?: Maybe<Scalars['bigint']>;
|
size?: Maybe<Scalars['bigint']>;
|
||||||
};
|
};
|
||||||
@@ -5024,6 +5098,7 @@ export type Backups_Min_Order_By = {
|
|||||||
appId?: InputMaybe<Order_By>;
|
appId?: InputMaybe<Order_By>;
|
||||||
completedAt?: InputMaybe<Order_By>;
|
completedAt?: InputMaybe<Order_By>;
|
||||||
createdAt?: InputMaybe<Order_By>;
|
createdAt?: InputMaybe<Order_By>;
|
||||||
|
expiresAt?: InputMaybe<Order_By>;
|
||||||
id?: InputMaybe<Order_By>;
|
id?: InputMaybe<Order_By>;
|
||||||
size?: InputMaybe<Order_By>;
|
size?: InputMaybe<Order_By>;
|
||||||
};
|
};
|
||||||
@@ -5050,6 +5125,7 @@ export type Backups_Order_By = {
|
|||||||
appId?: InputMaybe<Order_By>;
|
appId?: InputMaybe<Order_By>;
|
||||||
completedAt?: InputMaybe<Order_By>;
|
completedAt?: InputMaybe<Order_By>;
|
||||||
createdAt?: InputMaybe<Order_By>;
|
createdAt?: InputMaybe<Order_By>;
|
||||||
|
expiresAt?: InputMaybe<Order_By>;
|
||||||
id?: InputMaybe<Order_By>;
|
id?: InputMaybe<Order_By>;
|
||||||
size?: InputMaybe<Order_By>;
|
size?: InputMaybe<Order_By>;
|
||||||
};
|
};
|
||||||
@@ -5068,6 +5144,8 @@ export enum Backups_Select_Column {
|
|||||||
/** column name */
|
/** column name */
|
||||||
CreatedAt = 'createdAt',
|
CreatedAt = 'createdAt',
|
||||||
/** column name */
|
/** column name */
|
||||||
|
ExpiresAt = 'expiresAt',
|
||||||
|
/** column name */
|
||||||
Id = 'id',
|
Id = 'id',
|
||||||
/** column name */
|
/** column name */
|
||||||
Size = 'size'
|
Size = 'size'
|
||||||
@@ -5078,6 +5156,7 @@ export type Backups_Set_Input = {
|
|||||||
appId?: InputMaybe<Scalars['uuid']>;
|
appId?: InputMaybe<Scalars['uuid']>;
|
||||||
completedAt?: InputMaybe<Scalars['timestamptz']>;
|
completedAt?: InputMaybe<Scalars['timestamptz']>;
|
||||||
createdAt?: InputMaybe<Scalars['timestamptz']>;
|
createdAt?: InputMaybe<Scalars['timestamptz']>;
|
||||||
|
expiresAt?: InputMaybe<Scalars['timestamptz']>;
|
||||||
id?: InputMaybe<Scalars['uuid']>;
|
id?: InputMaybe<Scalars['uuid']>;
|
||||||
size?: InputMaybe<Scalars['bigint']>;
|
size?: InputMaybe<Scalars['bigint']>;
|
||||||
};
|
};
|
||||||
@@ -5128,6 +5207,7 @@ export type Backups_Stream_Cursor_Value_Input = {
|
|||||||
appId?: InputMaybe<Scalars['uuid']>;
|
appId?: InputMaybe<Scalars['uuid']>;
|
||||||
completedAt?: InputMaybe<Scalars['timestamptz']>;
|
completedAt?: InputMaybe<Scalars['timestamptz']>;
|
||||||
createdAt?: InputMaybe<Scalars['timestamptz']>;
|
createdAt?: InputMaybe<Scalars['timestamptz']>;
|
||||||
|
expiresAt?: InputMaybe<Scalars['timestamptz']>;
|
||||||
id?: InputMaybe<Scalars['uuid']>;
|
id?: InputMaybe<Scalars['uuid']>;
|
||||||
size?: InputMaybe<Scalars['bigint']>;
|
size?: InputMaybe<Scalars['bigint']>;
|
||||||
};
|
};
|
||||||
@@ -5152,6 +5232,8 @@ export enum Backups_Update_Column {
|
|||||||
/** column name */
|
/** column name */
|
||||||
CreatedAt = 'createdAt',
|
CreatedAt = 'createdAt',
|
||||||
/** column name */
|
/** column name */
|
||||||
|
ExpiresAt = 'expiresAt',
|
||||||
|
/** column name */
|
||||||
Id = 'id',
|
Id = 'id',
|
||||||
/** column name */
|
/** column name */
|
||||||
Size = 'size'
|
Size = 'size'
|
||||||
@@ -9150,6 +9232,7 @@ export type Mutation_Root = {
|
|||||||
/** insert a single row into the table: "regions" */
|
/** insert a single row into the table: "regions" */
|
||||||
insert_regions_one?: Maybe<Regions>;
|
insert_regions_one?: Maybe<Regions>;
|
||||||
migrateRDSToPostgres: Scalars['Boolean'];
|
migrateRDSToPostgres: Scalars['Boolean'];
|
||||||
|
pauseInactiveApps: Array<Scalars['String']>;
|
||||||
resetPostgresPassword: Scalars['Boolean'];
|
resetPostgresPassword: Scalars['Boolean'];
|
||||||
restoreApplicationDatabase: Scalars['Boolean'];
|
restoreApplicationDatabase: Scalars['Boolean'];
|
||||||
/** update single row of the table: "apps" */
|
/** 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 */
|
/** mutation root */
|
||||||
export type Mutation_RootBackupApplicationDatabaseArgs = {
|
export type Mutation_RootBackupApplicationDatabaseArgs = {
|
||||||
appID: Scalars['String'];
|
appID: Scalars['String'];
|
||||||
|
expireInDays?: InputMaybe<Scalars['Int']>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -11947,6 +12037,41 @@ export type Query_Root = {
|
|||||||
files: Array<Files>;
|
files: Array<Files>;
|
||||||
/** fetch aggregated fields from the table: "storage.files" */
|
/** fetch aggregated fields from the table: "storage.files" */
|
||||||
filesAggregate: Files_Aggregate;
|
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 */
|
/** fetch data from the table: "github_app_installations" using primary key columns */
|
||||||
githubAppInstallation?: Maybe<GithubAppInstallations>;
|
githubAppInstallation?: Maybe<GithubAppInstallations>;
|
||||||
/** fetch data from the table: "github_app_installations" */
|
/** fetch data from the table: "github_app_installations" */
|
||||||
@@ -11982,6 +12107,13 @@ export type Query_Root = {
|
|||||||
regions_aggregate: Regions_Aggregate;
|
regions_aggregate: Regions_Aggregate;
|
||||||
/** fetch data from the table: "regions" using primary key columns */
|
/** fetch data from the table: "regions" using primary key columns */
|
||||||
regions_by_pk?: Maybe<Regions>;
|
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>;
|
systemConfig?: Maybe<ConfigSystemConfig>;
|
||||||
systemConfigs: Array<ConfigAppSystemConfig>;
|
systemConfigs: Array<ConfigAppSystemConfig>;
|
||||||
/** fetch data from the table: "auth.users" using primary key columns */
|
/** 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 = {
|
export type Query_RootGithubAppInstallationArgs = {
|
||||||
id: Scalars['uuid'];
|
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 = {
|
export type Query_RootSystemConfigArgs = {
|
||||||
appID: Scalars['uuid'];
|
appID: Scalars['uuid'];
|
||||||
};
|
};
|
||||||
@@ -16390,6 +16563,16 @@ export type GetRemoteAppRolesQueryVariables = Exact<{ [key: string]: never; }>;
|
|||||||
|
|
||||||
export type GetRemoteAppRolesQuery = { __typename?: 'query_root', authRoles: Array<{ __typename?: 'authRoles', role: string }> };
|
export type GetRemoteAppRolesQuery = { __typename?: 'query_root', authRoles: Array<{ __typename?: 'authRoles', role: string }> };
|
||||||
|
|
||||||
|
export type WorkspaceFragment = { __typename?: 'workspaces', id: any, name: string, slug: string, workspaceMembers: Array<{ __typename?: 'workspaceMembers', id: any, type: string, user: { __typename?: 'users', id: any, email?: any | null, displayName: string } }>, projects: Array<{ __typename?: 'apps', id: any, slug: string, name: string, repositoryProductionBranch: string, subdomain: string, isProvisioned: boolean, createdAt: any, desiredState: number, nhostBaseFolder: string, providersUpdated?: boolean | null, config?: { __typename?: 'ConfigConfig', hasura: { __typename?: 'ConfigHasura', adminSecret: string } } | null, featureFlags: Array<{ __typename?: 'featureFlags', description: string, id: any, name: string, value: string }>, appStates: Array<{ __typename?: 'appStateHistory', id: any, appId: any, message?: string | null, stateId: number, createdAt: any }>, region: { __typename?: 'regions', id: any, countryCode: string, awsName: string, city: string }, plan: { __typename?: 'plans', id: any, name: string, isFree: boolean }, githubRepository?: { __typename?: 'githubRepositories', fullName: string } | null, deployments: Array<{ __typename?: 'deployments', id: any, commitSHA: string, commitMessage?: string | null, commitUserName?: string | null, deploymentStartedAt?: any | null, deploymentEndedAt?: any | null, commitUserAvatarUrl?: string | null, deploymentStatus?: string | null }>, creator?: { __typename?: 'users', id: any, email?: any | null, displayName: string } | null }> };
|
||||||
|
|
||||||
|
export type GetWorkspaceAndProjectQueryVariables = Exact<{
|
||||||
|
workspaceSlug: Scalars['String'];
|
||||||
|
projectSlug?: InputMaybe<Scalars['String']>;
|
||||||
|
}>;
|
||||||
|
|
||||||
|
|
||||||
|
export type GetWorkspaceAndProjectQuery = { __typename?: 'query_root', workspaces: Array<{ __typename?: 'workspaces', id: any, name: string, slug: string, workspaceMembers: Array<{ __typename?: 'workspaceMembers', id: any, type: string, user: { __typename?: 'users', id: any, email?: any | null, displayName: string } }>, projects: Array<{ __typename?: 'apps', id: any, slug: string, name: string, repositoryProductionBranch: string, subdomain: string, isProvisioned: boolean, createdAt: any, desiredState: number, nhostBaseFolder: string, providersUpdated?: boolean | null, config?: { __typename?: 'ConfigConfig', hasura: { __typename?: 'ConfigHasura', adminSecret: string } } | null, featureFlags: Array<{ __typename?: 'featureFlags', description: string, id: any, name: string, value: string }>, appStates: Array<{ __typename?: 'appStateHistory', id: any, appId: any, message?: string | null, stateId: number, createdAt: any }>, region: { __typename?: 'regions', id: any, countryCode: string, awsName: string, city: string }, plan: { __typename?: 'plans', id: any, name: string, isFree: boolean }, githubRepository?: { __typename?: 'githubRepositories', fullName: string } | null, deployments: Array<{ __typename?: 'deployments', id: any, commitSHA: string, commitMessage?: string | null, commitUserName?: string | null, deploymentStartedAt?: any | null, deploymentEndedAt?: any | null, commitUserAvatarUrl?: string | null, deploymentStatus?: string | null }>, creator?: { __typename?: 'users', id: any, email?: any | null, displayName: string } | null }> }>, projects: Array<{ __typename?: 'apps', id: any, slug: string, name: string, repositoryProductionBranch: string, subdomain: string, isProvisioned: boolean, createdAt: any, desiredState: number, nhostBaseFolder: string, providersUpdated?: boolean | null, config?: { __typename?: 'ConfigConfig', hasura: { __typename?: 'ConfigHasura', adminSecret: string } } | null, featureFlags: Array<{ __typename?: 'featureFlags', description: string, id: any, name: string, value: string }>, appStates: Array<{ __typename?: 'appStateHistory', id: any, appId: any, message?: string | null, stateId: number, createdAt: any }>, region: { __typename?: 'regions', id: any, countryCode: string, awsName: string, city: string }, plan: { __typename?: 'plans', id: any, name: string, isFree: boolean }, githubRepository?: { __typename?: 'githubRepositories', fullName: string } | null, deployments: Array<{ __typename?: 'deployments', id: any, commitSHA: string, commitMessage?: string | null, commitUserName?: string | null, deploymentStartedAt?: any | null, deploymentEndedAt?: any | null, commitUserAvatarUrl?: string | null, deploymentStatus?: string | null }>, creator?: { __typename?: 'users', id: any, email?: any | null, displayName: string } | null }> };
|
||||||
|
|
||||||
export type InsertApplicationMutationVariables = Exact<{
|
export type InsertApplicationMutationVariables = Exact<{
|
||||||
app: Apps_Insert_Input;
|
app: Apps_Insert_Input;
|
||||||
}>;
|
}>;
|
||||||
@@ -16480,7 +16663,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<{
|
export type GetSmtpSettingsQueryVariables = Exact<{
|
||||||
appId: Scalars['uuid'];
|
appId: Scalars['uuid'];
|
||||||
@@ -16617,6 +16800,8 @@ export type GetFilesAggregateQueryVariables = Exact<{
|
|||||||
|
|
||||||
export type GetFilesAggregateQuery = { __typename?: 'query_root', filesAggregate: { __typename?: 'files_aggregate', aggregate?: { __typename?: 'files_aggregate_fields', count: number } | null } };
|
export type GetFilesAggregateQuery = { __typename?: 'query_root', filesAggregate: { __typename?: 'files_aggregate', aggregate?: { __typename?: 'files_aggregate_fields', count: number } | null } };
|
||||||
|
|
||||||
|
export type ProjectFragment = { __typename?: 'apps', id: any, slug: string, name: string, repositoryProductionBranch: string, subdomain: string, isProvisioned: boolean, createdAt: any, desiredState: number, nhostBaseFolder: string, providersUpdated?: boolean | null, config?: { __typename?: 'ConfigConfig', hasura: { __typename?: 'ConfigHasura', adminSecret: string } } | null, featureFlags: Array<{ __typename?: 'featureFlags', description: string, id: any, name: string, value: string }>, appStates: Array<{ __typename?: 'appStateHistory', id: any, appId: any, message?: string | null, stateId: number, createdAt: any }>, region: { __typename?: 'regions', id: any, countryCode: string, awsName: string, city: string }, plan: { __typename?: 'plans', id: any, name: string, isFree: boolean }, githubRepository?: { __typename?: 'githubRepositories', fullName: string } | null, deployments: Array<{ __typename?: 'deployments', id: any, commitSHA: string, commitMessage?: string | null, commitUserName?: string | null, deploymentStartedAt?: any | null, deploymentEndedAt?: any | null, commitUserAvatarUrl?: string | null, deploymentStatus?: string | null }>, creator?: { __typename?: 'users', id: any, email?: any | null, displayName: string } | null };
|
||||||
|
|
||||||
export type GithubRepositoryFragment = { __typename?: 'githubRepositories', id: any, name: string, fullName: string, private: boolean, githubAppInstallation: { __typename?: 'githubAppInstallations', id: any, accountLogin?: string | null, accountType?: string | null, accountAvatarUrl?: string | null } };
|
export type GithubRepositoryFragment = { __typename?: 'githubRepositories', id: any, name: string, fullName: string, private: boolean, githubAppInstallation: { __typename?: 'githubAppInstallations', id: any, accountLogin?: string | null, accountType?: string | null, accountAvatarUrl?: string | null } };
|
||||||
|
|
||||||
export type GetGithubRepositoriesQueryVariables = Exact<{ [key: string]: never; }>;
|
export type GetGithubRepositoriesQueryVariables = Exact<{ [key: string]: never; }>;
|
||||||
@@ -16841,14 +17026,12 @@ export type GetFreeAndActiveProjectsQueryVariables = Exact<{
|
|||||||
|
|
||||||
export type GetFreeAndActiveProjectsQuery = { __typename?: 'query_root', freeAndActiveProjects: Array<{ __typename?: 'apps', id: any }> };
|
export type GetFreeAndActiveProjectsQuery = { __typename?: 'query_root', freeAndActiveProjects: Array<{ __typename?: 'apps', id: any }> };
|
||||||
|
|
||||||
export type ProjectFragment = { __typename?: 'apps', id: any, slug: string, name: string, repositoryProductionBranch: string, subdomain: string, isProvisioned: boolean, createdAt: any, desiredState: number, nhostBaseFolder: string, providersUpdated?: boolean | null, config?: { __typename?: 'ConfigConfig', hasura: { __typename?: 'ConfigHasura', adminSecret: string } } | null, featureFlags: Array<{ __typename?: 'featureFlags', description: string, id: any, name: string, value: string }>, appStates: Array<{ __typename?: 'appStateHistory', id: any, appId: any, message?: string | null, stateId: number, createdAt: any }>, region: { __typename?: 'regions', id: any, countryCode: string, awsName: string, city: string }, plan: { __typename?: 'plans', id: any, name: string, isFree: boolean }, githubRepository?: { __typename?: 'githubRepositories', fullName: string } | null, deployments: Array<{ __typename?: 'deployments', id: any, commitSHA: string, commitMessage?: string | null, commitUserName?: string | null, deploymentStartedAt?: any | null, deploymentEndedAt?: any | null, commitUserAvatarUrl?: string | null, deploymentStatus?: string | null }> };
|
|
||||||
|
|
||||||
export type GetOneUserQueryVariables = Exact<{
|
export type GetOneUserQueryVariables = Exact<{
|
||||||
userId: Scalars['uuid'];
|
userId: Scalars['uuid'];
|
||||||
}>;
|
}>;
|
||||||
|
|
||||||
|
|
||||||
export type GetOneUserQuery = { __typename?: 'query_root', user?: { __typename?: 'users', id: any, displayName: string, avatarUrl: string, workspaceMembers: Array<{ __typename?: 'workspaceMembers', id: any, userId: any, workspaceId: any, type: string, workspace: { __typename?: 'workspaces', creatorUserId?: any | null, id: any, slug: string, name: string, apps: Array<{ __typename?: 'apps', id: any, slug: string, name: string, repositoryProductionBranch: string, subdomain: string, isProvisioned: boolean, createdAt: any, desiredState: number, nhostBaseFolder: string, providersUpdated?: boolean | null, config?: { __typename?: 'ConfigConfig', hasura: { __typename?: 'ConfigHasura', adminSecret: string } } | null, featureFlags: Array<{ __typename?: 'featureFlags', description: string, id: any, name: string, value: string }>, appStates: Array<{ __typename?: 'appStateHistory', id: any, appId: any, message?: string | null, stateId: number, createdAt: any }>, region: { __typename?: 'regions', id: any, countryCode: string, awsName: string, city: string }, plan: { __typename?: 'plans', id: any, name: string, isFree: boolean }, githubRepository?: { __typename?: 'githubRepositories', fullName: string } | null, deployments: Array<{ __typename?: 'deployments', id: any, commitSHA: string, commitMessage?: string | null, commitUserName?: string | null, deploymentStartedAt?: any | null, deploymentEndedAt?: any | null, commitUserAvatarUrl?: string | null, deploymentStatus?: string | null }> }> } }> } | null };
|
export type GetOneUserQuery = { __typename?: 'query_root', user?: { __typename?: 'users', id: any, displayName: string, avatarUrl: string, workspaceMembers: Array<{ __typename?: 'workspaceMembers', id: any, userId: any, workspaceId: any, type: string, workspace: { __typename?: 'workspaces', creatorUserId?: any | null, id: any, slug: string, name: string, apps: Array<{ __typename?: 'apps', id: any, slug: string, name: string, repositoryProductionBranch: string, subdomain: string, isProvisioned: boolean, createdAt: any, desiredState: number, nhostBaseFolder: string, providersUpdated?: boolean | null, config?: { __typename?: 'ConfigConfig', hasura: { __typename?: 'ConfigHasura', adminSecret: string } } | null, featureFlags: Array<{ __typename?: 'featureFlags', description: string, id: any, name: string, value: string }>, appStates: Array<{ __typename?: 'appStateHistory', id: any, appId: any, message?: string | null, stateId: number, createdAt: any }>, region: { __typename?: 'regions', id: any, countryCode: string, awsName: string, city: string }, plan: { __typename?: 'plans', id: any, name: string, isFree: boolean }, githubRepository?: { __typename?: 'githubRepositories', fullName: string } | null, deployments: Array<{ __typename?: 'deployments', id: any, commitSHA: string, commitMessage?: string | null, commitUserName?: string | null, deploymentStartedAt?: any | null, deploymentEndedAt?: any | null, commitUserAvatarUrl?: string | null, deploymentStatus?: string | null }>, creator?: { __typename?: 'users', id: any, email?: any | null, displayName: string } | null }> } }> } | null };
|
||||||
|
|
||||||
export type GetUserAllWorkspacesQueryVariables = Exact<{ [key: string]: never; }>;
|
export type GetUserAllWorkspacesQueryVariables = Exact<{ [key: string]: never; }>;
|
||||||
|
|
||||||
@@ -17050,6 +17233,86 @@ export const GetAppByWorkspaceAndNameFragmentDoc = gql`
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
export const ProjectFragmentDoc = gql`
|
||||||
|
fragment Project on apps {
|
||||||
|
id
|
||||||
|
slug
|
||||||
|
name
|
||||||
|
repositoryProductionBranch
|
||||||
|
subdomain
|
||||||
|
isProvisioned
|
||||||
|
createdAt
|
||||||
|
desiredState
|
||||||
|
nhostBaseFolder
|
||||||
|
providersUpdated
|
||||||
|
config(resolve: true) {
|
||||||
|
hasura {
|
||||||
|
adminSecret
|
||||||
|
}
|
||||||
|
}
|
||||||
|
featureFlags {
|
||||||
|
description
|
||||||
|
id
|
||||||
|
name
|
||||||
|
value
|
||||||
|
}
|
||||||
|
appStates(order_by: {createdAt: desc}, limit: 1) {
|
||||||
|
id
|
||||||
|
appId
|
||||||
|
message
|
||||||
|
stateId
|
||||||
|
createdAt
|
||||||
|
}
|
||||||
|
region {
|
||||||
|
id
|
||||||
|
countryCode
|
||||||
|
awsName
|
||||||
|
city
|
||||||
|
}
|
||||||
|
plan {
|
||||||
|
id
|
||||||
|
name
|
||||||
|
isFree
|
||||||
|
}
|
||||||
|
githubRepository {
|
||||||
|
fullName
|
||||||
|
}
|
||||||
|
deployments(limit: 4, order_by: {deploymentEndedAt: desc}) {
|
||||||
|
id
|
||||||
|
commitSHA
|
||||||
|
commitMessage
|
||||||
|
commitUserName
|
||||||
|
deploymentStartedAt
|
||||||
|
deploymentEndedAt
|
||||||
|
commitUserAvatarUrl
|
||||||
|
deploymentStatus
|
||||||
|
}
|
||||||
|
creator {
|
||||||
|
id
|
||||||
|
email
|
||||||
|
displayName
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
export const WorkspaceFragmentDoc = gql`
|
||||||
|
fragment Workspace on workspaces {
|
||||||
|
id
|
||||||
|
name
|
||||||
|
slug
|
||||||
|
workspaceMembers {
|
||||||
|
id
|
||||||
|
user {
|
||||||
|
id
|
||||||
|
email
|
||||||
|
displayName
|
||||||
|
}
|
||||||
|
type
|
||||||
|
}
|
||||||
|
projects: apps {
|
||||||
|
...Project
|
||||||
|
}
|
||||||
|
}
|
||||||
|
${ProjectFragmentDoc}`;
|
||||||
export const PrefetchNewAppRegionsFragmentDoc = gql`
|
export const PrefetchNewAppRegionsFragmentDoc = gql`
|
||||||
fragment PrefetchNewAppRegions on regions {
|
fragment PrefetchNewAppRegions on regions {
|
||||||
id
|
id
|
||||||
@@ -17218,62 +17481,6 @@ export const RemoteAppGetUsersFragmentDoc = gql`
|
|||||||
disabled
|
disabled
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
export const ProjectFragmentDoc = gql`
|
|
||||||
fragment Project on apps {
|
|
||||||
id
|
|
||||||
slug
|
|
||||||
name
|
|
||||||
repositoryProductionBranch
|
|
||||||
subdomain
|
|
||||||
isProvisioned
|
|
||||||
createdAt
|
|
||||||
desiredState
|
|
||||||
nhostBaseFolder
|
|
||||||
providersUpdated
|
|
||||||
config(resolve: true) {
|
|
||||||
hasura {
|
|
||||||
adminSecret
|
|
||||||
}
|
|
||||||
}
|
|
||||||
featureFlags {
|
|
||||||
description
|
|
||||||
id
|
|
||||||
name
|
|
||||||
value
|
|
||||||
}
|
|
||||||
appStates(order_by: {createdAt: desc}, limit: 1) {
|
|
||||||
id
|
|
||||||
appId
|
|
||||||
message
|
|
||||||
stateId
|
|
||||||
createdAt
|
|
||||||
}
|
|
||||||
region {
|
|
||||||
id
|
|
||||||
countryCode
|
|
||||||
awsName
|
|
||||||
city
|
|
||||||
}
|
|
||||||
plan {
|
|
||||||
id
|
|
||||||
name
|
|
||||||
isFree
|
|
||||||
}
|
|
||||||
githubRepository {
|
|
||||||
fullName
|
|
||||||
}
|
|
||||||
deployments(limit: 4, order_by: {deploymentEndedAt: desc}) {
|
|
||||||
id
|
|
||||||
commitSHA
|
|
||||||
commitMessage
|
|
||||||
commitUserName
|
|
||||||
deploymentStartedAt
|
|
||||||
deploymentEndedAt
|
|
||||||
commitUserAvatarUrl
|
|
||||||
deploymentStatus
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
export const GetWorkspaceMembersWorkspaceMemberFragmentDoc = gql`
|
export const GetWorkspaceMembersWorkspaceMemberFragmentDoc = gql`
|
||||||
fragment getWorkspaceMembersWorkspaceMember on workspaceMembers {
|
fragment getWorkspaceMembersWorkspaceMember on workspaceMembers {
|
||||||
id
|
id
|
||||||
@@ -17746,6 +17953,49 @@ export type GetRemoteAppRolesQueryResult = Apollo.QueryResult<GetRemoteAppRolesQ
|
|||||||
export function refetchGetRemoteAppRolesQuery(variables?: GetRemoteAppRolesQueryVariables) {
|
export function refetchGetRemoteAppRolesQuery(variables?: GetRemoteAppRolesQueryVariables) {
|
||||||
return { query: GetRemoteAppRolesDocument, variables: variables }
|
return { query: GetRemoteAppRolesDocument, variables: variables }
|
||||||
}
|
}
|
||||||
|
export const GetWorkspaceAndProjectDocument = gql`
|
||||||
|
query GetWorkspaceAndProject($workspaceSlug: String!, $projectSlug: String) {
|
||||||
|
workspaces(where: {slug: {_eq: $workspaceSlug}}) {
|
||||||
|
...Workspace
|
||||||
|
}
|
||||||
|
projects: apps(where: {slug: {_eq: $projectSlug}}) {
|
||||||
|
...Project
|
||||||
|
}
|
||||||
|
}
|
||||||
|
${WorkspaceFragmentDoc}
|
||||||
|
${ProjectFragmentDoc}`;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* __useGetWorkspaceAndProjectQuery__
|
||||||
|
*
|
||||||
|
* To run a query within a React component, call `useGetWorkspaceAndProjectQuery` and pass it any options that fit your needs.
|
||||||
|
* When your component renders, `useGetWorkspaceAndProjectQuery` returns an object from Apollo Client that contains loading, error, and data properties
|
||||||
|
* you can use to render your UI.
|
||||||
|
*
|
||||||
|
* @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options;
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* const { data, loading, error } = useGetWorkspaceAndProjectQuery({
|
||||||
|
* variables: {
|
||||||
|
* workspaceSlug: // value for 'workspaceSlug'
|
||||||
|
* projectSlug: // value for 'projectSlug'
|
||||||
|
* },
|
||||||
|
* });
|
||||||
|
*/
|
||||||
|
export function useGetWorkspaceAndProjectQuery(baseOptions: Apollo.QueryHookOptions<GetWorkspaceAndProjectQuery, GetWorkspaceAndProjectQueryVariables>) {
|
||||||
|
const options = {...defaultOptions, ...baseOptions}
|
||||||
|
return Apollo.useQuery<GetWorkspaceAndProjectQuery, GetWorkspaceAndProjectQueryVariables>(GetWorkspaceAndProjectDocument, options);
|
||||||
|
}
|
||||||
|
export function useGetWorkspaceAndProjectLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<GetWorkspaceAndProjectQuery, GetWorkspaceAndProjectQueryVariables>) {
|
||||||
|
const options = {...defaultOptions, ...baseOptions}
|
||||||
|
return Apollo.useLazyQuery<GetWorkspaceAndProjectQuery, GetWorkspaceAndProjectQueryVariables>(GetWorkspaceAndProjectDocument, options);
|
||||||
|
}
|
||||||
|
export type GetWorkspaceAndProjectQueryHookResult = ReturnType<typeof useGetWorkspaceAndProjectQuery>;
|
||||||
|
export type GetWorkspaceAndProjectLazyQueryHookResult = ReturnType<typeof useGetWorkspaceAndProjectLazyQuery>;
|
||||||
|
export type GetWorkspaceAndProjectQueryResult = Apollo.QueryResult<GetWorkspaceAndProjectQuery, GetWorkspaceAndProjectQueryVariables>;
|
||||||
|
export function refetchGetWorkspaceAndProjectQuery(variables: GetWorkspaceAndProjectQueryVariables) {
|
||||||
|
return { query: GetWorkspaceAndProjectDocument, variables: variables }
|
||||||
|
}
|
||||||
export const InsertApplicationDocument = gql`
|
export const InsertApplicationDocument = gql`
|
||||||
mutation insertApplication($app: apps_insert_input!) {
|
mutation insertApplication($app: apps_insert_input!) {
|
||||||
insertApp(object: $app) {
|
insertApp(object: $app) {
|
||||||
@@ -18282,6 +18532,12 @@ export const GetSignInMethodsDocument = gql`
|
|||||||
connection
|
connection
|
||||||
organization
|
organization
|
||||||
}
|
}
|
||||||
|
azuread {
|
||||||
|
enabled
|
||||||
|
clientId
|
||||||
|
clientSecret
|
||||||
|
tenant
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,11 @@
|
|||||||
# @nhost/docs
|
# @nhost/docs
|
||||||
|
|
||||||
|
## 0.0.15
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- 0795d1c6: chore: add link to event triggers on the serverless functions page
|
||||||
|
|
||||||
## 0.0.14
|
## 0.0.14
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -84,6 +84,8 @@ older (`functions/_utils/<utils-files>.js`).
|
|||||||
|
|
||||||
[Environment variables](/platform/environment-variables) are available inside your Serverless Functions. Both in production and when running Nhost locally using the [Nhost CLI](/cli).
|
[Environment variables](/platform/environment-variables) are available inside your Serverless Functions. Both in production and when running Nhost locally using the [Nhost CLI](/cli).
|
||||||
|
|
||||||
|
The same [environment variables that are used to configure event triggers](https://docs.nhost.io/database/event-triggers#format) can be used to authenticate regular serverless functions.
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
We have multiple examples of Serverless Functions in our [Nhost repository](https://github.com/nhost/nhost/tree/main/examples/serverless-functions/functions).
|
We have multiple examples of Serverless Functions in our [Nhost repository](https://github.com/nhost/nhost/tree/main/examples/serverless-functions/functions).
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@nhost/docs",
|
"name": "@nhost/docs",
|
||||||
"version": "0.0.14",
|
"version": "0.0.15",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"docusaurus": "docusaurus",
|
"docusaurus": "docusaurus",
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ services:
|
|||||||
postgres_password: postgres
|
postgres_password: postgres
|
||||||
postgres_user: postgres
|
postgres_user: postgres
|
||||||
auth:
|
auth:
|
||||||
image: nhost/hasura-auth:0.16.1
|
image: nhost/hasura-auth:0.16.2
|
||||||
storage:
|
storage:
|
||||||
image: nhost/hasura-storage:0.3.0
|
image: nhost/hasura-storage:0.3.0
|
||||||
auth:
|
auth:
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ services:
|
|||||||
postgres_password: postgres
|
postgres_password: postgres
|
||||||
postgres_user: postgres
|
postgres_user: postgres
|
||||||
auth:
|
auth:
|
||||||
image: nhost/hasura-auth:0.16.1
|
image: nhost/hasura-auth:0.16.2
|
||||||
storage:
|
storage:
|
||||||
image: nhost/hasura-storage:0.3.0
|
image: nhost/hasura-storage:0.3.0
|
||||||
auth:
|
auth:
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ services:
|
|||||||
postgres_password: postgres
|
postgres_password: postgres
|
||||||
postgres_user: postgres
|
postgres_user: postgres
|
||||||
auth:
|
auth:
|
||||||
image: nhost/hasura-auth:0.16.1
|
image: nhost/hasura-auth:0.16.2
|
||||||
storage:
|
storage:
|
||||||
image: nhost/hasura-storage:0.3.0
|
image: nhost/hasura-storage:0.3.0
|
||||||
auth:
|
auth:
|
||||||
|
|||||||
@@ -1,5 +1,12 @@
|
|||||||
# @nhost/apollo
|
# @nhost/apollo
|
||||||
|
|
||||||
|
## 5.2.0
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [a0e093d7]
|
||||||
|
- @nhost/nhost-js@2.2.0
|
||||||
|
|
||||||
## 5.1.3
|
## 5.1.3
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@nhost/apollo",
|
"name": "@nhost/apollo",
|
||||||
"version": "5.1.3",
|
"version": "5.2.0",
|
||||||
"description": "Nhost Apollo Client library",
|
"description": "Nhost Apollo Client library",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
|
|||||||
@@ -1,5 +1,12 @@
|
|||||||
# @nhost/react-apollo
|
# @nhost/react-apollo
|
||||||
|
|
||||||
|
## 5.0.15
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- @nhost/apollo@5.2.0
|
||||||
|
- @nhost/react@2.0.13
|
||||||
|
|
||||||
## 5.0.14
|
## 5.0.14
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@nhost/react-apollo",
|
"name": "@nhost/react-apollo",
|
||||||
"version": "5.0.14",
|
"version": "5.0.15",
|
||||||
"description": "Nhost React Apollo client",
|
"description": "Nhost React Apollo client",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
|
|||||||
@@ -1,5 +1,17 @@
|
|||||||
# @nhost/react-urql
|
# @nhost/react-urql
|
||||||
|
|
||||||
|
## 2.0.14
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- 09cf5d4b: chore(deps): bump `urql` to v4
|
||||||
|
|
||||||
|
## 2.0.13
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- @nhost/react@2.0.13
|
||||||
|
|
||||||
## 2.0.12
|
## 2.0.12
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@nhost/react-urql",
|
"name": "@nhost/react-urql",
|
||||||
"version": "2.0.12",
|
"version": "2.0.14",
|
||||||
"description": "Nhost React URQL client",
|
"description": "Nhost React URQL client",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
@@ -75,6 +75,6 @@
|
|||||||
"graphql": "16.6.0",
|
"graphql": "16.6.0",
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
"react-dom": "^18.2.0",
|
"react-dom": "^18.2.0",
|
||||||
"urql": "^3.0.3"
|
"urql": "^4.0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,7 +76,7 @@
|
|||||||
"husky": "^8.0.1",
|
"husky": "^8.0.1",
|
||||||
"npm-run-all": "^4.1.5",
|
"npm-run-all": "^4.1.5",
|
||||||
"prettier": "^2.7.1",
|
"prettier": "^2.7.1",
|
||||||
"turbo": "1.8.5",
|
"turbo": "1.8.6",
|
||||||
"typedoc": "^0.22.18",
|
"typedoc": "^0.22.18",
|
||||||
"typescript": "4.9.5",
|
"typescript": "4.9.5",
|
||||||
"vite": "^4.0.2",
|
"vite": "^4.0.2",
|
||||||
|
|||||||
@@ -1,5 +1,11 @@
|
|||||||
# @nhost/hasura-auth-js
|
# @nhost/hasura-auth-js
|
||||||
|
|
||||||
|
## 2.1.0
|
||||||
|
|
||||||
|
### Minor Changes
|
||||||
|
|
||||||
|
- a0e093d7: fix(exports): don't use conflicting names in exports
|
||||||
|
|
||||||
## 2.0.2
|
## 2.0.2
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@nhost/hasura-auth-js",
|
"name": "@nhost/hasura-auth-js",
|
||||||
"version": "2.0.2",
|
"version": "2.1.0",
|
||||||
"description": "Hasura-auth client",
|
"description": "Hasura-auth client",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
@@ -43,7 +43,8 @@
|
|||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite build --config ./vite.dev.config.js",
|
"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:lib": "vite build",
|
||||||
"build:umd": "vite build --config ../../config/vite.lib.umd.config.js",
|
"build:umd": "vite build --config ../../config/vite.lib.umd.config.js",
|
||||||
"test": "vitest run",
|
"test": "vitest run",
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { ErrorPayload } from './types'
|
import { AuthErrorPayload } from './types'
|
||||||
|
|
||||||
export const NETWORK_ERROR_CODE = 0
|
export const NETWORK_ERROR_CODE = 0
|
||||||
export const OTHER_ERROR_CODE = 1
|
export const OTHER_ERROR_CODE = 1
|
||||||
@@ -12,8 +12,8 @@ export const STATE_ERROR_CODE = 20
|
|||||||
* See https://github.com/statelyai/xstate/issues/3037
|
* See https://github.com/statelyai/xstate/issues/3037
|
||||||
*/
|
*/
|
||||||
export class CodifiedError extends Error {
|
export class CodifiedError extends Error {
|
||||||
error: ErrorPayload
|
error: AuthErrorPayload
|
||||||
constructor(original: Error | ErrorPayload) {
|
constructor(original: Error | AuthErrorPayload) {
|
||||||
super(original.message)
|
super(original.message)
|
||||||
Error.captureStackTrace(this, this.constructor)
|
Error.captureStackTrace(this, this.constructor)
|
||||||
if (original instanceof Error) {
|
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
|
// TODO share with hasura-auth
|
||||||
export const INVALID_EMAIL_ERROR: ValidationErrorPayload = {
|
export const INVALID_EMAIL_ERROR: ValidationAuthErrorPayload = {
|
||||||
status: VALIDATION_ERROR_CODE,
|
status: VALIDATION_ERROR_CODE,
|
||||||
error: 'invalid-email',
|
error: 'invalid-email',
|
||||||
message: 'Email is incorrectly formatted'
|
message: 'Email is incorrectly formatted'
|
||||||
}
|
}
|
||||||
|
|
||||||
export const INVALID_MFA_TYPE_ERROR: ValidationErrorPayload = {
|
export const INVALID_MFA_TYPE_ERROR: ValidationAuthErrorPayload = {
|
||||||
status: VALIDATION_ERROR_CODE,
|
status: VALIDATION_ERROR_CODE,
|
||||||
error: 'invalid-mfa-type',
|
error: 'invalid-mfa-type',
|
||||||
message: 'MFA type is invalid'
|
message: 'MFA type is invalid'
|
||||||
}
|
}
|
||||||
|
|
||||||
export const INVALID_MFA_CODE_ERROR: ValidationErrorPayload = {
|
export const INVALID_MFA_CODE_ERROR: ValidationAuthErrorPayload = {
|
||||||
status: VALIDATION_ERROR_CODE,
|
status: VALIDATION_ERROR_CODE,
|
||||||
error: 'invalid-mfa-code',
|
error: 'invalid-mfa-code',
|
||||||
message: 'MFA code is invalid'
|
message: 'MFA code is invalid'
|
||||||
}
|
}
|
||||||
|
|
||||||
export const INVALID_PASSWORD_ERROR: ValidationErrorPayload = {
|
export const INVALID_PASSWORD_ERROR: ValidationAuthErrorPayload = {
|
||||||
status: VALIDATION_ERROR_CODE,
|
status: VALIDATION_ERROR_CODE,
|
||||||
error: 'invalid-password',
|
error: 'invalid-password',
|
||||||
message: 'Password is incorrectly formatted'
|
message: 'Password is incorrectly formatted'
|
||||||
}
|
}
|
||||||
|
|
||||||
export const INVALID_PHONE_NUMBER_ERROR: ValidationErrorPayload = {
|
export const INVALID_PHONE_NUMBER_ERROR: ValidationAuthErrorPayload = {
|
||||||
status: VALIDATION_ERROR_CODE,
|
status: VALIDATION_ERROR_CODE,
|
||||||
error: 'invalid-phone-number',
|
error: 'invalid-phone-number',
|
||||||
message: 'Phone number is incorrectly formatted'
|
message: 'Phone number is incorrectly formatted'
|
||||||
}
|
}
|
||||||
|
|
||||||
export const INVALID_MFA_TICKET_ERROR: ValidationErrorPayload = {
|
export const INVALID_MFA_TICKET_ERROR: ValidationAuthErrorPayload = {
|
||||||
status: VALIDATION_ERROR_CODE,
|
status: VALIDATION_ERROR_CODE,
|
||||||
error: 'invalid-mfa-ticket',
|
error: 'invalid-mfa-ticket',
|
||||||
message: 'MFA ticket is invalid'
|
message: 'MFA ticket is invalid'
|
||||||
}
|
}
|
||||||
|
|
||||||
export const NO_MFA_TICKET_ERROR: ValidationErrorPayload = {
|
export const NO_MFA_TICKET_ERROR: ValidationAuthErrorPayload = {
|
||||||
status: VALIDATION_ERROR_CODE,
|
status: VALIDATION_ERROR_CODE,
|
||||||
error: 'no-mfa-ticket',
|
error: 'no-mfa-ticket',
|
||||||
message: 'No MFA ticket has been provided'
|
message: 'No MFA ticket has been provided'
|
||||||
}
|
}
|
||||||
|
|
||||||
export const NO_REFRESH_TOKEN: ValidationErrorPayload = {
|
export const NO_REFRESH_TOKEN: ValidationAuthErrorPayload = {
|
||||||
status: VALIDATION_ERROR_CODE,
|
status: VALIDATION_ERROR_CODE,
|
||||||
error: 'no-refresh-token',
|
error: 'no-refresh-token',
|
||||||
message: 'No refresh token has been provided'
|
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,
|
status: STATE_ERROR_CODE,
|
||||||
error: 'refresher-already-running',
|
error: 'refresher-already-running',
|
||||||
message:
|
message:
|
||||||
'The token refresher is already running. You must wait until is has finished before submitting a new token.'
|
'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,
|
status: STATE_ERROR_CODE,
|
||||||
error: 'already-signed-in',
|
error: 'already-signed-in',
|
||||||
message: 'User is already signed in'
|
message: 'User is already signed in'
|
||||||
}
|
}
|
||||||
|
|
||||||
export const USER_UNAUTHENTICATED: ErrorPayload = {
|
export const USER_UNAUTHENTICATED: AuthErrorPayload = {
|
||||||
status: STATE_ERROR_CODE,
|
status: STATE_ERROR_CODE,
|
||||||
error: 'unauthenticated-user',
|
error: 'unauthenticated-user',
|
||||||
message: 'User is not authenticated'
|
message: 'User is not authenticated'
|
||||||
}
|
}
|
||||||
|
|
||||||
export const USER_NOT_ANONYMOUS: ErrorPayload = {
|
export const USER_NOT_ANONYMOUS: AuthErrorPayload = {
|
||||||
status: STATE_ERROR_CODE,
|
status: STATE_ERROR_CODE,
|
||||||
error: 'user-not-anonymous',
|
error: 'user-not-anonymous',
|
||||||
message: 'User is not anonymous'
|
message: 'User is not anonymous'
|
||||||
}
|
}
|
||||||
|
|
||||||
export const EMAIL_NEEDS_VERIFICATION: ErrorPayload = {
|
export const EMAIL_NEEDS_VERIFICATION: AuthErrorPayload = {
|
||||||
status: STATE_ERROR_CODE,
|
status: STATE_ERROR_CODE,
|
||||||
error: 'unverified-user',
|
error: 'unverified-user',
|
||||||
message: 'Email needs verification'
|
message: 'Email needs verification'
|
||||||
}
|
}
|
||||||
|
|
||||||
export const INVALID_REFRESH_TOKEN = {
|
export const INVALID_REFRESH_TOKEN: AuthErrorPayload = {
|
||||||
status: VALIDATION_ERROR_CODE,
|
status: VALIDATION_ERROR_CODE,
|
||||||
error: 'invalid-refresh-token',
|
error: 'invalid-refresh-token',
|
||||||
message: 'Invalid or expired 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,
|
status: OTHER_ERROR_CODE,
|
||||||
error: 'invalid-sign-in-method',
|
error: 'invalid-sign-in-method',
|
||||||
message: 'Invalid sign-in method'
|
message: 'Invalid sign-in method'
|
||||||
|
|||||||
@@ -34,13 +34,13 @@ import {
|
|||||||
} from './promises'
|
} from './promises'
|
||||||
import {
|
import {
|
||||||
AuthChangedFunction,
|
AuthChangedFunction,
|
||||||
|
AuthErrorPayload,
|
||||||
ChangeEmailParams,
|
ChangeEmailParams,
|
||||||
ChangeEmailResponse,
|
ChangeEmailResponse,
|
||||||
ChangePasswordParams,
|
ChangePasswordParams,
|
||||||
ChangePasswordResponse,
|
ChangePasswordResponse,
|
||||||
DeanonymizeParams,
|
DeanonymizeParams,
|
||||||
DeanonymizeResponse,
|
DeanonymizeResponse,
|
||||||
ErrorPayload,
|
|
||||||
JWTClaims,
|
JWTClaims,
|
||||||
JWTHasuraClaims,
|
JWTHasuraClaims,
|
||||||
NhostAuthConstructorParams,
|
NhostAuthConstructorParams,
|
||||||
@@ -411,7 +411,7 @@ export class HasuraAuthClient {
|
|||||||
*/
|
*/
|
||||||
async addSecurityKey(
|
async addSecurityKey(
|
||||||
nickname?: string
|
nickname?: string
|
||||||
): Promise<{ error: ErrorPayload | null; key?: SecurityKey }> {
|
): Promise<{ error: AuthErrorPayload | null; key?: SecurityKey }> {
|
||||||
const { error, key } = await addSecurityKeyPromise(this._client, nickname)
|
const { error, key } = await addSecurityKeyPromise(this._client, nickname)
|
||||||
return { error, key }
|
return { error, key }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { ErrorPayload, User } from '../../types'
|
import { AuthErrorPayload, User } from '../../types'
|
||||||
|
|
||||||
export type StateErrorTypes = 'registration' | 'authentication' | 'signout'
|
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 */
|
/** Number of times the user tried to get an access token from a refresh token but got a network error */
|
||||||
importTokenAttempts: number
|
importTokenAttempts: number
|
||||||
errors: Partial<Record<StateErrorTypes, ErrorPayload>>
|
errors: Partial<Record<StateErrorTypes, AuthErrorPayload>>
|
||||||
}
|
}
|
||||||
|
|
||||||
export const INITIAL_MACHINE_CONTEXT: AuthContext = {
|
export const INITIAL_MACHINE_CONTEXT: AuthContext = {
|
||||||
|
|||||||
@@ -24,9 +24,9 @@ import {
|
|||||||
} from '../../errors'
|
} from '../../errors'
|
||||||
import { localStorageGetter, localStorageSetter } from '../../local-storage'
|
import { localStorageGetter, localStorageSetter } from '../../local-storage'
|
||||||
import {
|
import {
|
||||||
|
AuthErrorPayload,
|
||||||
AuthOptions,
|
AuthOptions,
|
||||||
DeanonymizeResponse,
|
DeanonymizeResponse,
|
||||||
ErrorPayload,
|
|
||||||
NhostSession,
|
NhostSession,
|
||||||
NhostSessionResponse,
|
NhostSessionResponse,
|
||||||
PasswordlessEmailResponse,
|
PasswordlessEmailResponse,
|
||||||
@@ -856,7 +856,7 @@ export const createAuthMachine = ({
|
|||||||
error: null
|
error: null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let error: ErrorPayload | null = null
|
let error: AuthErrorPayload | null = null
|
||||||
if (autoSignIn) {
|
if (autoSignIn) {
|
||||||
const urlToken = getParameterByName('refreshToken') || null
|
const urlToken = getParameterByName('refreshToken') || null
|
||||||
if (urlToken) {
|
if (urlToken) {
|
||||||
@@ -866,7 +866,7 @@ export const createAuthMachine = ({
|
|||||||
})
|
})
|
||||||
return { session, error: null }
|
return { session, error: null }
|
||||||
} catch (exception) {
|
} catch (exception) {
|
||||||
error = (exception as { error: ErrorPayload }).error
|
error = (exception as { error: AuthErrorPayload }).error
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const error = getParameterByName('error')
|
const error = getParameterByName('error')
|
||||||
@@ -890,7 +890,7 @@ export const createAuthMachine = ({
|
|||||||
})
|
})
|
||||||
return { session, error: null }
|
return { session, error: null }
|
||||||
} catch (exception) {
|
} catch (exception) {
|
||||||
error = (exception as { error: ErrorPayload }).error
|
error = (exception as { error: AuthErrorPayload }).error
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (error) {
|
if (error) {
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import { assign, createMachine, send } from 'xstate'
|
import { assign, createMachine, send } from 'xstate'
|
||||||
import { INVALID_EMAIL_ERROR } from '../errors'
|
import { INVALID_EMAIL_ERROR } from '../errors'
|
||||||
import { AuthClient } from '../internal-client'
|
import { AuthClient } from '../internal-client'
|
||||||
import { ChangeEmailOptions, ChangeEmailResponse, ErrorPayload } from '../types'
|
import { AuthErrorPayload, ChangeEmailOptions, ChangeEmailResponse } from '../types'
|
||||||
import { postFetch, rewriteRedirectTo } from '../utils'
|
import { postFetch, rewriteRedirectTo } from '../utils'
|
||||||
import { isValidEmail } from '../utils/validators'
|
import { isValidEmail } from '../utils/validators'
|
||||||
|
|
||||||
export type ChangeEmailContext = {
|
export type ChangeEmailContext = {
|
||||||
error: ErrorPayload | null
|
error: AuthErrorPayload | null
|
||||||
}
|
}
|
||||||
|
|
||||||
export type ChangeEmailEvents =
|
export type ChangeEmailEvents =
|
||||||
@@ -16,7 +16,7 @@ export type ChangeEmailEvents =
|
|||||||
options?: ChangeEmailOptions
|
options?: ChangeEmailOptions
|
||||||
}
|
}
|
||||||
| { type: 'SUCCESS' }
|
| { type: 'SUCCESS' }
|
||||||
| { type: 'ERROR'; error: ErrorPayload | null }
|
| { type: 'ERROR'; error: AuthErrorPayload | null }
|
||||||
|
|
||||||
export type ChangeEmailServices = {
|
export type ChangeEmailServices = {
|
||||||
request: { data: ChangeEmailResponse }
|
request: { data: ChangeEmailResponse }
|
||||||
|
|||||||
@@ -16,9 +16,9 @@ export interface Typegen0 {
|
|||||||
}
|
}
|
||||||
missingImplementations: {
|
missingImplementations: {
|
||||||
actions: never
|
actions: never
|
||||||
services: never
|
|
||||||
guards: never
|
|
||||||
delays: never
|
delays: never
|
||||||
|
guards: never
|
||||||
|
services: never
|
||||||
}
|
}
|
||||||
eventsCausingActions: {
|
eventsCausingActions: {
|
||||||
reportError: 'error.platform.requestChange'
|
reportError: 'error.platform.requestChange'
|
||||||
@@ -26,13 +26,13 @@ export interface Typegen0 {
|
|||||||
saveInvalidEmailError: 'REQUEST'
|
saveInvalidEmailError: 'REQUEST'
|
||||||
saveRequestError: 'error.platform.requestChange'
|
saveRequestError: 'error.platform.requestChange'
|
||||||
}
|
}
|
||||||
eventsCausingServices: {
|
eventsCausingDelays: {}
|
||||||
requestChange: 'REQUEST'
|
|
||||||
}
|
|
||||||
eventsCausingGuards: {
|
eventsCausingGuards: {
|
||||||
invalidEmail: 'REQUEST'
|
invalidEmail: 'REQUEST'
|
||||||
}
|
}
|
||||||
eventsCausingDelays: {}
|
eventsCausingServices: {
|
||||||
|
requestChange: 'REQUEST'
|
||||||
|
}
|
||||||
matchesStates:
|
matchesStates:
|
||||||
| 'idle'
|
| 'idle'
|
||||||
| 'idle.error'
|
| 'idle.error'
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import { assign, createMachine, send } from 'xstate'
|
import { assign, createMachine, send } from 'xstate'
|
||||||
import { INVALID_PASSWORD_ERROR } from '../errors'
|
import { INVALID_PASSWORD_ERROR } from '../errors'
|
||||||
import { AuthClient } from '../internal-client'
|
import { AuthClient } from '../internal-client'
|
||||||
import { ChangePasswordResponse, ErrorPayload } from '../types'
|
import { AuthErrorPayload, ChangePasswordResponse } from '../types'
|
||||||
import { postFetch } from '../utils'
|
import { postFetch } from '../utils'
|
||||||
import { isValidPassword } from '../utils/validators'
|
import { isValidPassword } from '../utils/validators'
|
||||||
|
|
||||||
export type ChangePasswordContext = {
|
export type ChangePasswordContext = {
|
||||||
error: ErrorPayload | null
|
error: AuthErrorPayload | null
|
||||||
}
|
}
|
||||||
export type ChangePasswordEvents =
|
export type ChangePasswordEvents =
|
||||||
| {
|
| {
|
||||||
@@ -15,7 +15,7 @@ export type ChangePasswordEvents =
|
|||||||
ticket?: string
|
ticket?: string
|
||||||
}
|
}
|
||||||
| { type: 'SUCCESS' }
|
| { type: 'SUCCESS' }
|
||||||
| { type: 'ERROR'; error: ErrorPayload | null }
|
| { type: 'ERROR'; error: AuthErrorPayload | null }
|
||||||
|
|
||||||
export type ChangePasswordServices = {
|
export type ChangePasswordServices = {
|
||||||
requestChange: { data: ChangePasswordResponse }
|
requestChange: { data: ChangePasswordResponse }
|
||||||
|
|||||||
@@ -16,9 +16,9 @@ export interface Typegen0 {
|
|||||||
}
|
}
|
||||||
missingImplementations: {
|
missingImplementations: {
|
||||||
actions: never
|
actions: never
|
||||||
services: never
|
|
||||||
guards: never
|
|
||||||
delays: never
|
delays: never
|
||||||
|
guards: never
|
||||||
|
services: never
|
||||||
}
|
}
|
||||||
eventsCausingActions: {
|
eventsCausingActions: {
|
||||||
reportError: 'error.platform.requestChange'
|
reportError: 'error.platform.requestChange'
|
||||||
@@ -26,13 +26,13 @@ export interface Typegen0 {
|
|||||||
saveInvalidPasswordError: 'REQUEST'
|
saveInvalidPasswordError: 'REQUEST'
|
||||||
saveRequestError: 'error.platform.requestChange'
|
saveRequestError: 'error.platform.requestChange'
|
||||||
}
|
}
|
||||||
eventsCausingServices: {
|
eventsCausingDelays: {}
|
||||||
requestChange: 'REQUEST'
|
|
||||||
}
|
|
||||||
eventsCausingGuards: {
|
eventsCausingGuards: {
|
||||||
invalidPassword: 'REQUEST'
|
invalidPassword: 'REQUEST'
|
||||||
}
|
}
|
||||||
eventsCausingDelays: {}
|
eventsCausingServices: {
|
||||||
|
requestChange: 'REQUEST'
|
||||||
|
}
|
||||||
matchesStates:
|
matchesStates:
|
||||||
| 'idle'
|
| 'idle'
|
||||||
| 'idle.error'
|
| 'idle.error'
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import { assign, createMachine, send } from 'xstate'
|
import { assign, createMachine, send } from 'xstate'
|
||||||
import { INVALID_MFA_CODE_ERROR, INVALID_MFA_TYPE_ERROR } from '../errors'
|
import { INVALID_MFA_CODE_ERROR, INVALID_MFA_TYPE_ERROR } from '../errors'
|
||||||
import { AuthClient } from '../internal-client'
|
import { AuthClient } from '../internal-client'
|
||||||
import { ErrorPayload } from '../types'
|
import { AuthErrorPayload } from '../types'
|
||||||
import { getFetch, postFetch } from '../utils'
|
import { getFetch, postFetch } from '../utils'
|
||||||
|
|
||||||
export type EnableMfaContext = {
|
export type EnableMfaContext = {
|
||||||
error: ErrorPayload | null
|
error: AuthErrorPayload | null
|
||||||
imageUrl: string | null
|
imageUrl: string | null
|
||||||
secret: string | null
|
secret: string | null
|
||||||
}
|
}
|
||||||
@@ -20,9 +20,9 @@ export type EnableMfaEvents =
|
|||||||
activeMfaType: 'totp'
|
activeMfaType: 'totp'
|
||||||
}
|
}
|
||||||
| { type: 'GENERATED' }
|
| { type: 'GENERATED' }
|
||||||
| { type: 'GENERATED_ERROR'; error: ErrorPayload | null }
|
| { type: 'GENERATED_ERROR'; error: AuthErrorPayload | null }
|
||||||
| { type: 'SUCCESS' }
|
| { type: 'SUCCESS' }
|
||||||
| { type: 'ERROR'; error: ErrorPayload | null }
|
| { type: 'ERROR'; error: AuthErrorPayload | null }
|
||||||
|
|
||||||
export type EnableMfadMachine = ReturnType<typeof createEnableMfaMachine>
|
export type EnableMfadMachine = ReturnType<typeof createEnableMfaMachine>
|
||||||
|
|
||||||
|
|||||||
@@ -23,9 +23,9 @@ export interface Typegen0 {
|
|||||||
}
|
}
|
||||||
missingImplementations: {
|
missingImplementations: {
|
||||||
actions: never
|
actions: never
|
||||||
services: never
|
|
||||||
guards: never
|
|
||||||
delays: never
|
delays: never
|
||||||
|
guards: never
|
||||||
|
services: never
|
||||||
}
|
}
|
||||||
eventsCausingActions: {
|
eventsCausingActions: {
|
||||||
reportError: 'error.platform.activate'
|
reportError: 'error.platform.activate'
|
||||||
@@ -37,15 +37,15 @@ export interface Typegen0 {
|
|||||||
saveInvalidMfaCodeError: 'ACTIVATE'
|
saveInvalidMfaCodeError: 'ACTIVATE'
|
||||||
saveInvalidMfaTypeError: 'ACTIVATE'
|
saveInvalidMfaTypeError: 'ACTIVATE'
|
||||||
}
|
}
|
||||||
eventsCausingServices: {
|
eventsCausingDelays: {}
|
||||||
activate: 'ACTIVATE'
|
|
||||||
generate: 'GENERATE'
|
|
||||||
}
|
|
||||||
eventsCausingGuards: {
|
eventsCausingGuards: {
|
||||||
invalidMfaCode: 'ACTIVATE'
|
invalidMfaCode: 'ACTIVATE'
|
||||||
invalidMfaType: 'ACTIVATE'
|
invalidMfaType: 'ACTIVATE'
|
||||||
}
|
}
|
||||||
eventsCausingDelays: {}
|
eventsCausingServices: {
|
||||||
|
activate: 'ACTIVATE'
|
||||||
|
generate: 'GENERATE'
|
||||||
|
}
|
||||||
matchesStates:
|
matchesStates:
|
||||||
| 'generated'
|
| 'generated'
|
||||||
| 'generated.activated'
|
| 'generated.activated'
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import { assign, createMachine, send } from 'xstate'
|
import { assign, createMachine, send } from 'xstate'
|
||||||
import { INVALID_EMAIL_ERROR } from '../errors'
|
import { INVALID_EMAIL_ERROR } from '../errors'
|
||||||
import { AuthClient } from '../internal-client'
|
import { AuthClient } from '../internal-client'
|
||||||
import { ErrorPayload, ResetPasswordOptions, ResetPasswordResponse } from '../types'
|
import { AuthErrorPayload, ResetPasswordOptions, ResetPasswordResponse } from '../types'
|
||||||
import { postFetch, rewriteRedirectTo } from '../utils'
|
import { postFetch, rewriteRedirectTo } from '../utils'
|
||||||
import { isValidEmail } from '../utils/validators'
|
import { isValidEmail } from '../utils/validators'
|
||||||
|
|
||||||
export type ResetPasswordContext = {
|
export type ResetPasswordContext = {
|
||||||
error: ErrorPayload | null
|
error: AuthErrorPayload | null
|
||||||
}
|
}
|
||||||
export type ResetPasswordEvents =
|
export type ResetPasswordEvents =
|
||||||
| {
|
| {
|
||||||
@@ -15,7 +15,7 @@ export type ResetPasswordEvents =
|
|||||||
options?: ResetPasswordOptions
|
options?: ResetPasswordOptions
|
||||||
}
|
}
|
||||||
| { type: 'SUCCESS' }
|
| { type: 'SUCCESS' }
|
||||||
| { type: 'ERROR'; error: ErrorPayload | null }
|
| { type: 'ERROR'; error: AuthErrorPayload | null }
|
||||||
|
|
||||||
export type ResetPasswordServices = {
|
export type ResetPasswordServices = {
|
||||||
requestChange: { data: ResetPasswordResponse }
|
requestChange: { data: ResetPasswordResponse }
|
||||||
|
|||||||
@@ -16,9 +16,9 @@ export interface Typegen0 {
|
|||||||
}
|
}
|
||||||
missingImplementations: {
|
missingImplementations: {
|
||||||
actions: never
|
actions: never
|
||||||
services: never
|
|
||||||
guards: never
|
|
||||||
delays: never
|
delays: never
|
||||||
|
guards: never
|
||||||
|
services: never
|
||||||
}
|
}
|
||||||
eventsCausingActions: {
|
eventsCausingActions: {
|
||||||
reportError: 'error.platform.requestChange'
|
reportError: 'error.platform.requestChange'
|
||||||
@@ -26,13 +26,13 @@ export interface Typegen0 {
|
|||||||
saveInvalidEmailError: 'REQUEST'
|
saveInvalidEmailError: 'REQUEST'
|
||||||
saveRequestError: 'error.platform.requestChange'
|
saveRequestError: 'error.platform.requestChange'
|
||||||
}
|
}
|
||||||
eventsCausingServices: {
|
eventsCausingDelays: {}
|
||||||
requestChange: 'REQUEST'
|
|
||||||
}
|
|
||||||
eventsCausingGuards: {
|
eventsCausingGuards: {
|
||||||
invalidEmail: 'REQUEST'
|
invalidEmail: 'REQUEST'
|
||||||
}
|
}
|
||||||
eventsCausingDelays: {}
|
eventsCausingServices: {
|
||||||
|
requestChange: 'REQUEST'
|
||||||
|
}
|
||||||
matchesStates:
|
matchesStates:
|
||||||
| 'idle'
|
| 'idle'
|
||||||
| 'idle.error'
|
| 'idle.error'
|
||||||
|
|||||||
@@ -1,12 +1,16 @@
|
|||||||
import { assign, createMachine, send } from 'xstate'
|
import { assign, createMachine, send } from 'xstate'
|
||||||
import { INVALID_EMAIL_ERROR } from '../errors'
|
import { INVALID_EMAIL_ERROR } from '../errors'
|
||||||
import { AuthClient } from '../internal-client'
|
import { AuthClient } from '../internal-client'
|
||||||
import { ErrorPayload, SendVerificationEmailOptions, SendVerificationEmailResponse } from '../types'
|
import {
|
||||||
|
AuthErrorPayload,
|
||||||
|
SendVerificationEmailOptions,
|
||||||
|
SendVerificationEmailResponse
|
||||||
|
} from '../types'
|
||||||
import { postFetch, rewriteRedirectTo } from '../utils'
|
import { postFetch, rewriteRedirectTo } from '../utils'
|
||||||
import { isValidEmail } from '../utils/validators'
|
import { isValidEmail } from '../utils/validators'
|
||||||
|
|
||||||
export type SendVerificationEmailContext = {
|
export type SendVerificationEmailContext = {
|
||||||
error: ErrorPayload | null
|
error: AuthErrorPayload | null
|
||||||
}
|
}
|
||||||
|
|
||||||
export type SendVerificationEmailEvents =
|
export type SendVerificationEmailEvents =
|
||||||
@@ -16,7 +20,7 @@ export type SendVerificationEmailEvents =
|
|||||||
options?: SendVerificationEmailOptions
|
options?: SendVerificationEmailOptions
|
||||||
}
|
}
|
||||||
| { type: 'SUCCESS' }
|
| { type: 'SUCCESS' }
|
||||||
| { type: 'ERROR'; error: ErrorPayload | null }
|
| { type: 'ERROR'; error: AuthErrorPayload | null }
|
||||||
|
|
||||||
export type SendVerificationEmailServices = {
|
export type SendVerificationEmailServices = {
|
||||||
request: { data: SendVerificationEmailResponse }
|
request: { data: SendVerificationEmailResponse }
|
||||||
|
|||||||
@@ -16,9 +16,9 @@ export interface Typegen0 {
|
|||||||
}
|
}
|
||||||
missingImplementations: {
|
missingImplementations: {
|
||||||
actions: never
|
actions: never
|
||||||
services: never
|
|
||||||
guards: never
|
|
||||||
delays: never
|
delays: never
|
||||||
|
guards: never
|
||||||
|
services: never
|
||||||
}
|
}
|
||||||
eventsCausingActions: {
|
eventsCausingActions: {
|
||||||
reportError: 'error.platform.request'
|
reportError: 'error.platform.request'
|
||||||
@@ -26,13 +26,13 @@ export interface Typegen0 {
|
|||||||
saveInvalidEmailError: 'REQUEST'
|
saveInvalidEmailError: 'REQUEST'
|
||||||
saveRequestError: 'error.platform.request'
|
saveRequestError: 'error.platform.request'
|
||||||
}
|
}
|
||||||
eventsCausingServices: {
|
eventsCausingDelays: {}
|
||||||
request: 'REQUEST'
|
|
||||||
}
|
|
||||||
eventsCausingGuards: {
|
eventsCausingGuards: {
|
||||||
invalidEmail: 'REQUEST'
|
invalidEmail: 'REQUEST'
|
||||||
}
|
}
|
||||||
eventsCausingDelays: {}
|
eventsCausingServices: {
|
||||||
|
request: 'REQUEST'
|
||||||
|
}
|
||||||
matchesStates:
|
matchesStates:
|
||||||
| 'idle'
|
| 'idle'
|
||||||
| 'idle.error'
|
| 'idle.error'
|
||||||
|
|||||||
@@ -6,14 +6,14 @@ import {
|
|||||||
import { postFetch } from '..'
|
import { postFetch } from '..'
|
||||||
import { CodifiedError } from '../errors'
|
import { CodifiedError } from '../errors'
|
||||||
import { AuthClient } from '../internal-client'
|
import { AuthClient } from '../internal-client'
|
||||||
import { ErrorPayload, SecurityKey } from '../types'
|
import { AuthErrorPayload, SecurityKey } from '../types'
|
||||||
import { ActionErrorState, ActionLoadingState, ActionSuccessState } from './types'
|
import { AuthActionErrorState, AuthActionLoadingState, AuthActionSuccessState } from './types'
|
||||||
|
|
||||||
export interface AddSecurityKeyHandlerResult extends ActionErrorState, ActionSuccessState {
|
export interface AddSecurityKeyHandlerResult extends AuthActionErrorState, AuthActionSuccessState {
|
||||||
key?: SecurityKey
|
key?: SecurityKey
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface AddSecurityKeyState extends AddSecurityKeyHandlerResult, ActionLoadingState {}
|
export interface AddSecurityKeyState extends AddSecurityKeyHandlerResult, AuthActionLoadingState {}
|
||||||
|
|
||||||
export const addSecurityKeyPromise = async (
|
export const addSecurityKeyPromise = async (
|
||||||
{ backendUrl, interpreter }: AuthClient,
|
{ backendUrl, interpreter }: AuthClient,
|
||||||
@@ -38,7 +38,7 @@ export const addSecurityKeyPromise = async (
|
|||||||
)
|
)
|
||||||
return { key, isError: false, error: null, isSuccess: true }
|
return { key, isError: false, error: null, isSuccess: true }
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
const { error } = e as { error: ErrorPayload }
|
const { error } = e as { error: AuthErrorPayload }
|
||||||
return { isError: true, error, isSuccess: false }
|
return { isError: true, error, isSuccess: false }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,10 +3,12 @@ import { InterpreterFrom } from 'xstate'
|
|||||||
import { ChangeEmailMachine } from '../machines'
|
import { ChangeEmailMachine } from '../machines'
|
||||||
import { ChangeEmailOptions } from '../types'
|
import { ChangeEmailOptions } from '../types'
|
||||||
|
|
||||||
import { ActionErrorState, ActionLoadingState, NeedsEmailVerificationState } from './types'
|
import { AuthActionErrorState, AuthActionLoadingState, NeedsEmailVerificationState } from './types'
|
||||||
export interface ChangeEmailHandlerResult extends ActionErrorState, NeedsEmailVerificationState {}
|
export interface ChangeEmailHandlerResult
|
||||||
|
extends AuthActionErrorState,
|
||||||
|
NeedsEmailVerificationState {}
|
||||||
|
|
||||||
export interface ChangeEmailState extends ChangeEmailHandlerResult, ActionLoadingState {}
|
export interface ChangeEmailState extends ChangeEmailHandlerResult, AuthActionLoadingState {}
|
||||||
|
|
||||||
export const changeEmailPromise = async (
|
export const changeEmailPromise = async (
|
||||||
interpreter: InterpreterFrom<ChangeEmailMachine>,
|
interpreter: InterpreterFrom<ChangeEmailMachine>,
|
||||||
|
|||||||
@@ -2,11 +2,11 @@ import { InterpreterFrom } from 'xstate'
|
|||||||
|
|
||||||
import { ChangePasswordMachine } from '../machines'
|
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 (
|
export const changePasswordPromise = async (
|
||||||
interpreter: InterpreterFrom<ChangePasswordMachine>,
|
interpreter: InterpreterFrom<ChangePasswordMachine>,
|
||||||
|
|||||||
@@ -2,9 +2,9 @@ import { InterpreterFrom } from 'xstate'
|
|||||||
|
|
||||||
import { EnableMfadMachine } from '../machines'
|
import { EnableMfadMachine } from '../machines'
|
||||||
|
|
||||||
import { ActionErrorState } from './types'
|
import { AuthActionErrorState } from './types'
|
||||||
|
|
||||||
export interface GenerateQrCodeHandlerResult extends ActionErrorState {
|
export interface GenerateQrCodeHandlerResult extends AuthActionErrorState {
|
||||||
qrCodeDataUrl: string
|
qrCodeDataUrl: string
|
||||||
isGenerated: boolean
|
isGenerated: boolean
|
||||||
}
|
}
|
||||||
@@ -12,7 +12,7 @@ export interface GenerateQrCodeHandlerResult extends ActionErrorState {
|
|||||||
export interface GenerateQrCodeState extends GenerateQrCodeHandlerResult {
|
export interface GenerateQrCodeState extends GenerateQrCodeHandlerResult {
|
||||||
isGenerating: boolean
|
isGenerating: boolean
|
||||||
}
|
}
|
||||||
export interface ActivateMfaHandlerResult extends ActionErrorState {
|
export interface ActivateMfaHandlerResult extends AuthActionErrorState {
|
||||||
isActivated: boolean
|
isActivated: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,14 +3,14 @@ import { InterpreterFrom } from 'xstate'
|
|||||||
import { ResetPasswordMachine } from '../machines'
|
import { ResetPasswordMachine } from '../machines'
|
||||||
import { ResetPasswordOptions } from '../types'
|
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 */
|
/** Returns `true` when an email to reset the password has been sent */
|
||||||
isSent: boolean
|
isSent: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ResetPasswordState extends ResetPasswordHandlerResult, ActionLoadingState {}
|
export interface ResetPasswordState extends ResetPasswordHandlerResult, AuthActionLoadingState {}
|
||||||
|
|
||||||
export const resetPasswordPromise = async (
|
export const resetPasswordPromise = async (
|
||||||
interpreter: InterpreterFrom<ResetPasswordMachine>,
|
interpreter: InterpreterFrom<ResetPasswordMachine>,
|
||||||
|
|||||||
@@ -3,15 +3,15 @@ import { InterpreterFrom } from 'xstate'
|
|||||||
import { SendVerificationEmailMachine } from '../machines'
|
import { SendVerificationEmailMachine } from '../machines'
|
||||||
import { SendVerificationEmailOptions } from '../types'
|
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 */
|
/** Returns `true` when a new verification email has been sent */
|
||||||
isSent: boolean
|
isSent: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SendVerificationEmailState
|
export interface SendVerificationEmailState
|
||||||
extends ActionLoadingState,
|
extends AuthActionLoadingState,
|
||||||
SendVerificationEmailHandlerResult {}
|
SendVerificationEmailHandlerResult {}
|
||||||
|
|
||||||
export const sendVerificationEmailPromise = (
|
export const sendVerificationEmailPromise = (
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
import { USER_ALREADY_SIGNED_IN } from '../errors'
|
import { USER_ALREADY_SIGNED_IN } from '../errors'
|
||||||
import { AuthInterpreter } from '../machines'
|
import { AuthInterpreter } from '../machines'
|
||||||
|
|
||||||
import { ActionLoadingState, SessionActionHandlerResult } from './types'
|
import { AuthActionLoadingState, SessionActionHandlerResult } from './types'
|
||||||
|
|
||||||
export interface SignInAnonymousHandlerResult extends SessionActionHandlerResult {}
|
export interface SignInAnonymousHandlerResult extends SessionActionHandlerResult {}
|
||||||
export interface SignInAnonymousState extends SignInAnonymousHandlerResult, ActionLoadingState {}
|
export interface SignInAnonymousState
|
||||||
|
extends SignInAnonymousHandlerResult,
|
||||||
|
AuthActionLoadingState {}
|
||||||
|
|
||||||
export const signInAnonymousPromise = (
|
export const signInAnonymousPromise = (
|
||||||
interpreter: AuthInterpreter
|
interpreter: AuthInterpreter
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { USER_ALREADY_SIGNED_IN } from '../errors'
|
|||||||
import { AuthInterpreter } from '../machines'
|
import { AuthInterpreter } from '../machines'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
ActionLoadingState,
|
AuthActionLoadingState,
|
||||||
NeedsEmailVerificationState,
|
NeedsEmailVerificationState,
|
||||||
SessionActionHandlerResult
|
SessionActionHandlerResult
|
||||||
} from './types'
|
} from './types'
|
||||||
@@ -18,7 +18,7 @@ export interface SignInEmailPasswordHandlerResult
|
|||||||
|
|
||||||
export interface SignInEmailPasswordState
|
export interface SignInEmailPasswordState
|
||||||
extends SignInEmailPasswordHandlerResult,
|
extends SignInEmailPasswordHandlerResult,
|
||||||
ActionLoadingState {}
|
AuthActionLoadingState {}
|
||||||
|
|
||||||
export const signInEmailPasswordPromise = (
|
export const signInEmailPasswordPromise = (
|
||||||
interpreter: AuthInterpreter,
|
interpreter: AuthInterpreter,
|
||||||
|
|||||||
@@ -2,13 +2,13 @@ import { USER_ALREADY_SIGNED_IN } from '../errors'
|
|||||||
import { AuthInterpreter } from '../machines'
|
import { AuthInterpreter } from '../machines'
|
||||||
import { PasswordlessOptions } from '../types'
|
import { PasswordlessOptions } from '../types'
|
||||||
|
|
||||||
import { ActionErrorState, ActionLoadingState, ActionSuccessState } from './types'
|
import { AuthActionErrorState, AuthActionLoadingState, AuthActionSuccessState } from './types'
|
||||||
export interface SignInEmailPasswordlessHandlerResult
|
export interface SignInEmailPasswordlessHandlerResult
|
||||||
extends ActionErrorState,
|
extends AuthActionErrorState,
|
||||||
ActionSuccessState {}
|
AuthActionSuccessState {}
|
||||||
export interface SignInEmailPasswordlessState
|
export interface SignInEmailPasswordlessState
|
||||||
extends SignInEmailPasswordlessHandlerResult,
|
extends SignInEmailPasswordlessHandlerResult,
|
||||||
ActionLoadingState {}
|
AuthActionLoadingState {}
|
||||||
|
|
||||||
export const signInEmailPasswordlessPromise = (
|
export const signInEmailPasswordlessPromise = (
|
||||||
interpreter: AuthInterpreter,
|
interpreter: AuthInterpreter,
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { USER_ALREADY_SIGNED_IN } from '../errors'
|
|||||||
import { AuthInterpreter } from '../machines'
|
import { AuthInterpreter } from '../machines'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
ActionLoadingState,
|
AuthActionLoadingState,
|
||||||
NeedsEmailVerificationState,
|
NeedsEmailVerificationState,
|
||||||
SessionActionHandlerResult
|
SessionActionHandlerResult
|
||||||
} from './types'
|
} from './types'
|
||||||
@@ -13,7 +13,7 @@ export interface SignInSecurityKeyPasswordlessHandlerResult
|
|||||||
|
|
||||||
export interface SignInSecurityKeyPasswordlessState
|
export interface SignInSecurityKeyPasswordlessState
|
||||||
extends SignInSecurityKeyPasswordlessHandlerResult,
|
extends SignInSecurityKeyPasswordlessHandlerResult,
|
||||||
ActionLoadingState {}
|
AuthActionLoadingState {}
|
||||||
|
|
||||||
export const signInEmailSecurityKeyPromise = (interpreter: AuthInterpreter, email: string) =>
|
export const signInEmailSecurityKeyPromise = (interpreter: AuthInterpreter, email: string) =>
|
||||||
new Promise<SignInSecurityKeyPasswordlessHandlerResult>((resolve) => {
|
new Promise<SignInSecurityKeyPasswordlessHandlerResult>((resolve) => {
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import { USER_ALREADY_SIGNED_IN } from '../errors'
|
import { USER_ALREADY_SIGNED_IN } from '../errors'
|
||||||
import { AuthInterpreter } from '../machines'
|
import { AuthInterpreter } from '../machines'
|
||||||
|
|
||||||
import { ActionLoadingState, SessionActionHandlerResult } from './types'
|
import { AuthActionLoadingState, SessionActionHandlerResult } from './types'
|
||||||
|
|
||||||
export interface SignInMfaTotpHandlerResult extends SessionActionHandlerResult {}
|
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) =>
|
export const signInMfaTotpPromise = (interpreter: AuthInterpreter, otp: string, ticket?: string) =>
|
||||||
new Promise<SignInMfaTotpHandlerResult>((resolve) => {
|
new Promise<SignInMfaTotpHandlerResult>((resolve) => {
|
||||||
|
|||||||
@@ -2,13 +2,15 @@ import { USER_ALREADY_SIGNED_IN } from '../errors'
|
|||||||
import { AuthInterpreter } from '../machines'
|
import { AuthInterpreter } from '../machines'
|
||||||
import { PasswordlessOptions } from '../types'
|
import { PasswordlessOptions } from '../types'
|
||||||
|
|
||||||
import { ActionErrorState, ActionLoadingState, ActionSuccessState } from './types'
|
import { AuthActionErrorState, AuthActionLoadingState, AuthActionSuccessState } from './types'
|
||||||
|
|
||||||
export interface SignInSmsPasswordlessState
|
export interface SignInSmsPasswordlessState
|
||||||
extends SignInSmsPasswordlessHandlerResult,
|
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.
|
* 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.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import { USER_ALREADY_SIGNED_IN } from '../errors'
|
import { USER_ALREADY_SIGNED_IN } from '../errors'
|
||||||
import { AuthInterpreter } from '../machines'
|
import { AuthInterpreter } from '../machines'
|
||||||
|
|
||||||
import { ActionLoadingState, SessionActionHandlerResult } from './types'
|
import { AuthActionLoadingState, SessionActionHandlerResult } from './types'
|
||||||
|
|
||||||
export interface SignInSmsPasswordlessOtpHandlerResult extends SessionActionHandlerResult {}
|
export interface SignInSmsPasswordlessOtpHandlerResult extends SessionActionHandlerResult {}
|
||||||
export interface SignInSmsPasswordlessOtpState
|
export interface SignInSmsPasswordlessOtpState
|
||||||
extends SignInSmsPasswordlessOtpHandlerResult,
|
extends SignInSmsPasswordlessOtpHandlerResult,
|
||||||
ActionLoadingState {}
|
AuthActionLoadingState {}
|
||||||
|
|
||||||
export const signInSmsPasswordlessOtpPromise = (
|
export const signInSmsPasswordlessOtpPromise = (
|
||||||
interpreter: AuthInterpreter,
|
interpreter: AuthInterpreter,
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import { USER_UNAUTHENTICATED } from '../errors'
|
import { USER_UNAUTHENTICATED } from '../errors'
|
||||||
import { AuthInterpreter } from '../machines'
|
import { AuthInterpreter } from '../machines'
|
||||||
|
|
||||||
import { ActionErrorState, ActionLoadingState, ActionSuccessState } from './types'
|
import { AuthActionErrorState, AuthActionLoadingState, AuthActionSuccessState } from './types'
|
||||||
|
|
||||||
export interface SignOutlessHandlerResult extends ActionErrorState, ActionSuccessState {}
|
export interface SignOutlessHandlerResult extends AuthActionErrorState, AuthActionSuccessState {}
|
||||||
export interface SignOutlessState extends SignOutlessHandlerResult, ActionLoadingState {}
|
export interface SignOutlessState extends SignOutlessHandlerResult, AuthActionLoadingState {}
|
||||||
|
|
||||||
export const signOutPromise = async (
|
export const signOutPromise = async (
|
||||||
interpreter: AuthInterpreter,
|
interpreter: AuthInterpreter,
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { AuthInterpreter } from '../machines'
|
|||||||
import { SignUpOptions } from '../types'
|
import { SignUpOptions } from '../types'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
ActionLoadingState,
|
AuthActionLoadingState,
|
||||||
NeedsEmailVerificationState,
|
NeedsEmailVerificationState,
|
||||||
SessionActionHandlerResult
|
SessionActionHandlerResult
|
||||||
} from './types'
|
} from './types'
|
||||||
@@ -14,7 +14,7 @@ export interface SignUpEmailPasswordHandlerResult
|
|||||||
|
|
||||||
export interface SignUpEmailPasswordState
|
export interface SignUpEmailPasswordState
|
||||||
extends SignUpEmailPasswordHandlerResult,
|
extends SignUpEmailPasswordHandlerResult,
|
||||||
ActionLoadingState {}
|
AuthActionLoadingState {}
|
||||||
|
|
||||||
export const signUpEmailPasswordPromise = (
|
export const signUpEmailPasswordPromise = (
|
||||||
interpreter: AuthInterpreter,
|
interpreter: AuthInterpreter,
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { AuthInterpreter } from '../machines'
|
|||||||
import { SignUpSecurityKeyOptions } from '../types'
|
import { SignUpSecurityKeyOptions } from '../types'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
ActionLoadingState,
|
AuthActionLoadingState,
|
||||||
NeedsEmailVerificationState,
|
NeedsEmailVerificationState,
|
||||||
SessionActionHandlerResult
|
SessionActionHandlerResult
|
||||||
} from './types'
|
} from './types'
|
||||||
@@ -14,7 +14,7 @@ export interface SignUpSecurityKeyHandlerResult
|
|||||||
|
|
||||||
export interface SignUpSecurityKeyState
|
export interface SignUpSecurityKeyState
|
||||||
extends SignUpSecurityKeyHandlerResult,
|
extends SignUpSecurityKeyHandlerResult,
|
||||||
ActionLoadingState {}
|
AuthActionLoadingState {}
|
||||||
|
|
||||||
export const signUpEmailSecurityKeyPromise = (
|
export const signUpEmailSecurityKeyPromise = (
|
||||||
interpreter: AuthInterpreter,
|
interpreter: AuthInterpreter,
|
||||||
|
|||||||
@@ -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
|
* @return `true` if an error occurred
|
||||||
* @depreacted use `!isSuccess` or `!!error` instead
|
* @depreacted use `!isSuccess` or `!!error` instead
|
||||||
* */
|
* */
|
||||||
isError: boolean
|
isError: boolean
|
||||||
/** Provides details about the error */
|
/** 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.
|
* @return `true` when the action is executing, `false` when it finished its execution.
|
||||||
*/
|
*/
|
||||||
isLoading: boolean
|
isLoading: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ActionSuccessState {
|
export interface AuthActionSuccessState {
|
||||||
/** Returns `true` if the action is successful. */
|
/** Returns `true` if the action is successful. */
|
||||||
isSuccess: boolean
|
isSuccess: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SessionActionHandlerResult extends ActionSuccessState, ActionErrorState {
|
export interface SessionActionHandlerResult extends AuthActionSuccessState, AuthActionErrorState {
|
||||||
/** User information */
|
/** User information */
|
||||||
user: User | null
|
user: User | null
|
||||||
/** Access token (JWT) */
|
/** Access token (JWT) */
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
// TODO shared with other packages
|
// TODO shared with other packages
|
||||||
export type ErrorPayload = {
|
export type AuthErrorPayload = {
|
||||||
error: string
|
error: string
|
||||||
status: number
|
status: number
|
||||||
message: string
|
message: string
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
import { ErrorPayload, NhostSession } from './common'
|
import { AuthErrorPayload, NhostSession } from './common'
|
||||||
|
|
||||||
// Hasura-auth API response types
|
// Hasura-auth API response types
|
||||||
export interface NullableErrorResponse {
|
export interface NullableErrorResponse {
|
||||||
error: ErrorPayload | null
|
error: AuthErrorPayload | null
|
||||||
}
|
}
|
||||||
|
|
||||||
/** session payload from common hasura-auth responses */
|
/** session payload from common hasura-auth responses */
|
||||||
export type NhostSessionResponse =
|
export type NhostSessionResponse =
|
||||||
| { session: null; error: ErrorPayload }
|
| { session: null; error: AuthErrorPayload }
|
||||||
| { session: NhostSession | null; error: null }
|
| { session: NhostSession | null; error: null }
|
||||||
|
|
||||||
/** payload from hasura-auth endpoint /signin/email-password */
|
/** payload from hasura-auth endpoint /signin/email-password */
|
||||||
@@ -16,7 +16,7 @@ export interface SignInResponse {
|
|||||||
mfa: {
|
mfa: {
|
||||||
ticket: string
|
ticket: string
|
||||||
} | null
|
} | null
|
||||||
error: ErrorPayload | null
|
error: AuthErrorPayload | null
|
||||||
}
|
}
|
||||||
|
|
||||||
/** payload from hasura-auth endpoint /signup/email-password */
|
/** payload from hasura-auth endpoint /signup/email-password */
|
||||||
|
|||||||
@@ -1,5 +1,15 @@
|
|||||||
# @nhost/hasura-storage-js
|
# @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
|
## 2.0.5
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@nhost/hasura-storage-js",
|
"name": "@nhost/hasura-storage-js",
|
||||||
"version": "2.0.5",
|
"version": "2.1.0",
|
||||||
"description": "Hasura-storage client",
|
"description": "Hasura-storage client",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
@@ -41,7 +41,8 @@
|
|||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite build --config ../../config/vite.lib.dev.config.js",
|
"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:lib": "vite build",
|
||||||
"build:umd": "vite build --config ../../config/vite.lib.umd.config.js",
|
"build:umd": "vite build --config ../../config/vite.lib.umd.config.js",
|
||||||
"e2e": "start-test e2e:backend http-get://localhost:9695 ci:test",
|
"e2e": "start-test e2e:backend http-get://localhost:9695 ci:test",
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import FormData from 'form-data'
|
import FormData from 'form-data'
|
||||||
import { assign, createMachine } from 'xstate'
|
import { assign, createMachine } from 'xstate'
|
||||||
import { ErrorPayload, FileUploadConfig } from '../utils'
|
import { FileUploadConfig, StorageErrorPayload } from '../utils'
|
||||||
import { fetchUpload } from '../utils/upload'
|
import { fetchUpload } from '../utils/upload'
|
||||||
|
|
||||||
export type FileUploadContext = {
|
export type FileUploadContext = {
|
||||||
progress: number | null
|
progress: number | null
|
||||||
loaded: number
|
loaded: number
|
||||||
error: ErrorPayload | null
|
error: StorageErrorPayload | null
|
||||||
id?: string
|
id?: string
|
||||||
bucketId?: string
|
bucketId?: string
|
||||||
file?: File
|
file?: File
|
||||||
@@ -24,7 +24,7 @@ export type FileUploadEvents =
|
|||||||
} & FileUploadConfig)
|
} & FileUploadConfig)
|
||||||
| { type: 'UPLOAD_PROGRESS'; progress: number; loaded: number; additions: number }
|
| { type: 'UPLOAD_PROGRESS'; progress: number; loaded: number; additions: number }
|
||||||
| { type: 'UPLOAD_DONE'; id: string; bucketId: string }
|
| { type: 'UPLOAD_DONE'; id: string; bucketId: string }
|
||||||
| { type: 'UPLOAD_ERROR'; error: ErrorPayload }
|
| { type: 'UPLOAD_ERROR'; error: StorageErrorPayload }
|
||||||
| { type: 'CANCEL' }
|
| { type: 'CANCEL' }
|
||||||
| { type: 'DESTROY' }
|
| { type: 'DESTROY' }
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { InterpreterFrom } from 'xstate'
|
import { InterpreterFrom } from 'xstate'
|
||||||
|
|
||||||
import { FileItemRef, FileUploadMachine } from '../machines'
|
import { FileItemRef, FileUploadMachine } from '../machines'
|
||||||
import { ActionErrorState, FileUploadConfig, StorageUploadFileParams } from '../utils'
|
import { FileUploadConfig, StorageActionErrorState, StorageUploadFileParams } from '../utils'
|
||||||
|
|
||||||
export interface UploadProgressState {
|
export interface UploadProgressState {
|
||||||
/**
|
/**
|
||||||
@@ -14,7 +14,7 @@ export interface UploadProgressState {
|
|||||||
progress: number | null
|
progress: number | null
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface UploadFileHandlerResult extends ActionErrorState {
|
export interface UploadFileHandlerResult extends StorageActionErrorState {
|
||||||
/**
|
/**
|
||||||
* Returns `true` when the file has been successfully uploaded.
|
* Returns `true` when the file has been successfully uploaded.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import appendImageTransformationParameters from './appendImageTransformationPara
|
|||||||
|
|
||||||
test('should append image transformation parameters to a simple URL', () => {
|
test('should append image transformation parameters to a simple URL', () => {
|
||||||
expect(
|
expect(
|
||||||
appendImageTransformationParameters('https://example.com/', {
|
appendImageTransformationParameters('https://example.com', {
|
||||||
width: 100,
|
width: 100,
|
||||||
height: 100,
|
height: 100,
|
||||||
blur: 50,
|
blur: 50,
|
||||||
@@ -25,7 +25,7 @@ test('should append image transformation parameters to a URL with existing query
|
|||||||
|
|
||||||
test('should not append falsy values', () => {
|
test('should not append falsy values', () => {
|
||||||
expect(
|
expect(
|
||||||
appendImageTransformationParameters('https://example.com/', {
|
appendImageTransformationParameters('https://example.com', {
|
||||||
width: undefined,
|
width: undefined,
|
||||||
height: 100,
|
height: 100,
|
||||||
blur: undefined,
|
blur: undefined,
|
||||||
@@ -35,7 +35,9 @@ test('should not append falsy values', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
test('should keep the original URL if no transformation parameters are provided', () => {
|
test('should keep the original URL if no transformation parameters are provided', () => {
|
||||||
expect(appendImageTransformationParameters('https://example.com/', {})).toBe(
|
expect(appendImageTransformationParameters('https://example.com')).toBe('https://example.com')
|
||||||
'https://example.com/'
|
expect(
|
||||||
)
|
appendImageTransformationParameters('https://example.com/?param1=test_data¶m2=test_data')
|
||||||
|
).toBe('https://example.com/?param1=test_data¶m2=test_data')
|
||||||
|
expect(appendImageTransformationParameters('https://example.com/')).toBe('https://example.com/')
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -12,8 +12,12 @@ import { StorageImageTransformationParams } from '../types'
|
|||||||
*/
|
*/
|
||||||
export default function appendImageTransformationParameters(
|
export default function appendImageTransformationParameters(
|
||||||
url: string,
|
url: string,
|
||||||
params: StorageImageTransformationParams
|
params?: StorageImageTransformationParams
|
||||||
): string {
|
): string {
|
||||||
|
if (!params || Object.keys(params).length === 0) {
|
||||||
|
return url
|
||||||
|
}
|
||||||
|
|
||||||
const urlObject = new URL(url)
|
const urlObject = new URL(url)
|
||||||
|
|
||||||
// create an object with the transformation parameters by using the first
|
// create an object with the transformation parameters by using the first
|
||||||
|
|||||||
@@ -1,21 +1,21 @@
|
|||||||
import FormData from 'form-data'
|
import FormData from 'form-data'
|
||||||
|
|
||||||
// TODO shared with other packages
|
// TODO shared with other packages
|
||||||
export type ErrorPayload = {
|
export type StorageErrorPayload = {
|
||||||
error: string
|
error: string
|
||||||
status: number
|
status: number
|
||||||
message: string
|
message: string
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO shared with other packages
|
// TODO shared with other packages
|
||||||
export interface ActionErrorState {
|
export interface StorageActionErrorState {
|
||||||
/**
|
/**
|
||||||
* @return `true` if an error occurred
|
* @return `true` if an error occurred
|
||||||
* @depreacted use `!isSuccess` or `!!error` instead
|
* @depreacted use `!isSuccess` or `!!error` instead
|
||||||
* */
|
* */
|
||||||
isError: boolean
|
isError: boolean
|
||||||
/** Provides details about the error */
|
/** Provides details about the error */
|
||||||
error: ErrorPayload | null
|
error: StorageErrorPayload | null
|
||||||
}
|
}
|
||||||
|
|
||||||
// * Avoid circular references and broken links in docusaurus generated docs
|
// * Avoid circular references and broken links in docusaurus generated docs
|
||||||
@@ -46,7 +46,7 @@ export type StorageUploadParams = StorageUploadFileParams | StorageUploadFormDat
|
|||||||
|
|
||||||
export type StorageUploadResponse =
|
export type StorageUploadResponse =
|
||||||
| { fileMetadata: FileResponse; error: null }
|
| { fileMetadata: FileResponse; error: null }
|
||||||
| { fileMetadata: null; error: ErrorPayload }
|
| { fileMetadata: null; error: StorageErrorPayload }
|
||||||
|
|
||||||
export interface StorageImageTransformationParams {
|
export interface StorageImageTransformationParams {
|
||||||
/** Image width, in pixels */
|
/** Image width, in pixels */
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user