fix (packages): update storage/auth e2e config (#3306)

### **PR Type**
Enhancement, Tests


___

### **Description**
- Update e2e configuration for hasura-auth-js and hasura-storage-js

- Modify CI workflow for package-specific Nhost CLI shutdown

- Adjust test scripts in package.json files

- Add changeset for patch updates


___



### **Changes walkthrough** 📝
<table><thead><tr><th></th><th align="left">Relevant
files</th></tr></thead><tbody><tr><td><strong>Documentation</strong></td><td><table>
<tr>
  <td>
    <details>
<summary><strong>fluffy-shoes-cross.md</strong><dd><code>Add changeset
for auth and storage package updates</code>&nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; </dd></summary>
<hr>

.changeset/fluffy-shoes-cross.md

<li>Add new changeset file for patch updates<br> <li> Specify changes
for @nhost/hasura-storage-js and @nhost/hasura-auth-js


</details>


  </td>
<td><a
href="https://github.com/nhost/nhost/pull/3306/files#diff-bfec01342bb3adca8f892b1223015496f20919e642eb0cd4f2fc42f4a659f93b">+6/-0</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>
</table></td></tr><tr><td><strong>Enhancement</strong></td><td><table>
<tr>
  <td>
    <details>
<summary><strong>ci.yaml</strong><dd><code>Update CI workflow for
package-specific Nhost CLI shutdown</code></dd></summary>
<hr>

.github/workflows/ci.yaml

<li>Add new step to stop Nhost CLI for specific packages<br> <li> Ensure
Nhost CLI stops even if previous steps fail


</details>


  </td>
<td><a
href="https://github.com/nhost/nhost/pull/3306/files#diff-944291df2c9c06359d37cc8833d182d705c9e8c3108e7cfe132d61a06e9133dd">+6/-0</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>
</table></td></tr><tr><td><strong>Tests</strong></td><td><table>
<tr>
  <td>
    <details>
<summary><strong>package.json</strong><dd><code>Modify test scripts for
hasura-auth-js package</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
<hr>

packages/hasura-auth-js/package.json

<li>Update ci:test script to use vite.config.e2e.json<br> <li> Remove
Nhost CLI shutdown from ci:test script


</details>


  </td>
<td><a
href="https://github.com/nhost/nhost/pull/3306/files#diff-69ad7e7b51fc8532cb472f319780be5355e41c386f1cc223ce929369c3b87500">+1/-1</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>

<tr>
  <td>
    <details>
<summary><strong>package.json</strong><dd><code>Update test script for
hasura-storage-js package</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
<hr>

packages/hasura-storage-js/package.json

- Remove Nhost CLI shutdown from ci:test script


</details>


  </td>
<td><a
href="https://github.com/nhost/nhost/pull/3306/files#diff-eca15b254298d1b63d7c80b470d31e046d63ae93b1f09eb6dc3959e3a326560d">+1/-1</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>
</table></td></tr></tr></tbody></table>

___

> <details> <summary> Need help?</summary><li>Type <code>/help how to
...</code> in the comments thread for any questions about PR-Agent
usage.</li><li>Check out the <a
href="https://qodo-merge-docs.qodo.ai/usage-guide/">documentation</a>
for more information.</li></details>
This commit is contained in:
robertkasza
2025-04-25 18:21:09 +02:00
committed by GitHub
parent 0bf28085b7
commit 5ff4dd6e40
29 changed files with 286 additions and 62 deletions

View File

@@ -0,0 +1,6 @@
---
'@nhost/hasura-storage-js': patch
'@nhost/hasura-auth-js': patch
---
fix (hasura-auth-js|hasura-storage-js): update e2e config for packages

View File

@@ -190,6 +190,10 @@ jobs:
if: matrix.package.path == 'dashboard'
working-directory: ./nhost-test-project
run: nhost down
- name: Stop Nhost CLI for packages
if: always() && (matrix.package.path == 'packages/hasura-auth-js' || matrix.package.path == 'packages/hasura-storage-js')
working-directory: ./${{ matrix.package.path }}
run: nhost down
- id: file-name
if: ${{ failure() }}
name: Transform package name into a valid file name

View File

@@ -8,7 +8,7 @@ Make sure to install the dependencies:
pnpm install
```
## Settting up the environment
## Setting up the environment
Create a `.env` file in the root of the project with the following content:

View File

@@ -38,7 +38,7 @@
"react-dom": "^18.2.0",
"react-dropzone": "^14.2.3",
"react-hook-form": "^7.52.2",
"react-router-dom": "^6.22.3",
"react-router-dom": "^7.5.2",
"sonner": "^1.5.0",
"tailwind-merge": "^1.14.0",
"tailwindcss-animate": "^1.0.7",

View File

@@ -176,7 +176,8 @@
"axios@<1.8.2": ">=1.8.2",
"vite@>=5.0.0 <5.4.18": ">=5.4.18",
"vite@>=6.2.0 <6.2.6": ">=6.2.6",
"@sveltejs/kit@>=2.0.0 <2.20.6": ">=2.20.6"
"@sveltejs/kit@>=2.0.0 <2.20.6": ">=2.20.6",
"react-router@<7.5.2": ">=7.5.2"
}
}
}

View File

@@ -65,7 +65,7 @@ describe('emails', () => {
password
})
// sign in shoudl fail
// sign in should fail
const signInA = await auth.signIn({
email,
password

View File

@@ -13,7 +13,7 @@ const auth = new HasuraAuthClient({
})
const mailhog = createMailhogClient({
host: 'local.mailhog.nhost.run',
host: 'local.mailhog.local.nhost.run',
protocol: 'https:',
port: 443
})
@@ -21,7 +21,7 @@ const mailhog = createMailhogClient({
export { auth, mailhog }
/**
* Get the value of `a href` that follpws a given pattern
* Get the value of `a href` that follows a given pattern
* in the last email sent to a given email address.
*/
export const getHtmlLink = async (email: string, pattern: string) => {

View File

@@ -1 +1,9 @@
lockfileVersion: '6.0'
lockfileVersion: '9.0'
settings:
autoInstallPeers: true
excludeLinksFromLockfile: false
importers:
.: {}

View File

@@ -0,0 +1 @@
{}

View File

@@ -0,0 +1,26 @@
table:
name: refresh_token_types
schema: auth
is_enum: true
configuration:
column_config: {}
custom_column_names: {}
custom_name: authRefreshTokenTypes
custom_root_fields:
delete: deleteAuthRefreshTokenTypes
delete_by_pk: deleteAuthRefreshTokenType
insert: insertAuthRefreshTokenTypes
insert_one: insertAuthRefreshTokenType
select: authRefreshTokenTypes
select_aggregate: authRefreshTokenTypesAggregate
select_by_pk: authRefreshTokenType
update: updateAuthRefreshTokenTypes
update_by_pk: updateAuthRefreshTokenType
array_relationships:
- name: refreshTokens
using:
foreign_key_constraint_on:
column: type
table:
name: refresh_tokens
schema: auth

View File

@@ -7,14 +7,14 @@ configuration:
custom_name: createdAt
expires_at:
custom_name: expiresAt
refresh_token:
custom_name: refreshToken
refresh_token_hash:
custom_name: refreshTokenHash
user_id:
custom_name: userId
custom_column_names:
created_at: createdAt
expires_at: expiresAt
refresh_token: refreshToken
refresh_token_hash: refreshTokenHash
user_id: userId
custom_name: authRefreshTokens
custom_root_fields:
@@ -31,3 +31,25 @@ object_relationships:
- name: user
using:
foreign_key_constraint_on: user_id
select_permissions:
- role: user
permission:
columns:
- id
- created_at
- expires_at
- metadata
- type
- user_id
filter:
user_id:
_eq: X-Hasura-User-Id
delete_permissions:
- role: user
permission:
filter:
_and:
- user_id:
_eq: X-Hasura-User-Id
- type:
_eq: pat

View File

@@ -0,0 +1,42 @@
table:
name: virus
schema: storage
configuration:
column_config:
created_at:
custom_name: createdAt
file_id:
custom_name: fileId
filename:
custom_name: filename
id:
custom_name: id
updated_at:
custom_name: updatedAt
user_session:
custom_name: userSession
virus:
custom_name: virus
custom_column_names:
created_at: createdAt
file_id: fileId
filename: filename
id: id
updated_at: updatedAt
user_session: userSession
virus: virus
custom_name: virus
custom_root_fields:
delete: deleteViruses
delete_by_pk: deleteVirus
insert: insertViruses
insert_one: insertVirus
select: viruses
select_aggregate: virusesAggregate
select_by_pk: virus
update: updateViruses
update_by_pk: updateVirus
object_relationships:
- name: file
using:
foreign_key_constraint_on: file_id

View File

@@ -1,5 +1,6 @@
- "!include auth_provider_requests.yaml"
- "!include auth_providers.yaml"
- "!include auth_refresh_token_types.yaml"
- "!include auth_refresh_tokens.yaml"
- "!include auth_roles.yaml"
- "!include auth_user_providers.yaml"
@@ -9,3 +10,4 @@
- "!include public_test.yaml"
- "!include storage_buckets.yaml"
- "!include storage_files.yaml"
- "!include storage_virus.yaml"

View File

@@ -0,0 +1 @@
{}

View File

@@ -0,0 +1 @@
{}

View File

@@ -1,7 +1,7 @@
[global]
[hasura]
version = 'v2.25.1-ce'
version = 'v2.44.0-ce'
adminSecret = '{{ secrets.HASURA_GRAPHQL_ADMIN_SECRET }}'
webhookSecret = '{{ secrets.NHOST_WEBHOOK_SECRET }}'
@@ -25,10 +25,10 @@ httpPoolSize = 100
[functions]
[functions.node]
version = 18
version = 22
[auth]
version = '0.20.2'
version = '0.38.0'
[auth.redirections]
clientUrl = 'http://localhost:3000'
@@ -70,7 +70,7 @@ enabled = true
[auth.method.emailPassword]
hibpEnabled = false
emailVerificationRequired = false
emailVerificationRequired = true
passwordMinLength = 8
[auth.method.smsPasswordless]
@@ -133,13 +133,41 @@ timeout = 60000
enabled = false
[postgres]
version = '14.6-20230406-2'
version = '15.10-20250311-1'
[postgres.resources.storage]
capacity = 1
[provider]
[provider.smtp]
host = "smtp.test.com"
method = "LOGIN"
password = "test123123"
port = 587
secure = false
sender = "test@nhost.io"
user = "test"
[storage]
version = '0.3.4'
version = '0.7.1'
[observability]
[observability.grafana]
adminPassword = '{{ secrets.GRAFANA_ADMIN_PASSWORD }}'
[auth.rateLimit]
[auth.rateLimit.emails]
limit = 100
interval = '1h'
[auth.rateLimit.bruteForce]
limit = 100
interval = '5m'
[auth.rateLimit.signups]
limit = 100
interval = '5m'
[auth.rateLimit.global]
limit = 1000
interval = '1m'

View File

@@ -51,8 +51,8 @@
"test": "vitest run",
"test:watch": "vitest",
"e2e": "pnpm e2e:backend && pnpm ci:test",
"ci:test": "vitest run --config vite.config.e2e.js; nhost down",
"e2e:backend": "cp .secrets.example .secrets && nhost up",
"ci:test": "vitest run --config vite.config.e2e.js",
"e2e:backend": "cp .secrets.example .secrets && nhost up --down-on-error",
"test:coverage": "vitest run --coverage",
"prettier": "prettier --check src/",
"prettier:fix": "prettier --write src/",

View File

@@ -1 +1,9 @@
lockfileVersion: '6.0'
lockfileVersion: '9.0'
settings:
autoInstallPeers: true
excludeLinksFromLockfile: false
importers:
.: {}

View File

@@ -47,3 +47,16 @@ array_relationships:
table:
name: files
schema: storage
insert_permissions:
- role: public
permission:
check: {}
columns:
- id
- created_at
- updated_at
- download_expiration
- min_upload_file_size
- max_upload_file_size
- cache_control
- presigned_urls_enabled

View File

@@ -54,30 +54,32 @@ insert_permissions:
permission:
check: {}
columns:
- is_uploaded
- size
- bucket_id
- etag
- mime_type
- name
- id
- created_at
- updated_at
- id
- bucket_id
- name
- size
- mime_type
- etag
- is_uploaded
- uploaded_by_user_id
- metadata
select_permissions:
- role: public
permission:
columns:
- is_uploaded
- size
- bucket_id
- etag
- mime_type
- name
- id
- created_at
- updated_at
- id
- bucket_id
- name
- size
- mime_type
- etag
- is_uploaded
- uploaded_by_user_id
- metadata
filter: {}
delete_permissions:
- role: public

View File

@@ -0,0 +1,42 @@
table:
name: virus
schema: storage
configuration:
column_config:
created_at:
custom_name: createdAt
file_id:
custom_name: fileId
filename:
custom_name: filename
id:
custom_name: id
updated_at:
custom_name: updatedAt
user_session:
custom_name: userSession
virus:
custom_name: virus
custom_column_names:
created_at: createdAt
file_id: fileId
filename: filename
id: id
updated_at: updatedAt
user_session: userSession
virus: virus
custom_name: virus
custom_root_fields:
delete: deleteViruses
delete_by_pk: deleteVirus
insert: insertViruses
insert_one: insertVirus
select: viruses
select_aggregate: virusesAggregate
select_by_pk: virus
update: updateViruses
update_by_pk: updateVirus
object_relationships:
- name: file
using:
foreign_key_constraint_on: file_id

View File

@@ -9,3 +9,4 @@
- "!include auth_users.yaml"
- "!include storage_buckets.yaml"
- "!include storage_files.yaml"
- "!include storage_virus.yaml"

View File

@@ -1,7 +1,7 @@
[global]
[hasura]
version = 'v2.25.1-ce'
version = 'v2.44.0-ce'
adminSecret = '{{ secrets.HASURA_GRAPHQL_ADMIN_SECRET }}'
webhookSecret = '{{ secrets.NHOST_WEBHOOK_SECRET }}'
@@ -25,10 +25,10 @@ httpPoolSize = 100
[functions]
[functions.node]
version = 18
version = 22
[auth]
version = '0.20.2'
version = '0.38.0'
[auth.redirections]
clientUrl = 'http://localhost:3000'
@@ -133,12 +133,15 @@ timeout = 60000
enabled = false
[postgres]
version = '14.6-20230406-2'
version = '15.10-20250311-1'
[postgres.resources.storage]
capacity = 1
[provider]
[storage]
version = '0.3.4'
version = '0.7.1'
[observability]
[observability.grafana]

View File

@@ -47,8 +47,8 @@
"build:lib": "vite build",
"build:umd": "vite build --config ../../config/vite.lib.umd.config.js",
"e2e": "pnpm e2e:backend && pnpm ci:test",
"ci:test": "vitest run; nhost down",
"e2e:backend": "cp .secrets.example .secrets && nhost up",
"ci:test": "vitest run",
"e2e:backend": "cp .secrets.example .secrets && nhost up --down-on-error",
"test": "vitest --config ./vite.unit.config.js",
"test:watch": "vitest",
"test:coverage": "vitest run --coverage",

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@@ -84,5 +84,5 @@ describe('Image transformation', () => {
})
// TODO implement radius and quality tests
// TODO implement pressigned url tests when implemented in hasura-storage
// TODO implement presigned url tests when implemented in hasura-storage
})

View File

@@ -90,7 +90,7 @@ describe('test upload', () => {
const { name: fileName } = fileMetadata
expect(error).toBeNull()
expect(fileName).toMatchInlineSnapshot('"%E4%BD%A0%20%E5%A5%BD"')
expect(fileName).toBe('你 好')
})
it('should upload a file with specific id and name', async () => {
@@ -136,7 +136,7 @@ describe('test upload', () => {
expect(bucketId).toBe('default')
})
it('should upload a file with specific bucket id (test-bucket)', async () => {
it.skip('should upload a file with specific bucket id (test-bucket)', async () => {
const fd = new FormData()
fd.append('file', fs.createReadStream('./tests/assets/sample.pdf'))

51
pnpm-lock.yaml generated
View File

@@ -78,6 +78,7 @@ overrides:
vite@>=5.0.0 <5.4.18: '>=5.4.18'
vite@>=6.2.0 <6.2.6: '>=6.2.6'
'@sveltejs/kit@>=2.0.0 <2.20.6': '>=2.20.6'
react-router@<7.5.2: '>=7.5.2'
importers:
@@ -1285,8 +1286,8 @@ importers:
specifier: ^7.52.2
version: 7.54.1(react@18.2.0)
react-router-dom:
specifier: ^6.22.3
version: 6.28.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0)
specifier: ^7.5.2
version: 7.5.2(react-dom@18.2.0(react@18.2.0))(react@18.2.0)
sonner:
specifier: ^1.5.0
version: 1.7.1(react-dom@18.2.0(react@18.2.0))(react@18.2.0)
@@ -6215,10 +6216,6 @@ packages:
'@react-navigation/routers@6.1.9':
resolution: {integrity: sha512-lTM8gSFHSfkJvQkxacGM6VJtBt61ip2XO54aNfswD+KMw6eeZ4oehl7m0me3CR9hnDE4+60iAZR8sAhvCiI3NA==}
'@remix-run/router@1.21.0':
resolution: {integrity: sha512-xfSkCAchbdG5PnbrKqFWwia4Bi61nH+wm8wLEqfHDyp7Y3dZzgqS2itV8i4gAq9pC2HsTpwyBC6Ds8VHZ96JlA==}
engines: {node: '>=14.0.0'}
'@repeaterjs/repeater@3.0.4':
resolution: {integrity: sha512-AW8PKd6iX3vAZ0vA43nOUOnbq/X5ihgU+mSXXqunMkeQADGiqw/PY0JNeYtD5sr0PAy51YPgAPbDoeapv9r8WA==}
@@ -9194,6 +9191,10 @@ packages:
resolution: {integrity: sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==}
engines: {node: '>= 0.6'}
cookie@1.0.2:
resolution: {integrity: sha512-9Kr/j4O16ISv8zBBhJoi4bXOYNTkFLOqSL3UDB0njXxCXNezjeyVrJyGOWtgfs/q2km1gwBcfH8q1yEGoMYunA==}
engines: {node: '>=18'}
cookies-next@3.0.0:
resolution: {integrity: sha512-VaSrsjQJ8yHnGAGulV9zJxBr7hrKJ/O2mo87evsGIMF7XvJI3AJNguevotx0Gek1MMMBkZvZNWu2JueSNoSKEQ==}
@@ -14390,18 +14391,22 @@ packages:
react: 18.2.0
react-dom: 18.2.0
react-router-dom@6.28.0:
resolution: {integrity: sha512-kQ7Unsl5YdyOltsPGl31zOjLrDv+m2VcIEcIHqYYD3Lp0UppLjrzcfJqDJwXxFw3TH/yvapbnUvPlAj7Kx5nbg==}
engines: {node: '>=14.0.0'}
react-router-dom@7.5.2:
resolution: {integrity: sha512-yk1XW8Fj7gK7flpYBXF3yzd2NbX6P7Kxjvs2b5nu1M04rb5pg/Zc4fGdBNTeT4eDYL2bvzWNyKaIMJX/RKHTTg==}
engines: {node: '>=20.0.0'}
peerDependencies:
react: 18.2.0
react-dom: 18.2.0
react-router@6.28.0:
resolution: {integrity: sha512-HrYdIFqdrnhDw0PqG/AKjAqEqM7AvxCz0DQ4h2W8k6nqmc5uRBYDag0SBxx9iYz5G8gnuNVLzUe13wl9eAsXXg==}
engines: {node: '>=14.0.0'}
react-router@7.5.2:
resolution: {integrity: sha512-9Rw8r199klMnlGZ8VAsV/I8WrIF6IyJ90JQUdboupx1cdkgYqwnrYjH+I/nY/7cA1X5zia4mDJqH36npP7sxGQ==}
engines: {node: '>=20.0.0'}
peerDependencies:
react: 18.2.0
react-dom: 18.2.0
peerDependenciesMeta:
react-dom:
optional: true
react-shallow-renderer@16.15.0:
resolution: {integrity: sha512-oScf2FqQ9LFVQgA73vr86xl2NaOIX73rh+YFqcOp68CWj56tSfgtGKrEbyhCj0rSijyG9M1CYprTh39fBi5hzA==}
@@ -15935,6 +15940,9 @@ packages:
cpu: [arm64]
os: [linux]
turbo-stream@2.4.0:
resolution: {integrity: sha512-FHncC10WpBd2eOmGwpmQsWLDoK4cqsA/UT/GqNoaKOQnT8uzhtCbg3EoUDMvqpOSAI0S26mr0rkjzbOO6S3v1g==}
turbo-windows-64@2.3.3:
resolution: {integrity: sha512-O2+BS4QqjK3dOERscXqv7N2GXNcqHr9hXumkMxDj/oGx9oCatIwnnwx34UmzodloSnJpgSqjl8iRWiY65SmYoQ==}
cpu: [x64]
@@ -23808,8 +23816,6 @@ snapshots:
dependencies:
nanoid: 3.3.8
'@remix-run/router@1.21.0': {}
'@repeaterjs/repeater@3.0.4': {}
'@repeaterjs/repeater@3.0.5': {}
@@ -28129,6 +28135,8 @@ snapshots:
cookie@0.7.2: {}
cookie@1.0.2: {}
cookies-next@3.0.0:
dependencies:
'@types/cookie': 0.4.1
@@ -35294,17 +35302,20 @@ snapshots:
react: 18.2.0
react-dom: 18.2.0(react@18.2.0)
react-router-dom@6.28.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0):
react-router-dom@7.5.2(react-dom@18.2.0(react@18.2.0))(react@18.2.0):
dependencies:
'@remix-run/router': 1.21.0
react: 18.2.0
react-dom: 18.2.0(react@18.2.0)
react-router: 6.28.0(react@18.2.0)
react-router: 7.5.2(react-dom@18.2.0(react@18.2.0))(react@18.2.0)
react-router@6.28.0(react@18.2.0):
react-router@7.5.2(react-dom@18.2.0(react@18.2.0))(react@18.2.0):
dependencies:
'@remix-run/router': 1.21.0
cookie: 1.0.2
react: 18.2.0
set-cookie-parser: 2.7.1
turbo-stream: 2.4.0
optionalDependencies:
react-dom: 18.2.0(react@18.2.0)
react-shallow-renderer@16.15.0(react@18.2.0):
dependencies:
@@ -37434,6 +37445,8 @@ snapshots:
turbo-linux-arm64@2.3.3:
optional: true
turbo-stream@2.4.0: {}
turbo-windows-64@2.3.3:
optional: true