Compare commits

..

9 Commits

Author SHA1 Message Date
github-actions[bot]
dd9dedc226 chore: update versions (#2086) 2023-06-30 10:12:55 +02:00
Hassan Ben Jobrane
5638a91240 Merge pull request #2080 from nhost/renovate/tsconfig-docusaurus-2.x
chore(deps): update dependency @tsconfig/docusaurus to v2
2023-06-29 18:19:00 +01:00
Hassan Ben Jobrane
cdefbdebee chore: remove unchanged packages from changeset 2023-06-29 17:09:27 +01:00
Hassan Ben Jobrane
923abd3655 chore: add changeset 2023-06-29 17:02:26 +01:00
renovate[bot]
ef28540f9a chore(deps): update dependency @tsconfig/docusaurus to v2 2023-06-29 15:10:11 +00:00
Szilárd Dóró
d54e4cdd4e fix(hasura-storage-js): allow using custom buckets for upload (#2085)
This PR is a fix for the [issue mentioned on our Discord
channel](https://discord.com/channels/552499021260914688/1123893547955933214/1123893547955933214).
It wasn't caused by the latest hasura-storage-js release.
2023-06-29 17:07:29 +02:00
David Barroso
4a00963602 feat(observability): added graph with restarts (#2084) 2023-06-29 13:57:37 +02:00
github-actions[bot]
7ea9b890c8 chore: update versions (#2083)
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## @nhost/dashboard@0.17.19

### Patch Changes

-   f866120a6: fix(users): use the password length from the config

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-06-29 11:19:53 +02:00
Szilárd Dóró
f866120a65 fix(dashboard): use dynamic validation schema for password editing (#2082)
Fixes #2081
2023-06-29 10:52:40 +02:00
31 changed files with 310 additions and 38 deletions

View File

@@ -1,5 +1,18 @@
# @nhost/dashboard
## 0.17.20
### Patch Changes
- @nhost/react-apollo@5.0.31
- @nhost/nextjs@1.13.33
## 0.17.19
### Patch Changes
- f866120a6: fix(users): use the password length from the config
## 0.17.18
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@nhost/dashboard",
"version": "0.17.18",
"version": "0.17.20",
"private": true,
"scripts": {
"preinstall": "npx only-allow pnpm",
@@ -101,6 +101,7 @@
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^14.0.0",
"@testing-library/user-event": "^14.4.3",
"@types/bcryptjs": "^2.4.2",
"@types/lodash.debounce": "^4.0.7",
"@types/node": "^16.11.7",
"@types/pluralize": "^0.0.29",

View File

@@ -3,12 +3,16 @@ import { Form } from '@/components/form/Form';
import { Alert } from '@/components/ui/v2/Alert';
import { Button } from '@/components/ui/v2/Button';
import { Input } from '@/components/ui/v2/Input';
import { useCurrentWorkspaceAndProject } from '@/features/projects/common/hooks/useCurrentWorkspaceAndProject';
import { useRemoteApplicationGQLClient } from '@/hooks/useRemoteApplicationGQLClient';
import type { DialogFormProps } from '@/types/common';
import { getToastStyleProps } from '@/utils/constants/settings';
import { getServerError } from '@/utils/getServerError';
import type { RemoteAppGetUsersQuery } from '@/utils/__generated__/graphql';
import { useUpdateRemoteAppUserMutation } from '@/utils/__generated__/graphql';
import {
useGetSignInMethodsQuery,
useUpdateRemoteAppUserMutation,
} from '@/utils/__generated__/graphql';
import { yupResolver } from '@hookform/resolvers/yup';
import bcrypt from 'bcryptjs';
import { useState } from 'react';
@@ -27,19 +31,6 @@ export interface EditUserPasswordFormProps extends DialogFormProps {
user: RemoteAppGetUsersQuery['users'][0];
}
export const validationSchema = Yup.object({
password: Yup.string()
.label('Users Password')
.min(8, 'Password must be at least 8 characters long.')
.required('This field is required.'),
cpassword: Yup.string()
.required('Confirm Password is required')
.min(8, 'Password must be at least 8 characters long.')
.oneOf([Yup.ref('password')], 'Passwords do not match'),
});
export type EditUserPasswordFormValues = Yup.InferType<typeof validationSchema>;
export default function EditUserPasswordForm({
onCancel,
user,
@@ -49,26 +40,52 @@ export default function EditUserPasswordForm({
client: remoteProjectGQLClient,
});
const { closeDialog } = useDialog();
const { currentProject } = useCurrentWorkspaceAndProject();
const { data } = useGetSignInMethodsQuery({
variables: { appId: currentProject?.id },
skip: !currentProject?.id,
});
const passwordMinLength =
data?.config?.auth?.method?.emailPassword?.passwordMinLength || 1;
const validationSchema = Yup.object({
password: Yup.string()
.label('Password')
.min(
passwordMinLength,
`Password must be at least ${passwordMinLength} characters long.`,
)
.required('This field is required.'),
cpassword: Yup.string()
.label('Password Confirmation')
.min(
passwordMinLength,
`Password must be at least ${passwordMinLength} characters long.`,
)
.oneOf([Yup.ref('password')], 'Passwords do not match')
.required('This field is required.'),
});
const [editUserPasswordFormError, setEditUserPasswordFormError] =
useState<Error | null>(null);
const form = useForm<EditUserPasswordFormValues>({
const form = useForm<Yup.InferType<typeof validationSchema>>({
defaultValues: {},
reValidateMode: 'onSubmit',
resolver: yupResolver(validationSchema),
});
const handleSubmit = async ({ password }: EditUserPasswordFormValues) => {
const handleSubmit = async ({
password,
}: Yup.InferType<typeof validationSchema>) => {
setEditUserPasswordFormError(null);
const passwordHash = await bcrypt.hash(password, 10);
const updateUserPasswordPromise = updateUser({
variables: {
id: user.id,
user: {
passwordHash,
},
user: { passwordHash },
},
client: remoteProjectGQLClient,
});

View File

@@ -1,5 +1,11 @@
# @nhost/docs
## 0.3.5
### Patch Changes
- 923abd365: chore(deps): update dependency @tsconfig/docusaurus to v2
## 0.3.4
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@nhost/docs",
"version": "0.3.4",
"version": "0.3.5",
"private": true,
"scripts": {
"docusaurus": "docusaurus",
@@ -31,7 +31,7 @@
},
"devDependencies": {
"@docusaurus/module-type-aliases": "2.4.1",
"@tsconfig/docusaurus": "^1.0.6",
"@tsconfig/docusaurus": "^2.0.0",
"typescript": "^4.8.4"
},
"browserslist": {

View File

@@ -1,5 +1,12 @@
# @nhost-examples/node-storage
## 0.0.4
### Patch Changes
- d54e4cdd4: fix(buckets): allow using custom buckets for upload
- @nhost/nhost-js@2.2.12
## 0.0.3
### Patch Changes

View File

@@ -26,5 +26,4 @@ You can use the `.env.example` file as a starting point.
pnpm start
```
The example will download a file from a public URL and upload it to your Nhost
Storage bucket.
The example will run a few upload operations and then exit.

View File

@@ -0,0 +1 @@
DELETE FROM "storage"."buckets" WHERE "id" = 'custom';

View File

@@ -0,0 +1 @@
INSERT INTO "storage"."buckets"("presigned_urls_enabled", "download_expiration", "max_upload_file_size", "min_upload_file_size", "cache_control", "id", "created_at", "updated_at") VALUES (true, 30, 30000000, 1, E'max-age=3600', E'custom', E'2023-06-29T14:30:13.859559+00:00', E'2023-06-29T14:30:13.859559+00:00');

View File

@@ -1,6 +1,6 @@
{
"name": "@nhost-examples/node-storage",
"version": "0.0.3",
"version": "0.0.4",
"private": true,
"description": "This is an example of how to use the Storage with Node.js",
"main": "src/index.mjs",

View File

@@ -1,5 +1,6 @@
import { uploadFile } from './uploadFile.mjs'
import { uploadFormData } from './uploadFormData.mjs'
import { uploadToBucket } from './uploadToBucket.mjs'
async function uploadFiles() {
await uploadFormData()
@@ -7,6 +8,10 @@ async function uploadFiles() {
console.info('-----')
await uploadFile()
console.info('-----')
await uploadToBucket()
}
uploadFiles()

View File

@@ -0,0 +1,68 @@
import fs from 'fs'
import fetch from 'node-fetch'
import { createClient } from './client.mjs'
const client = createClient()
export async function uploadToBucket() {
console.info('Uploading a Single File to a custom bucket...')
try {
// Download image from remote URL
const response = await fetch(
'https://hips.hearstapps.com/hmg-prod/images/cute-cat-photos-1593441022.jpg?crop=1.00xw:0.753xh;0,0.153xh&resize=1200:*'
)
if (!response.ok) {
console.error(`[file-to-bucket]`, 'Image not found!')
return
}
const arrayBuffer = await response.arrayBuffer()
const fileBuffer = Buffer.from(arrayBuffer)
const fileName = 'cat.jpg'
fs.writeFile(fileName, fileBuffer, async (err) => {
if (err) {
console.error(`[file-to-bucket]`, err)
return
}
const file = fs.createReadStream(fileName)
const { error: uploadError, fileMetadata } = await client.storage.upload({
file,
bucketId: 'custom'
})
if (uploadError) {
console.error(`[file-to-bucket]`, uploadError)
return
}
console.info(`[file-to-bucket]`, `File has been uploaded successfully!`)
console.info(`[file-to-bucket]`, `ID: ${fileMetadata?.id}`)
console.log(fileMetadata.bucketId)
// Generate a presigned URL for the uploaded file
const { error: presignError, presignedUrl: image } = await client.storage.getPresignedUrl({
fileId: fileMetadata.id
})
if (presignError) {
console.error(`[file-to-bucket]`, presignError)
return
}
console.info(`[file-to-bucket]`, `Presigned URL: ${image.url}`)
})
// Upload file to Nhost Storage
} catch (error) {
console.error(`[file-to-bucket]`, error.message)
}
}

View File

@@ -1,5 +1,11 @@
# @nhost/apollo
## 5.2.14
### Patch Changes
- @nhost/nhost-js@2.2.12
## 5.2.13
### Patch Changes

View File

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

View File

@@ -1,5 +1,12 @@
# @nhost/react-apollo
## 5.0.31
### Patch Changes
- @nhost/apollo@5.2.14
- @nhost/react@2.0.27
## 5.0.30
### Patch Changes

View File

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

View File

@@ -1,5 +1,11 @@
# @nhost/react-urql
## 2.0.28
### Patch Changes
- @nhost/react@2.0.27
## 2.0.27
### Patch Changes

View File

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

View File

@@ -629,6 +629,103 @@
"title": "Network Traffic",
"type": "timeseries"
},
{
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
},
"description": "This graph shows when a service was restarted. There are two main reasons why a service may be restarted:\n\n- OOMKilled - This means the service tried to use more memory than it has available and had to be restarted. For more information on resources you can check the [documentation](https://docs.nhost.io/platform/compute).\n- Error - This can show for mainly two reasons; when new configuration needs to be applied the service is terminated and due to limitations this shows as \"Error\" but it is, in fact, part of normal operations. This can also show if your service is misconfigured and/or can't start correctly for some reason. If this error doesn't show constantly it is safe to ignore this error.",
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "auto",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"decimals": 2,
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "none"
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 12,
"x": 12,
"y": 29
},
"id": 37,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
},
"editorMode": "code",
"expr": "sum by(container, reason) (increase(pod_terminated_total[$__rate_interval]))",
"hide": false,
"interval": "2m",
"legendFormat": "{{container}}-{{reason}}",
"range": true,
"refId": "A"
}
],
"title": "Service Restarts",
"type": "timeseries"
},
{
"collapsed": false,
"gridPos": {

View File

@@ -1,5 +1,11 @@
# @nhost/hasura-storage-js
## 2.2.1
### Patch Changes
- d54e4cdd4: fix(buckets): allow using custom buckets for upload
## 2.2.0
### Minor Changes

View File

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

View File

@@ -39,7 +39,7 @@ export const fetchUpload = async (
...initialHeaders
}
if (bucketId) {
data.append('bucketId', bucketId)
data.append('bucket-id', bucketId)
}
if (adminSecret) {
headers['x-hasura-admin-secret'] = adminSecret

View File

@@ -1,5 +1,11 @@
# @nhost/nextjs
## 1.13.33
### Patch Changes
- @nhost/react@2.0.27
## 1.13.32
### Patch Changes

View File

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

View File

@@ -1,5 +1,12 @@
# @nhost/nhost-js
## 2.2.12
### Patch Changes
- Updated dependencies [d54e4cdd4]
- @nhost/hasura-storage-js@2.2.1
## 2.2.11
### Patch Changes

View File

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

View File

@@ -1,5 +1,11 @@
# @nhost/react
## 2.0.27
### Patch Changes
- @nhost/nhost-js@2.2.12
## 2.0.26
### Patch Changes

View File

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

View File

@@ -1,5 +1,11 @@
# @nhost/vue
## 1.13.32
### Patch Changes
- @nhost/nhost-js@2.2.12
## 1.13.31
### Patch Changes

View File

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

15
pnpm-lock.yaml generated
View File

@@ -354,6 +354,9 @@ importers:
'@testing-library/user-event':
specifier: ^14.4.3
version: 14.4.3(@testing-library/dom@9.0.0)
'@types/bcryptjs':
specifier: ^2.4.2
version: 2.4.2
'@types/lodash.debounce':
specifier: ^4.0.7
version: 4.0.7
@@ -539,8 +542,8 @@ importers:
specifier: 2.4.1
version: 2.4.1(react-dom@18.2.0)(react@18.2.0)
'@tsconfig/docusaurus':
specifier: ^1.0.6
version: 1.0.6
specifier: ^2.0.0
version: 2.0.0
typescript:
specifier: ^4.8.4
version: 4.8.4
@@ -13190,8 +13193,8 @@ packages:
path-browserify: 1.0.1
dev: true
/@tsconfig/docusaurus@1.0.6:
resolution: {integrity: sha512-1QxDaP54hpzM6bq9E+yFEo4F9WbWHhsDe4vktZXF/iDlc9FqGr9qlg+3X/nuKQXx8QxHV7ue8NXFazzajsxFBA==}
/@tsconfig/docusaurus@2.0.0:
resolution: {integrity: sha512-X5wptT7pXA/46/IRFTW76oR5GNjoy9qjNM/1JGhFV4QAsmLh3YUpJJA+Vpx7Ds6eEBxSxz1QrgoNEBy6rLVs8w==}
dev: true
/@tsconfig/node10@1.0.8:
@@ -13214,6 +13217,10 @@ packages:
resolution: {integrity: sha512-XTIieEY+gvJ39ChLcB4If5zHtPxt3Syj5rgZR+e1ctpmK8NjPf0zFqsz4JpLJT0xla9GFDKjy8Cpu331nrmE1Q==}
dev: true
/@types/bcryptjs@2.4.2:
resolution: {integrity: sha512-LiMQ6EOPob/4yUL66SZzu6Yh77cbzJFYll+ZfaPiPPFswtIlA/Fs1MzdKYA7JApHU49zQTbJGX3PDmCpIdDBRQ==}
dev: true
/@types/body-parser@1.19.2:
resolution: {integrity: sha512-ALYone6pm6QmwZoAgeyNksccT9Q4AWZQ6PvfwR37GT6r6FWUPguq6sUmNGSMV2Wr761oQoBxwGGa6DR5o1DC9g==}
dependencies: