diff --git a/.eslintignore b/.eslintignore index 5ec373b2..3e272af3 100644 --- a/.eslintignore +++ b/.eslintignore @@ -2,9 +2,9 @@ .eslintrc.js next.config.js jest.config.js -packages/ -repos/ +/packages +/repos .next/ -app-data/ -apps/ +/app-data +/apps package.json diff --git a/package.json b/package.json index 9e21a589..94d139c2 100644 --- a/package.json +++ b/package.json @@ -60,7 +60,7 @@ "next": "14.0.4", "next-client-cookies": "^1.1.0", "next-intl": "^3.4.4", - "next-safe-action": "^5.0.2", + "next-safe-action": "^6.0.2", "pg": "^8.11.3", "qrcode.react": "^3.1.0", "react": "18.2.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e1d52d85..9846bc4d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -93,8 +93,8 @@ importers: specifier: ^3.4.4 version: 3.4.4(next@14.0.4)(react@18.2.0) next-safe-action: - specifier: ^5.0.2 - version: 5.0.2(next@14.0.4)(react@18.2.0)(zod@3.22.4) + specifier: ^6.0.2 + version: 6.0.2(next@14.0.4)(react@18.2.0)(vite@5.0.12) pg: specifier: ^8.11.3 version: 8.11.3 @@ -1000,6 +1000,63 @@ packages: kuler: 2.0.0 dev: false + /@decs/typeschema@0.12.2(vite@5.0.12)(zod@3.22.4): + resolution: {integrity: sha512-PA8uAH/Xfsa5X2UNNSnb5i6vB8qWZywp4+d2U8kNMCO7qwirYRPbFCHwIfWBJyURh4rULn3Ey+VBADLcK2xxaQ==} + peerDependencies: + '@deepkit/type': ^1.0.1-alpha.113 + '@effect/schema': ^0.60.6 + '@sinclair/typebox': ^0.32.11 + ajv: ^8.12.0 + arktype: ^1.0.29-alpha + effect: ^2.1.2 + fp-ts: ^2.16.2 + io-ts: ^2.2.21 + joi: ^17.12.0 + ow: ^0.28.2 + runtypes: ^6.7.0 + superstruct: ^1.0.3 + valibot: ^0.26.0 + vite: ^5.0.12 + yup: ^1.3.3 + zod: ^3.22.4 + peerDependenciesMeta: + '@deepkit/type': + optional: true + '@effect/schema': + optional: true + '@sinclair/typebox': + optional: true + ajv: + optional: true + arktype: + optional: true + effect: + optional: true + fp-ts: + optional: true + io-ts: + optional: true + joi: + optional: true + ow: + optional: true + runtypes: + optional: true + superstruct: + optional: true + valibot: + optional: true + vite: + optional: true + yup: + optional: true + zod: + optional: true + dependencies: + vite: 5.0.12(@types/node@20.8.10)(sass@1.70.0) + zod: 3.22.4 + dev: false + /@emotion/babel-plugin@11.10.6: resolution: {integrity: sha512-p2dAqtVrkhSa7xz1u/m9eHYdLi+en8NowrmXeF/dKtJpU8lCWli8RUAati7NcSl0afsBott48pdnANuD0wh9QQ==} dependencies: @@ -1129,7 +1186,6 @@ packages: cpu: [arm64] os: [android] requiresBuild: true - dev: true optional: true /@esbuild/android-arm@0.18.20: @@ -1147,7 +1203,6 @@ packages: cpu: [arm] os: [android] requiresBuild: true - dev: true optional: true /@esbuild/android-x64@0.18.20: @@ -1165,7 +1220,6 @@ packages: cpu: [x64] os: [android] requiresBuild: true - dev: true optional: true /@esbuild/darwin-arm64@0.18.20: @@ -1183,7 +1237,6 @@ packages: cpu: [arm64] os: [darwin] requiresBuild: true - dev: true optional: true /@esbuild/darwin-x64@0.18.20: @@ -1201,7 +1254,6 @@ packages: cpu: [x64] os: [darwin] requiresBuild: true - dev: true optional: true /@esbuild/freebsd-arm64@0.18.20: @@ -1219,7 +1271,6 @@ packages: cpu: [arm64] os: [freebsd] requiresBuild: true - dev: true optional: true /@esbuild/freebsd-x64@0.18.20: @@ -1237,7 +1288,6 @@ packages: cpu: [x64] os: [freebsd] requiresBuild: true - dev: true optional: true /@esbuild/linux-arm64@0.18.20: @@ -1255,7 +1305,6 @@ packages: cpu: [arm64] os: [linux] requiresBuild: true - dev: true optional: true /@esbuild/linux-arm@0.18.20: @@ -1273,7 +1322,6 @@ packages: cpu: [arm] os: [linux] requiresBuild: true - dev: true optional: true /@esbuild/linux-ia32@0.18.20: @@ -1291,7 +1339,6 @@ packages: cpu: [ia32] os: [linux] requiresBuild: true - dev: true optional: true /@esbuild/linux-loong64@0.18.20: @@ -1309,7 +1356,6 @@ packages: cpu: [loong64] os: [linux] requiresBuild: true - dev: true optional: true /@esbuild/linux-mips64el@0.18.20: @@ -1327,7 +1373,6 @@ packages: cpu: [mips64el] os: [linux] requiresBuild: true - dev: true optional: true /@esbuild/linux-ppc64@0.18.20: @@ -1345,7 +1390,6 @@ packages: cpu: [ppc64] os: [linux] requiresBuild: true - dev: true optional: true /@esbuild/linux-riscv64@0.18.20: @@ -1363,7 +1407,6 @@ packages: cpu: [riscv64] os: [linux] requiresBuild: true - dev: true optional: true /@esbuild/linux-s390x@0.18.20: @@ -1381,7 +1424,6 @@ packages: cpu: [s390x] os: [linux] requiresBuild: true - dev: true optional: true /@esbuild/linux-x64@0.18.20: @@ -1399,7 +1441,6 @@ packages: cpu: [x64] os: [linux] requiresBuild: true - dev: true optional: true /@esbuild/netbsd-x64@0.18.20: @@ -1417,7 +1458,6 @@ packages: cpu: [x64] os: [netbsd] requiresBuild: true - dev: true optional: true /@esbuild/openbsd-x64@0.18.20: @@ -1435,7 +1475,6 @@ packages: cpu: [x64] os: [openbsd] requiresBuild: true - dev: true optional: true /@esbuild/sunos-x64@0.18.20: @@ -1453,7 +1492,6 @@ packages: cpu: [x64] os: [sunos] requiresBuild: true - dev: true optional: true /@esbuild/win32-arm64@0.18.20: @@ -1471,7 +1509,6 @@ packages: cpu: [arm64] os: [win32] requiresBuild: true - dev: true optional: true /@esbuild/win32-ia32@0.18.20: @@ -1489,7 +1526,6 @@ packages: cpu: [ia32] os: [win32] requiresBuild: true - dev: true optional: true /@esbuild/win32-x64@0.18.20: @@ -1507,7 +1543,6 @@ packages: cpu: [x64] os: [win32] requiresBuild: true - dev: true optional: true /@eslint-community/eslint-utils@4.4.0(eslint@8.55.0): @@ -3102,7 +3137,6 @@ packages: cpu: [arm] os: [android] requiresBuild: true - dev: true optional: true /@rollup/rollup-android-arm64@4.9.4: @@ -3110,7 +3144,6 @@ packages: cpu: [arm64] os: [android] requiresBuild: true - dev: true optional: true /@rollup/rollup-darwin-arm64@4.9.4: @@ -3118,7 +3151,6 @@ packages: cpu: [arm64] os: [darwin] requiresBuild: true - dev: true optional: true /@rollup/rollup-darwin-x64@4.9.4: @@ -3126,7 +3158,6 @@ packages: cpu: [x64] os: [darwin] requiresBuild: true - dev: true optional: true /@rollup/rollup-linux-arm-gnueabihf@4.9.4: @@ -3134,7 +3165,6 @@ packages: cpu: [arm] os: [linux] requiresBuild: true - dev: true optional: true /@rollup/rollup-linux-arm64-gnu@4.9.4: @@ -3142,7 +3172,6 @@ packages: cpu: [arm64] os: [linux] requiresBuild: true - dev: true optional: true /@rollup/rollup-linux-arm64-musl@4.9.4: @@ -3150,7 +3179,6 @@ packages: cpu: [arm64] os: [linux] requiresBuild: true - dev: true optional: true /@rollup/rollup-linux-riscv64-gnu@4.9.4: @@ -3158,7 +3186,6 @@ packages: cpu: [riscv64] os: [linux] requiresBuild: true - dev: true optional: true /@rollup/rollup-linux-x64-gnu@4.9.4: @@ -3166,7 +3193,6 @@ packages: cpu: [x64] os: [linux] requiresBuild: true - dev: true optional: true /@rollup/rollup-linux-x64-musl@4.9.4: @@ -3174,7 +3200,6 @@ packages: cpu: [x64] os: [linux] requiresBuild: true - dev: true optional: true /@rollup/rollup-win32-arm64-msvc@4.9.4: @@ -3182,7 +3207,6 @@ packages: cpu: [arm64] os: [win32] requiresBuild: true - dev: true optional: true /@rollup/rollup-win32-ia32-msvc@4.9.4: @@ -3190,7 +3214,6 @@ packages: cpu: [ia32] os: [win32] requiresBuild: true - dev: true optional: true /@rollup/rollup-win32-x64-msvc@4.9.4: @@ -3198,7 +3221,6 @@ packages: cpu: [x64] os: [win32] requiresBuild: true - dev: true optional: true /@runtipi/postgres-migrations@5.3.0: @@ -5984,7 +6006,6 @@ packages: '@esbuild/win32-arm64': 0.19.4 '@esbuild/win32-ia32': 0.19.4 '@esbuild/win32-x64': 0.19.4 - dev: true /escalade@3.1.1: resolution: {integrity: sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==} @@ -9362,17 +9383,34 @@ packages: react: 18.2.0 dev: true - /next-safe-action@5.0.2(next@14.0.4)(react@18.2.0)(zod@3.22.4): - resolution: {integrity: sha512-ogBqdBNW41SVNTOBWwpmCxkjtEk6VosX6YWetJVGXBAUOniq8qFPSQVI32EnoM97lDGb0tuYe5hlqWmWgwtwhw==} - engines: {node: '>=16'} + /next-safe-action@6.0.2(next@14.0.4)(react@18.2.0)(vite@5.0.12): + resolution: {integrity: sha512-czJrcw4Ov6obePv/AwUki+Z90xxFH6Gx9V5cBN/TU/cuEggxj151kTggo0h1fAiYqZEOxw5PRbDvutvm9/exaw==} + engines: {node: '>=18.17'} peerDependencies: next: '>= 14.0.0' react: '>= 18.2.0' - zod: '>= 3.0.0' dependencies: + '@decs/typeschema': 0.12.2(vite@5.0.12)(zod@3.22.4) next: 14.0.4(@babel/core@7.23.6)(react-dom@18.2.0)(react@18.2.0)(sass@1.70.0) react: 18.2.0 + optionalDependencies: zod: 3.22.4 + transitivePeerDependencies: + - '@deepkit/type' + - '@effect/schema' + - '@sinclair/typebox' + - ajv + - arktype + - effect + - fp-ts + - io-ts + - joi + - ow + - runtypes + - superstruct + - valibot + - vite + - yup dev: false /next@14.0.4(@babel/core@7.23.6)(react-dom@18.2.0)(react@18.2.0)(sass@1.70.0): @@ -10108,7 +10146,6 @@ packages: nanoid: 3.3.7 picocolors: 1.0.0 source-map-js: 1.0.2 - dev: true /postgres-array@2.0.0: resolution: {integrity: sha512-VpZrUqU5A69eQyW2c5CA1jtLecCsN2U/bD6VilrFDWq5+5UIEVO7nazS3TEcHf1zuPYO/sqGvUvW62g86RXZuA==} @@ -10797,7 +10834,6 @@ packages: '@rollup/rollup-win32-ia32-msvc': 4.9.4 '@rollup/rollup-win32-x64-msvc': 4.9.4 fsevents: 2.3.3 - dev: true /run-async@2.4.1: resolution: {integrity: sha512-tvVnVv01b8c1RrA6Ep7JkStj85Guv/YrMcwqYQnwjsAS2cTmmPGBBjAjpCW7RrSodNSoE2/qg9O4bceNvUuDgQ==} @@ -12157,7 +12193,6 @@ packages: sass: 1.70.0 optionalDependencies: fsevents: 2.3.3 - dev: true /vitest@1.2.1(@types/node@20.8.10)(sass@1.70.0): resolution: {integrity: sha512-TRph8N8rnSDa5M2wKWJCMnztCZS9cDcgVTQ6tsTFTG/odHJ4l5yNVqvbeDJYJRZ6is3uxaEpFs8LL6QM+YFSdA==} diff --git a/src/app/(auth)/login/components/LoginContainer/LoginContainer.tsx b/src/app/(auth)/login/components/LoginContainer/LoginContainer.tsx index 2351b603..cdf6f689 100644 --- a/src/app/(auth)/login/components/LoginContainer/LoginContainer.tsx +++ b/src/app/(auth)/login/components/LoginContainer/LoginContainer.tsx @@ -1,6 +1,6 @@ 'use client'; -import { useAction } from 'next-safe-action/hook'; +import { useAction } from 'next-safe-action/hooks'; import React, { useState } from 'react'; import { toast } from 'react-hot-toast'; import { loginAction } from '@/actions/login/login-action'; diff --git a/src/app/(auth)/register/components/RegisterContainer/RegisterContainer.tsx b/src/app/(auth)/register/components/RegisterContainer/RegisterContainer.tsx index 1764615d..292683a8 100644 --- a/src/app/(auth)/register/components/RegisterContainer/RegisterContainer.tsx +++ b/src/app/(auth)/register/components/RegisterContainer/RegisterContainer.tsx @@ -1,7 +1,7 @@ 'use client'; import React from 'react'; -import { useAction } from 'next-safe-action/hook'; +import { useAction } from 'next-safe-action/hooks'; import { toast } from 'react-hot-toast'; import { useRouter } from 'next/navigation'; import { registerAction } from '@/actions/register/register-action'; diff --git a/src/app/(auth)/reset-password/components/ResetPasswordContainer/ResetPasswordContainer.tsx b/src/app/(auth)/reset-password/components/ResetPasswordContainer/ResetPasswordContainer.tsx index f6d30838..9e75c22d 100644 --- a/src/app/(auth)/reset-password/components/ResetPasswordContainer/ResetPasswordContainer.tsx +++ b/src/app/(auth)/reset-password/components/ResetPasswordContainer/ResetPasswordContainer.tsx @@ -1,7 +1,7 @@ 'use client'; import React from 'react'; -import { useAction } from 'next-safe-action/hook'; +import { useAction } from 'next-safe-action/hooks'; import { toast } from 'react-hot-toast'; import { useRouter } from 'next/navigation'; import { useTranslations } from 'next-intl'; diff --git a/src/app/(dashboard)/app-store/[id]/components/AppDetailsContainer/AppDetailsContainer.tsx b/src/app/(dashboard)/app-store/[id]/components/AppDetailsContainer/AppDetailsContainer.tsx index b44f085e..7223f9b7 100644 --- a/src/app/(dashboard)/app-store/[id]/components/AppDetailsContainer/AppDetailsContainer.tsx +++ b/src/app/(dashboard)/app-store/[id]/components/AppDetailsContainer/AppDetailsContainer.tsx @@ -2,7 +2,7 @@ import React from 'react'; import { toast } from 'react-hot-toast'; import { useTranslations } from 'next-intl'; import { useDisclosure } from '@/client/hooks/useDisclosure'; -import { useAction } from 'next-safe-action/hook'; +import { useAction } from 'next-safe-action/hooks'; import { installAppAction } from '@/actions/app-actions/install-app-action'; import { uninstallAppAction } from '@/actions/app-actions/uninstall-app-action'; import { stopAppAction } from '@/actions/app-actions/stop-app-action'; diff --git a/src/app/(dashboard)/apps/components/UpdateAllButton/UpdateAllButton.tsx b/src/app/(dashboard)/apps/components/UpdateAllButton/UpdateAllButton.tsx index a535b22a..b489c1b5 100644 --- a/src/app/(dashboard)/apps/components/UpdateAllButton/UpdateAllButton.tsx +++ b/src/app/(dashboard)/apps/components/UpdateAllButton/UpdateAllButton.tsx @@ -4,7 +4,7 @@ import React from 'react'; import { toast } from 'react-hot-toast'; import { Button } from '@/components/ui/Button'; import { useDisclosure } from '@/client/hooks/useDisclosure'; -import { useAction } from 'next-safe-action/hook'; +import { useAction } from 'next-safe-action/hooks'; import { updateAllAppsAction } from '@/actions/app-actions/update-all-apps-action'; import { useTranslations } from 'next-intl'; import { UpdateAllModal } from '../UpdateAllModal'; diff --git a/src/app/(dashboard)/components/Header/Header.tsx b/src/app/(dashboard)/components/Header/Header.tsx index b672c2fc..1db8fd32 100644 --- a/src/app/(dashboard)/components/Header/Header.tsx +++ b/src/app/(dashboard)/components/Header/Header.tsx @@ -9,7 +9,7 @@ import Link from 'next/link'; import { Tooltip } from 'react-tooltip'; import { useTranslations } from 'next-intl'; import { useUIStore } from '@/client/state/uiStore'; -import { useAction } from 'next-safe-action/hook'; +import { useAction } from 'next-safe-action/hooks'; import { logoutAction } from '@/actions/logout/logout-action'; import Script from 'next/script'; import { useRouter } from 'next/navigation'; diff --git a/src/app/(dashboard)/components/Welcome/Welcome.tsx b/src/app/(dashboard)/components/Welcome/Welcome.tsx index b9b80fbb..7c980b97 100644 --- a/src/app/(dashboard)/components/Welcome/Welcome.tsx +++ b/src/app/(dashboard)/components/Welcome/Welcome.tsx @@ -6,7 +6,7 @@ import { getLogo } from '@/lib/themes'; import { Button } from '@/components/ui/Button'; import { Switch } from '@/components/ui/Switch'; import { IconBrandDiscord, IconBrandGithub } from '@tabler/icons-react'; -import { useAction } from 'next-safe-action/hook'; +import { useAction } from 'next-safe-action/hooks'; import { acknowledgeWelcomeAction } from '@/actions/acknowledge-welcome/acknowledge-welcome'; import { useRouter } from 'next/navigation'; diff --git a/src/app/(dashboard)/settings/components/ChangePasswordForm/ChangePasswordForm.tsx b/src/app/(dashboard)/settings/components/ChangePasswordForm/ChangePasswordForm.tsx index e62da035..5deee925 100644 --- a/src/app/(dashboard)/settings/components/ChangePasswordForm/ChangePasswordForm.tsx +++ b/src/app/(dashboard)/settings/components/ChangePasswordForm/ChangePasswordForm.tsx @@ -7,7 +7,7 @@ import { zodResolver } from '@hookform/resolvers/zod'; import { useRouter } from 'next/navigation'; import { toast } from 'react-hot-toast'; import { useTranslations } from 'next-intl'; -import { useAction } from 'next-safe-action/hook'; +import { useAction } from 'next-safe-action/hooks'; import { changePasswordAction } from '@/actions/settings/change-password'; export const ChangePasswordForm = () => { diff --git a/src/app/(dashboard)/settings/components/ChangeUsernameForm/ChangeUsernameForm.tsx b/src/app/(dashboard)/settings/components/ChangeUsernameForm/ChangeUsernameForm.tsx index 6d058960..e69809ae 100644 --- a/src/app/(dashboard)/settings/components/ChangeUsernameForm/ChangeUsernameForm.tsx +++ b/src/app/(dashboard)/settings/components/ChangeUsernameForm/ChangeUsernameForm.tsx @@ -4,7 +4,7 @@ import { Button } from '@/components/ui/Button'; import { useRouter } from 'next/navigation'; import { toast } from 'react-hot-toast'; import { useTranslations } from 'next-intl'; -import { useAction } from 'next-safe-action/hook'; +import { useAction } from 'next-safe-action/hooks'; import { changeUsernameAction } from '@/actions/settings/change-username'; import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from '@/components/ui/Dialog'; import { useDisclosure } from '@/client/hooks/useDisclosure'; diff --git a/src/app/(dashboard)/settings/components/OtpForm/OtpForm.tsx b/src/app/(dashboard)/settings/components/OtpForm/OtpForm.tsx index a1d6e0eb..33f264c0 100644 --- a/src/app/(dashboard)/settings/components/OtpForm/OtpForm.tsx +++ b/src/app/(dashboard)/settings/components/OtpForm/OtpForm.tsx @@ -8,7 +8,7 @@ import { OtpInput } from '@/components/ui/OtpInput'; import { toast } from 'react-hot-toast'; import { useDisclosure } from '@/client/hooks/useDisclosure'; import { useTranslations } from 'next-intl'; -import { useAction } from 'next-safe-action/hook'; +import { useAction } from 'next-safe-action/hooks'; import { getTotpUriAction } from '@/actions/settings/get-totp-uri'; import { setupTotpAction } from '@/actions/settings/setup-totp-action'; import { disableTotpAction } from '@/actions/settings/disable-totp'; diff --git a/src/app/(dashboard)/settings/components/SettingsContainer/SettingsContainer.tsx b/src/app/(dashboard)/settings/components/SettingsContainer/SettingsContainer.tsx index d935027c..eeba5f05 100644 --- a/src/app/(dashboard)/settings/components/SettingsContainer/SettingsContainer.tsx +++ b/src/app/(dashboard)/settings/components/SettingsContainer/SettingsContainer.tsx @@ -3,7 +3,7 @@ import React from 'react'; import { toast } from 'react-hot-toast'; import { useTranslations } from 'next-intl'; -import { useAction } from 'next-safe-action/hook'; +import { useAction } from 'next-safe-action/hooks'; import { updateSettingsAction } from '@/actions/settings/update-settings'; import { Locale } from '@/shared/internationalization/locales'; import { useRouter } from 'next/navigation'; diff --git a/src/app/components/ClientProviders/SocketProvider/SocketProvider.ts b/src/app/components/ClientProviders/SocketProvider/SocketProvider.ts index 3cff8617..f19b90c4 100644 --- a/src/app/components/ClientProviders/SocketProvider/SocketProvider.ts +++ b/src/app/components/ClientProviders/SocketProvider/SocketProvider.ts @@ -2,7 +2,7 @@ import React, { useEffect } from 'react'; import { revalidateAppAction } from '@/actions/app-actions/revalidate-app'; import { useSocket } from '@/lib/socket/useSocket'; import { useTranslations } from 'next-intl'; -import { useAction } from 'next-safe-action/hook'; +import { useAction } from 'next-safe-action/hooks'; import toast from 'react-hot-toast'; import { useRouter } from 'next/navigation'; diff --git a/src/app/components/LanguageSelector/LanguageSelector.tsx b/src/app/components/LanguageSelector/LanguageSelector.tsx index 099212d4..88156688 100644 --- a/src/app/components/LanguageSelector/LanguageSelector.tsx +++ b/src/app/components/LanguageSelector/LanguageSelector.tsx @@ -1,7 +1,7 @@ 'use client'; import React from 'react'; -import { useAction } from 'next-safe-action/hook'; +import { useAction } from 'next-safe-action/hooks'; import { LOCALE_OPTIONS, Locale } from '@/shared/internationalization/locales'; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/Select'; import { useRouter } from 'next/navigation'; diff --git a/src/lib/safe-action.ts b/src/lib/safe-action.ts index cfe837a3..84889492 100644 --- a/src/lib/safe-action.ts +++ b/src/lib/safe-action.ts @@ -5,8 +5,6 @@ export const action = createSafeActionClient({ // eslint-disable-next-line no-console console.error('Error from server', e); - return { - serverError: e.message || 'An unexpected error occurred', - }; + return e.message || 'An unexpected error occurred'; }, });